[Mesa-dev] [PATCH 3/7] glsl: Propagate sampler uniform initializers to gl_shader_program::SamplerUnits

Ian Romanick idr at freedesktop.org
Thu Apr 12 17:25:39 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/link_uniform_initializers.cpp |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp
index bbd26df..2c12cf8 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -122,11 +122,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;
-- 
1.7.6.5



More information about the mesa-dev mailing list