Merge pull request #339 from raven02/patch-25

RSX : implement line stipple [NV4097_SET_LINE_STIPPLE/PATTERN]
This commit is contained in:
B1ackDaemon 2014-06-15 01:06:34 +03:00
commit aafa3351da
3 changed files with 30 additions and 1 deletions

View File

@ -844,6 +844,7 @@ void GLGSRender::ExecCMD()
Enable(m_set_poly_offset_line, GL_POLYGON_OFFSET_LINE); Enable(m_set_poly_offset_line, GL_POLYGON_OFFSET_LINE);
Enable(m_set_poly_offset_point, GL_POLYGON_OFFSET_POINT); Enable(m_set_poly_offset_point, GL_POLYGON_OFFSET_POINT);
Enable(m_set_restart_index, GL_PRIMITIVE_RESTART); Enable(m_set_restart_index, GL_PRIMITIVE_RESTART);
Enable(m_set_line_stipple, GL_LINE_STIPPLE);
if(m_set_clip_plane) if(m_set_clip_plane)
{ {
@ -859,7 +860,6 @@ void GLGSRender::ExecCMD()
checkForGlError("glEnable"); checkForGlError("glEnable");
if (m_set_front_polygon_mode) if (m_set_front_polygon_mode)
{ {
glPolygonMode(GL_FRONT, m_front_polygon_mode); glPolygonMode(GL_FRONT, m_front_polygon_mode);
@ -994,6 +994,12 @@ void GLGSRender::ExecCMD()
checkForGlError("glLineWidth"); checkForGlError("glLineWidth");
} }
if (m_set_line_stipple)
{
glLineStipple(m_line_stipple_factor, m_line_stipple_pattern);
checkForGlError("glLineStipple");
}
if(m_set_blend_equation) if(m_set_blend_equation)
{ {
glBlendEquationSeparate(m_blend_equation_rgb, m_blend_equation_alpha); glBlendEquationSeparate(m_blend_equation_rgb, m_blend_equation_alpha);

View File

@ -1441,6 +1441,22 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
} }
break; break;
// Line/Polygon Stipple
case NV4097_SET_LINE_STIPPLE:
{
m_set_line_stipple = ARGS(0) ? true : false;
}
break;
case NV4097_SET_LINE_STIPPLE_PATTERN:
{
m_set_line_stipple = true;
const u32 a0 = ARGS(0);
m_line_stipple_factor = a0 & 0xffff;
m_line_stipple_pattern = a0 >> 16;
}
break;
// Zcull // Zcull
case NV4097_SET_ZCULL_EN: case NV4097_SET_ZCULL_EN:
{ {

View File

@ -216,6 +216,9 @@ public:
bool m_set_poly_offset_mode; bool m_set_poly_offset_mode;
float m_poly_offset_scale_factor; float m_poly_offset_scale_factor;
float m_poly_offset_bias; float m_poly_offset_bias;
bool m_set_line_stipple;
u16 m_line_stipple_pattern;
u16 m_line_stipple_factor;
// Logic Ops // Logic Ops
bool m_set_logic_op; bool m_set_logic_op;
@ -437,6 +440,7 @@ protected:
m_set_poly_offset_line = false; m_set_poly_offset_line = false;
m_set_poly_offset_point = false; m_set_poly_offset_point = false;
m_set_restart_index = false; m_set_restart_index = false;
m_set_line_stipple = false;
m_clear_color_r = 0; m_clear_color_r = 0;
m_clear_color_g = 0; m_clear_color_g = 0;
@ -460,6 +464,8 @@ protected:
m_point_y = 0; m_point_y = 0;
m_point_size = 1.0; m_point_size = 1.0;
m_line_width = 1.0; m_line_width = 1.0;
m_line_stipple_pattern = 0x1111;
m_line_stipple_factor = 1;
// Construct Textures // Construct Textures
for(int i=0; i<16; i++) for(int i=0; i<16; i++)
@ -528,6 +534,7 @@ protected:
m_set_restart_index = false; m_set_restart_index = false;
m_set_point_sprite_control = false; m_set_point_sprite_control = false;
m_set_specular = false; m_set_specular = false;
m_set_line_stipple = false;
m_clear_surface_mask = 0; m_clear_surface_mask = 0;
m_begin_end = 0; m_begin_end = 0;