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

Neil Roberts neil at linux.intel.com
Wed Nov 26 12:02:58 PST 2014


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;
-- 
1.9.3



More information about the mesa-dev mailing list