mesa: Fold _mesa_uniform_split_location_offset into its only caller
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 2 Aug 2014 01:51:30 +0000 (18:51 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 7 Aug 2014 23:17:53 +0000 (16:17 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/uniform_query.cpp
src/mesa/main/uniforms.h

index 2dc9f273b47d90dcb265223a01263397b4027ce6..5989364935df99a11245fbe148467f6486c70dc1 100644 (file)
@@ -267,9 +267,7 @@ validate_uniform_parameters(struct gl_context *ctx,
        INACTIVE_UNIFORM_EXPLICIT_LOCATION)
       return NULL;
 
-   unsigned loc;
-   _mesa_uniform_split_location_offset(shProg, location, &loc, array_index);
-   struct gl_uniform_storage *const uni = &shProg->UniformStorage[loc];
+   struct gl_uniform_storage *const uni = shProg->UniformRemapTable[location];
 
    if (uni->array_elements == 0 && count > 1) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
@@ -278,6 +276,11 @@ validate_uniform_parameters(struct gl_context *ctx,
       return NULL;
    }
 
+   /* The array index specified by the uniform location is just the uniform
+    * location minus the base location of of the uniform.
+    */
+   *array_index = location - uni->remap_location;
+
    /* If the uniform is an array, check that array_index is in bounds.
     * If not an array, check that array_index is zero.
     * array_index is unsigned so no need to check for less than zero.
index 10518dcbb6eabfceace8bf42e9e699b429a9cb82..3e1648380bccd6c28ad95e8e2d981d8ee8dfd043 100644 (file)
@@ -364,25 +364,6 @@ _mesa_uniform_merge_location_offset(const struct gl_shader_program *prog,
    return prog->UniformStorage[storage_index].remap_location +
       uniform_array_index;
 }
-
-/**
- * Separate the uniform storage index and array index
- */
-static inline void
-_mesa_uniform_split_location_offset(const struct gl_shader_program *prog,
-                                    GLint location, unsigned *storage_index,
-                                   unsigned *uniform_array_index)
-{
-   *storage_index = prog->UniformRemapTable[location] - prog->UniformStorage;
-   *uniform_array_index = location -
-      prog->UniformRemapTable[location]->remap_location;
-
-   /*gl_uniform_storage in UniformStorage with the calculated base_location
-    * must match with the entry in remap table
-    */
-   assert(&prog->UniformStorage[*storage_index] ==
-          prog->UniformRemapTable[location]);
-}
 /*@}*/