From e086b7a522a2b70c80ede714b1fee47c294c011a Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Sat, 10 Oct 2015 19:04:09 +0200 Subject: [PATCH] Remove cull/front face --- rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp | 27 +++++++++++++--------- rpcs3/Emu/RSX/GL/GLGSRender.cpp | 10 ++++---- rpcs3/Emu/RSX/RSXThread.cpp | 9 -------- rpcs3/Emu/RSX/RSXThread.h | 16 +++---------- rpcs3/Emu/SysCalls/Modules/cellResc.cpp | 2 +- rpcs3/Gui/RSXDebugger.cpp | 4 ++-- 6 files changed, 27 insertions(+), 41 deletions(-) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp index bb26640d35..b6dd777ac9 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp @@ -268,20 +268,25 @@ bool D3D12GSRender::LoadProgram() D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF, }; prop.Rasterization = CD3D12_RASTERIZER_DESC; - switch (m_set_cull_face) + if (rsx::method_registers[NV4097_SET_CULL_FACE_ENABLE]) { - case CELL_GCM_FRONT: - prop.Rasterization.CullMode = D3D12_CULL_MODE_FRONT; - break; - case CELL_GCM_BACK: - prop.Rasterization.CullMode = D3D12_CULL_MODE_BACK; - break; - default: - prop.Rasterization.CullMode = D3D12_CULL_MODE_NONE; - break; + switch (rsx::method_registers[NV4097_SET_CULL_FACE]) + { + case CELL_GCM_FRONT: + prop.Rasterization.CullMode = D3D12_CULL_MODE_FRONT; + break; + case CELL_GCM_BACK: + prop.Rasterization.CullMode = D3D12_CULL_MODE_BACK; + break; + default: + prop.Rasterization.CullMode = D3D12_CULL_MODE_NONE; + break; + } } + else + prop.Rasterization.CullMode = D3D12_CULL_MODE_NONE; - switch (m_front_face) + switch (rsx::method_registers[NV4097_SET_FRONT_FACE]) { case CELL_GCM_CW: prop.Rasterization.FrontCounterClockwise = FALSE; diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index c61fc276cd..596c48e468 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -1667,7 +1667,7 @@ void GLGSRender::end() // 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); // Enable(m_set_logic_op, GL_LOGIC_OP); - Enable(m_set_cull_face, GL_CULL_FACE); +// 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_line_smooth, GL_LINE_SMOOTH); @@ -1865,15 +1865,15 @@ void GLGSRender::end() checkForGlError("glBlendColor"); } - if (m_set_cull_face) +// if (m_set_cull_face) { - glCullFace(m_cull_face); +// glCullFace(m_cull_face); checkForGlError("glCullFace"); } - if (m_set_front_face) +// if (m_set_front_face) { - glFrontFace(m_front_face); +// glFrontFace(m_front_face); checkForGlError("glFrontFace"); } diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index a98bc1fb17..4f0660eaea 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -574,26 +574,17 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const // Cull face case NV4097_SET_CULL_FACE_ENABLE: - { - m_set_cull_face = ARGS(0) ? true : false; notifyRasterizerStateChange(); break; - } case NV4097_SET_CULL_FACE: - { - m_cull_face = ARGS(0); notifyRasterizerStateChange(); break; - } // Front face case NV4097_SET_FRONT_FACE: - { - m_front_face = ARGS(0); notifyRasterizerStateChange(); break; - } // Blending case NV4097_SET_BLEND_ENABLE: diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index e6b0d9c753..82aa1647eb 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -348,10 +348,6 @@ public: u8 m_swizzle_height; u32 m_swizzle_offset; - // Cull face - bool m_set_cull_face; - u32 m_cull_face; - // Shader u16 m_shader_window_height; u8 m_shader_window_origin; @@ -361,10 +357,6 @@ public: u32 m_vertex_data_base_offset; u32 m_vertex_data_base_index; - // Front face - bool m_set_front_face; - u32 m_front_face; - // Frequency divider u32 m_set_frequency_divider_operation; @@ -397,7 +389,6 @@ protected: m_set_depth_bounds_test = false; rsx::method_registers[NV4097_SET_BLEND_ENABLE_MRT] = 0; rsx::method_registers[NV4097_SET_BLEND_ENABLE] = false; - m_set_cull_face = false; m_set_dither = false; m_set_scissor_horizontal = false; m_set_scissor_vertical = false; @@ -424,8 +415,8 @@ protected: m_restart_index = 0xffffffff; m_front_polygon_mode = 0x1b02; // GL_FILL m_back_polygon_mode = 0x1b02; // GL_FILL - m_front_face = 0x0901; // GL_CCW - m_cull_face = 0x0405; // GL_BACK + rsx::method_registers[NV4097_SET_FRONT_FACE] = 0x0901; // GL_CCW + rsx::method_registers[NV4097_SET_CULL_FACE] = 0x0405; // GL_BACK rsx::method_registers[NV4097_SET_ALPHA_FUNC] = 0x0207; // GL_ALWAYS rsx::method_registers[NV4097_SET_ALPHA_REF] = 0.0f; m_shade_mode = 0x1D01; // GL_SMOOTH @@ -496,8 +487,7 @@ protected: m_set_context_dma_color_c = false; m_set_context_dma_color_d = false; m_set_context_dma_z = false; - m_set_cull_face = false; - m_set_front_face = false; + rsx::method_registers[NV4097_SET_CULL_FACE_ENABLE] = false; rsx::method_registers[NV4097_SET_ALPHA_TEST_ENABLE] = false; rsx::method_registers[NV4097_SET_ALPHA_FUNC] = false; rsx::method_registers[NV4097_SET_ALPHA_REF] = false; diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index b35545e3ba..4670c031bc 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -474,7 +474,7 @@ void SetupRsxRenderingStates(vm::ptr& cntxt) rsx::method_registers[NV4097_SET_BLEND_ENABLE] = false; rsx::method_registers[NV4097_SET_BLEND_ENABLE_MRT] = false; // r.m_set_logic_op = false; - r.m_set_cull_face = false; + rsx::method_registers[NV4097_SET_CULL_FACE_ENABLE] = false; r.m_set_depth_bounds_test = false; rsx::method_registers[NV4097_SET_DEPTH_TEST_ENABLE] = false; r.m_set_poly_offset_fill = false; diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index fc404da369..6ebd7c0e8c 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -496,7 +496,7 @@ void RSXDebugger::GetFlags() LIST_FLAGS_ADD("Alpha test", rsx::method_registers[NV4097_SET_ALPHA_TEST_ENABLE]); LIST_FLAGS_ADD("Blend", rsx::method_registers[NV4097_SET_BLEND_ENABLE]); 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("Cull face", rsx::method_registers[NV4097_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("Dither", render.m_set_dither); @@ -653,7 +653,7 @@ void RSXDebugger::SetFlags(wxListEvent& event) { case 0: rsx::method_registers[NV4097_SET_ALPHA_TEST_ENABLE] ^= true; break; case 1: rsx::method_registers[NV4097_SET_BLEND_ENABLE] ^= true; break; - case 2: render.m_set_cull_face ^= true; break; + case 2: rsx::method_registers[NV4097_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 5: render.m_set_dither ^= true; break;