gpu: Use the window event watcher list for Vulkan and D3D12

Events won't be delivered to the regular event watcher list callbacks if a client event filter discards events. Use the special window event watcher list to watch for resizes in the GPU renderers, as events are delivered to this list before a client can potentially discard them.
This commit is contained in:
Frank Praznik
2025-12-30 21:45:16 -05:00
parent 4d8f84f161
commit cb4f33b644
2 changed files with 6 additions and 4 deletions

View File

@@ -23,6 +23,7 @@
#ifdef SDL_GPU_D3D12
#include "../../events/SDL_windowevents_c.h"
#include "../../core/windows/SDL_windows.h"
#include "../../video/directx/SDL_d3d12.h"
#include "../SDL_sysgpu.h"
@@ -7097,7 +7098,7 @@ static bool D3D12_ClaimWindow(
renderer->claimedWindowCount += 1;
SDL_UnlockMutex(renderer->windowLock);
SDL_AddEventWatch(D3D12_INTERNAL_OnWindowResize, window);
SDL_AddWindowEventWatch(SDL_WINDOW_EVENT_WATCH_NORMAL, D3D12_INTERNAL_OnWindowResize, window);
return true;
} else {
@@ -7145,7 +7146,7 @@ static void D3D12_ReleaseWindow(
SDL_free(windowData);
SDL_ClearProperty(SDL_GetWindowProperties(window), WINDOW_PROPERTY_DATA);
SDL_RemoveEventWatch(D3D12_INTERNAL_OnWindowResize, window);
SDL_RemoveWindowEventWatch(SDL_WINDOW_EVENT_WATCH_NORMAL, D3D12_INTERNAL_OnWindowResize, window);
}
static bool D3D12_SetSwapchainParameters(

View File

@@ -32,6 +32,7 @@
#include <SDL3/SDL_vulkan.h>
#include "../SDL_sysgpu.h"
#include "../../events/SDL_windowevents_c.h"
// Global Vulkan Loader Entry Points
@@ -9815,7 +9816,7 @@ static bool VULKAN_ClaimWindow(
renderer->claimedWindowCount += 1;
SDL_UnlockMutex(renderer->windowLock);
SDL_AddEventWatch(VULKAN_INTERNAL_OnWindowResize, window);
SDL_AddWindowEventWatch(SDL_WINDOW_EVENT_WATCH_NORMAL, VULKAN_INTERNAL_OnWindowResize, window);
return true;
} else if (createSwapchainResult == VULKAN_INTERNAL_TRY_AGAIN) {
@@ -9880,7 +9881,7 @@ static void VULKAN_ReleaseWindow(
SDL_free(windowData);
SDL_ClearProperty(SDL_GetWindowProperties(window), WINDOW_PROPERTY_DATA);
SDL_RemoveEventWatch(VULKAN_INTERNAL_OnWindowResize, window);
SDL_RemoveWindowEventWatch(SDL_WINDOW_EVENT_WATCH_NORMAL, VULKAN_INTERNAL_OnWindowResize, window);
}
static Uint32 VULKAN_INTERNAL_RecreateSwapchain(