[Piglit] [PATCH 3/3] pragma-macro-expansion: changed to extension-macro-expansion.

Fabian Bieler fabianbieler at fastmail.fm
Mon Apr 22 14:00:37 PDT 2013


>From the GLSL 1.10 specification:
"If an implementation does not recognize the tokens following #pragma, then it
will ignore that pragma."

So even without macro expansion the directive
 #pragma debug(FOO)
should be ignored and the shader should compile.
---
 .../preprocessor/extension-macro-expansion.vert    |   19 +++++++++++++++++++
 .../preprocessor/pragma-macro-expansion.vert       |   20 --------------------
 2 files changed, 19 insertions(+), 20 deletions(-)
 create mode 100644 tests/spec/glsl-1.10/preprocessor/extension-macro-expansion.vert
 delete mode 100644 tests/spec/glsl-1.10/preprocessor/pragma-macro-expansion.vert

diff --git a/tests/spec/glsl-1.10/preprocessor/extension-macro-expansion.vert b/tests/spec/glsl-1.10/preprocessor/extension-macro-expansion.vert
new file mode 100644
index 0000000..8d92d0b
--- /dev/null
+++ b/tests/spec/glsl-1.10/preprocessor/extension-macro-expansion.vert
@@ -0,0 +1,19 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 13 (page 19 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Macro expansion is not done on lines containing #extension and #version
+ *      directives."
+ *
+ * Therefore, FOO will not be replaced by a valid behavior token.
+ */
+#define FOO disable
+#extension all : FOO
+
+/* Some compilers generate spurious errors if a shader does not contain
+ * any code or declarations.
+ */
+int foo(void) { return 1; }
diff --git a/tests/spec/glsl-1.10/preprocessor/pragma-macro-expansion.vert b/tests/spec/glsl-1.10/preprocessor/pragma-macro-expansion.vert
deleted file mode 100644
index febe645..0000000
--- a/tests/spec/glsl-1.10/preprocessor/pragma-macro-expansion.vert
+++ /dev/null
@@ -1,20 +0,0 @@
-/* [config]
- * expect_result: fail
- * glsl_version: 1.10
- * [end config]
- *
- * Page 11 (page 17 of the PDF) of the GLSL 1.10 spec says:
- *
- *     "Tokens following #pragma are not subject to preprocessor macro
- *     expansion."
- *
- * Therefore, debug(FOO) will be recognized as is.  Since debug can only take
- * the parameters "on" or "off", this will generate an error.
- */
-#define FOO on
-#pragma debug(FOO)
-
-/* Some compilers generate spurious errors if a shader does not contain
- * any code or declarations.
- */
-int foo(void) { return 1; }
-- 
1.7.10.4



More information about the Piglit mailing list