From 5704ed27dd2ebc88639cbd32ac971939ef3c267a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 15:31:28 -0700 Subject: 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. --- src/glsl/ir_constant_expression.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/glsl') 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; } -- cgit v1.2.3