Mesa (master): glsl: Only set ir_variable:: constant_value for const-decorated variables
Ian Romanick
idr at kemper.freedesktop.org
Mon Oct 12 18:36:31 UTC 2015
Module: Mesa
Branch: master
Commit: 3524d6df33b1e3716992f9a555ffb0f7b1ae2f4f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3524d6df33b1e3716992f9a555ffb0f7b1ae2f4f
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Wed Oct 7 12:52:58 2015 -0700
glsl: Only set ir_variable::constant_value for const-decorated variables
Right now we're also setting for uniforms, and that doesn't seem to hurt
things. The next patch will make general global variables in GLSL ES,
and those definitely should not have constant_value set!
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Cc: "10.6 11.0" <mesa-stable at lists.freedesktop.org>
---
src/glsl/ast_to_hir.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index fdded1e..0f05cea 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3249,17 +3249,20 @@ process_initializer(ir_variable *var, ast_declaration *decl,
decl->identifier);
if (var->type->is_numeric()) {
/* Reduce cascading errors. */
- var->constant_value = ir_constant::zero(state, var->type);
+ var->constant_value = type->qualifier.flags.q.constant
+ ? ir_constant::zero(state, var->type) : NULL;
}
}
} else {
rhs = constant_value;
- var->constant_value = constant_value;
+ var->constant_value = type->qualifier.flags.q.constant
+ ? constant_value : NULL;
}
} else {
if (var->type->is_numeric()) {
/* Reduce cascading errors. */
- var->constant_value = ir_constant::zero(state, var->type);
+ var->constant_value = type->qualifier.flags.q.constant
+ ? ir_constant::zero(state, var->type) : NULL;
}
}
}
More information about the mesa-commit
mailing list