Mesa (master): glsl: Propagate sampler uniform initializers to gl_shader_program::SamplerUnits

Ian Romanick idr at kemper.freedesktop.org
Wed May 23 11:43:52 PDT 2012


Module: Mesa
Branch: master
Commit: 76027f5b5cd8017f8455e2df375fcea7cc888dce
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=76027f5b5cd8017f8455e2df375fcea7cc888dce

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Tue Apr 10 10:42:13 2012 -0700

glsl: Propagate sampler uniform initializers to gl_shader_program::SamplerUnits

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 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 46f0526..849e080 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -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;



More information about the mesa-commit mailing list