[d3d9] Only bind depth buffer if the depth or stencil test is enabled

This commit is contained in:
Robin Kertels 2022-03-29 22:46:11 +02:00 committed by Joshie
parent d6cbd99141
commit bdafa16e39
1 changed files with 7 additions and 4 deletions

View File

@ -1922,17 +1922,17 @@ namespace dxvk {
m_flags.set(D3D9DeviceFlag::DirtyMultiSampleState);
break;
case D3DRS_STENCILENABLE:
case D3DRS_ZWRITEENABLE:
if (m_activeHazardsDS != 0)
case D3DRS_ZENABLE:
if (likely(m_state.depthStencil != nullptr))
m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
m_flags.set(D3D9DeviceFlag::DirtyDepthStencilState);
break;
case D3DRS_ZENABLE:
case D3DRS_ZFUNC:
case D3DRS_TWOSIDEDSTENCILMODE:
case D3DRS_STENCILENABLE:
case D3DRS_STENCILFAIL:
case D3DRS_STENCILZFAIL:
case D3DRS_STENCILPASS:
@ -5560,7 +5560,10 @@ namespace dxvk {
m_state.renderTargets[i]->GetRenderTargetLayout() };
}
if (m_state.depthStencil != nullptr) {
if (m_state.depthStencil != nullptr &&
(m_state.renderStates[D3DRS_ZENABLE]
|| m_state.renderStates[D3DRS_ZWRITEENABLE]
|| m_state.renderStates[D3DRS_STENCILENABLE])) {
const DxvkImageCreateInfo& dsImageInfo = m_state.depthStencil->GetCommonTexture()->GetImage()->info();
const bool depthWrite = m_state.renderStates[D3DRS_ZWRITEENABLE];