summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-08-26 14:49:15 -0600
committerBrian Paul <brianp@vmware.com>2009-08-26 14:49:15 -0600
commit38f56411067d51ad0de0ea73498964baaacea90b (patch)
tree99408c0bebf2316169657cdb0f2f28a16d3f699f
parentb2b220e6225fdd673ea7b9fdda00e98423263fc3 (diff)
parentbabb5ba9a977d23ddae828521401eae312bdb619 (diff)
Merge branch 'mesa_7_5_branch'
-rw-r--r--docs/relnotes-7.5.1.html1
-rw-r--r--src/mesa/shader/shader_api.c19
2 files changed, 16 insertions, 4 deletions
diff --git a/docs/relnotes-7.5.1.html b/docs/relnotes-7.5.1.html
index 77f2dd29b3..1a327577ba 100644
--- a/docs/relnotes-7.5.1.html
+++ b/docs/relnotes-7.5.1.html
@@ -52,6 +52,7 @@ tbd
<li>Fixed some Gallium glBlitFramebuffer() bugs
<li>Empty glBegin/glEnd() pair could cause divide by zero (bug 23489)
<li>Fixed Gallium glBitmap() Z position bug
+<li>Setting arrays of sampler uniforms did not work
</ul>
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 23aca3000e..54a25dfaf0 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1631,6 +1631,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
if (param->Type == PROGRAM_SAMPLER) {
/* This controls which texture unit which is used by a sampler */
+ GLboolean changed = GL_FALSE;
GLint i;
/* this should have been caught by the compatible_types() check */
@@ -1655,13 +1656,23 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
_mesa_printf("Set program %p sampler %d '%s' to unit %u\n",
program, sampler, param->Name, texUnit);
#endif
- program->SamplerUnits[sampler] = texUnit;
+ if (program->SamplerUnits[sampler] != texUnit) {
+ program->SamplerUnits[sampler] = texUnit;
+ changed = GL_TRUE;
+ }
}
}
- _mesa_update_shader_textures_used(program);
-
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ if (changed) {
+ /* When a sampler's value changes it usually requires rewriting
+ * a GPU program's TEX instructions since there may not be a
+ * sampler->texture lookup table. We signal this with the
+ * ProgramStringNotify() callback.
+ */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE | _NEW_PROGRAM);
+ _mesa_update_shader_textures_used(program);
+ ctx->Driver.ProgramStringNotify(ctx, program->Target, program);
+ }
}
else {
/* ordinary uniform variable */