[d3d9] Mark presenter for recreation on device reset with deferSurfaceCreation

This commit is contained in:
WinterSnowfall 2023-09-17 21:53:12 +03:00 committed by Philip Rebohle
parent f0ff0007dc
commit 4d974685c9
3 changed files with 12 additions and 0 deletions

View File

@ -482,6 +482,9 @@ namespace dxvk {
Flush();
SynchronizeCsThread(DxvkCsThread::SynchronizeAll);
if (m_d3d9Options.deferSurfaceCreation)
m_deviceHasBeenReset = true;
return D3D_OK;
}

View File

@ -1033,6 +1033,12 @@ namespace dxvk {
bool CanSWVP() const {
return m_behaviorFlags & (D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING);
}
// Device Reset detection for D3D9SwapChainEx::Present
bool IsDeviceReset() {
return std::exchange(m_deviceHasBeenReset, false);
}
void DetermineConstantLayouts(bool canSWVP);
D3D9BufferSlice AllocUPBuffer(VkDeviceSize size);
@ -1337,6 +1343,7 @@ namespace dxvk {
VkImageLayout m_hazardLayout = VK_IMAGE_LAYOUT_GENERAL;
bool m_usingGraphicsPipelines = false;
bool m_deviceHasBeenReset = false;
DxvkDepthBiasRepresentation m_depthBiasRepresentation = { VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORMAT_EXT, false };
float m_depthBiasScale = 0.0f;

View File

@ -147,6 +147,8 @@ namespace dxvk {
bool recreate = false;
recreate |= m_wctx->presenter == nullptr;
recreate |= m_dialog != m_lastDialog;
if (options->deferSurfaceCreation)
recreate |= m_parent->IsDeviceReset();
if (m_wctx->presenter != nullptr) {
m_dirty |= m_wctx->presenter->setSyncInterval(presentInterval) != VK_SUCCESS;