[Mesa-dev] [PATCH 07/11] glsl: Delete unused code for handling samplers in array-initializers.

Kenneth Graunke kenneth at whitecape.org
Wed Jul 17 18:24:07 PDT 2013


The first case handles uniform variables whose initializers are array
literals.  Prior to GLSL 4.20's "binding" keyword, samplers don't have
initializers at all.  With the binding keyword, the "initializer" is a
single integer representing the texture unit to use for the first
element; consecutive array elements get consecutive texture units.

In either case, array-typed initializers for sampler uniforms do not
exist, so this code should never execute.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/link_uniform_initializers.cpp | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp
index 54d9bf1..3d8b181 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -127,6 +127,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
       const unsigned int elements = val->array_elements[0]->type->components();
       unsigned int idx = 0;
 
+      assert(base_type != GLSL_TYPE_SAMPLER);
       assert(val->type->length >= storage->array_elements);
       for (unsigned int i = 0; i < storage->array_elements; i++) {
 	 copy_constant_to_storage(& storage->storage[idx],
@@ -136,20 +137,6 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
 
 	 idx += elements;
       }
-
-      if (base_type == GLSL_TYPE_SAMPLER) {
-         for (int sh = 0; sh < MESA_SHADER_TYPES; sh++) {
-            gl_shader *shader = prog->_LinkedShaders[sh];
-
-            if (shader && storage->sampler[sh].active) {
-               for (unsigned i = 0; i < storage->array_elements; i++) {
-                  unsigned index = storage->sampler[sh].index + i;
-
-                  shader->SamplerUnits[index] = storage->storage[i].i;
-               }
-            }
-	 }
-      }
    } else {
       copy_constant_to_storage(storage->storage,
 			       val,
-- 
1.8.3.2



More information about the mesa-dev mailing list