diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index 839f585a57..9e1980e9cc 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -447,7 +447,7 @@ void D3D12GSRender::end() m_timers.m_programLoadDuration += std::chrono::duration_cast(programLoadEnd - programLoadStart).count(); getCurrentResourceStorage().m_commandList->SetGraphicsRootSignature(m_rootSignatures[m_PSO->second].Get()); - getCurrentResourceStorage().m_commandList->OMSetStencilRef(m_stencil_func_ref); + getCurrentResourceStorage().m_commandList->OMSetStencilRef(rsx::method_registers[NV4097_SET_STENCIL_FUNC_REF]); std::chrono::time_point constantsDurationStart = std::chrono::system_clock::now(); diff --git a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp index 721945e275..c987dd8e68 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp @@ -235,27 +235,27 @@ bool D3D12GSRender::LoadProgram() prop.DepthStencil.DepthEnable = !!(rsx::method_registers[NV4097_SET_DEPTH_TEST_ENABLE]); prop.DepthStencil.DepthWriteMask = !!(rsx::method_registers[NV4097_SET_DEPTH_MASK]) ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO; prop.DepthStencil.DepthFunc = getCompareFunc(rsx::method_registers[NV4097_SET_DEPTH_FUNC]); - prop.DepthStencil.StencilEnable = m_set_stencil_test; - prop.DepthStencil.StencilReadMask = m_stencil_func_mask; - prop.DepthStencil.StencilWriteMask = m_stencil_mask; - prop.DepthStencil.FrontFace.StencilPassOp = getStencilOp(m_stencil_zpass); - prop.DepthStencil.FrontFace.StencilDepthFailOp = getStencilOp(m_stencil_zfail); - prop.DepthStencil.FrontFace.StencilFailOp = getStencilOp(m_stencil_fail); - prop.DepthStencil.FrontFace.StencilFunc = getCompareFunc(m_stencil_func); + prop.DepthStencil.StencilEnable = !!(rsx::method_registers[NV4097_SET_STENCIL_TEST_ENABLE]); + prop.DepthStencil.StencilReadMask = rsx::method_registers[NV4097_SET_STENCIL_FUNC_MASK]; + prop.DepthStencil.StencilWriteMask = rsx::method_registers[NV4097_SET_STENCIL_MASK]; + prop.DepthStencil.FrontFace.StencilPassOp = getStencilOp(rsx::method_registers[NV4097_SET_STENCIL_OP_ZPASS]); + prop.DepthStencil.FrontFace.StencilDepthFailOp = getStencilOp(rsx::method_registers[NV4097_SET_STENCIL_OP_ZFAIL]); + prop.DepthStencil.FrontFace.StencilFailOp = getStencilOp(rsx::method_registers[NV4097_SET_STENCIL_OP_FAIL]); + prop.DepthStencil.FrontFace.StencilFunc = getCompareFunc(rsx::method_registers[NV4097_SET_STENCIL_FUNC]); - if (m_set_two_sided_stencil_test_enable) + if (rsx::method_registers[NV4097_SET_TWO_SIDED_STENCIL_TEST_ENABLE]) { - prop.DepthStencil.BackFace.StencilFailOp = getStencilOp(m_back_stencil_fail); - prop.DepthStencil.BackFace.StencilFunc = getCompareFunc(m_back_stencil_func); - prop.DepthStencil.BackFace.StencilPassOp = getStencilOp(m_back_stencil_zpass); - prop.DepthStencil.BackFace.StencilDepthFailOp = getStencilOp(m_back_stencil_zfail); + prop.DepthStencil.BackFace.StencilFailOp = getStencilOp(rsx::method_registers[NV4097_SET_BACK_STENCIL_OP_FAIL]); + prop.DepthStencil.BackFace.StencilFunc = getCompareFunc(rsx::method_registers[NV4097_SET_BACK_STENCIL_FUNC]); + prop.DepthStencil.BackFace.StencilPassOp = getStencilOp(rsx::method_registers[NV4097_SET_BACK_STENCIL_OP_ZPASS]); + prop.DepthStencil.BackFace.StencilDepthFailOp = getStencilOp(rsx::method_registers[NV4097_SET_BACK_STENCIL_OP_ZFAIL]); } else { - prop.DepthStencil.BackFace.StencilPassOp = getStencilOp(m_stencil_zpass); - prop.DepthStencil.BackFace.StencilDepthFailOp = getStencilOp(m_stencil_zfail); - prop.DepthStencil.BackFace.StencilFailOp = getStencilOp(m_stencil_fail); - prop.DepthStencil.BackFace.StencilFunc = getCompareFunc(m_stencil_func); + prop.DepthStencil.BackFace.StencilPassOp = getStencilOp(rsx::method_registers[NV4097_SET_STENCIL_OP_ZPASS]); + prop.DepthStencil.BackFace.StencilDepthFailOp = getStencilOp(rsx::method_registers[NV4097_SET_STENCIL_OP_ZFAIL]); + prop.DepthStencil.BackFace.StencilFailOp = getStencilOp(rsx::method_registers[NV4097_SET_STENCIL_OP_FAIL]); + prop.DepthStencil.BackFace.StencilFunc = getCompareFunc(rsx::method_registers[NV4097_SET_STENCIL_FUNC]); } // Sensible default value diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 18927278f4..d45ea010f5 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -1669,7 +1669,7 @@ void GLGSRender::end() Enable(m_set_logic_op, GL_LOGIC_OP); Enable(m_set_cull_face, GL_CULL_FACE); Enable(m_set_dither, GL_DITHER); - Enable(m_set_stencil_test, GL_STENCIL_TEST); +// Enable(m_set_stencil_test, GL_STENCIL_TEST); Enable(m_set_line_smooth, GL_LINE_SMOOTH); Enable(m_set_poly_smooth, GL_POLYGON_SMOOTH); Enable(m_set_point_sprite_control, GL_POINT_SPRITE); @@ -1736,7 +1736,7 @@ void GLGSRender::end() checkForGlError("glScissor"); } - if (m_set_two_sided_stencil_test_enable) +/* if (m_set_two_sided_stencil_test_enable) { if (m_set_stencil_fail && m_set_stencil_zfail && m_set_stencil_zpass) { @@ -1793,7 +1793,7 @@ void GLGSRender::end() glStencilFunc(m_stencil_func, m_stencil_func_ref, m_stencil_func_mask); checkForGlError("glStencilFunc"); } - } + }*/ // TODO: Use other glLightModel functions? glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, m_set_two_side_light_enable ? GL_TRUE : GL_FALSE); diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 58ff368101..e16a17e347 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -1256,17 +1256,11 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const // Stencil testing case NV4097_SET_STENCIL_TEST_ENABLE: - { - m_set_stencil_test = ARGS(0) ? true : false; notifyDepthStencilStateChange(); break; - } - case NV4097_SET_TWO_SIDED_STENCIL_TEST_ENABLE: - { - m_set_two_sided_stencil_test_enable = ARGS(0) ? true : false; break; - } + case NV4097_SET_TWO_SIDE_LIGHT_EN: { @@ -1275,133 +1269,35 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const } case NV4097_SET_STENCIL_MASK: - { - m_set_stencil_mask = true; - m_stencil_mask = ARGS(0); notifyDepthStencilStateChange(); break; - } - case NV4097_SET_STENCIL_FUNC: - { - m_set_stencil_func = true; - m_stencil_func = ARGS(0); - - if (count >= 2) - { - m_set_stencil_func_ref = true; - m_stencil_func_ref = ARGS(1); - - if (count >= 3) - { - m_set_stencil_func_mask = true; - m_stencil_func_mask = ARGS(2); - } - } notifyDepthStencilStateChange(); break; - } - case NV4097_SET_STENCIL_FUNC_REF: - { - m_set_stencil_func_ref = true; - m_stencil_func_ref = ARGS(0); notifyDepthStencilStateChange(); break; - } - case NV4097_SET_STENCIL_FUNC_MASK: - { - m_set_stencil_func_mask = true; - m_stencil_func_mask = ARGS(0); notifyDepthStencilStateChange(); break; - } - case NV4097_SET_STENCIL_OP_FAIL: - { - m_set_stencil_fail = true; - m_stencil_fail = ARGS(0); - - if (count >= 2) - { - m_set_stencil_zfail = true; - m_stencil_zfail = ARGS(1); - - if (count >= 3) - { - m_set_stencil_zpass = true; - m_stencil_zpass = ARGS(2); - } - } notifyDepthStencilStateChange(); break; - } - case NV4097_SET_BACK_STENCIL_MASK: - { - m_set_back_stencil_mask = true; - m_back_stencil_mask = ARGS(0); notifyDepthStencilStateChange(); break; - } - case NV4097_SET_BACK_STENCIL_FUNC: - { - m_set_back_stencil_func = true; - m_back_stencil_func = ARGS(0); - - if (count >= 2) - { - m_set_back_stencil_func_ref = true; - m_back_stencil_func_ref = ARGS(1); - - if (count >= 3) - { - m_set_back_stencil_func_mask = true; - m_back_stencil_func_mask = ARGS(2); - } - } notifyDepthStencilStateChange(); break; - } - case NV4097_SET_BACK_STENCIL_FUNC_REF: - { - m_set_back_stencil_func_ref = true; - m_back_stencil_func_ref = ARGS(0); notifyDepthStencilStateChange(); break; - } - case NV4097_SET_BACK_STENCIL_FUNC_MASK: - { - m_set_back_stencil_func_mask = true; - m_back_stencil_func_mask = ARGS(0); notifyDepthStencilStateChange(); break; - } - case NV4097_SET_BACK_STENCIL_OP_FAIL: - { - m_set_stencil_fail = true; - m_stencil_fail = ARGS(0); - - if (count >= 2) - { - m_set_back_stencil_zfail = true; - m_back_stencil_zfail = ARGS(1); - - if (count >= 3) - { - m_set_back_stencil_zpass = true; - m_back_stencil_zpass = ARGS(2); - } - } notifyDepthStencilStateChange(); break; - } - case NV4097_SET_SCULL_CONTROL: { if (u32 value = ARGS(0)) diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index faa3081107..9e11be4762 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -273,38 +273,7 @@ public: bool m_set_blend_mrt3; // Stencil Test - bool m_set_stencil_test; - bool m_set_stencil_mask; - u32 m_stencil_mask; - bool m_set_stencil_func; - u32 m_stencil_func; - bool m_set_stencil_func_ref; - u32 m_stencil_func_ref; - bool m_set_stencil_func_mask; - u32 m_stencil_func_mask; - bool m_set_stencil_fail; - u32 m_stencil_fail; - bool m_set_stencil_zfail; - u32 m_stencil_zfail; - bool m_set_stencil_zpass; - u32 m_stencil_zpass; - bool m_set_two_sided_stencil_test_enable; bool m_set_two_side_light_enable; - bool m_set_back_stencil_mask; - u32 m_back_stencil_mask; - bool m_set_back_stencil_func; - u32 m_back_stencil_func; - bool m_set_back_stencil_func_ref; - u32 m_back_stencil_func_ref; - bool m_set_back_stencil_func_mask; - u32 m_back_stencil_func_mask; - bool m_set_back_stencil_fail; - u32 m_back_stencil_fail; - bool m_set_back_stencil_zfail; - u32 m_back_stencil_zfail; - bool m_set_back_stencil_zpass; - u32 m_back_stencil_zpass; - bool m_set_stencil_op_fail; // Line width bool m_set_line_width; @@ -469,14 +438,12 @@ protected: m_set_logic_op = false; m_set_cull_face = false; m_set_dither = false; - m_set_stencil_test = false; m_set_scissor_horizontal = false; m_set_scissor_vertical = false; m_set_line_smooth = false; m_set_poly_smooth = false; m_set_point_sprite_control = false; m_set_specular = false; - m_set_two_sided_stencil_test_enable = false; m_set_two_side_light_enable = false; m_set_surface_clip_horizontal = false; m_set_surface_clip_vertical = false; @@ -566,24 +533,7 @@ protected: m_set_blend_dfactor = false; m_set_blend_equation = false; m_set_blend_color = false; - m_set_stencil_test = false; - m_set_two_sided_stencil_test_enable = false; m_set_two_side_light_enable = false; - m_set_stencil_mask = false; - m_set_stencil_func = false; - m_set_stencil_func_ref = false; - m_set_stencil_func_mask = false; - m_set_stencil_fail = false; - m_set_stencil_zfail = false; - m_set_stencil_zpass = false; - m_set_back_stencil_mask = false; - m_set_back_stencil_func = false; - m_set_back_stencil_func_ref = false; - m_set_back_stencil_func_mask = false; - m_set_back_stencil_fail = false; - m_set_back_stencil_zfail = false; - m_set_back_stencil_zpass = false; - m_set_stencil_op_fail = false; m_set_point_sprite_control = false; m_set_point_size = false; m_set_line_width = false; diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index b9fa6c24ff..569f041d14 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -478,8 +478,8 @@ void SetupRsxRenderingStates(vm::ptr& cntxt) r.m_set_depth_bounds_test = false; rsx::method_registers[NV4097_SET_DEPTH_TEST_ENABLE] = false; r.m_set_poly_offset_fill = false; - r.m_set_stencil_test = false; - r.m_set_two_sided_stencil_test_enable = false; +// r.m_set_stencil_test = false; +// r.m_set_two_sided_stencil_test_enable = false; r.m_set_two_side_light_enable = false; r.m_set_point_sprite_control = false; r.m_set_dither = true; diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index c39a65622c..3fd29dac7e 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -506,7 +506,7 @@ void RSXDebugger::GetFlags() LIST_FLAGS_ADD("Poly offset fill", render.m_set_poly_offset_fill); LIST_FLAGS_ADD("Poly offset line", render.m_set_poly_offset_line); LIST_FLAGS_ADD("Poly offset point", render.m_set_poly_offset_point); - LIST_FLAGS_ADD("Stencil test", render.m_set_stencil_test); +// LIST_FLAGS_ADD("Stencil test", render.m_set_stencil_test); LIST_FLAGS_ADD("Primitive restart", render.m_set_restart_index); LIST_FLAGS_ADD("Two sided lighting", render.m_set_two_side_light_enable); LIST_FLAGS_ADD("Point Sprite", render.m_set_point_sprite_control); @@ -623,9 +623,9 @@ void RSXDebugger::GetSettings() render.m_scissor_y, render.m_scissor_w, render.m_scissor_h)); - LIST_SETTINGS_ADD("Stencil func", !(render.m_set_stencil_func) ? "(none)" : wxString::Format("0x%x (%s)", - render.m_stencil_func, - ParseGCMEnum(render.m_stencil_func, CELL_GCM_ENUM))); +// LIST_SETTINGS_ADD("Stencil func", !(render.m_set_stencil_func) ? "(none)" : wxString::Format("0x%x (%s)", +// render.m_stencil_func, +// ParseGCMEnum(render.m_stencil_func, CELL_GCM_ENUM))); LIST_SETTINGS_ADD("Surface Pitch A", wxString::Format("0x%x", render.m_surface_pitch_a)); LIST_SETTINGS_ADD("Surface Pitch B", wxString::Format("0x%x", render.m_surface_pitch_b)); LIST_SETTINGS_ADD("Surface Pitch C", wxString::Format("0x%x", render.m_surface_pitch_c)); @@ -663,7 +663,7 @@ void RSXDebugger::SetFlags(wxListEvent& event) case 9: render.m_set_poly_offset_fill ^= true; break; case 10: render.m_set_poly_offset_line ^= true; break; case 11: render.m_set_poly_offset_point ^= true; break; - case 12: render.m_set_stencil_test ^= true; break; +// case 12: render.m_set_stencil_test ^= true; break; case 13: render.m_set_point_sprite_control ^= true; break; case 14: render.m_set_restart_index ^= true; break; case 15: render.m_set_specular ^= true; break;