Skip to content

Commit

Permalink
[d3d9] Only use GDI GetFrontBufferData when Gamescope WSI isn't enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
K0bin committed Apr 11, 2024
1 parent 97347a5 commit e4e89db
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ namespace dxvk {
m_activeRTsWhichAreTextures = 0;
m_alphaSwizzleRTs = 0;
m_lastHazardsRT = 0;

m_gamescopeWSI = dxvk::env::getEnvVar("ENABLE_GAMESCOPE_WSI") == "1";
}


Expand Down Expand Up @@ -1094,7 +1096,9 @@ namespace dxvk {
return D3DERR_INVALIDCALL;

#ifdef _WIN32
return D3D9SwapChainEx::GetFrontBufferDataGDI(pDestSurface);
if (!IsGamescopeWSIEnabled()) {
return D3D9SwapChainEx::GetFrontBufferDataGDI(pDestSurface);
}
#endif

D3D9DeviceLock lock = LockDevice();
Expand Down
6 changes: 6 additions & 0 deletions src/d3d9/d3d9_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,10 @@ namespace dxvk {
m_mostRecentlyUsedSwapchain = m_implicitSwapchain.ptr();
}

bool IsGamescopeWSIEnabled() const {
return m_gamescopeWSI;
}

Com<D3D9InterfaceEx> m_parent;
D3DDEVTYPE m_deviceType;
HWND m_window;
Expand Down Expand Up @@ -1439,6 +1443,8 @@ namespace dxvk {

D3D9SwapChainEx* m_mostRecentlyUsedSwapchain = nullptr;

bool m_gamescopeWSI;

#ifdef D3D9_ALLOW_UNMAPPING
lru_list<D3D9CommonTexture*> m_mappedTextures;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/d3d9/d3d9_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ namespace dxvk {

HRESULT STDMETHODCALLTYPE D3D9SwapChainEx::GetFrontBufferData(IDirect3DSurface9* pDestSurface) {
#ifdef _WIN32
if (m_presentParams.Windowed || !HasFrontBuffer()) {
if (!m_parent->IsGamescopeWSIEnabled() && (m_presentParams.Windowed || !HasFrontBuffer())) {
return D3D9SwapChainEx::GetFrontBufferDataGDI(pDestSurface);
}
#endif
Expand Down

0 comments on commit e4e89db

Please sign in to comment.