diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2013-07-15 11:45:24 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2013-07-18 16:57:22 -0700 |
commit | a4d15a3cd963dee6beb0b6d8a4c25b371ea9a289 (patch) | |
tree | bf474f4be877d9e57d22e49cc27b696f64e4106b /src/glsl | |
parent | 83fe4f7019283851d56df14f47a5d5c01d6b6b9e (diff) | |
download | external_mesa3d-a4d15a3cd963dee6beb0b6d8a4c25b371ea9a289.zip external_mesa3d-a4d15a3cd963dee6beb0b6d8a4c25b371ea9a289.tar.gz external_mesa3d-a4d15a3cd963dee6beb0b6d8a4c25b371ea9a289.tar.bz2 |
glsl: Refactor parameter qualifier handling.
"Parameter direction qualifier" is a new term I invented just now; it's
not part of any GLSL specification.
This paves the way handling multiple parameter qualifiers, in any order,
as required by GLSL 4.20/ARB_shading_language_420pack.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/glsl_parser.yy | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index ffaf0f3..0c5defb 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -180,6 +180,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %type <parameter_declarator> parameter_declarator %type <parameter_declarator> parameter_declaration %type <type_qualifier> parameter_qualifier +%type <type_qualifier> parameter_direction_qualifier %type <type_qualifier> parameter_type_qualifier %type <type_specifier> parameter_type_specifier %type <function_definition> function_definition @@ -903,7 +904,17 @@ parameter_qualifier: { memset(& $$, 0, sizeof($$)); } - | IN_TOK + | parameter_direction_qualifier parameter_qualifier + { + if (($1.flags.q.in || $1.flags.q.out) && ($2.flags.q.in || $2.flags.q.out)) + _mesa_glsl_error(&@1, state, "duplicate in/out/inout qualifier"); + + $$ = $1; + $$.merge_qualifier(&@1, state, $2); + } + +parameter_direction_qualifier: + IN_TOK { memset(& $$, 0, sizeof($$)); $$.flags.q.in = 1; |