mirror of https://github.com/RPCS3/rpcs3.git
Compact duplicate draw objects routine
This commit is contained in:
parent
d3cb97d4e9
commit
08c7ae64e3
|
@ -1146,53 +1146,42 @@ void GLGSRender::ExecCMD()
|
||||||
|
|
||||||
void GLGSRender::Flip()
|
void GLGSRender::Flip()
|
||||||
{
|
{
|
||||||
// Fast path for non-MRT using glBlitFramebuffer
|
switch (m_surface_colour_target)
|
||||||
// TODO: check for MRT samples
|
|
||||||
if (m_fbo.IsCreated() && (m_surface_colour_target == CELL_GCM_SURFACE_TARGET_0 || m_surface_colour_target == CELL_GCM_SURFACE_TARGET_1))
|
|
||||||
{
|
{
|
||||||
|
case CELL_GCM_SURFACE_TARGET_0:
|
||||||
|
case CELL_GCM_SURFACE_TARGET_1:
|
||||||
|
{
|
||||||
|
// Fast path for non-MRT using glBlitFramebuffer.
|
||||||
GLfbo::Bind(GL_DRAW_FRAMEBUFFER, 0);
|
GLfbo::Bind(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
// Renderbuffer is upside turn , swapped srcY0 and srcY1
|
// Renderbuffer is upside turn , swapped srcY0 and srcY1
|
||||||
GLfbo::Blit(0, RSXThread::m_height, RSXThread::m_width, 0, 0, 0, RSXThread::m_width, RSXThread::m_height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
GLfbo::Blit(0, RSXThread::m_height, RSXThread::m_width, 0, 0, 0, RSXThread::m_width, RSXThread::m_height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
m_fbo.Bind();
|
case CELL_GCM_SURFACE_TARGET_NONE:
|
||||||
|
case CELL_GCM_SURFACE_TARGET_MRT1:
|
||||||
for (uint i = 0; i<m_post_draw_objs.size(); ++i)
|
case CELL_GCM_SURFACE_TARGET_MRT2:
|
||||||
|
case CELL_GCM_SURFACE_TARGET_MRT3:
|
||||||
{
|
{
|
||||||
m_post_draw_objs[i].Draw();
|
// Slow path for MRT/None target using glReadPixels.
|
||||||
}
|
if (m_set_scissor_horizontal && m_set_scissor_vertical)
|
||||||
|
|
||||||
m_frame->Flip(m_context);
|
|
||||||
|
|
||||||
m_fbo.Bind();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_set_scissor_horizontal && m_set_scissor_vertical)
|
|
||||||
{
|
{
|
||||||
glScissor(0, 0, RSXThread::m_width, RSXThread::m_height);
|
glScissor(0, 0, RSXThread::m_width, RSXThread::m_height);
|
||||||
checkForGlError("glScissor");
|
checkForGlError("glScissor");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint i = 0; i<m_post_draw_objs.size(); ++i)
|
|
||||||
{
|
|
||||||
m_post_draw_objs[i].Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_frame->Flip(m_context);
|
|
||||||
|
|
||||||
static u8* src_buffer = nullptr;
|
static u8* src_buffer = nullptr;
|
||||||
static u32 width = 0;
|
static u32 width = 0;
|
||||||
static u32 height = 0;
|
static u32 height = 0;
|
||||||
GLenum format = GL_RGBA;
|
GLenum format = GL_RGBA;
|
||||||
|
|
||||||
if(m_read_buffer)
|
if (m_read_buffer)
|
||||||
{
|
{
|
||||||
format = GL_BGRA;
|
format = GL_BGRA;
|
||||||
gcmBuffer* buffers = (gcmBuffer*)Memory.GetMemFromAddr(m_gcm_buffers_addr);
|
gcmBuffer* buffers = (gcmBuffer*)Memory.GetMemFromAddr(m_gcm_buffers_addr);
|
||||||
u32 addr = GetAddress(re(buffers[m_gcm_current_buffer].offset), CELL_GCM_LOCATION_LOCAL);
|
u32 addr = GetAddress(re(buffers[m_gcm_current_buffer].offset), CELL_GCM_LOCATION_LOCAL);
|
||||||
|
|
||||||
if(Memory.IsGoodAddr(addr))
|
if (Memory.IsGoodAddr(addr))
|
||||||
{
|
{
|
||||||
width = re(buffers[m_gcm_current_buffer].width);
|
width = re(buffers[m_gcm_current_buffer].width);
|
||||||
height = re(buffers[m_gcm_current_buffer].height);
|
height = re(buffers[m_gcm_current_buffer].height);
|
||||||
|
@ -1203,7 +1192,7 @@ void GLGSRender::Flip()
|
||||||
src_buffer = nullptr;
|
src_buffer = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(m_fbo.IsCreated())
|
else if (m_fbo.IsCreated())
|
||||||
{
|
{
|
||||||
format = GL_RGBA;
|
format = GL_RGBA;
|
||||||
static std::vector<u8> pixels;
|
static std::vector<u8> pixels;
|
||||||
|
@ -1218,7 +1207,7 @@ void GLGSRender::Flip()
|
||||||
else
|
else
|
||||||
src_buffer = nullptr;
|
src_buffer = nullptr;
|
||||||
|
|
||||||
if(src_buffer)
|
if (src_buffer)
|
||||||
{
|
{
|
||||||
glDisable(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
@ -1263,11 +1252,23 @@ void GLGSRender::Flip()
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_set_scissor_horizontal && m_set_scissor_vertical)
|
if (m_set_scissor_horizontal && m_set_scissor_vertical)
|
||||||
{
|
{
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw Objects
|
||||||
|
for (uint i = 0; i<m_post_draw_objs.size(); ++i)
|
||||||
|
{
|
||||||
|
m_post_draw_objs[i].Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_frame->Flip(m_context);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 LinearToSwizzleAddress(u32 x, u32 y, u32 z, u32 log2_width, u32 log2_height, u32 log2_depth)
|
u32 LinearToSwizzleAddress(u32 x, u32 y, u32 z, u32 log2_width, u32 log2_height, u32 log2_depth)
|
||||||
|
|
Loading…
Reference in New Issue