glsl: Propagate sampler uniform initializers to gl_shader_program::SamplerUnits
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 10 Apr 2012 17:42:13 +0000 (10:42 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 23 May 2012 18:42:07 +0000 (11:42 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/link_uniform_initializers.cpp

index 46f05261f18744b1219c7c3d97cf72ec4c155e5d..849e080970adffb5f2972a58d8089c7095b7f714 100644 (file)
@@ -132,11 +132,20 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
 
         idx += elements;
       }
+
+      if (base_type == GLSL_TYPE_SAMPLER) {
+        for (unsigned int i = 0; i < storage->array_elements; i++) {
+           prog->SamplerUnits[storage->sampler + i] = storage->storage[i].i;
+        }
+      }
    } else {
       copy_constant_to_storage(storage->storage,
                               val,
                               val->type->base_type,
                               val->type->components());
+
+      if (storage->type->is_sampler())
+        prog->SamplerUnits[storage->sampler] = storage->storage[0].i;
    }
 
    storage->initialized = true;