Add function "const", where the initializer does not have to be a compile-time constant.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23566 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-10-17 20:55:30 +00:00
parent 779e6b406a
commit e46b087760
15 changed files with 165 additions and 111 deletions

View file

@ -300,8 +300,6 @@ integer_expression
function_call
: function_call_or_method {
$$ = parseContext.handleFunctionCall($1.loc, $1.function, $1.intermNode, $1.intermAggregate);
if ($$ == 0)
YYERROR;
delete $1.function;
}
;
@ -738,7 +736,7 @@ expression
constant_expression
: conditional_expression {
parseContext.constCheck($1, "");
parseContext.constantValueCheck($1, "");
$$ = $1;
}
;
@ -1160,7 +1158,7 @@ single_type_qualifier
storage_qualifier
: CONST {
$$.init($1.loc);
$$.qualifier.storage = EvqConst;
$$.qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant
}
| ATTRIBUTE {
parseContext.requireStage($1.loc, EShLangVertex, "attribute");
@ -2247,7 +2245,7 @@ switch_statement_list
case_label
: CASE expression COLON {
parseContext.constCheck($2, "case");
parseContext.constantValueCheck($2, "case");
parseContext.integerCheck($2, "case");
$$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc);
}