summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/uniform_query.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 5371d6a176b..33ba53c2e7b 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -698,11 +698,27 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
prog = shProg->_LinkedShaders[i]->Program;
+ /* If the shader stage doesn't use any samplers, don't bother
+ * checking if any samplers have changed.
+ */
+ if (prog->SamplersUsed == 0)
+ continue;
+
assert(sizeof(prog->SamplerUnits) == sizeof(shProg->SamplerUnits));
- if (memcmp(prog->SamplerUnits,
- shProg->SamplerUnits,
- sizeof(shProg->SamplerUnits)) != 0) {
+ /* Determine if any of the samplers used by this shader stage have
+ * been modified.
+ */
+ bool changed = false;
+ for (unsigned j = 0; j < Elements(prog->SamplerUnits); j++) {
+ if ((prog->SamplersUsed & (1U << j)) != 0
+ && (prog->SamplerUnits[j] != shProg->SamplerUnits[j])) {
+ changed = true;
+ break;
+ }
+ }
+
+ if (changed) {
if (!flushed) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE | _NEW_PROGRAM);
flushed = true;