mirror of
https://github.com/stenzek/duckstation.git
synced 2026-01-31 02:05:18 +01:00
VideoThread: Avoid possible null presentation in PresentFrameAndRestoreContext()
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user