[Piglit] [PATCH v2 1/2] Verify that vertex shader "in" parameters are read-only.

Paul Berry stereotype441 at gmail.com
Sat Nov 12 09:46:34 PST 2011


Piglit already contained tests to verify that in GLSL 1.00-1.20, a
vertex shader could not write to a variable declared "attribute" (see
spec/glsl-1.xx/compiler/storage-qualfiers/static-write-attribute-*.vert).
In GLSL 1.30, such variables are now declared as global "in"
variables.  These new tests verify that the existing read-only
behavior of these variables is preserved.
---
 .../storage-qualifiers/static-write-in-direct.vert |   18 +++++++++++++++++
 .../static-write-in-indirect.vert                  |   21 ++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-direct.vert
 create mode 100644 tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-indirect.vert

diff --git a/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-direct.vert b/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-direct.vert
new file mode 100644
index 0000000..9c879e2
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-direct.vert
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 31 (37 of pdf) of the GLSL 1.30 spec:
+//     Variables declared as in or centroid in may not be written
+//     to during shader execution.
+
+
+#version 130
+
+in float x;
+
+float f() {
+	x = 0.0;
+	return x;
+}
diff --git a/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-indirect.vert b/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-indirect.vert
new file mode 100644
index 0000000..8385286
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-indirect.vert
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 31 (37 of pdf) of the GLSL 1.30 spec:
+//     Variables declared as in or centroid in may not be written
+//     to during shader execution.
+
+
+#version 130
+
+in float x;
+
+void f(out float y) {
+    y = 0.0;
+}
+
+void g() {
+    f(x);
+}
-- 
1.7.6.4



More information about the Piglit mailing list