mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
Code cleanup and added glPolygonOffset
This commit is contained in:
parent
e569de73d6
commit
b95667563f
3 changed files with 33 additions and 9 deletions
|
@ -581,7 +581,7 @@ void GLGSRender::WriteColourBufferD()
|
|||
checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)");
|
||||
}
|
||||
|
||||
void GLGSRender::WriteBuffers()
|
||||
void GLGSRender::WriteColorBuffers()
|
||||
{
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
|
@ -641,7 +641,6 @@ void GLGSRender::OnInitThread()
|
|||
InitProcTable();
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
#ifdef _WIN32
|
||||
glSwapInterval(Ini.GSVSyncEnable.GetValue() ? 1 : 0);
|
||||
|
@ -773,8 +772,10 @@ void GLGSRender::ExecCMD()
|
|||
}
|
||||
|
||||
m_fbo.Bind();
|
||||
|
||||
if(Ini.GSDumpDepthBuffer.GetValue())
|
||||
WriteDepthBuffer();
|
||||
|
||||
static const GLenum draw_buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
|
||||
|
||||
switch(m_surface_colour_target)
|
||||
|
@ -813,8 +814,6 @@ void GLGSRender::ExecCMD()
|
|||
checkForGlError("glColorMask");
|
||||
}
|
||||
|
||||
//glFrontFace(m_front_face);
|
||||
|
||||
if(m_set_viewport_horizontal && m_set_viewport_vertical)
|
||||
{
|
||||
//glViewport(m_viewport_x, m_viewport_y, m_viewport_w, m_viewport_h);
|
||||
|
@ -859,6 +858,7 @@ void GLGSRender::ExecCMD()
|
|||
Enable(m_set_blend, GL_BLEND);
|
||||
Enable(m_set_logic_op, GL_LOGIC_OP);
|
||||
Enable(m_set_cull_face_enable, GL_CULL_FACE);
|
||||
//Enable(m_set_front_face, GL_FRONT_FACE); // glEnable : OpenGL error 0x0500
|
||||
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);
|
||||
|
@ -867,7 +867,7 @@ void GLGSRender::ExecCMD()
|
|||
Enable(m_set_poly_offset_fill, GL_POLYGON_OFFSET_FILL);
|
||||
Enable(m_set_poly_offset_line, GL_POLYGON_OFFSET_LINE);
|
||||
Enable(m_set_poly_offset_point, GL_POLYGON_OFFSET_POINT);
|
||||
//Enable(m_set_restart_index, GL_PRIMITIVE_RESTART); //Requires OpenGL 3.1+
|
||||
//Enable(m_set_restart_index, GL_PRIMITIVE_RESTART); // Requires OpenGL 3.1+
|
||||
|
||||
if(m_set_clip_plane)
|
||||
{
|
||||
|
@ -896,6 +896,12 @@ void GLGSRender::ExecCMD()
|
|||
checkForGlError("glPolygonMode(Back)");
|
||||
}
|
||||
|
||||
if (m_set_poly_offset_scale_factor && m_set_poly_offset_bias)
|
||||
{
|
||||
glPolygonOffset(m_set_poly_offset_scale_factor, m_set_poly_offset_bias);
|
||||
checkForGlError("glPolygonOffset");
|
||||
}
|
||||
|
||||
if (m_set_logic_op)
|
||||
{
|
||||
glLogicOp(m_logic_op);
|
||||
|
@ -907,6 +913,7 @@ void GLGSRender::ExecCMD()
|
|||
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)
|
||||
|
@ -1029,6 +1036,12 @@ void GLGSRender::ExecCMD()
|
|||
checkForGlError("glCullFace");
|
||||
}
|
||||
|
||||
if (m_set_front_face)
|
||||
{
|
||||
//glFrontFace(m_front_face); // glFrontFace : OpenGL error 0x0500
|
||||
checkForGlError("glFrontFace");
|
||||
}
|
||||
|
||||
if(m_set_alpha_func && m_set_alpha_ref)
|
||||
{
|
||||
glAlphaFunc(m_alpha_func, m_alpha_ref/255.0f);
|
||||
|
@ -1052,7 +1065,7 @@ void GLGSRender::ExecCMD()
|
|||
if(m_set_restart_index)
|
||||
{
|
||||
ConLog.Warning("m_set_restart_index requires glPrimitiveRestartIndex()");
|
||||
//glPrimitiveRestartIndex(m_restart_index); //Requires OpenGL 3.1+
|
||||
//glPrimitiveRestartIndex(m_restart_index); // Requires OpenGL 3.1+
|
||||
//checkForGlError("glPrimitiveRestartIndex");
|
||||
}
|
||||
|
||||
|
@ -1117,8 +1130,8 @@ void GLGSRender::ExecCMD()
|
|||
DisableVertexData();
|
||||
}
|
||||
|
||||
if(Ini.GSDumpColorBuffers.GetValue())
|
||||
WriteBuffers();
|
||||
if (Ini.GSDumpColorBuffers.GetValue())
|
||||
WriteColorBuffers();
|
||||
}
|
||||
|
||||
void GLGSRender::Flip()
|
||||
|
|
|
@ -827,11 +827,11 @@ private:
|
|||
virtual void Close();
|
||||
bool LoadProgram();
|
||||
void WriteDepthBuffer();
|
||||
void WriteColorBuffers();
|
||||
void WriteColourBufferA();
|
||||
void WriteColourBufferB();
|
||||
void WriteColourBufferC();
|
||||
void WriteColourBufferD();
|
||||
void WriteBuffers();
|
||||
|
||||
void DrawObjects();
|
||||
|
||||
|
|
|
@ -175,6 +175,11 @@ public:
|
|||
bool m_set_poly_offset_line;
|
||||
bool m_set_poly_offset_point;
|
||||
|
||||
bool m_set_poly_offset_scale_factor;
|
||||
u32 m_poly_offset_scale_factor;
|
||||
bool m_set_poly_offset_bias;
|
||||
u32 m_poly_offset_bias;
|
||||
|
||||
bool m_set_restart_index;
|
||||
u32 m_restart_index;
|
||||
|
||||
|
@ -384,6 +389,7 @@ public:
|
|||
|
||||
u32 m_surface_colour_target;
|
||||
|
||||
bool m_set_front_face;
|
||||
u32 m_front_face;
|
||||
|
||||
u8 m_begin_end;
|
||||
|
@ -428,6 +434,9 @@ protected:
|
|||
m_clear_z = 0xffffff;
|
||||
m_clear_s = 0;
|
||||
|
||||
m_poly_offset_scale_factor = 0;
|
||||
m_poly_offset_bias = 0;
|
||||
|
||||
m_depth_bounds_min = 0.0;
|
||||
m_depth_bounds_max = 1.0;
|
||||
m_restart_index = 0xffffffff;
|
||||
|
@ -500,6 +509,8 @@ protected:
|
|||
m_set_poly_offset_fill = false;
|
||||
m_set_poly_offset_line = false;
|
||||
m_set_poly_offset_point = false;
|
||||
m_set_poly_offset_scale_factor = false;
|
||||
m_set_poly_offset_bias = false;
|
||||
m_set_restart_index = false;
|
||||
|
||||
m_clear_surface_mask = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue