Compute the constant value of a constant initializer.
Fixes constFunc.frag.
This commit is contained in:

committed by
Ian Romanick

parent
ac3af37d27
commit
307c71bf24
@@ -1434,13 +1434,22 @@ ast_declarator_list::hir(exec_list *instructions,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ir_dereference *const lhs = new ir_dereference(var);
|
ir_dereference *const lhs = new ir_dereference(var);
|
||||||
ir_rvalue *const rhs = decl->initializer->hir(instructions, state);
|
ir_rvalue *rhs = decl->initializer->hir(instructions, state);
|
||||||
|
|
||||||
/* FINISHME: If the declaration is either 'const' or 'uniform', the
|
/* Calculate the constant value if this is a const
|
||||||
* FINISHME: initializer (rhs) must be a constant expression.
|
* declaration.
|
||||||
*/
|
*/
|
||||||
|
if (this->type->qualifier.constant) {
|
||||||
|
rhs = rhs->constant_expression_value();
|
||||||
|
if (!rhs) {
|
||||||
|
_mesa_glsl_error(& initializer_loc, state,
|
||||||
|
"initializer of const variable `%s' must be a "
|
||||||
|
"constant expression",
|
||||||
|
decl->identifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!rhs->type->is_error()) {
|
if (rhs && !rhs->type->is_error()) {
|
||||||
bool temp = var->read_only;
|
bool temp = var->read_only;
|
||||||
if (this->type->qualifier.constant)
|
if (this->type->qualifier.constant)
|
||||||
var->read_only = false;
|
var->read_only = false;
|
||||||
|
Reference in New Issue
Block a user