aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/link_uniforms.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-25 15:31:52 +0200
committermarha <marha@users.sourceforge.net>2012-05-25 15:31:52 +0200
commite37e5c7e6678395a7f5dff1aea1c240a5b1c8f66 (patch)
tree9e46ba338311cb6658589a7767ebcb7f525eb369 /mesalib/src/glsl/link_uniforms.cpp
parentaebbd673a0fb4d5e9ae4e8e690b29fb364376875 (diff)
parenteef864d36de97903007f04fad9fa43afe297745b (diff)
downloadvcxsrv-e37e5c7e6678395a7f5dff1aea1c240a5b1c8f66.tar.gz
vcxsrv-e37e5c7e6678395a7f5dff1aea1c240a5b1c8f66.tar.bz2
vcxsrv-e37e5c7e6678395a7f5dff1aea1c240a5b1c8f66.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/glsl/link_uniforms.cpp')
-rw-r--r--mesalib/src/glsl/link_uniforms.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp
index 506b6fe1c..3cbc50510 100644
--- a/mesalib/src/glsl/link_uniforms.cpp
+++ b/mesalib/src/glsl/link_uniforms.cpp
@@ -329,9 +329,16 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
prog->UniformHash = new string_to_uint_map;
}
- for (unsigned i = 0; i < Elements(prog->SamplerUnits); i++) {
- prog->SamplerUnits[i] = i;
- }
+ /* Uniforms that lack an initializer in the shader code have an initial
+ * value of zero. This includes sampler uniforms.
+ *
+ * Page 24 (page 30 of the PDF) of the GLSL 1.20 spec says:
+ *
+ * "The link time initial value is either the value of the variable's
+ * initializer, if present, or 0 if no initializer is present. Sampler
+ * types cannot have initializers."
+ */
+ memset(prog->SamplerUnits, 0, sizeof(prog->SamplerUnits));
/* First pass: Count the uniform resources used by the user-defined
* uniforms. While this happens, each active uniform will have an index
@@ -425,5 +432,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
prog->NumUserUniformStorage = num_user_uniforms;
prog->UniformStorage = uniforms;
+ link_set_uniform_initializers(prog);
+
return;
}