mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
Merge pull request #259 from raven02/patch-14
Code cleanup and added glPolygonOffset
This commit is contained in:
commit
e2ebb09d6c
3 changed files with 36 additions and 9 deletions
|
@ -581,7 +581,7 @@ void GLGSRender::WriteColourBufferD()
|
||||||
checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)");
|
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_ROW_LENGTH, 0);
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||||
|
@ -641,7 +641,6 @@ void GLGSRender::OnInitThread()
|
||||||
InitProcTable();
|
InitProcTable();
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
glSwapInterval(Ini.GSVSyncEnable.GetValue() ? 1 : 0);
|
glSwapInterval(Ini.GSVSyncEnable.GetValue() ? 1 : 0);
|
||||||
|
@ -773,8 +772,10 @@ void GLGSRender::ExecCMD()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fbo.Bind();
|
m_fbo.Bind();
|
||||||
|
|
||||||
if(Ini.GSDumpDepthBuffer.GetValue())
|
if(Ini.GSDumpDepthBuffer.GetValue())
|
||||||
WriteDepthBuffer();
|
WriteDepthBuffer();
|
||||||
|
|
||||||
static const GLenum draw_buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
|
static const GLenum draw_buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
|
||||||
|
|
||||||
switch(m_surface_colour_target)
|
switch(m_surface_colour_target)
|
||||||
|
@ -813,8 +814,6 @@ void GLGSRender::ExecCMD()
|
||||||
checkForGlError("glColorMask");
|
checkForGlError("glColorMask");
|
||||||
}
|
}
|
||||||
|
|
||||||
//glFrontFace(m_front_face);
|
|
||||||
|
|
||||||
if(m_set_viewport_horizontal && m_set_viewport_vertical)
|
if(m_set_viewport_horizontal && m_set_viewport_vertical)
|
||||||
{
|
{
|
||||||
//glViewport(m_viewport_x, m_viewport_y, m_viewport_w, m_viewport_h);
|
//glViewport(m_viewport_x, m_viewport_y, m_viewport_w, m_viewport_h);
|
||||||
|
@ -896,6 +895,12 @@ void GLGSRender::ExecCMD()
|
||||||
checkForGlError("glPolygonMode(Back)");
|
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)
|
if (m_set_logic_op)
|
||||||
{
|
{
|
||||||
glLogicOp(m_logic_op);
|
glLogicOp(m_logic_op);
|
||||||
|
@ -907,6 +912,7 @@ void GLGSRender::ExecCMD()
|
||||||
glScissor(m_scissor_x, m_scissor_y, m_scissor_w, m_scissor_h);
|
glScissor(m_scissor_x, m_scissor_y, m_scissor_w, m_scissor_h);
|
||||||
checkForGlError("glScissor");
|
checkForGlError("glScissor");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_set_two_sided_stencil_test_enable)
|
if(m_set_two_sided_stencil_test_enable)
|
||||||
{
|
{
|
||||||
if(m_set_stencil_fail && m_set_stencil_zfail && m_set_stencil_zpass)
|
if(m_set_stencil_fail && m_set_stencil_zfail && m_set_stencil_zpass)
|
||||||
|
@ -1029,6 +1035,16 @@ void GLGSRender::ExecCMD()
|
||||||
checkForGlError("glCullFace");
|
checkForGlError("glCullFace");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_set_front_face)
|
||||||
|
{
|
||||||
|
// Sanity check . Disgaea 3 return 0x1d0 here and cause openGL 0x0500
|
||||||
|
if (m_front_face == GL_CW || m_front_face == GL_CCW)
|
||||||
|
{
|
||||||
|
glFrontFace(m_front_face);
|
||||||
|
checkForGlError("glFrontFace");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(m_set_alpha_func && m_set_alpha_ref)
|
if(m_set_alpha_func && m_set_alpha_ref)
|
||||||
{
|
{
|
||||||
glAlphaFunc(m_alpha_func, m_alpha_ref/255.0f);
|
glAlphaFunc(m_alpha_func, m_alpha_ref/255.0f);
|
||||||
|
@ -1118,7 +1134,7 @@ void GLGSRender::ExecCMD()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ini.GSDumpColorBuffers.GetValue())
|
if (Ini.GSDumpColorBuffers.GetValue())
|
||||||
WriteBuffers();
|
WriteColorBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGSRender::Flip()
|
void GLGSRender::Flip()
|
||||||
|
|
|
@ -827,11 +827,11 @@ private:
|
||||||
virtual void Close();
|
virtual void Close();
|
||||||
bool LoadProgram();
|
bool LoadProgram();
|
||||||
void WriteDepthBuffer();
|
void WriteDepthBuffer();
|
||||||
|
void WriteColorBuffers();
|
||||||
void WriteColourBufferA();
|
void WriteColourBufferA();
|
||||||
void WriteColourBufferB();
|
void WriteColourBufferB();
|
||||||
void WriteColourBufferC();
|
void WriteColourBufferC();
|
||||||
void WriteColourBufferD();
|
void WriteColourBufferD();
|
||||||
void WriteBuffers();
|
|
||||||
|
|
||||||
void DrawObjects();
|
void DrawObjects();
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,11 @@ public:
|
||||||
bool m_set_poly_offset_line;
|
bool m_set_poly_offset_line;
|
||||||
bool m_set_poly_offset_point;
|
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;
|
bool m_set_restart_index;
|
||||||
u32 m_restart_index;
|
u32 m_restart_index;
|
||||||
|
|
||||||
|
@ -384,6 +389,7 @@ public:
|
||||||
|
|
||||||
u32 m_surface_colour_target;
|
u32 m_surface_colour_target;
|
||||||
|
|
||||||
|
bool m_set_front_face;
|
||||||
u32 m_front_face;
|
u32 m_front_face;
|
||||||
|
|
||||||
u8 m_begin_end;
|
u8 m_begin_end;
|
||||||
|
@ -428,6 +434,9 @@ protected:
|
||||||
m_clear_z = 0xffffff;
|
m_clear_z = 0xffffff;
|
||||||
m_clear_s = 0;
|
m_clear_s = 0;
|
||||||
|
|
||||||
|
m_poly_offset_scale_factor = 0;
|
||||||
|
m_poly_offset_bias = 0;
|
||||||
|
|
||||||
m_depth_bounds_min = 0.0;
|
m_depth_bounds_min = 0.0;
|
||||||
m_depth_bounds_max = 1.0;
|
m_depth_bounds_max = 1.0;
|
||||||
m_restart_index = 0xffffffff;
|
m_restart_index = 0xffffffff;
|
||||||
|
@ -500,6 +509,8 @@ protected:
|
||||||
m_set_poly_offset_fill = false;
|
m_set_poly_offset_fill = false;
|
||||||
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_poly_offset_scale_factor = false;
|
||||||
|
m_set_poly_offset_bias = false;
|
||||||
m_set_restart_index = false;
|
m_set_restart_index = false;
|
||||||
|
|
||||||
m_clear_surface_mask = 0;
|
m_clear_surface_mask = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue