summaryrefslogtreecommitdiff
path: root/src/glsl/link_uniform_initializers.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2014-04-04 10:52:31 -0700
committerIan Romanick <ian.d.romanick@intel.com>2014-04-11 12:26:01 -0700
commit881c52f13f4a8ca1c80ca1766238d5100ddf283b (patch)
tree294c8a3a0be0b20eacf8bfeadd0e5b5a00af4f08 /src/glsl/link_uniform_initializers.cpp
parent6e2f63b69e37c365094ce9bf7e2f9cd118cea01a (diff)
linker: Various trivial clean-ups in set_sampler_binding
- Remove the spurious block left from the previous commit and re-indent. - Constify elements. - Make the spec reference in the code look like other spec references in the compiler. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Cc: "10.1" <mesa-stable@lists.freedesktop.org> Cc: github@socker.lepus.uberspace.de
Diffstat (limited to 'src/glsl/link_uniform_initializers.cpp')
-rw-r--r--src/glsl/link_uniform_initializers.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp
index 9a103507313..6f15e69565e 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -95,27 +95,27 @@ set_sampler_binding(void *mem_ctx, gl_shader_program *prog,
return;
}
- {
- unsigned elements = MAX2(storage->array_elements, 1);
-
- /* From section 4.4.4 of the GLSL 4.20 specification:
- * "If the binding identifier is used with an array, the first element
- * of the array takes the specified unit and each subsequent element
- * takes the next consecutive unit."
- */
- for (unsigned int i = 0; i < elements; i++) {
- storage->storage[i].i = binding + i;
- }
+ const unsigned elements = MAX2(storage->array_elements, 1);
+
+ /* Section 4.4.4 (Opaque-Uniform Layout Qualifiers) of the GLSL 4.20 spec
+ * says:
+ *
+ * "If the binding identifier is used with an array, the first element
+ * of the array takes the specified unit and each subsequent element
+ * takes the next consecutive unit."
+ */
+ for (unsigned int i = 0; i < elements; i++) {
+ storage->storage[i].i = binding + i;
+ }
- for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
- gl_shader *shader = prog->_LinkedShaders[sh];
+ for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
+ gl_shader *shader = prog->_LinkedShaders[sh];
- if (shader && storage->sampler[sh].active) {
- for (unsigned i = 0; i < elements; i++) {
- unsigned index = storage->sampler[sh].index + i;
+ if (shader && storage->sampler[sh].active) {
+ for (unsigned i = 0; i < elements; i++) {
+ unsigned index = storage->sampler[sh].index + i;
- shader->SamplerUnits[index] = storage->storage[i].i;
- }
+ shader->SamplerUnits[index] = storage->storage[i].i;
}
}
}