1
0
Fork 0

Merge pull request #3724 from degasus/scissor

gl_rasterizer: Remove redundant scissor state change.
This commit is contained in:
Weiyi Wang 2018-05-25 20:35:41 +03:00 committed by GitHub
commit ba4a0525bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 19 deletions

View File

@ -783,9 +783,6 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
} }
} }
// Disable scissor test
state.scissor.enabled = false;
vertex_batch.clear(); vertex_batch.clear();
// Unbind textures for potential future use as framebuffer attachments // Unbind textures for potential future use as framebuffer attachments

View File

@ -259,16 +259,10 @@ static void AllocateTextureCube(GLuint texture, const FormatTuple& format_tuple,
static bool BlitTextures(GLuint src_tex, const MathUtil::Rectangle<u32>& src_rect, GLuint dst_tex, static bool BlitTextures(GLuint src_tex, const MathUtil::Rectangle<u32>& src_rect, GLuint dst_tex,
const MathUtil::Rectangle<u32>& dst_rect, SurfaceType type, const MathUtil::Rectangle<u32>& dst_rect, SurfaceType type,
GLuint read_fb_handle, GLuint draw_fb_handle) { GLuint read_fb_handle, GLuint draw_fb_handle) {
OpenGLState state = OpenGLState::GetCurState(); OpenGLState prev_state = OpenGLState::GetCurState();
OpenGLState prev_state = state;
SCOPE_EXIT({ prev_state.Apply(); }); SCOPE_EXIT({ prev_state.Apply(); });
// Make sure textures aren't bound to texture units, since going to bind them to framebuffer OpenGLState state;
// components
state.ResetTexture(src_tex);
state.ResetTexture(dst_tex);
state.draw.read_framebuffer = read_fb_handle; state.draw.read_framebuffer = read_fb_handle;
state.draw.draw_framebuffer = draw_fb_handle; state.draw.draw_framebuffer = draw_fb_handle;
state.Apply(); state.Apply();
@ -318,13 +312,10 @@ static bool BlitTextures(GLuint src_tex, const MathUtil::Rectangle<u32>& src_rec
static bool FillSurface(const Surface& surface, const u8* fill_data, static bool FillSurface(const Surface& surface, const u8* fill_data,
const MathUtil::Rectangle<u32>& fill_rect, GLuint draw_fb_handle) { const MathUtil::Rectangle<u32>& fill_rect, GLuint draw_fb_handle) {
OpenGLState state = OpenGLState::GetCurState(); OpenGLState prev_state = OpenGLState::GetCurState();
OpenGLState prev_state = state;
SCOPE_EXIT({ prev_state.Apply(); }); SCOPE_EXIT({ prev_state.Apply(); });
state.ResetTexture(surface->texture.handle); OpenGLState state;
state.scissor.enabled = true; state.scissor.enabled = true;
state.scissor.x = static_cast<GLint>(fill_rect.left); state.scissor.x = static_cast<GLint>(fill_rect.left);
state.scissor.y = static_cast<GLint>(fill_rect.bottom); state.scissor.y = static_cast<GLint>(fill_rect.bottom);
@ -1310,11 +1301,10 @@ const CachedTextureCube& RasterizerCacheOpenGL::GetTextureCube(const TextureCube
u32 scaled_size = cube.res_scale * config.width; u32 scaled_size = cube.res_scale * config.width;
OpenGLState state = OpenGLState::GetCurState(); OpenGLState prev_state = OpenGLState::GetCurState();
OpenGLState prev_state = state;
SCOPE_EXIT({ prev_state.Apply(); }); SCOPE_EXIT({ prev_state.Apply(); });
OpenGLState state;
state.draw.read_framebuffer = read_framebuffer.handle; state.draw.read_framebuffer = read_framebuffer.handle;
state.draw.draw_framebuffer = draw_framebuffer.handle; state.draw.draw_framebuffer = draw_framebuffer.handle;
state.ResetTexture(cube.texture.handle); state.ResetTexture(cube.texture.handle);