From 345924f12d795625aa45172fa6c6ea2b9c83ee4c Mon Sep 17 00:00:00 2001 From: Caleb Cornett Date: Sun, 11 Feb 2024 00:40:48 -0600 Subject: [PATCH] Fix infinite while loop in D3D11_INTERNAL_WaitForFence --- src/Refresh_Driver_D3D11.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Refresh_Driver_D3D11.c b/src/Refresh_Driver_D3D11.c index ac5a676..dd77729 100644 --- a/src/Refresh_Driver_D3D11.c +++ b/src/Refresh_Driver_D3D11.c @@ -3655,17 +3655,17 @@ static void D3D11_INTERNAL_WaitForFence( SDL_LockMutex(renderer->contextLock); - res = ID3D11DeviceContext_GetData( - renderer->immediateContext, - (ID3D11Asynchronous*) fence->handle, - &queryData, - sizeof(queryData), - 0 - ); - while (res != S_OK) + do { - /* Spin until we get a result back... */ + res = ID3D11DeviceContext_GetData( + renderer->immediateContext, + (ID3D11Asynchronous*)fence->handle, + &queryData, + sizeof(queryData), + 0 + ); } + while (res != S_OK); /* Spin until we get a result back... */ SDL_UnlockMutex(renderer->contextLock); }