Просмотр исходного кода

SDL_ClaimWindowForGPUDevice() should fail for transparent windows

The GPU API doesn't currently support transparent windows (transparent swapchain effects doesn't seem possible on D3D12) so we should explicitly fail so users don't expect transparency and then not get it.

Fixes https://github.com/libsdl-org/SDL/issues/12410
Sam Lantinga 11 месяцев назад
Родитель
Сommit
2fbb583290
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      src/gpu/SDL_gpu.c

+ 5 - 2
src/gpu/SDL_gpu.c

@@ -2653,8 +2653,11 @@ bool SDL_ClaimWindowForGPUDevice(
 {
 {
     CHECK_DEVICE_MAGIC(device, false);
     CHECK_DEVICE_MAGIC(device, false);
     if (window == NULL) {
     if (window == NULL) {
-        SDL_InvalidParamError("window");
-        return false;
+        return SDL_InvalidParamError("window");
+    }
+
+    if ((window->flags & SDL_WINDOW_TRANSPARENT) != 0) {
+        return SDL_SetError("The GPU API doesn't support transparent windows");
     }
     }
 
 
     return device->ClaimWindow(
     return device->ClaimWindow(