[Mesa-dev] [PATCH] compiler/glsl: invalidate float suffixes for glsl 1.10

Timothy Arceri timothy.arceri at collabora.com
Mon Mar 28 23:32:50 UTC 2016


On Sat, 2016-03-26 at 10:03 -0400, Lars Hamre wrote:
> Invalidates float suffixes for glsl 1.10
> 
> Fixes the following piglit tests:
> tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-capital-
> f.vert
> tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-f.vert`
> 
> Signed-off-by: Lars Hamre <chemecse at gmail.com>


Please add the follow to the end of the commit message:

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81585

> 
> ---
>  src/compiler/glsl/glsl_lexer.ll | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compiler/glsl/glsl_lexer.ll
> b/src/compiler/glsl/glsl_lexer.ll
> index 1f12265..dc71009 100644
> --- a/src/compiler/glsl/glsl_lexer.ll
> +++ b/src/compiler/glsl/glsl_lexer.ll
> @@ -472,8 +472,17 @@ layout		{
>  \.[0-9]+([eE][+-]?[0-9]+)?[fF]?		|
>  [0-9]+\.([eE][+-]?[0-9]+)?[fF]?		|
>  [0-9]+[eE][+-]?[0-9]+[fF]?		{
> -			    yylval->real = _mesa_strtof(yytext,
> NULL);
> -			    return FLOATCONSTANT;
> +			    struct _mesa_glsl_parse_state *state =
> yyextra;
> +			    char suffix = yytext[strlen(yytext) -
> 1];
> +			    if (!state->is_version(120, 0) &&
> +			        (suffix == 'f' || suffix == 'F')) {
> +			        _mesa_glsl_error(yylloc, state,
> +			                         "Float suffixes are
> invalid");

Maybe change to "Float suffixes are invalid in GLSL 1.10" ?

Otherwise this seems ok. 

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>

> +			        return ERROR_TOK;
> +			    } else {
> +			        yylval->real = _mesa_strtof(yytext,
> NULL);
> +			        return FLOATCONSTANT;
> +			    }
>  			}
> 
>  [0-9]+\.[0-9]+([eE][+-]?[0-9]+)?(lf|LF)	|
> --
> 2.5.5
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list