[Mesa-dev] [PATCH 08/16] meta/blit: Since _mesa_meta_bind_rb_as_tex_image has only one output, return it

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


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

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

diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 128c342..a41de8b 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -462,10 +462,9 @@ extern void
 _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
                            struct fb_tex_blit_state *blit);
 
-extern GLboolean
+extern struct gl_texture_object *
 _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
-                                struct gl_renderbuffer *rb,
-                                struct gl_texture_object **texObj);
+                                struct gl_renderbuffer *rb);
 
 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 4e660d2..d33624d 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -640,7 +640,8 @@ 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, &texObj))
+      texObj = _mesa_meta_bind_rb_as_tex_image(ctx, rb);
+      if (texObj == NULL)
          return false;
 
       fb_tex_blit.tempTex = texObj->Name;
@@ -882,12 +883,12 @@ _mesa_meta_fb_tex_blit_end(struct gl_context *ctx, GLenum target,
       _mesa_DeleteTextures(1, &blit->tempTex);
 }
 
-GLboolean
+struct gl_texture_object *
 _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
-                                struct gl_renderbuffer *rb,
-                                struct gl_texture_object **texObj)
+                                struct gl_renderbuffer *rb)
 {
    struct gl_texture_image *texImage;
+   struct gl_texture_object *texObj;
    GLuint tempTex;
    const GLenum target = rb->NumSamples > 1
       ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;
@@ -895,15 +896,15 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
    tempTex = 0;
    _mesa_GenTextures(1, &tempTex);
    if (tempTex == 0)
-      return false;
+      return NULL;
 
    _mesa_BindTexture(target, tempTex);
-   *texObj = _mesa_lookup_texture(ctx, tempTex);
-   texImage = _mesa_get_tex_image(ctx, *texObj, target, 0);
+   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, &tempTex);
-      return false;
+      return NULL;
    }
 
    if (ctx->Driver.FinishRenderTexture && !rb->NeedsFinishRenderTexture) {
@@ -911,9 +912,9 @@ _mesa_meta_bind_rb_as_tex_image(struct gl_context *ctx,
       ctx->Driver.FinishRenderTexture(ctx, rb);
    }
 
-   assert(target == (*texObj)->Target);
-   assert(tempTex == (*texObj)->Name);
-   return true;
+   assert(target == texObj->Target);
+   assert(tempTex == texObj->Name);
+   return texObj;
 }
 
 struct gl_sampler_object *
-- 
2.9.5



More information about the mesa-dev mailing list