[Mesa-dev] [PATCH] glsl: Support unsigned integer constants in layout qualifiers.

Ian Romanick idr at freedesktop.org
Tue Nov 20 09:12:12 PST 2012


On 11/19/2012 10:37 PM, Kenneth Graunke wrote:
> Fixes es3conform's explicit_attrib_location_integer_constants.

 From the look of things, this is how it should work on desktop as well. 
  The grammar says:

       layout-qualifier-id
         location = integer-constant

and

     integer-constant :
         decimal-constant integer-suffixopt
         octal-constant integer-suffixopt
         hexadecimal-constant integer-suffixopt
     integer-suffix: one of u U
     ...

This patch should go on master, and it should be marked for the stable 
branches.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>   src/glsl/glsl_parser.yy | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index 89175f5..f123368 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -241,6 +241,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg)
>   %type <node> conditionopt
>   %type <node> for_init_statement
>   %type <for_rest_statement> for_rest_statement
> +%type <n> integer_constant
>   %%
>
>   translation_unit:
> @@ -1084,6 +1085,10 @@ layout_qualifier_id_list:
>   	}
>   	;
>
> +integer_constant:
> +	INTCONSTANT { $$ = $1; }
> +	| UINTCONSTANT { $$ = $1; }
> +
>   layout_qualifier_id:
>   	any_identifier
>   	{
> @@ -1155,7 +1160,7 @@ layout_qualifier_id:
>   	      YYERROR;
>   	   }
>   	}
> -	| any_identifier '=' INTCONSTANT
> +	| any_identifier '=' integer_constant
>   	{
>   	   memset(& $$, 0, sizeof($$));
>
>



More information about the mesa-dev mailing list