From 967935d3893ce1c4ec58e8d11190da15c176ee68 Mon Sep 17 00:00:00 2001 From: raven02 Date: Wed, 21 May 2014 17:55:44 +0800 Subject: [PATCH] Enable GL_SCISSOR_TEST and add glLogicOp --- rpcs3/Emu/GS/GL/GLGSRender.cpp | 43 ++++++++++++++++++++-------------- rpcs3/Emu/GS/RSXThread.cpp | 4 ++++ rpcs3/Emu/GS/RSXThread.h | 4 +++- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index 21f62b562a..70c263493a 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -821,12 +821,6 @@ void GLGSRender::ExecCMD() //checkForGlError("glViewport"); } - if(m_set_scissor_horizontal && m_set_scissor_vertical) - { - glScissor(m_scissor_x, m_scissor_y, m_scissor_w, m_scissor_h); - checkForGlError("glScissor"); - } - if(m_clear_surface_mask) { GLbitfield f = 0; @@ -859,18 +853,6 @@ void GLGSRender::ExecCMD() glClear(f); } - if(m_set_front_polygon_mode) - { - glPolygonMode(GL_FRONT, m_front_polygon_mode); - checkForGlError("glPolygonMode(Front)"); - } - - if (m_set_back_polygon_mode) - { - glPolygonMode(GL_BACK, m_back_polygon_mode); - checkForGlError("glPolygonMode(Back)"); - } - Enable(m_depth_test_enable, GL_DEPTH_TEST); Enable(m_set_alpha_test, GL_ALPHA_TEST); Enable(m_set_depth_bounds_test, GL_DEPTH_BOUNDS_TEST_EXT); @@ -879,6 +861,7 @@ void GLGSRender::ExecCMD() Enable(m_set_cull_face_enable, GL_CULL_FACE); Enable(m_set_dither, GL_DITHER); Enable(m_set_stencil_test, GL_STENCIL_TEST); + Enable(m_set_scissor_horizontal && m_set_scissor_vertical, GL_SCISSOR_TEST); Enable(m_set_line_smooth, GL_LINE_SMOOTH); Enable(m_set_poly_smooth, GL_POLYGON_SMOOTH); Enable(m_set_poly_offset_fill, GL_POLYGON_OFFSET_FILL); @@ -900,6 +883,30 @@ void GLGSRender::ExecCMD() checkForGlError("glEnable"); + + if (m_set_front_polygon_mode) + { + glPolygonMode(GL_FRONT, m_front_polygon_mode); + checkForGlError("glPolygonMode(Front)"); + } + + if (m_set_back_polygon_mode) + { + glPolygonMode(GL_BACK, m_back_polygon_mode); + checkForGlError("glPolygonMode(Back)"); + } + + if (m_set_logic_op) + { + glLogicOp(m_logic_op); + checkForGlError("glLogicOp"); + } + + if (m_set_scissor_horizontal && m_set_scissor_vertical) + { + glScissor(m_scissor_x, m_scissor_y, m_scissor_w, m_scissor_h); + checkForGlError("glScissor"); + } if(m_set_two_sided_stencil_test_enable) { if(m_set_stencil_fail && m_set_stencil_zfail && m_set_stencil_zpass) diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index 814684b30c..bbdd53d382 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -762,6 +762,10 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 m_set_logic_op = ARGS(0) ? true : false; break; + case NV4097_SET_LOGIC_OP: + m_logic_op = ARGS(0); + break; + case NV4097_SET_CULL_FACE_ENABLE: m_set_cull_face_enable = ARGS(0) ? true : false; break; diff --git a/rpcs3/Emu/GS/RSXThread.h b/rpcs3/Emu/GS/RSXThread.h index 7d1e503882..6a4030a89c 100644 --- a/rpcs3/Emu/GS/RSXThread.h +++ b/rpcs3/Emu/GS/RSXThread.h @@ -166,7 +166,6 @@ public: bool m_set_blend; bool m_set_depth_bounds_test; bool m_depth_test_enable; - bool m_set_logic_op; bool m_set_cull_face_enable; bool m_set_dither; bool m_set_stencil_test; @@ -198,6 +197,9 @@ public: bool m_set_back_polygon_mode; u32 m_back_polygon_mode; + bool m_set_logic_op; + u32 m_logic_op; + u32 m_clear_surface_mask; u32 m_clear_surface_z; u8 m_clear_surface_s;