[Piglit] [PATCH] glsl-1.10: Add test for structure with same-name fields

Ian Romanick idr at freedesktop.org
Tue Nov 27 17:27:16 PST 2012


From: Ian Romanick <ian.d.romanick at intel.com>

This is related to the WebGL shader-with-non-reserved-words tests.
Several of these tests use name that are reserved words in other GLSL
versions as variable names, structure names, structure field names,
and function names.  Some of the cases use the same name for the
structure name and the field name.

Currently, the tests fail on Mesa.  Changing the field name from S to
T causes the test to pass on Mesa.  The tests pass on NVIDIA 295.59.
AMD drivers were not tested.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57622
Reference: https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/misc/shader-with-non-reserved-words.html
---
 .../structure-and-field-have-same-name-nested.vert     | 18 ++++++++++++++++++
 .../struct/structure-and-field-have-same-name.vert     | 17 +++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 tests/spec/glsl-1.10/compiler/struct/structure-and-field-have-same-name-nested.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/struct/structure-and-field-have-same-name.vert

diff --git a/tests/spec/glsl-1.10/compiler/struct/structure-and-field-have-same-name-nested.vert b/tests/spec/glsl-1.10/compiler/struct/structure-and-field-have-same-name-nested.vert
new file mode 100644
index 0000000..9cc082f
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/struct/structure-and-field-have-same-name-nested.vert
@@ -0,0 +1,18 @@
+/* [config]
+ * expect_result: pass
+ * [end config]
+ *
+ * This is related to the WebGL shader-with-non-reserved-words tests.  Several
+ * of these tests use name that are reserved words in other GLSL versions as
+ * variable names, structure names, structure field names, and function
+ * names.  Some of the cases use the same name for the structure name and the
+ * field name.
+ */
+struct S  { vec4 S; };
+struct S2 { S S; };
+
+void main()
+{
+  S2 s = S2(S(gl_Vertex));
+  gl_Position = s.S.S;
+}
diff --git a/tests/spec/glsl-1.10/compiler/struct/structure-and-field-have-same-name.vert b/tests/spec/glsl-1.10/compiler/struct/structure-and-field-have-same-name.vert
new file mode 100644
index 0000000..867b501
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/struct/structure-and-field-have-same-name.vert
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: pass
+ * [end config]
+ *
+ * This is related to the WebGL shader-with-non-reserved-words tests.  Several
+ * of these tests use name that are reserved words in other GLSL versions as
+ * variable names, structure names, structure field names, and function
+ * names.  Some of the cases use the same name for the structure name and the
+ * field name.
+ */
+struct S { vec4 S; };
+
+void main()
+{
+  S s = S(gl_Vertex);
+  gl_Position = s.S;
+}
-- 
1.7.11.7



More information about the Piglit mailing list