diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index 9309eae93c..97344c35d4 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -892,7 +892,8 @@ void GLGSRender::ExecCMD() Enable(m_set_poly_offset_point, GL_POLYGON_OFFSET_POINT); Enable(m_set_restart_index, GL_PRIMITIVE_RESTART); Enable(m_set_line_stipple, GL_LINE_STIPPLE); - + Enable(m_set_polygon_stipple, GL_POLYGON_STIPPLE); + if(m_set_clip_plane) { Enable(m_clip_plane_0, GL_CLIP_PLANE0); @@ -1041,6 +1042,12 @@ void GLGSRender::ExecCMD() checkForGlError("glLineStipple"); } + if (m_set_polygon_stipple) + { + glPolygonStipple((const GLubyte*)m_polygon_stipple_pattern); + checkForGlError("glPolygonStipple"); + } + if(m_set_blend_equation) { glBlendEquationSeparate(m_blend_equation_rgb, m_blend_equation_alpha); diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index cc93503b06..287b754d9a 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -1573,15 +1573,16 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_POLYGON_STIPPLE: { - if (ARGS(0)) - LOG_WARNING(RSX, "NV4097_SET_POLYGON_STIPPLE: %x", ARGS(0)); + m_set_polygon_stipple = ARGS(0) ? true : false; } break; case NV4097_SET_POLYGON_STIPPLE_PATTERN: { - if (ARGS(0)) - LOG_WARNING(RSX, "NV4097_SET_POLYGON_STIPPLE_PATTERN: %x", ARGS(0)); + for (size_t i = 0; i < 32; i++) + { + m_polygon_stipple_pattern[i] = ARGS(i); + } } break; diff --git a/rpcs3/Emu/GS/RSXThread.h b/rpcs3/Emu/GS/RSXThread.h index fd016f5c3c..5bb3058df1 100644 --- a/rpcs3/Emu/GS/RSXThread.h +++ b/rpcs3/Emu/GS/RSXThread.h @@ -210,7 +210,7 @@ public: u16 m_scissor_w; u16 m_scissor_h; - // Polygon + // Polygon mode/offset bool m_set_poly_smooth; bool m_set_poly_offset_fill; bool m_set_poly_offset_line; @@ -222,9 +222,13 @@ public: bool m_set_poly_offset_mode; float m_poly_offset_scale_factor; float m_poly_offset_bias; + + // Line/Polygon stipple bool m_set_line_stipple; u16 m_line_stipple_pattern; u16 m_line_stipple_factor; + bool m_set_polygon_stipple; + u32 m_polygon_stipple_pattern[32]; // Logic Ops bool m_set_logic_op; @@ -450,6 +454,7 @@ protected: m_set_poly_offset_point = false; m_set_restart_index = false; m_set_line_stipple = false; + m_set_polygon_stipple = false; m_clear_color_r = 0; m_clear_color_g = 0; @@ -475,6 +480,11 @@ protected: m_line_width = 1.0; m_line_stipple_pattern = 0xffff; m_line_stipple_factor = 1; + for (size_t i = 0; i < 32; i++) + { + // TODO: Check if the polygon stipple pattern is really "all ones" + m_polygon_stipple_pattern[i] = 0xFFFFFFFF; + } // Construct Textures for(int i=0; i<16; i++) @@ -552,6 +562,7 @@ protected: m_set_restart_index = false; m_set_specular = false; m_set_line_stipple = false; + m_set_polygon_stipple = false; m_set_logic_op = false; m_set_surface_format = false; m_set_surface_clip_horizontal = false;