glsl: Add a gl_shader_program parameter to _mesa_uniform_{merge,split}_location_offset
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 10 Jun 2013 17:33:59 +0000 (10:33 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 12 Jun 2013 23:30:06 +0000 (16:30 -0700)
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@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/main/uniform_query.cpp
src/mesa/main/uniforms.c
src/mesa/main/uniforms.h
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index ec3104936e4ca01d5e748114fa677037d08146ff..296f80f17bfba5170d1d9117b0617cc0d314089b 100644 (file)
@@ -235,7 +235,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)",
index 6d79df6835fb267270fbdee743d14656fc08795f..17e62403de24b0baac37a0cef720cf75b67e2278 100644 (file)
@@ -538,7 +538,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
index 5ebd5e49a7882545c8a79cf4dab2ff9457603cdf..d718b0f12e39231c4720c36b955a6784dc9e9933 100644 (file)
@@ -269,7 +269,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;
 }
@@ -278,7 +279,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;
index f8176eb77b2dc7616f022e150395fa37bbad159a..d6796d7a11ea0f18c2685b845e8f7d6fa3ad47f2 100644 (file)
@@ -3096,7 +3096,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;