Mesa (master): st/mesa: add const qualifiers in sampler validation code

Brian Paul brianp at kemper.freedesktop.org
Fri Dec 13 23:15:52 UTC 2013


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

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Dec 13 09:33:49 2013 -0700

st/mesa: add const qualifiers in sampler validation code

Reviewed-by: Roland Scheidegger <sroland at vmware.com>

---

 src/mesa/state_tracker/st_atom_sampler.c |    6 +++---
 src/mesa/state_tracker/st_texture.h      |    6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 989e42c..447788c 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -130,7 +130,7 @@ convert_sampler(struct st_context *st,
                 struct pipe_sampler_state *sampler,
                 GLuint texUnit)
 {
-   struct gl_texture_object *texobj;
+   const struct gl_texture_object *texobj;
    struct gl_context *ctx = st->ctx;
    struct gl_sampler_object *msamp;
 
@@ -175,8 +175,8 @@ convert_sampler(struct st_context *st,
        msamp->BorderColor.ui[1] ||
        msamp->BorderColor.ui[2] ||
        msamp->BorderColor.ui[3]) {
-      struct st_texture_object *stobj = st_texture_object(texobj);
-      struct gl_texture_image *teximg;
+      const struct st_texture_object *stobj = st_texture_object_const(texobj);
+      const struct gl_texture_image *teximg;
       const GLboolean is_integer = texobj->_IsIntegerFormat;
       union pipe_color_union border_color;
 
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index c15aeae..ac93d96 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -112,6 +112,12 @@ st_texture_object(struct gl_texture_object *obj)
    return (struct st_texture_object *) obj;
 }
 
+static INLINE const struct st_texture_object *
+st_texture_object_const(const struct gl_texture_object *obj)
+{
+   return (const struct st_texture_object *) obj;
+}
+
 
 static INLINE struct pipe_resource *
 st_get_texobj_resource(struct gl_texture_object *texObj)




More information about the mesa-commit mailing list