From 18ef1248f91cb4aaa2ae92cc0f5672eb7d7f3a2a Mon Sep 17 00:00:00 2001 From: Triang3l Date: Fri, 19 Oct 2018 11:55:01 +0300 Subject: [PATCH] [D3D12] ROV: Use front face stencil for back face when needed --- .../gpu/d3d12/d3d12_command_processor.cc | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/xenia/gpu/d3d12/d3d12_command_processor.cc b/src/xenia/gpu/d3d12/d3d12_command_processor.cc index f120c4580..e14f39cbf 100644 --- a/src/xenia/gpu/d3d12/d3d12_command_processor.cc +++ b/src/xenia/gpu/d3d12/d3d12_command_processor.cc @@ -1988,18 +1988,29 @@ void D3D12CommandProcessor::UpdateSystemConstantValues( system_constants_.edram_stencil_front_comparison != stencil_value; system_constants_.edram_stencil_front_comparison = stencil_value; - stencil_value = kStencilOpMap[(rb_depthcontrol >> 23) & 0x7]; - dirty |= system_constants_.edram_stencil_back_fail != stencil_value; - system_constants_.edram_stencil_back_fail = stencil_value; - stencil_value = kStencilOpMap[(rb_depthcontrol >> 29) & 0x7]; - dirty |= system_constants_.edram_stencil_back_depth_fail != stencil_value; - system_constants_.edram_stencil_back_depth_fail = stencil_value; - stencil_value = kStencilOpMap[(rb_depthcontrol >> 26) & 0x7]; - dirty |= system_constants_.edram_stencil_back_pass != stencil_value; - system_constants_.edram_stencil_back_pass = stencil_value; - stencil_value = (rb_depthcontrol >> 20) & 0x7; - dirty |= system_constants_.edram_stencil_back_comparison != stencil_value; - system_constants_.edram_stencil_back_comparison = stencil_value; + if (rb_depthcontrol & 0x80) { + stencil_value = kStencilOpMap[(rb_depthcontrol >> 23) & 0x7]; + dirty |= system_constants_.edram_stencil_back_fail != stencil_value; + system_constants_.edram_stencil_back_fail = stencil_value; + stencil_value = kStencilOpMap[(rb_depthcontrol >> 29) & 0x7]; + dirty |= + system_constants_.edram_stencil_back_depth_fail != stencil_value; + system_constants_.edram_stencil_back_depth_fail = stencil_value; + stencil_value = kStencilOpMap[(rb_depthcontrol >> 26) & 0x7]; + dirty |= system_constants_.edram_stencil_back_pass != stencil_value; + system_constants_.edram_stencil_back_pass = stencil_value; + stencil_value = (rb_depthcontrol >> 20) & 0x7; + dirty |= + system_constants_.edram_stencil_back_comparison != stencil_value; + system_constants_.edram_stencil_back_comparison = stencil_value; + } else { + dirty |= std::memcmp(system_constants_.edram_stencil_back, + system_constants_.edram_stencil_front, + 4 * sizeof(uint32_t)) != 0; + std::memcpy(system_constants_.edram_stencil_back, + system_constants_.edram_stencil_front, + 4 * sizeof(uint32_t)); + } } dirty |= system_constants_.edram_blend_constant[0] !=