[Mesa-dev] [PATCH 1/2] glsl: Disallow float literals with the 'f' suffix but no point or exponent

Iago Toral itoral at igalia.com
Wed Nov 26 23:14:31 PST 2014


Thanks Neil! I was planning to fix this once I was done with the format
conversion stuff, so you saved me some work :)

I tested the patch and it fixes the following dEQP tests:

dEQP-GLES3.functional.shaders.constants.float_int_f_suffix_0_vertex
dEQP-GLES3.functional.shaders.constants.float_int_f_suffix_0_fragment
dEQP-GLES3.functional.shaders.constants.float_int_f_suffix_1_vertex
dEQP-GLES3.functional.shaders.constants.float_int_f_suffix_1_fragment

Iago

On Wed, 2014-11-26 at 20:02 +0000, Neil Roberts wrote:
> According to the GLSL spec float literals like ‘1f’ shouldn't be allowed
> without adding a decimal point or an exponent. Apparently the AMD driver also
> disallows this so it seems unlikely that anything would be relying on it.
> ---
> 
> This was discussed here:
> 
> http://lists.freedesktop.org/archives/mesa-dev/2014-November/071039.html
> 
> I've run this through Piglit and it doesn't cause any regressions
> except for glsl-floating-constant-120.shader_test but I think that
> test is bogus. I've posted a patch to change it here:
> 
> http://lists.freedesktop.org/archives/piglit/2014-November/013488.html
> 
>  src/glsl/glsl_lexer.ll | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
> index ad6d32f..419a07b 100644
> --- a/src/glsl/glsl_lexer.ll
> +++ b/src/glsl/glsl_lexer.ll
> @@ -466,10 +466,6 @@ layout		{
>  			    yylval->real = _mesa_strtof(yytext, NULL);
>  			    return FLOATCONSTANT;
>  			}
> -[0-9]+[fF]		{
> -			    yylval->real = _mesa_strtof(yytext, NULL);
> -			    return FLOATCONSTANT;
> -			}
>  
>  true			{
>  			    yylval->n = 1;




More information about the mesa-dev mailing list