gl: Blit fixup

- Typo fix. I meant to disable scissor test, not stencil test
- Also clean up and simplify/optimize the core logic
This commit is contained in:
kd-11 2019-01-22 14:05:51 +03:00 committed by kd-11
parent 7e33cdcb08
commit 5a4bea8c4f
2 changed files with 14 additions and 16 deletions

View file

@ -693,7 +693,7 @@ void GLGSRender::set_scissor()
// NOTE: window origin does not affect scissor region (probably only affects viewport matrix; already applied)
// See LIMBO [NPUB-30373] which uses shader window origin = top
glScissor(scissor_x, scissor_y, scissor_w, scissor_h);
glEnable(GL_SCISSOR_TEST);
gl_state.enable(GL_TRUE, GL_SCISSOR_TEST);
}
void GLGSRender::on_init_thread()
@ -1592,7 +1592,7 @@ void GLGSRender::flip(int buffer)
}
// Disable scissor test (affects blit, clear, etc)
glDisable(GL_SCISSOR_TEST);
gl_state.enable(GL_FALSE, GL_SCISSOR_TEST);
// Clear the window background to black
gl_state.clear_color(0, 0, 0, 0);

View file

@ -424,19 +424,19 @@ namespace gl
target = gl::buffers::color;
}
cmd.drv->enable(GL_FALSE, GL_SCISSOR_TEST);
save_binding_state saved;
cmd.drv->enable(GL_FALSE, GL_STENCIL_TEST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, blit_src.id());
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, attachment, GL_TEXTURE_2D, src_id, 0);
blit_src.bind();
glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, src_id, 0);
blit_src.check();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, blit_dst.id());
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attachment, GL_TEXTURE_2D, dst_id, 0);
blit_dst.bind();
glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, dst_id, 0);
blit_dst.check();
blit_src.blit(blit_dst, src_rect, dst_rect, target, interp);
glBlitFramebuffer(src_rect.x1, src_rect.y1, src_rect.x2, src_rect.y2,
dst_rect.x1, dst_rect.y1, dst_rect.x2, dst_rect.y2,
(GLbitfield)target, (GLenum)interp);
if (xfer_info.dst_is_typeless)
{
@ -444,11 +444,9 @@ namespace gl
copy_typeless(dst, typeless_dst.get());
}
blit_src.bind();
glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, GL_NONE, 0);
blit_dst.bind();
glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, GL_NONE, 0);
// Release the attachments explicitly (not doing so causes glitches, e.g Journey Menu)
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, attachment, GL_TEXTURE_2D, GL_NONE, 0);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attachment, GL_TEXTURE_2D, GL_NONE, 0);
}
void blitter::fast_clear_image(gl::command_context& cmd, const texture* dst, const color4f& color)