Synchronize several renderer callbacks

Many renderers do not properly synchronize these on their own, so let's do it for them.

HDR and window changes are infrequent enough not to really matter.
This commit is contained in:
Cameron Gutman committed 2026-10-29 23:55:57 -05:00
1 parent 10270ca0f6
commit 1ced9dd9b0
4 files changed
+51 -7

No files matched your search

@@ -1263,8 +1263,12 @@ bool D3D11VARenderer::notifyWindowChanged(PWINDOW_STATE_CHANGE_INFO stateInfo)
DXGI_SWAP_CHAIN_DESC1 swapchainDesc;
m_SwapChain->GetDesc1(&swapchainDesc);
// Lock the context to avoid concurrent rendering
lockContext(this);
// Lock the context to avoid concurrent decoding use. This is
// already synchronized with rendering by the render lock, so
// we only need to do this when not using separate devices.
if (m_DecodeDevice == m_RenderDevice) {
lockContext(this);
}
m_DisplayWidth = stateInfo->width;
m_DisplayHeight = stateInfo->height;
@@ -1294,17 +1298,23 @@ bool D3D11VARenderer::notifyWindowChanged(PWINDOW_STATE_CHANGE_INFO stateInfo)
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"IDXGISwapChain::ResizeBuffers() failed: %x",
hr);
unlockContext(this);
if (m_DecodeDevice == m_RenderDevice) {
unlockContext(this);
}
return false;
}
// Reset swapchain-dependent resources (RTV, viewport, etc)
if (!setupSwapchainDependentResources()) {
unlockContext(this);
if (m_DecodeDevice == m_RenderDevice) {
unlockContext(this);
}
return false;
}
unlockContext(this);
if (m_DecodeDevice == m_RenderDevice) {
unlockContext(this);
}
// We've handled this state change
stateInfo->stateChangeFlags &= ~WINDOW_STATE_CHANGE_SIZE;