VideoThread: Avoid possible null presentation in PresentFrameAndRestoreContext()

This commit is contained in:
Stenzek
2026-01-27 22:46:45 +10:00
parent 5516f7a2f1
commit 335145b54b
2 changed files with 9 additions and 4 deletions

View File

@@ -1439,6 +1439,8 @@ bool VideoPresenter::PresentFrame(GPUBackend* backend, u64 present_time)
}
GPUSwapChain* const swap_chain = g_gpu_device->GetMainSwapChain();
DebugAssert(swap_chain);
const GPUDevice::PresentResult pres =
((backend && !FullscreenUI::IsTransitionActive()) ? RenderDisplay(nullptr, swap_chain->GetSizeVec(), true, true) :
g_gpu_device->BeginPresent(swap_chain));

View File

@@ -1014,11 +1014,14 @@ bool VideoThread::Internal::PresentFrameAndRestoreContext()
if (s_state.gpu_backend)
s_state.gpu_backend->FlushRender();
if (!VideoPresenter::PresentFrame(s_state.gpu_backend.get(), 0))
return false;
if (g_gpu_device->HasMainSwapChain())
{
if (!VideoPresenter::PresentFrame(s_state.gpu_backend.get(), 0))
return false;
if (s_state.gpu_backend)
s_state.gpu_backend->RestoreDeviceContext();
if (s_state.gpu_backend)
s_state.gpu_backend->RestoreDeviceContext();
}
return true;
}