[Mesa-dev] [PATCH 07/16] meta/blit: Don't return the texture handle from _mesa_meta_bind_rb_as_tex_image

Ian Romanick idr at freedesktop.org
Tue Dec 19 00:14:05 UTC 2017


From: Ian Romanick <ian.d.romanick at intel.com>

It's always the same as *texObj->Name.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/common/meta.h      |  1 -
 src/mesa/drivers/common/meta_blit.c | 15 +++++++--------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 16dd8e2..128c342 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -465,7 +465,6 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
 extern GLboolean
 _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
                                 struct gl_renderbuffer *rb,
-                                GLuint *tex,
                                 struct gl_texture_object **texObj);
 
 struct gl_sampler_object *
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index f7e29bc..4e660d2 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -640,10 +640,11 @@ blitframebuffer_texture(struct gl_context *ctx,
       srcLevel = readAtt->TextureLevel;
       texObj = readAtt->Texture;
    } else if (!readAtt->Texture && ctx->Driver.BindRenderbufferTexImage) {
-      if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb, &fb_tex_blit.tempTex,
-                                           &texObj))
+      if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb, &texObj))
          return false;
 
+      fb_tex_blit.tempTex = texObj->Name;
+
       srcLevel = 0;
       if (_mesa_is_winsys_fbo(readFb)) {
          GLint temp = srcY0;
@@ -884,7 +885,6 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
 GLboolean
 _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
                                 struct gl_renderbuffer *rb,
-                                GLuint *tex,
                                 struct gl_texture_object **texObj)
 {
    struct gl_texture_image *texImage;
@@ -897,14 +897,12 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
    if (tempTex == 0)
       return false;
 
-   *tex = tempTex;
-
-   _mesa_BindTexture(target, *tex);
-   *texObj = _mesa_lookup_texture(ctx, *tex);
+   _mesa_BindTexture(target, tempTex);
+   *texObj = _mesa_lookup_texture(ctx, tempTex);
    texImage = _mesa_get_tex_image(ctx, *texObj, target, 0);
 
    if (!ctx->Driver.BindRenderbufferTexImage(ctx, rb, texImage)) {
-      _mesa_DeleteTextures(1, tex);
+      _mesa_DeleteTextures(1, &tempTex);
       return false;
    }
 
@@ -914,6 +912,7 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
    }
 
    assert(target == (*texObj)->Target);
+   assert(tempTex == (*texObj)->Name);
    return true;
 }
 
-- 
2.9.5



More information about the mesa-dev mailing list