glsl: Delete unused code for handling samplers in array-initializers.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 17 Jul 2013 18:45:57 +0000 (11:45 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 18 Jul 2013 23:57:24 +0000 (16:57 -0700)
There is existing code to handle sampler uniform initializers.  Prior to
GLSL 4.20's "binding" keyword, sampler uniforms don't have initializers
at all, so this is somewhat surprising.

The existing code is broken into two cases: one where both the variable and
initializer are arrays, and a second where the variable and initializer are
scalars.

The first case should never occur, since array-typed initializers do not
exist for sampler uniforms.  Even with the binding keyword, the
initializer is a single integer which represents the texture unit to use
for the first array element.

The second is apparently used for some fixed-function code.

v2: Rewrite the commit message - suggested by Paul.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/glsl/link_uniform_initializers.cpp

index 54d9bf1f528ddd63a95e39f7b29bf4ef0d681c1f..f46f6e2db1529bb96152a60113bf2e1385ad6ba7 100644 (file)
@@ -136,20 +136,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,