Mesa (master): mesa: don't push/pop gl_texture_object::Target

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jan 30 21:52:58 UTC 2021


Module: Mesa
Branch: master
Commit: 230b46bceebeb388e5333abdb36d3f3df7136984
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=230b46bceebeb388e5333abdb36d3f3df7136984

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Dec 19 19:33:40 2020 -0500

mesa: don't push/pop gl_texture_object::Target

This field is immutable because each texture unit is an array of texture
target slots and only matching targets can be bound into each slot.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8181>

---

 src/mesa/main/attrib.c | 3 +--
 src/mesa/main/mtypes.h | 4 +++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 92dc1d3d1ac..bd8a44b5788 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -248,7 +248,6 @@ _mesa_PushAttrib(GLbitfield mask)
             struct gl_texture_object *dst = &head->Texture.SavedObj[u][tex];
             struct gl_texture_object *src = ctx->Texture.Unit[u].CurrentTex[tex];
 
-            dst->Target = src->Target;
             dst->Name = src->Name;
             memcpy(&dst->Sampler.Attrib, &src->Sampler.Attrib, sizeof(src->Sampler.Attrib));
             memcpy(&dst->Attrib, &src->Attrib, sizeof(src->Attrib));
@@ -597,7 +596,7 @@ pop_texture_group(struct gl_context *ctx, struct gl_texture_attrib_node *texstat
             /* We don't need to check whether the texture target is supported,
              * because we wouldn't get in this conditional block if it wasn't.
              */
-            _mesa_BindTexture_no_error(savedObj->Target, savedObj->Name);
+            _mesa_BindTexture_no_error(texObj->Target, savedObj->Name);
             texObj = _mesa_get_tex_unit(ctx, u)->CurrentTex[tgt];
          }
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 530f89d1e53..d3e3ff73501 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -5053,7 +5053,9 @@ struct gl_texture_attrib_node
    struct gl_fixedfunc_texture_unit FixedFuncUnit[MAX_TEXTURE_COORD_UNITS];
    GLfloat LodBias[MAX_TEXTURE_UNITS];
 
-   /** to save per texture object state (wrap modes, filters, etc): */
+   /* For saving per texture object state (wrap modes, filters, etc),
+    * SavedObj[][].Target is unused, so the value is invalid.
+    */
    struct gl_texture_object SavedObj[MAX_TEXTURE_UNITS][NUM_TEXTURE_TARGETS];
 
    /* We need to keep a reference to the shared state.  That's where the



More information about the mesa-commit mailing list