From 9e7589d8440dffbb07049fa0f51dc7ca4b26b6f1 Mon Sep 17 00:00:00 2001 From: Caleb Cornett Date: Fri, 29 Sep 2023 20:52:14 -0500 Subject: [PATCH] Stub out D3D11_Wait, fix crash when unclaiming windows, fix backend order --- src/Refresh.c | 2 +- src/Refresh_Driver_D3D11.c | 12 +++++++++--- src/Refresh_Driver_Vulkan.c | 5 +++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Refresh.c b/src/Refresh.c index b495fd2..4b2ad46 100644 --- a/src/Refresh.c +++ b/src/Refresh.c @@ -53,8 +53,8 @@ static const Refresh_Driver *backends[] = { NULL, - D3D11_DRIVER, VULKAN_DRIVER, + D3D11_DRIVER, PS5_DRIVER }; diff --git a/src/Refresh_Driver_D3D11.c b/src/Refresh_Driver_D3D11.c index a6bfee1..13465b2 100644 --- a/src/Refresh_Driver_D3D11.c +++ b/src/Refresh_Driver_D3D11.c @@ -1273,13 +1273,19 @@ static Refresh_Texture* D3D11_AcquireSwapchainTexture( ) { D3D11Renderer *renderer = (D3D11Renderer*) driverData; D3D11CommandBuffer *cmdbuf = (D3D11CommandBuffer*) commandBuffer; + D3D11WindowData *windowData; D3D11SwapchainData *swapchainData; DXGI_SWAP_CHAIN_DESC swapchainDesc; int w, h; HRESULT res; - /* Fetch the window and swapchain data. */ - swapchainData = D3D11_INTERNAL_FetchWindowData(windowHandle)->swapchainData; + windowData = D3D11_INTERNAL_FetchWindowData(windowHandle); + if (windowData == NULL) + { + return NULL; + } + + swapchainData = windowData->swapchainData; if (swapchainData == NULL) { return NULL; @@ -1387,7 +1393,7 @@ static Refresh_Fence* D3D11_SubmitAndAcquireFence( static void D3D11_Wait( Refresh_Renderer *driverData ) { - NOT_IMPLEMENTED + /* FIXME: Anything we need to do here? */ } static void D3D11_WaitForFences( diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index a3864b1..e64fcee 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -9756,6 +9756,11 @@ static Refresh_Texture* VULKAN_AcquireSwapchainTexture( VulkanPresentData *presentData; windowData = VULKAN_INTERNAL_FetchWindowData(windowHandle); + if (windowData == NULL) + { + return NULL; + } + swapchainData = windowData->swapchainData; /* Window is claimed but swapchain is invalid! */