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

Ian Romanick idr at freedesktop.org
Fri Dec 23 14:48:08 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 ++++++++++++++++++++
 ...tincrement-int-out-parameter-not-an-lvalue.frag |   31 ++++++++++++++++++++
 ...tincrement-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/postincrement-float-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-float-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-int-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-int-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec2-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec2-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec3-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec3-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec4-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec4-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-vec2-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-vec2-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-vec3-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-vec3-out-parameter-not-an-lvalue.vert
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-vec4-out-parameter-not-an-lvalue.frag
 create mode 100644 tests/spec/glsl-1.10/compiler/expressions/postincrement-vec4-out-parameter-not-an-lvalue.vert

diff --git a/tests/spec/glsl-1.10/compiler/expressions/postincrement-float-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/postincrement-float-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..74d3883
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-float-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/postincrement-float-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..920af33
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-int-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/postincrement-int-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..6bd1a95
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-int-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/postincrement-int-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..3f018f1
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-ivec2-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec2-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..080c7bd
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-ivec2-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec2-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..a62e609
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-ivec3-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec3-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..ce2e15a
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-ivec3-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec3-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..28931b0
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-ivec4-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec4-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..1ef8a52
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-ivec4-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/postincrement-ivec4-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..c2d690b
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-vec2-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/postincrement-vec2-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..4ff1597
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-vec2-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/postincrement-vec2-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..8803b35
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-vec3-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/postincrement-vec3-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..7e29971
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-vec3-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/postincrement-vec3-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..5ff4223
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-vec4-out-parameter-not-an-lvalue.frag b/tests/spec/glsl-1.10/compiler/expressions/postincrement-vec4-out-parameter-not-an-lvalue.frag
new file mode 100644
index 0000000..eed7bcd
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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/postincrement-vec4-out-parameter-not-an-lvalue.vert b/tests/spec/glsl-1.10/compiler/expressions/postincrement-vec4-out-parameter-not-an-lvalue.vert
new file mode 100644
index 0000000..329dfe1
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/expressions/postincrement-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