From 8e1e52cad917a80d121d7ad6aa4236d5bcc0a56e Mon Sep 17 00:00:00 2001 From: Markus Wick Date: Wed, 9 May 2018 09:02:41 +0200 Subject: [PATCH] gl_rasterizer_cache: Use clean state for glBlitFramebuffer. Framebuffer blits depends on pixel tests: Ownership (is fine) Scissor (is broken on the last commit) Masking (is broken on master for a while) So let's be honest and start with a clean state in those helper functions. --- .../renderer_opengl/gl_rasterizer_cache.cpp | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 8def5e2082..46a8c4c737 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -259,16 +259,10 @@ static void AllocateTextureCube(GLuint texture, const FormatTuple& format_tuple, static bool BlitTextures(GLuint src_tex, const MathUtil::Rectangle& src_rect, GLuint dst_tex, const MathUtil::Rectangle& dst_rect, SurfaceType type, GLuint read_fb_handle, GLuint draw_fb_handle) { - OpenGLState state = OpenGLState::GetCurState(); - - OpenGLState prev_state = state; + OpenGLState prev_state = OpenGLState::GetCurState(); SCOPE_EXIT({ prev_state.Apply(); }); - // Make sure textures aren't bound to texture units, since going to bind them to framebuffer - // components - state.ResetTexture(src_tex); - state.ResetTexture(dst_tex); - + OpenGLState state; state.draw.read_framebuffer = read_fb_handle; state.draw.draw_framebuffer = draw_fb_handle; state.Apply(); @@ -318,13 +312,10 @@ static bool BlitTextures(GLuint src_tex, const MathUtil::Rectangle& src_rec static bool FillSurface(const Surface& surface, const u8* fill_data, const MathUtil::Rectangle& fill_rect, GLuint draw_fb_handle) { - OpenGLState state = OpenGLState::GetCurState(); - - OpenGLState prev_state = state; + OpenGLState prev_state = OpenGLState::GetCurState(); SCOPE_EXIT({ prev_state.Apply(); }); - state.ResetTexture(surface->texture.handle); - + OpenGLState state; state.scissor.enabled = true; state.scissor.x = static_cast(fill_rect.left); state.scissor.y = static_cast(fill_rect.bottom); @@ -1310,11 +1301,10 @@ const CachedTextureCube& RasterizerCacheOpenGL::GetTextureCube(const TextureCube u32 scaled_size = cube.res_scale * config.width; - OpenGLState state = OpenGLState::GetCurState(); - - OpenGLState prev_state = state; + OpenGLState prev_state = OpenGLState::GetCurState(); SCOPE_EXIT({ prev_state.Apply(); }); + OpenGLState state; state.draw.read_framebuffer = read_framebuffer.handle; state.draw.draw_framebuffer = draw_framebuffer.handle; state.ResetTexture(cube.texture.handle);