[d3d9] Only use GDI GetFrontBufferData when Gamescope WSI isn't enabled

This commit is contained in:
Robin Kertels 2024-04-11 17:56:13 +02:00
parent 97347a5846
commit e4e89db23c
No known key found for this signature in database
GPG Key ID: 3824904F14D40757
3 changed files with 12 additions and 2 deletions

View File

@ -183,6 +183,8 @@ namespace dxvk {
m_activeRTsWhichAreTextures = 0; m_activeRTsWhichAreTextures = 0;
m_alphaSwizzleRTs = 0; m_alphaSwizzleRTs = 0;
m_lastHazardsRT = 0; m_lastHazardsRT = 0;
m_gamescopeWSI = dxvk::env::getEnvVar("ENABLE_GAMESCOPE_WSI") == "1";
} }
@ -1094,7 +1096,9 @@ namespace dxvk {
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
#ifdef _WIN32 #ifdef _WIN32
return D3D9SwapChainEx::GetFrontBufferDataGDI(pDestSurface); if (!IsGamescopeWSIEnabled()) {
return D3D9SwapChainEx::GetFrontBufferDataGDI(pDestSurface);
}
#endif #endif
D3D9DeviceLock lock = LockDevice(); D3D9DeviceLock lock = LockDevice();

View File

@ -1273,6 +1273,10 @@ namespace dxvk {
m_mostRecentlyUsedSwapchain = m_implicitSwapchain.ptr(); m_mostRecentlyUsedSwapchain = m_implicitSwapchain.ptr();
} }
bool IsGamescopeWSIEnabled() const {
return m_gamescopeWSI;
}
Com<D3D9InterfaceEx> m_parent; Com<D3D9InterfaceEx> m_parent;
D3DDEVTYPE m_deviceType; D3DDEVTYPE m_deviceType;
HWND m_window; HWND m_window;
@ -1439,6 +1443,8 @@ namespace dxvk {
D3D9SwapChainEx* m_mostRecentlyUsedSwapchain = nullptr; D3D9SwapChainEx* m_mostRecentlyUsedSwapchain = nullptr;
bool m_gamescopeWSI;
#ifdef D3D9_ALLOW_UNMAPPING #ifdef D3D9_ALLOW_UNMAPPING
lru_list<D3D9CommonTexture*> m_mappedTextures; lru_list<D3D9CommonTexture*> m_mappedTextures;
#endif #endif

View File

@ -321,7 +321,7 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D9SwapChainEx::GetFrontBufferData(IDirect3DSurface9* pDestSurface) { HRESULT STDMETHODCALLTYPE D3D9SwapChainEx::GetFrontBufferData(IDirect3DSurface9* pDestSurface) {
#ifdef _WIN32 #ifdef _WIN32
if (m_presentParams.Windowed || !HasFrontBuffer()) { if (!m_parent->IsGamescopeWSIEnabled() && (m_presentParams.Windowed || !HasFrontBuffer())) {
return D3D9SwapChainEx::GetFrontBufferDataGDI(pDestSurface); return D3D9SwapChainEx::GetFrontBufferDataGDI(pDestSurface);
} }
#endif #endif