Skip to content

Commit a81c2c6

Browse files
committed
UILetterbox: add render state reset code, may fix dgvoodoo
1 parent 6108bb2 commit a81c2c6

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/overlay/hooks_overlay.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,20 @@ class D3DHooks : public Hook
112112
d3ddev->GetRenderState(D3DRS_CULLMODE, &prevCullMode);
113113
d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
114114

115-
// TODO: not sure if we might need these in future, if game overrides some state during gameplay it may affect letterbox
116-
#if 0
117-
// Set render states
118-
d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
119-
d3ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
120-
d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
121-
122-
// Set texture stage states to avoid any texture influence
123-
d3ddev->SetTexture(0, NULL);
124-
d3ddev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
125-
d3ddev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
126-
#endif
115+
// Seems these SetRenderState/SetTexture calls are needed for DGVoodoo to render letterbox while imgui is active
116+
// DXVK/D3D9 seem to work fine without them
117+
// TODO: the game keeps its own copies of the render states so it can update them if needed, should we update the games copy here?
118+
{
119+
// Set render states
120+
d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
121+
d3ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
122+
d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
123+
124+
// Set texture stage states to avoid any texture influence
125+
d3ddev->SetTexture(0, NULL);
126+
d3ddev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
127+
d3ddev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
128+
}
127129

128130
// Set FVF and stream source
129131
d3ddev->SetFVF(CUSTOMFVF);

0 commit comments

Comments
 (0)