From 807c1075bd63fac68dc2b2dc4477fdc1f049375b Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Thu, 7 Mar 2024 15:28:52 +0100 Subject: [PATCH] [d3d9] Skip presenting if D3D9Swapchain has no associated window --- src/d3d9/d3d9_swapchain.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/d3d9/d3d9_swapchain.cpp b/src/d3d9/d3d9_swapchain.cpp index 57724330..f93bfbcb 100644 --- a/src/d3d9/d3d9_swapchain.cpp +++ b/src/d3d9/d3d9_swapchain.cpp @@ -172,6 +172,9 @@ namespace dxvk { m_lastDialog = m_dialog; + if (m_window == nullptr) + return D3D_OK; + #ifdef _WIN32 const bool useGDIFallback = m_partialCopy && !HasFrontBuffer(); if (useGDIFallback) @@ -994,6 +997,9 @@ namespace dxvk { void D3D9SwapChainEx::UpdateWindowCtx() { + if (m_window == nullptr) + return; + if (!m_presenters.count(m_window)) { auto res = m_presenters.emplace( std::piecewise_construct, @@ -1323,10 +1329,10 @@ namespace dxvk { || dstRect.right - dstRect.left != LONG(width) || dstRect.bottom - dstRect.top != LONG(height); - bool recreate = - m_wctx->presenter == nullptr - || m_wctx->presenter->info().imageExtent.width != width - || m_wctx->presenter->info().imageExtent.height != height; + bool recreate = m_wctx != nullptr + && (m_wctx->presenter == nullptr + || m_wctx->presenter->info().imageExtent.width != width + || m_wctx->presenter->info().imageExtent.height != height); m_swapchainExtent = { width, height }; m_dstRect = dstRect;