aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-07-09 11:30:31 +0200
committermarha <marha@users.sourceforge.net>2013-07-09 11:30:31 +0200
commitc6069c33e3a4a6d48aa059dbe9a78702dabff9cc (patch)
tree9e98e08fa3b70c7d168d60aa981498e1f3b8ace6 /mesalib/src/glsl/ast_to_hir.cpp
parenta9866a9e7dc9c89962a13d6e750aa5a18b98369c (diff)
downloadvcxsrv-c6069c33e3a4a6d48aa059dbe9a78702dabff9cc.tar.gz
vcxsrv-c6069c33e3a4a6d48aa059dbe9a78702dabff9cc.tar.bz2
vcxsrv-c6069c33e3a4a6d48aa059dbe9a78702dabff9cc.zip
fontconfig libX11 libxcb mesa git update 9 Jul 2013
libxcb commit a1e67b141a57d39cbcaff1a703d6fc0da1fbb56d libX11 commit 383e2b0d029482a0f4c39fe00e15397538576fc1 fontconfig commit 04bd904632b22682c888f658650cdcd322544273 mesa commit 292368570a13501dfa95b1b0dd70966caf6ffc6b
Diffstat (limited to 'mesalib/src/glsl/ast_to_hir.cpp')
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index efbd72c18..cbd9ea357 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -2355,17 +2355,25 @@ process_initializer(ir_variable *var, ast_declaration *decl,
ir_constant *constant_value = rhs->constant_expression_value();
if (!constant_value) {
- _mesa_glsl_error(& initializer_loc, state,
- "initializer of %s variable `%s' must be a "
- "constant expression",
- (type->qualifier.flags.q.constant)
- ? "const" : "uniform",
- decl->identifier);
- if (var->type->is_numeric()) {
- /* Reduce cascading errors. */
- var->constant_value = ir_constant::zero(state, var->type);
- }
- } else {
+ /* If ARB_shading_language_420pack is enabled, initializers of
+ * const-qualified local variables do not have to be constant
+ * expressions. Const-qualified global variables must still be
+ * initialized with constant expressions.
+ */
+ if (!state->ARB_shading_language_420pack_enable
+ || state->current_function == NULL) {
+ _mesa_glsl_error(& initializer_loc, state,
+ "initializer of %s variable `%s' must be a "
+ "constant expression",
+ (type->qualifier.flags.q.constant)
+ ? "const" : "uniform",
+ decl->identifier);
+ if (var->type->is_numeric()) {
+ /* Reduce cascading errors. */
+ var->constant_value = ir_constant::zero(state, var->type);
+ }
+ }
+ } else {
rhs = constant_value;
var->constant_value = constant_value;
}