From c55c09368b8e7d878cbe602b6d380ba0d1e6e1b3 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 11 Dec 2022 19:28:37 +0100 Subject: [PATCH] [d3d11] Only store low 8 bits of stencil reference Seems to match behaviour of the D3D11 runtime, in that OMGetDepthStencilState will not retain the high bits. Found by CME. Should fix #1784. --- src/d3d11/d3d11_context.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 3c649c05..37135a75 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -2261,6 +2261,10 @@ namespace dxvk { ApplyDepthStencilState(); } + // The D3D11 runtime only appears to store the low 8 bits, + // and some games rely on this behaviour. Do the same here. + StencilRef &= 0xFF; + if (m_state.om.stencilRef != StencilRef) { m_state.om.stencilRef = StencilRef; ApplyStencilRef();