diff options
author | Eric Anholt <[email protected]> | 2014-03-03 11:14:42 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-03-11 12:47:46 -0700 |
commit | d3eb709ded3fb632eaeab7699665913662808ba0 (patch) | |
tree | 3f2e51332b0e3516819fc13aba8cc8b3da709c30 /src | |
parent | feb3d8dacd587683ded706049d696d1904cb87cd (diff) |
meta: Always restore the framebuffers and current renderbuffer.
The few paths that were playing with framebuffers and renderbuffer were
saving and restoring them.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 33 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta_generate_mipmap.c | 3 |
3 files changed, 17 insertions, 21 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index fe353ec2a06..76cbb41a9d0 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -733,6 +733,11 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) save->RasterDiscard = ctx->RasterDiscard; if (ctx->RasterDiscard) _mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_FALSE); + + save->DrawBufferName = ctx->DrawBuffer->Name; + save->ReadBufferName = ctx->ReadBuffer->Name; + save->RenderbufferName = (ctx->CurrentRenderbuffer ? + ctx->CurrentRenderbuffer->Name : 0); } } @@ -1079,6 +1084,16 @@ _mesa_meta_end(struct gl_context *ctx) if (save->TransformFeedbackNeedsResume) _mesa_ResumeTransformFeedback(); + if (ctx->DrawBuffer->Name != save->DrawBufferName) + _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, save->DrawBufferName); + + if (ctx->ReadBuffer->Name != save->ReadBufferName) + _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, save->ReadBufferName); + + if (!ctx->CurrentRenderbuffer || + ctx->CurrentRenderbuffer->Name != save->RenderbufferName) + _mesa_BindRenderbuffer(GL_RENDERBUFFER, save->RenderbufferName); + ctx->Meta->SaveStackDepth--; ctx->API = save->API; @@ -2652,7 +2667,6 @@ get_temp_image_type(struct gl_context *ctx, mesa_format format) } } - /** * Helper for _mesa_meta_CopyTexSubImage1/2/3D() functions. * Have to be careful with locking and meta state for pixel transfer. @@ -2786,8 +2800,6 @@ decompress_texture_image(struct gl_context *ctx, const GLenum target = texObj->Target; GLenum faceTarget; struct vertex verts[4]; - GLuint fboDrawSave, fboReadSave; - GLuint rbSave; GLuint samplerSave; const bool use_glsl_version = ctx->Extensions.ARB_vertex_shader && ctx->Extensions.ARB_fragment_shader; @@ -2821,11 +2833,6 @@ decompress_texture_image(struct gl_context *ctx, break; } - /* save fbo bindings (not saved by _mesa_meta_begin()) */ - fboDrawSave = ctx->DrawBuffer->Name; - fboReadSave = ctx->ReadBuffer->Name; - rbSave = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; - _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_PIXEL_STORE); samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ? @@ -2974,16 +2981,6 @@ decompress_texture_image(struct gl_context *ctx, _mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave); _mesa_meta_end(ctx); - - /* restore fbo bindings */ - if (fboDrawSave == fboReadSave) { - _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboDrawSave); - } - else { - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, fboDrawSave); - _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER_EXT, fboReadSave); - } - _mesa_BindRenderbuffer(GL_RENDERBUFFER_EXT, rbSave); } diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 6029a775cd5..e2ccb939e8c 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -177,6 +177,8 @@ struct save_state GLboolean Lighting; GLboolean RasterDiscard; GLboolean TransformFeedbackNeedsResume; + + GLuint DrawBufferName, ReadBufferName, RenderbufferName; }; /** diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c index 3db073ab16e..d62819c4c22 100644 --- a/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/src/mesa/drivers/common/meta_generate_mipmap.c @@ -194,7 +194,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, const GLuint maxLevel = texObj->MaxLevel; const GLint maxLevelSave = texObj->MaxLevel; const GLboolean genMipmapSave = texObj->GenerateMipmap; - const GLuint fboSave = ctx->DrawBuffer->Name; const GLuint currentTexUnitSave = ctx->Texture.CurrentUnit; const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader && ctx->Extensions.ARB_fragment_shader; @@ -378,6 +377,4 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave); if (genMipmapSave) _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave); - - _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboSave); } |