[Piglit] [PATCH 5/8] glsl-1.10: Verify that preincrement is not an l-value for function out parameters

Ian Romanick idr at freedesktop.org
Fri Dec 23 14:48:07 PST 2011


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

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43975
---
 ...ncrement-float-out-parameter-not-an-lvalue.frag |   31 ++++++++++++++++++++
 ...ncrement-float-out-parameter-not-an-lvalue.vert |   31 ++++++++++++++++++++
 ...eincrement-int-out-parameter-not-an-lvalue.frag |   31 ++++++++++++++++++++
 ...eincrement-int-out-parameter-not-an-lvalue.vert |   31 ++++++++++++++++++++
 ...ncrement-ivec2-out-parameter-not-an-lvalue.frag |   31 ++++++++++++++++++++
 ...ncrement-ivec2-out-parameter-not-an-lvalue.vert |   31 ++++++++++++++++++++
 ...ncrement-ivec3-out-parameter-not-an-lvalue.frag |   31 ++++++++++++++++++++
 ...ncrement-ivec3-out-parameter-not-an-lvalue.vert |   31 ++++++++++++++++++++
 ...ncrement-ivec4-out-parameter-not-an-lvalue.frag |   31 ++++++++++++++++++++
 ...ncrement-ivec4-out-parameter-not-an-lvalue.vert |   31 ++++++++++++++++++++
 ...increment-vec2-out-parameter-not-an-lvalue.frag |   31 ++++++++++++++++++++
 ...increment-vec2-out-parameter-not-an-lvalue.vert |   31 ++++++++++++++++++++
 ...increment-vec3-out-parameter-not-an-lvalue.frag |   31 ++++++++++++++++++++
 ...increment-vec3-out-parameter-not-an-lvalue.vert |   31 ++++++++++++++++++++
 ...increment-vec4-out-parameter-not-an-lvalue.frag |   31 ++++++++++++++++++++
 ...increment-vec4-out-parameter-not-an-lvalue.vert |   31 ++++++++++++++++++++
 16 files changed, 496 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-float-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-float-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-int-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-int-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec2-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec2-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec3-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec3-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec4-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec4-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-vec2-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-vec2-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-vec3-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-vec3-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-vec4-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/preincrement-vec4-out-parameter-not-an-lvalue.vert

diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-float-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/preincrement-float-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..38b693b
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-float-out-parameter-not-an-lvalue.frag
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform float u;
+varying vec4 v;
+
+void f(out float p)
+{
+    p = float(v.x);
+}
+
+void main()
+{
+    float t = u;
+
+    f(++t);
+    gl_FragColor = vec4(t, v.yzw);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-float-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/preincrement-float-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..ebbda6e
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-float-out-parameter-not-an-lvalue.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform float u;
+attribute vec4 v;
+
+void f(out float p)
+{
+    p = float(v.x);
+}
+
+void main()
+{
+    float t = u;
+
+    f(++t);
+    gl_Position = vec4(t, v.yzw);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-int-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/preincrement-int-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..57e0b17
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-int-out-parameter-not-an-lvalue.frag
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform int u;
+varying vec4 v;
+
+void f(out int p)
+{
+    p = int(v.x);
+}
+
+void main()
+{
+    int t = u;
+
+    f(++t);
+    gl_FragColor = vec4(t, v.yzw);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-int-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/preincrement-int-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..f9187d1
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-int-out-parameter-not-an-lvalue.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform int u;
+attribute vec4 v;
+
+void f(out int p)
+{
+    p = int(v.x);
+}
+
+void main()
+{
+    int t = u;
+
+    f(++t);
+    gl_Position = vec4(t, v.yzw);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec2-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec2-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..bbbde8c
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec2-out-parameter-not-an-lvalue.frag
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform ivec2 u;
+varying vec4 v;
+
+void f(out ivec2 p)
+{
+    p = ivec2(v.xy);
+}
+
+void main()
+{
+    ivec2 t = u;
+
+    f(++t);
+    gl_FragColor = vec4(t, v.zw);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec2-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec2-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..3ad0ef0
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec2-out-parameter-not-an-lvalue.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform ivec2 u;
+attribute vec4 v;
+
+void f(out ivec2 p)
+{
+    p = ivec2(v.xy);
+}
+
+void main()
+{
+    ivec2 t = u;
+
+    f(++t);
+    gl_Position = vec4(t, v.zw);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec3-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec3-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..1d12ac7
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec3-out-parameter-not-an-lvalue.frag
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform ivec3 u;
+varying vec4 v;
+
+void f(out ivec3 p)
+{
+    p = ivec3(v.xyz);
+}
+
+void main()
+{
+    ivec3 t = u;
+
+    f(++t);
+    gl_FragColor = vec4(t, v.w);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec3-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec3-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..c53abd8
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec3-out-parameter-not-an-lvalue.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform ivec3 u;
+attribute vec4 v;
+
+void f(out ivec3 p)
+{
+    p = ivec3(v.xyz);
+}
+
+void main()
+{
+    ivec3 t = u;
+
+    f(++t);
+    gl_Position = vec4(t, v.w);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec4-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec4-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..1d98558
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec4-out-parameter-not-an-lvalue.frag
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform ivec4 u;
+varying vec4 v;
+
+void f(out ivec4 p)
+{
+    p = ivec4(v);
+}
+
+void main()
+{
+    ivec4 t = u;
+
+    f(++t);
+    gl_FragColor = vec4(t);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec4-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec4-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..1497825
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-ivec4-out-parameter-not-an-lvalue.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform ivec4 u;
+attribute vec4 v;
+
+void f(out ivec4 p)
+{
+    p = ivec4(v);
+}
+
+void main()
+{
+    ivec4 t = u;
+
+    f(++t);
+    gl_Position = vec4(t);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec2-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec2-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..1e9e597
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec2-out-parameter-not-an-lvalue.frag
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform vec2 u;
+varying vec4 v;
+
+void f(out vec2 p)
+{
+    p = vec2(v.xy);
+}
+
+void main()
+{
+    vec2 t = u;
+
+    f(++t);
+    gl_FragColor = vec4(t, v.zw);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec2-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec2-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..572ec7b
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec2-out-parameter-not-an-lvalue.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform vec2 u;
+attribute vec4 v;
+
+void f(out vec2 p)
+{
+    p = vec2(v.xy);
+}
+
+void main()
+{
+    vec2 t = u;
+
+    f(++t);
+    gl_Position = vec4(t, v.zw);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec3-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec3-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..fc2bf44
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec3-out-parameter-not-an-lvalue.frag
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform vec3 u;
+varying vec4 v;
+
+void f(out vec3 p)
+{
+    p = vec3(v.xyz);
+}
+
+void main()
+{
+    vec3 t = u;
+
+    f(++t);
+    gl_FragColor = vec4(t, v.w);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec3-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec3-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..c18d826
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec3-out-parameter-not-an-lvalue.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform vec3 u;
+attribute vec4 v;
+
+void f(out vec3 p)
+{
+    p = vec3(v.xyz);
+}
+
+void main()
+{
+    vec3 t = u;
+
+    f(++t);
+    gl_Position = vec4(t, v.w);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec4-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec4-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..e3be7b3
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec4-out-parameter-not-an-lvalue.frag
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform vec4 u;
+varying vec4 v;
+
+void f(out vec4 p)
+{
+    p = vec4(v);
+}
+
+void main()
+{
+    vec4 t = u;
+
+    f(++t);
+    gl_FragColor = vec4(t);
+}
diff --git a/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec4-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec4-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..fda216e
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/preincrement-vec4-out-parameter-not-an-lvalue.vert
@@ -0,0 +1,31 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ *
+ * Page 32 (page 38 of the PDF) of the GLSL 1.10 spec says:
+ *
+ *     "Variables that are built-in types, entire structures, structure
+ *     fields, l-values with the field selector ( . ) applied to select
+ *     components or swizzles without repeated fields, and l-values
+ *     dereferenced with the array subscript operator ( [ ] ) are all
+ *     l-values. Other binary or unary expressions, non-dereferenced arrays,
+ *     function names, swizzles with repeated fields, and constants cannot be
+ *     l-values.  The ternary operator (?:) is also not allowed as an
+ *     l-value."
+ */
+uniform vec4 u;
+attribute vec4 v;
+
+void f(out vec4 p)
+{
+    p = vec4(v);
+}
+
+void main()
+{
+    vec4 t = u;
+
+    f(++t);
+    gl_Position = vec4(t);
+}
-- 
1.7.6.4



More information about the Piglit mailing list