SDL: Don't use the direct3d12 renderer with transparent windows

From 91639d855f2cb6a19d5151ceb9b21aa1fe27334b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 8 Feb 2024 09:24:11 -0800
Subject: [PATCH] Don't use the direct3d12 renderer with transparent windows

Fixes https://github.com/libsdl-org/SDL/issues/9024
---
 src/render/direct3d12/SDL_render_d3d12.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c
index 9c13499ee276..15dddf4b0acd 100644
--- a/src/render/direct3d12/SDL_render_d3d12.c
+++ b/src/render/direct3d12/SDL_render_d3d12.c
@@ -3139,6 +3139,12 @@ SDL_Renderer *D3D12_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_p
     SDL_Renderer *renderer;
     D3D12_RenderData *data;
 
+    if (SDL_GetWindowFlags(window) & SDL_WINDOW_TRANSPARENT) {
+		/* D3D12 removed the swap effect needed to support transparent windows, use D3D11 instead */
+		SDL_SetError("The direct3d12 renderer doesn't work with transparent windows");
+		return NULL;
+	}
+
     renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
     if (!renderer) {
         return NULL;