[Mesa-dev] [PATCH 17/18] meta: Only bind the sampler in one place

Ian Romanick idr at freedesktop.org
Fri Jan 8 18:59:23 PST 2016


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

All of the calls after the first _mesa_bind_sampler call are DSA style
calls that don't depend on the current binding.

I kept this change separate and last because it is one of the few in the
series that is not a candidate for the stable branch.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/common/meta.c                 | 6 ++----
 src/mesa/drivers/common/meta_generate_mipmap.c | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 8f93b25..b026e47 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3129,7 +3129,6 @@ decompress_texture_image(struct gl_context *ctx,
          return true;
       }
 
-      _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, decompress->samp_obj);
       /* nearest filtering */
       _mesa_set_sampler_filters(ctx, decompress->samp_obj, GL_NEAREST, GL_NEAREST);
 
@@ -3137,11 +3136,10 @@ decompress_texture_image(struct gl_context *ctx,
       if (ctx->Extensions.EXT_texture_sRGB_decode) {
          _mesa_set_sampler_srgb_decode(ctx, decompress->samp_obj, GL_SKIP_DECODE_EXT);
       }
-
-   } else {
-      _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, decompress->samp_obj);
    }
 
+   _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, decompress->samp_obj);
+
    /* Silence valgrind warnings about reading uninitialized stack. */
    memset(verts, 0, sizeof(verts));
 
diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c
index aa81258..7beae5f 100644
--- a/src/mesa/drivers/common/meta_generate_mipmap.c
+++ b/src/mesa/drivers/common/meta_generate_mipmap.c
@@ -234,8 +234,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
          return;
       }
 
-      _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, mipmap->samp_obj);
-
       _mesa_set_sampler_filters(ctx, mipmap->samp_obj, GL_LINEAR_MIPMAP_LINEAR,
                                 GL_LINEAR);
       _mesa_set_sampler_wrap(ctx, mipmap->samp_obj, GL_CLAMP_TO_EDGE,
@@ -248,10 +246,10 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
       if (ctx->Extensions.EXT_texture_sRGB_decode) {
          _mesa_set_sampler_srgb_decode(ctx, mipmap->samp_obj, GL_SKIP_DECODE_EXT);
       }
-   } else {
-      _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, mipmap->samp_obj);
    }
 
+   _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, mipmap->samp_obj);
+
    assert(mipmap->FBO != 0);
    _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, mipmap->FBO);
 
-- 
2.5.0



More information about the mesa-dev mailing list