glsl2: Don't consider uniform initializers as constant expressions.
authorEric Anholt <eric@anholt.net>
Mon, 2 Aug 2010 22:31:28 +0000 (15:31 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 3 Aug 2010 00:47:35 +0000 (17:47 -0700)
We were happily optimizing away the body of
glsl-uniform-initializer-* to never use the uniforms.

src/glsl/ir_constant_expression.cpp

index f02cd3127eeeb4baf39c63600d45167117e09147..915d362b15243ff49d91001116fc2dfd574df483 100644 (file)
@@ -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;
 }