From 922ee3b493d3e0bd58525399952e358e0dbd48f7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 12 Jan 2016 18:09:47 -0800 Subject: [PATCH] meta/blit: Don't return the target from _mesa_meta_bind_rb_as_tex_image MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It's always the same as *texObj->Target. Signed-off-by: Ian Romanick Reviewed-by: Tapani Pälli --- src/mesa/drivers/common/meta.h | 3 +-- src/mesa/drivers/common/meta_blit.c | 21 +++++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index af2399642fc..16dd8e293d4 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -466,8 +466,7 @@ extern GLboolean _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint *tex, - struct gl_texture_object **texObj, - GLenum *target); + struct gl_texture_object **texObj); struct gl_sampler_object * _mesa_meta_setup_sampler(struct gl_context *ctx, diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index 66714b1ea5a..f7e29bcfc6f 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -639,10 +639,9 @@ blitframebuffer_texture(struct gl_context *ctx, */ srcLevel = readAtt->TextureLevel; texObj = readAtt->Texture; - target = texObj->Target; } else if (!readAtt->Texture && ctx->Driver.BindRenderbufferTexImage) { if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb, &fb_tex_blit.tempTex, - &texObj, &target)) + &texObj)) return false; srcLevel = 0; @@ -673,7 +672,6 @@ blitframebuffer_texture(struct gl_context *ctx, } srcLevel = 0; - target = meta_temp_texture->Target; texObj = _mesa_lookup_texture(ctx, meta_temp_texture->TexObj); if (texObj == NULL) { return false; @@ -685,6 +683,7 @@ blitframebuffer_texture(struct gl_context *ctx, tex_base_format, filter); + assert(texObj->Target == meta_temp_texture->Target); srcX0 = 0; srcY0 = 0; @@ -692,6 +691,7 @@ blitframebuffer_texture(struct gl_context *ctx, srcY1 = srcH; } + target = texObj->Target; fb_tex_blit.baseLevelSave = texObj->BaseLevel; fb_tex_blit.maxLevelSave = texObj->MaxLevel; fb_tex_blit.stencilSamplingSave = texObj->StencilSampling; @@ -885,16 +885,12 @@ GLboolean _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint *tex, - struct gl_texture_object **texObj, - GLenum *target) + struct gl_texture_object **texObj) { struct gl_texture_image *texImage; GLuint tempTex; - - if (rb->NumSamples > 1) - *target = GL_TEXTURE_2D_MULTISAMPLE; - else - *target = GL_TEXTURE_2D; + const GLenum target = rb->NumSamples > 1 + ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D; tempTex = 0; _mesa_GenTextures(1, &tempTex); @@ -903,9 +899,9 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, *tex = tempTex; - _mesa_BindTexture(*target, *tex); + _mesa_BindTexture(target, *tex); *texObj = _mesa_lookup_texture(ctx, *tex); - texImage = _mesa_get_tex_image(ctx, *texObj, *target, 0); + texImage = _mesa_get_tex_image(ctx, *texObj, target, 0); if (!ctx->Driver.BindRenderbufferTexImage(ctx, rb, texImage)) { _mesa_DeleteTextures(1, tex); @@ -917,6 +913,7 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx, ctx->Driver.FinishRenderTexture(ctx, rb); } + assert(target == (*texObj)->Target); return true; } -- 2.30.2