[Mesa-dev] [PATCH] glsl/glcpp: allow undefining __VERSION__ and GL_ (v2)

Dave Airlie airlied at gmail.com
Tue Aug 25 23:45:26 PDT 2015


From: Dave Airlie <airlied at redhat.com>

GL33-CTS.shaders.preprocessor.definitions.*
has 4 tests the undefine these,

It appears GLES doesn't allow this, but desktop GL
does, yay specs.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/glsl/glcpp/glcpp-parse.y | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 18e50af..0579dc0 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -288,10 +288,11 @@ control_line_success:
 		glcpp_parser_resolve_implicit_version(parser);
 	} IDENTIFIER NEWLINE {
 		macro_t *macro;
-		if (strcmp("__LINE__", $4) == 0
-		    || strcmp("__FILE__", $4) == 0
-		    || strcmp("__VERSION__", $4) == 0
-		    || strncmp("GL_", $4, 3) == 0)
+		if (parser->is_gles &&
+		    (strcmp("__LINE__", $4) == 0
+		     || strcmp("__FILE__", $4) == 0
+		     || strcmp("__VERSION__", $4) == 0
+		     || strncmp("GL_", $4, 3) == 0))
 			glcpp_error(& @1, parser, "Built-in (pre-defined)"
 				    " macro names cannot be undefined.");
 
-- 
2.4.3



More information about the mesa-dev mailing list