[Piglit] [PATCH] Comment continuation in the middle of a define.
jfonseca at vmware.com
jfonseca at vmware.com
Thu Oct 25 06:40:05 PDT 2012
From: José Fonseca <jfonseca at vmware.com>
---
.../glsl2/comment-continuation-preprocessor.frag | 34 ++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 tests/glslparsertest/glsl2/comment-continuation-preprocessor.frag
diff --git a/tests/glslparsertest/glsl2/comment-continuation-preprocessor.frag b/tests/glslparsertest/glsl2/comment-continuation-preprocessor.frag
new file mode 100644
index 0000000..21b889b
--- /dev/null
+++ b/tests/glslparsertest/glsl2/comment-continuation-preprocessor.frag
@@ -0,0 +1,34 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+//
+// [end config]
+//
+// GLSL specification states that
+//
+// Removal of new lines by the line-continuation character ( \ ) logically
+// occurs before comments are processed.
+//
+// GNU cpp does the same. However NVIDIA accepts the shader below.
+//
+// This was seen with MindCAD 3D Viewer.
+//
+
+#define DECLARE_FOO() \
+ void foo(out vec4 color) \
+ { \
+ color = vec4(0, 1, 0, 1); \
+ \
+// if (0) \
+// { \
+// color = vec4(0, 0, 1, 1) ; \
+// } \
+ }
+
+DECLARE_FOO()
+
+void main()
+{
+ foo(gl_FragColor);
+}
+
--
1.7.9.5
More information about the Piglit
mailing list