[Mesa-dev] [PATCH] glsl: Relax GLSL 1.10 float suffix error to a warning.

Kenneth Graunke kenneth at whitecape.org
Thu Apr 21 01:48:44 UTC 2016


On Wednesday, April 20, 2016 12:29:23 PM PDT Matt Turner wrote:
> Float suffixes are allowed in all subsequent GLSL specifications, and
> it's obvious what the user meant if they specify one. Accept it with a
> warning to avoid breaking applications, like Planeshift.
> ---
>  src/compiler/glsl/glsl_lexer.ll | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/
glsl_lexer.ll
> index 6b1ef17..8a562cb 100644
> --- a/src/compiler/glsl/glsl_lexer.ll
> +++ b/src/compiler/glsl/glsl_lexer.ll
> @@ -476,8 +476,8 @@ layout		{
>  			    char suffix = yytext[strlen(yytext) - 1];
>  			    if (!state->is_version(120, 300) &&
>  			        (suffix == 'f' || suffix == 'F')) {
> -			        _mesa_glsl_error(yylloc, state,
> -			                         "Float suffixes are invalid in GLSL 
1.10");
> +			        _mesa_glsl_warning(yylloc, state,
> +			                           "Float suffixes are invalid in GLSL 
1.10");
>  			    }
>  			    yylval->real = _mesa_strtof(yytext, NULL);
>  			    return FLOATCONSTANT;
> 

I checked PlaneShift 0.6.3 (our old shaders were from 0.6.1), and while
it still uses 1.10 (no #version line), I don't see any float suffixes.

So, maybe they fixed this.

However, I'm definitely in favor of making this a warning.  It's allowed
in every GLSL version other than 1.10, and also the C syntax...so I
would not be at all surprised to see other applications hit this.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

It might be worth simply deleting the Piglit tests.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160420/daaa225b/attachment.sig>


More information about the mesa-dev mailing list