[Piglit] [PATCH v2 2/2] Verify that built-in shader inputs are read-only.

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


These tests verify that the following built-in shader input variables
are read-only:

For vertex shaders:
- gl_Color
- gl_SecondaryColor
- gl_Normal
- gl_Vertex
- gl_MultiTexCoord0
- gl_MultiTexCoord1
- gl_MultiTexCoord2
- gl_MultiTexCoord3
- gl_MultiTexCoord4
- gl_MultiTexCoord5
- gl_MultiTexCoord6
- gl_MultiTexCoord7
- gl_FogCoord
- gl_VertexID (a GLSL 1.30 feature)

For fragment shaders:
- gl_FragCoord
- gl_FrontFacing
- gl_Color
- gl_SecondaryColor
- gl_TexCoord
- gl_FogFragCoord
- gl_PointCoord
- gl_ClipDistance (a GLSL 1.30 feature)
---
 .../storage-qualfiers/static-write-color.frag      |   18 ++++++++++++++++
 .../storage-qualfiers/static-write-color.vert      |   22 ++++++++++++++++++++
 .../storage-qualfiers/static-write-fog-coord.vert  |   22 ++++++++++++++++++++
 .../static-write-fog-frag-coord.frag               |   18 ++++++++++++++++
 .../storage-qualfiers/static-write-frag-coord.frag |   14 ++++++++++++
 .../static-write-front-facing.frag                 |   14 ++++++++++++
 .../static-write-multitexcoord0.vert               |   22 ++++++++++++++++++++
 .../static-write-multitexcoord1.vert               |   22 ++++++++++++++++++++
 .../static-write-multitexcoord2.vert               |   22 ++++++++++++++++++++
 .../static-write-multitexcoord3.vert               |   22 ++++++++++++++++++++
 .../static-write-multitexcoord4.vert               |   22 ++++++++++++++++++++
 .../static-write-multitexcoord5.vert               |   22 ++++++++++++++++++++
 .../static-write-multitexcoord6.vert               |   22 ++++++++++++++++++++
 .../static-write-multitexcoord7.vert               |   22 ++++++++++++++++++++
 .../storage-qualfiers/static-write-normal.vert     |   22 ++++++++++++++++++++
 .../static-write-secondary-color.frag              |   18 ++++++++++++++++
 .../static-write-secondary-color.vert              |   22 ++++++++++++++++++++
 .../storage-qualfiers/static-write-tex-coord.frag  |   18 ++++++++++++++++
 .../storage-qualfiers/static-write-vertex.vert     |   22 ++++++++++++++++++++
 .../static-write-point-coord.frag                  |   18 ++++++++++++++++
 .../static-write-clip-distance.frag                |   20 ++++++++++++++++++
 .../storage-qualifiers/static-write-vertex-id.vert |   20 ++++++++++++++++++
 22 files changed, 444 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-color.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-color.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-fog-coord.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-fog-frag-coord.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-frag-coord.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-front-facing.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord0.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord1.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord2.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord3.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord4.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord5.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord6.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord7.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-normal.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-secondary-color.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-secondary-color.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-tex-coord.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-vertex.vert
 create mode 100644 tests/spec/glsl-1.20/compiler/storage-qualfiers/static-write-point-coord.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-clip-distance.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-vertex-id.vert

diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-color.frag b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-color.frag
new file mode 100644
index 0000000..0120068
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-color.frag
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.6 of the GLSL 1.10 spec:
+//     A fragment shader can not write to a varying variable.
+//
+// From section 7.6 of the GLSL 1.10 spec:
+//     The following varying variables are available to read from in a fragment shader.
+//         ...
+//     varying vec4 gl_Color;
+
+#version 110
+
+void g() {
+    gl_Color = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-color.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-color.vert
new file mode 100644
index 0000000..2ac2392
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-color.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_Color;
+
+
+#version 110
+
+void f() {
+	gl_Color = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-fog-coord.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-fog-coord.vert
new file mode 100644
index 0000000..f94ff78
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-fog-coord.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute float gl_FogCoord;
+
+
+#version 110
+
+void f() {
+	gl_FogCoord = 0.0;
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-fog-frag-coord.frag b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-fog-frag-coord.frag
new file mode 100644
index 0000000..28c0730
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-fog-frag-coord.frag
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.6 of the GLSL 1.10 spec:
+//     A fragment shader can not write to a varying variable.
+//
+// From section 7.6 of the GLSL 1.10 spec:
+//     The following varying variables are available to read from in a fragment shader.
+//         ...
+//     varying float gl_FogFragCoord;
+
+#version 110
+
+void g() {
+    gl_FogFragCoord = 0.0;
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-frag-coord.frag b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-frag-coord.frag
new file mode 100644
index 0000000..89a99a4
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-frag-coord.frag
@@ -0,0 +1,14 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 7.2 of the GLSL 1.10 spec:
+//     The variable gl_FragCoord is available as a read-only variable
+//     from within fragment shaders...
+
+#version 110
+
+void g() {
+    gl_FragCoord = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-front-facing.frag b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-front-facing.frag
new file mode 100644
index 0000000..d99e296
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-front-facing.frag
@@ -0,0 +1,14 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 7.2 of the GLSL 1.10 spec:
+//     The fragment shader has access to the read-only built-in
+//     variable gl_FrontFacing...
+
+#version 110
+
+void g() {
+    gl_FrontFacing = true;
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord0.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord0.vert
new file mode 100644
index 0000000..24b9641
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord0.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_MultiTexCoord0;
+
+
+#version 110
+
+void f() {
+	gl_MultiTexCoord0 = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord1.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord1.vert
new file mode 100644
index 0000000..c729dc7
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord1.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_MultiTexCoord1;
+
+
+#version 110
+
+void f() {
+	gl_MultiTexCoord1 = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord2.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord2.vert
new file mode 100644
index 0000000..076329f
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord2.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_MultiTexCoord2;
+
+
+#version 110
+
+void f() {
+	gl_MultiTexCoord2 = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord3.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord3.vert
new file mode 100644
index 0000000..08f02d0
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord3.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_MultiTexCoord3;
+
+
+#version 110
+
+void f() {
+	gl_MultiTexCoord3 = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord4.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord4.vert
new file mode 100644
index 0000000..aef83d2
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord4.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_MultiTexCoord4;
+
+
+#version 110
+
+void f() {
+	gl_MultiTexCoord4 = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord5.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord5.vert
new file mode 100644
index 0000000..fa71038
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord5.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_MultiTexCoord5;
+
+
+#version 110
+
+void f() {
+	gl_MultiTexCoord5 = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord6.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord6.vert
new file mode 100644
index 0000000..9526a46
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord6.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_MultiTexCoord6;
+
+
+#version 110
+
+void f() {
+	gl_MultiTexCoord6 = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord7.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord7.vert
new file mode 100644
index 0000000..bb5439a
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-multitexcoord7.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_MultiTexCoord7;
+
+
+#version 110
+
+void f() {
+	gl_MultiTexCoord7 = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-normal.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-normal.vert
new file mode 100644
index 0000000..ee8cc04
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-normal.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_Normal;
+
+
+#version 110
+
+void f() {
+	gl_Normal = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-secondary-color.frag b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-secondary-color.frag
new file mode 100644
index 0000000..a4b577c
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-secondary-color.frag
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.6 of the GLSL 1.10 spec:
+//     A fragment shader can not write to a varying variable.
+//
+// From section 7.6 of the GLSL 1.10 spec:
+//     The following varying variables are available to read from in a fragment shader.
+//         ...
+//     varying vec4 gl_SecondaryColor;
+
+#version 110
+
+void g() {
+    gl_SecondaryColor = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-secondary-color.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-secondary-color.vert
new file mode 100644
index 0000000..68b44a9
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-secondary-color.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_SecondaryColor;
+
+
+#version 110
+
+void f() {
+	gl_SecondaryColor = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-tex-coord.frag b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-tex-coord.frag
new file mode 100644
index 0000000..b32106b
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-tex-coord.frag
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.6 of the GLSL 1.10 spec:
+//     A fragment shader can not write to a varying variable.
+//
+// From section 7.6 of the GLSL 1.10 spec:
+//     The following varying variables are available to read from in a fragment shader.
+//         ...
+//     varying vec4 gl_TexCoord[];
+
+#version 110
+
+void g() {
+    gl_TexCoord[0] = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-vertex.vert b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-vertex.vert
new file mode 100644
index 0000000..6548a39
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-vertex.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.10 spec:
+//     Attribute variables are read-only as far as the vertex shader is
+//     concerned.
+//
+// From section 7.3 of the GLSL 1.10 spec:
+//     The following attribute names are built into the OpenGL vertex
+//     language and can be used from within a vertex shader to access
+//     the current values of attributes declared by OpenGL.
+//         ...
+//     attribute vec4 gl_Vertex;
+
+
+#version 110
+
+void f() {
+	gl_Vertex = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.20/compiler/storage-qualfiers/static-write-point-coord.frag b/tests/spec/glsl-1.20/compiler/storage-qualfiers/static-write-point-coord.frag
new file mode 100644
index 0000000..b2f70b9
--- /dev/null
+++ b/tests/spec/glsl-1.20/compiler/storage-qualfiers/static-write-point-coord.frag
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// [end config]
+//
+// From section 4.3.6 of the GLSL 1.20 spec:
+//     A fragment shader can not write to a varying variable.
+//
+// From section 7.6 of the GLSL 1.20 spec:
+//     The following varying variables are available to read from in a fragment shader.
+//         ...
+//     varying vec2 gl_PointCoord;
+
+#version 120
+
+void g() {
+    gl_PointCoord = vec2(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-clip-distance.frag b/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-clip-distance.frag
new file mode 100644
index 0000000..1dddd59
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-clip-distance.frag
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.30 spec:
+//     Variables declared as in or centroid in may not be written
+//     to during shader execution.
+//
+// From section 7.2 of the GLSL 1.30 spec:
+//     The built-in special variables that are accessible from a
+//     fragment shader are intrinsically declared as follows:
+//         ...
+//     in float gl_ClipDistance[];
+
+#version 130
+
+void g() {
+    gl_ClipDistance[0] = 0.0;
+}
diff --git a/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-vertex-id.vert b/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-vertex-id.vert
new file mode 100644
index 0000000..811bc4d
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-vertex-id.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From section 4.3.4 of the GLSL 1.30 spec:
+//     Variables declared as in or centroid in may not be written
+//     to during shader execution.
+//
+// From section 7.1 of the GLSL 1.30 spec:
+//     These built-in vertex shader variables for communicating with
+//     fixed functionality are intrinsically declared as follows:
+//         ...
+//     in int gl_VertexID;
+
+#version 130
+
+void g() {
+    gl_VertexID = 0;
+}
-- 
1.7.6.4



More information about the Piglit mailing list