diff --git a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp index 987a9b71b0..721945e275 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp @@ -232,9 +232,9 @@ bool D3D12GSRender::LoadProgram() LOG_ERROR(RSX, "Bad surface color target: %d", m_surface_color_target); } - prop.DepthStencil.DepthEnable = m_set_depth_test; - prop.DepthStencil.DepthWriteMask = m_depth_mask ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO; - prop.DepthStencil.DepthFunc = getCompareFunc(m_depth_func); + 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; diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index bd7ade74f7..18927278f4 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -1662,7 +1662,7 @@ void GLGSRender::end() draw_array_first = 0; } - Enable(m_set_depth_test, GL_DEPTH_TEST); +// Enable(m_set_depth_test, GL_DEPTH_TEST); Enable(m_set_alpha_test, GL_ALPHA_TEST); Enable(m_set_blend || m_set_blend_mrt1 || m_set_blend_mrt2 || m_set_blend_mrt3, GL_BLEND); Enable(m_set_scissor_horizontal && m_set_scissor_vertical, GL_SCISSOR_TEST); @@ -1805,15 +1805,15 @@ void GLGSRender::end() checkForGlError("glShadeModel"); } - if (m_set_depth_mask) +// if (m_set_depth_mask) { - glDepthMask(m_depth_mask); +// glDepthMask(m_depth_mask); checkForGlError("glDepthMask"); } - if (m_set_depth_func) +// if (m_set_depth_func) { - glDepthFunc(m_depth_func); +// glDepthFunc(m_depth_func); checkForGlError("glDepthFunc"); } diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 7add5b73d9..58ff368101 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -807,26 +807,15 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const // Depth testing case NV4097_SET_DEPTH_TEST_ENABLE: - { - m_set_depth_test = ARGS(0) ? true : false; break; - } case NV4097_SET_DEPTH_FUNC: - { - m_set_depth_func = true; - m_depth_func = ARGS(0); notifyDepthStencilStateChange(); break; - } case NV4097_SET_DEPTH_MASK: - { - m_set_depth_mask = true; - m_depth_mask = ARGS(0); notifyDepthStencilStateChange(); break; - } // Polygon mode/offset case NV4097_SET_FRONT_POLYGON_MODE: @@ -863,7 +852,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const case NV4097_SET_POLYGON_OFFSET_SCALE_FACTOR: { - m_set_depth_test = true; + //m_set_depth_test = true; m_set_poly_offset_mode = true; const u32 a0 = ARGS(0); @@ -879,7 +868,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const case NV4097_SET_POLYGON_OFFSET_BIAS: { - m_set_depth_test = true; + //m_set_depth_test = true; m_set_poly_offset_mode = true; const u32 a0 = ARGS(0); @@ -1780,14 +1769,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const // Zcull case NV4097_SET_ZCULL_EN: - { - const u32 a0 = ARGS(0); - - m_set_depth_test = a0 & 0x1 ? true : false; - m_set_stencil_test = a0 & 0x2 ? true : false; notifyDepthStencilStateChange(); break; - } case NV4097_SET_ZCULL_CONTROL0: { diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 8c2c0581d8..faa3081107 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -191,13 +191,6 @@ public: float m_clip_min; float m_clip_max; - // Depth test - bool m_set_depth_test; - bool m_set_depth_func; - int m_depth_func; - bool m_set_depth_mask; - u32 m_depth_mask; - // Depth bound test bool m_set_depth_bounds_test; bool m_set_depth_bounds; @@ -467,7 +460,6 @@ protected: flip_handler.set(0); vblank_handler.set(0); user_handler.set(0); - m_set_depth_test = false; m_set_alpha_test = false; m_set_depth_bounds_test = false; m_set_blend = false; @@ -510,8 +502,7 @@ protected: m_alpha_ref = 0.0f; m_logic_op = 0x1503; // GL_COPY m_shade_mode = 0x1D01; // GL_SMOOTH - m_depth_mask = 1; - m_depth_func = 0x0201; // GL_LESS + m_depth_bounds_min = 0.0; m_depth_bounds_max = 1.0; m_clip_min = 0.0; @@ -552,12 +543,13 @@ protected: void Reset() { + rsx::method_registers[NV4097_SET_DEPTH_TEST_ENABLE] = false; + rsx::method_registers[NV4097_SET_DEPTH_MASK] = 1; + rsx::method_registers[NV4097_SET_DEPTH_FUNC] = 0x0201; + m_set_dither = false; m_set_color_mask = false; m_set_clip = false; - m_set_depth_test = false; - m_set_depth_func = false; - m_set_depth_mask = false; m_set_depth_bounds_test = false; m_set_depth_bounds = false; m_set_viewport_horizontal = false; diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 03722cafcf..b9fa6c24ff 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -469,14 +469,14 @@ void SetupRsxRenderingStates(vm::ptr& cntxt) //TODO: use cntxt GSRender& r = Emu.GetGSManager().GetRender(); r.m_set_color_mask = true; r.m_color_mask_a = r.m_color_mask_r = r.m_color_mask_g = r.m_color_mask_b = true; - r.m_set_depth_mask = true; r.m_depth_mask = 0; + rsx::method_registers[NV4097_SET_DEPTH_MASK] = 0; r.m_set_alpha_test = false; r.m_set_blend = false; r.m_set_blend_mrt1 = r.m_set_blend_mrt2 = r.m_set_blend_mrt3 = false; r.m_set_logic_op = false; r.m_set_cull_face = false; r.m_set_depth_bounds_test = false; - r.m_set_depth_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; diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index c374c52ffe..c39a65622c 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -498,7 +498,7 @@ void RSXDebugger::GetFlags() LIST_FLAGS_ADD("Scissor", render.m_set_scissor_horizontal && render.m_set_scissor_vertical); LIST_FLAGS_ADD("Cull face", render.m_set_cull_face); LIST_FLAGS_ADD("Depth bounds test", render.m_set_depth_bounds_test); - LIST_FLAGS_ADD("Depth test", render.m_set_depth_test); +// LIST_FLAGS_ADD("Depth test", render.m_set_depth_test); LIST_FLAGS_ADD("Dither", render.m_set_dither); LIST_FLAGS_ADD("Line smooth", render.m_set_line_smooth); LIST_FLAGS_ADD("Logic op", render.m_set_logic_op); @@ -612,9 +612,9 @@ void RSXDebugger::GetSettings() LIST_SETTINGS_ADD("Context DMA Color D", wxString::Format("0x%x", render.m_context_dma_color_d)); LIST_SETTINGS_ADD("Context DMA Zeta", wxString::Format("0x%x", render.m_context_dma_z)); LIST_SETTINGS_ADD("Depth bounds", wxString::Format("Min:%f, Max:%f", render.m_depth_bounds_min, render.m_depth_bounds_max)); - LIST_SETTINGS_ADD("Depth func", !(render.m_set_depth_func) ? "(none)" : wxString::Format("0x%x (%s)", - render.m_depth_func, - ParseGCMEnum(render.m_depth_func, CELL_GCM_ENUM))); +// LIST_SETTINGS_ADD("Depth func", !(render.m_set_depth_func) ? "(none)" : wxString::Format("0x%x (%s)", +// render.m_depth_func, +// ParseGCMEnum(render.m_depth_func, CELL_GCM_ENUM))); LIST_SETTINGS_ADD("Draw mode", wxString::Format("%d (%s)", render.draw_mode, ParseGCMEnum(render.draw_mode, CELL_GCM_PRIMITIVE_ENUM))); @@ -655,7 +655,7 @@ void RSXDebugger::SetFlags(wxListEvent& event) case 1: render.m_set_blend ^= true; break; case 2: render.m_set_cull_face ^= true; break; case 3: render.m_set_depth_bounds_test ^= true; break; - case 4: render.m_set_depth_test ^= true; break; +// case 4: render.m_set_depth_test ^= true; break; case 5: render.m_set_dither ^= true; break; case 6: render.m_set_line_smooth ^= true; break; case 7: render.m_set_logic_op ^= true; break;