glsl: Ban #undefining __LINE__ and friends on GLES2.

Fixes deqp_gles2 undefine_invalid_object_* failures.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Eric Anholt
2017-05-01 16:35:34 -07:00
parent efa9750e96
commit e5ade7db73

View File

@@ -284,7 +284,8 @@ control_line_success:
* It is an error to undefine or to redefine a built-in
* (pre-defined) macro name.
*
* The GLSL ES 1.00 spec does not contain this text.
* The GLSL ES 1.00 spec does not contain this text, but
* dEQP's preprocess test in GLES2 checks for it.
*
* Section 3.3 (Preprocessor) of the GLSL 1.30 spec says:
*
@@ -296,12 +297,8 @@ control_line_success:
* Furthermore, there are desktop OpenGL conformance tests
* that expect '#undef __VERSION__' and '#undef
* GL_core_profile' to work.
*
* Only disallow #undef of pre-defined macros on GLSL ES >=
* 3.00 shaders.
*/
if (parser->is_gles &&
parser->version >= 300 &&
(strcmp("__LINE__", $3) == 0
|| strcmp("__FILE__", $3) == 0
|| strcmp("__VERSION__", $3) == 0