diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 9d5530be..7419cc48 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -1668,6 +1668,8 @@ namespace dxvk { bool changed = states[State] != Value; if (likely(changed)) { + const bool oldClipPlaneEnabled = IsClipPlaneEnabled(); + const bool oldDepthBiasEnabled = IsDepthBiasEnabled(); const bool oldATOC = IsAlphaToCoverageEnabled(); @@ -1836,9 +1838,15 @@ namespace dxvk { m_flags.set(D3D9DeviceFlag::DirtyRasterizerState); break; - case D3DRS_CLIPPLANEENABLE: + case D3DRS_CLIPPLANEENABLE: { + const bool clipPlaneEnabled = IsClipPlaneEnabled(); + + if (clipPlaneEnabled != oldClipPlaneEnabled) + m_flags.set(D3D9DeviceFlag::DirtyFFVertexShader); + m_flags.set(D3D9DeviceFlag::DirtyClipPlanes); break; + } case D3DRS_ALPHAREF: UpdatePushConstant(); @@ -5946,6 +5954,8 @@ namespace dxvk { key.Data.Contents.VertexBlendCount = m_state.renderStates[D3DRS_VERTEXBLEND] & 0xff; } + key.Data.Contents.VertexClipping = IsClipPlaneEnabled(); + EmitCs([ this, cKey = key, diff --git a/src/d3d9/d3d9_device.h b/src/d3d9/d3d9_device.h index fb825600..25174dc3 100644 --- a/src/d3d9/d3d9_device.h +++ b/src/d3d9/d3d9_device.h @@ -776,6 +776,10 @@ namespace dxvk { return m_state.renderStates[D3DRS_ZENABLE] && m_state.depthStencil != nullptr; } + inline bool IsClipPlaneEnabled() { + return m_state.renderStates[D3DRS_CLIPPLANEENABLE] != 0; + } + void BindMultiSampleState(); void BindBlendState(); diff --git a/src/d3d9/d3d9_fixed_function.cpp b/src/d3d9/d3d9_fixed_function.cpp index 22c9c20c..b4c459fc 100644 --- a/src/d3d9/d3d9_fixed_function.cpp +++ b/src/d3d9/d3d9_fixed_function.cpp @@ -1163,7 +1163,8 @@ namespace dxvk { uint32_t pointSize = m_module.opFClamp(m_floatType, pointInfo.defaultValue, pointInfo.min, pointInfo.max); m_module.opStore(m_vs.out.POINTSIZE, pointSize); - emitVsClipping(vtx); + if (m_vsKey.Data.Contents.VertexClipping) + emitVsClipping(vtx); } diff --git a/src/d3d9/d3d9_fixed_function.h b/src/d3d9/d3d9_fixed_function.h index 378685d3..f839e12e 100644 --- a/src/d3d9/d3d9_fixed_function.h +++ b/src/d3d9/d3d9_fixed_function.h @@ -107,6 +107,8 @@ namespace dxvk { uint32_t VertexBlendMode : 2; uint32_t VertexBlendIndexed : 1; uint32_t VertexBlendCount : 3; + + uint32_t VertexClipping : 1; } Contents; uint32_t Primitive[4];