[Piglit] [PATCH 2/2] Verify that built-in shader inputs are read-only.
Paul Berry
stereotype441 at gmail.com
Thu Nov 10 11:38:26 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_ClipDistance (a GLSL 1.30 feature)
---
.../storage-qualfiers/static-write-color.vert | 22 ++++++++++++++++++++
.../storage-qualfiers/static-write-fog-coord.vert | 22 ++++++++++++++++++++
.../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.vert | 22 ++++++++++++++++++++
.../storage-qualfiers/static-write-vertex.vert | 22 ++++++++++++++++++++
.../static-write-clip-distance.frag | 20 ++++++++++++++++++
.../storage-qualifiers/static-write-in-direct.vert | 18 ++++++++++++++++
.../static-write-in-indirect.vert | 21 +++++++++++++++++++
.../storage-qualifiers/static-write-vertex-id.vert | 20 ++++++++++++++++++
19 files changed, 393 insertions(+), 0 deletions(-)
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-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.vert
create mode 100644 tests/spec/glsl-1.10/compiler/storage-qualfiers/static-write-vertex.vert
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-in-direct.vert
create mode 100644 tests/spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-indirect.vert
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.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-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.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-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.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-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);
+}
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