aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/uniforms.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/uniforms.c')
-rw-r--r--mesalib/src/mesa/main/uniforms.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index 0d0cbf57e..c30710772 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -75,12 +75,26 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg,
memcpy(prog->SamplerUnits, shader->SamplerUnits, sizeof(prog->SamplerUnits));
memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
+ shProg->SamplersValidated = GL_TRUE;
+
for (s = 0; s < MAX_SAMPLERS; s++) {
if (prog->SamplersUsed & (1 << s)) {
GLuint unit = shader->SamplerUnits[s];
GLuint tgt = shader->SamplerTargets[s];
assert(unit < Elements(prog->TexturesUsed));
assert(tgt < NUM_TEXTURE_TARGETS);
+
+ /* The types of the samplers associated with a particular texture
+ * unit must be an exact match. Page 74 (page 89 of the PDF) of the
+ * OpenGL 3.3 core spec says:
+ *
+ * "It is not allowed to have variables of different sampler
+ * types pointing to the same texture image unit within a program
+ * object."
+ */
+ if (prog->TexturesUsed[unit] & ~(1 << tgt))
+ shProg->SamplersValidated = GL_FALSE;
+
prog->TexturesUsed[unit] |= (1 << tgt);
}
}
@@ -917,7 +931,7 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
return -1;
}
- index = _mesa_get_uniform_location(ctx, shProg, name, &offset);
+ index = _mesa_get_uniform_location(shProg, name, &offset);
if (index == GL_INVALID_INDEX)
return -1;
@@ -990,7 +1004,7 @@ _mesa_GetUniformIndices(GLuint program,
for (i = 0; i < uniformCount; i++) {
unsigned offset;
- uniformIndices[i] = _mesa_get_uniform_location(ctx, shProg,
+ uniformIndices[i] = _mesa_get_uniform_location(shProg,
uniformNames[i], &offset);
}
}
@@ -1096,7 +1110,7 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
for (i = 0; i < block->NumUniforms; i++) {
unsigned offset;
const int idx =
- _mesa_get_uniform_location(ctx, shProg,
+ _mesa_get_uniform_location(shProg,
block->Uniforms[i].IndexName,
&offset);
if (idx != -1)
@@ -1113,7 +1127,7 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
for (i = 0; i < block->NumUniforms; i++) {
unsigned offset;
const int idx =
- _mesa_get_uniform_location(ctx, shProg,
+ _mesa_get_uniform_location(shProg,
block->Uniforms[i].IndexName,
&offset);