aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-08-02 15:31:28 -0700
committerEric Anholt <[email protected]>2010-08-02 17:47:35 -0700
commit5704ed27dd2ebc88639cbd32ac971939ef3c267a (patch)
tree91a8dd47861781e372ae1cc26d969e040455a9a7
parentb10bb527eaf39378da25dd4ad21b1c68ceaa1e2d (diff)
glsl2: Don't consider uniform initializers as constant expressions.
We were happily optimizing away the body of glsl-uniform-initializer-* to never use the uniforms.
-rw-r--r--src/glsl/ir_constant_expression.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index f02cd3127ee..915d362b152 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -674,6 +674,12 @@ ir_dereference_variable::constant_expression_value()
if (!var)
return NULL;
+ /* The constant_value of a uniform variable is its initializer,
+ * not the lifetime constant value of the uniform.
+ */
+ if (var->mode == ir_var_uniform)
+ return NULL;
+
return var->constant_value ? var->constant_value->clone(NULL) : NULL;
}