diff options
author | Lars Hamre <[email protected]> | 2016-03-28 20:42:14 -0400 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2016-03-29 21:26:34 -0700 |
commit | 6773128bbf8703663ed1a4d6c1c3308b3c002a35 (patch) | |
tree | e4a3b9c5c92cc0a169a164d8b494f0b51f249466 /src/compiler/glsl | |
parent | 2d3b8aefda1df66ef43c11c66e95ecb9a19c9137 (diff) |
glsl: invalidate float suffixes for GLSL 1.10 and GLSL ES 1.00
Float suffixes are not allowed in GLSL 1.10 nor GLSL ES 1.00.
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`
v2: modify error message
v3: parse the float instead of returning an ERROR_TOK
v4: (by Ken) Change to is_version(120, 300) to avoid breaking ES3
shaders; update commit message accordingly.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81585
Signed-off-by: Lars Hamre <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/glsl_lexer.ll | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll index 883c58f0da9..5492045f7c3 100644 --- a/src/compiler/glsl/glsl_lexer.ll +++ b/src/compiler/glsl/glsl_lexer.ll @@ -472,6 +472,13 @@ layout { \.[0-9]+([eE][+-]?[0-9]+)?[fF]? | [0-9]+\.([eE][+-]?[0-9]+)?[fF]? | [0-9]+[eE][+-]?[0-9]+[fF]? { + struct _mesa_glsl_parse_state *state = yyextra; + 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"); + } yylval->real = _mesa_strtof(yytext, NULL); return FLOATCONSTANT; } |