Mesa (9.1): glsl: Add a gl_shader_program parameter to _mesa_uniform_{merge ,split}_location_offset

Ian Romanick idr at kemper.freedesktop.org
Wed Jul 3 20:19:17 UTC 2013


Module: Mesa
Branch: 9.1
Commit: ab159327a7dc2dd41f9887d053d4abb3de69d195
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab159327a7dc2dd41f9887d053d4abb3de69d195

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Jun 10 10:33:59 2013 -0700

glsl: Add a gl_shader_program parameter to _mesa_uniform_{merge,split}_location_offset

This will be used in the next commit.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-and-tested-by: Chad Versace <chad.versace at linux.intel.com>
(cherry picked from commit 5097f358419c067a71e96e39764b3bb0a716bdbb)

---

 src/mesa/main/uniform_query.cpp            |    2 +-
 src/mesa/main/uniforms.c                   |    2 +-
 src/mesa/main/uniforms.h                   |    6 ++++--
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |    2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index b8335fe..fbbe577 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -234,7 +234,7 @@ validate_uniform_parameters(struct gl_context *ctx,
       return false;
    }
 
-   _mesa_uniform_split_location_offset(location, loc, array_index);
+   _mesa_uniform_split_location_offset(shProg, location, loc, array_index);
 
    if (*loc >= shProg->NumUserUniformStorage) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index d902407..cee57a7 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -532,7 +532,7 @@ _mesa_GetUniformLocation(GLhandleARB programObj, const GLcharARB *name)
    if (shProg->UniformStorage[index].block_index != -1)
       return -1;
 
-   return _mesa_uniform_merge_location_offset(index, offset);
+   return _mesa_uniform_merge_location_offset(shProg, index, offset);
 }
 
 GLuint GLAPIENTRY
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index a12ad9b..853a27c 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -268,7 +268,8 @@ struct gl_builtin_uniform_desc {
  * Combine the uniform's base location and the offset
  */
 static inline GLint
-_mesa_uniform_merge_location_offset(unsigned base_location, unsigned offset)
+_mesa_uniform_merge_location_offset(const struct gl_shader_program *prog,
+                                    unsigned base_location, unsigned offset)
 {
    return (base_location << 16) | offset;
 }
@@ -277,7 +278,8 @@ _mesa_uniform_merge_location_offset(unsigned base_location, unsigned offset)
  * Separate the uniform base location and parameter offset
  */
 static inline void
-_mesa_uniform_split_location_offset(GLint location, unsigned *base_location,
+_mesa_uniform_split_location_offset(const struct gl_shader_program *prog,
+                                    GLint location, unsigned *base_location,
 				    unsigned *offset)
 {
    *offset = location & 0xffff;
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 4286f0e..1e04f64 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3052,7 +3052,7 @@ set_uniform_initializer(struct gl_context *ctx, void *mem_ctx,
         	"Couldn't find uniform for initializer %s\n", name);
       return;
    }
-   int loc = _mesa_uniform_merge_location_offset(index, offset);
+   int loc = _mesa_uniform_merge_location_offset(shader_program, index, offset);
 
    for (unsigned int i = 0; i < (type->is_array() ? type->length : 1); i++) {
       ir_constant *element;




More information about the mesa-commit mailing list