[Piglit] [PATCH] Test some interactions with multiple inout parameters
Ian Romanick
idr at freedesktop.org
Fri Mar 22 15:04:21 PDT 2013
From: Ian Romanick <ian.d.romanick at intel.com>
There are several variations of
void foo(inout int i, inout float f);
...
foo(i, f[i]);
that Mesa's GLSL compiler gets wrong. NVIDIA's closed-source driver
(version 304.64) fails vs-inout-index-inout-mat2-col.shader_test and
vs-inout-index-inout-mat2-row.shader_test, but passes the others.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
.../vs-inout-index-inout-float-array.shader_test | 35 ++++++++++++++++++++++
.../vs-inout-index-inout-mat2-col.shader_test | 34 +++++++++++++++++++++
.../vs-inout-index-inout-mat2-row.shader_test | 34 +++++++++++++++++++++
...nout-index-inout-vec4-array-element.shader_test | 35 ++++++++++++++++++++++
.../vs-inout-index-inout-vec4-array.shader_test | 35 ++++++++++++++++++++++
.../vs-inout-index-inout-vec4.shader_test | 35 ++++++++++++++++++++++
6 files changed, 208 insertions(+)
create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test
create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test
create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test
create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element.shader_test
create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array.shader_test
create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4.shader_test
diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test
new file mode 100644
index 0000000..3230705
--- /dev/null
+++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test
@@ -0,0 +1,35 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+
+uniform int u = 1;
+varying vec4 color;
+
+void func(inout int i, inout float f)
+{
+ i = 0;
+ f = 1.;
+}
+
+void main()
+{
+ float fa[] = float[](0., 0., 0., 0.);
+ int i = u;
+
+ func(i, fa[i]);
+ color = vec4(fa[0], fa[1], fa[2], fa[3]);
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+draw rect -1 -1 2 2
+relative probe rgb (.5, .5) (0., 1., 0.)
diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test
new file mode 100644
index 0000000..ed01ab6
--- /dev/null
+++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test
@@ -0,0 +1,34 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+uniform int u = 0;
+varying vec4 color;
+
+void func(inout int i, inout float f)
+{
+ i = 0;
+ f = 1.;
+}
+
+void main()
+{
+ mat2 m = mat2(0.);
+ int i = u;
+
+ func(i, m[i][1]);
+ color = vec4(m[0].x, m[0].y, m[1].x, m[1].y);
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+draw rect -1 -1 2 2
+relative probe rgb (.5, .5) (0., 1., 0.)
diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test
new file mode 100644
index 0000000..a12ad78
--- /dev/null
+++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test
@@ -0,0 +1,34 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+uniform int u = 1;
+varying vec4 color;
+
+void func(inout int i, inout float f)
+{
+ i = 0;
+ f = 1.;
+}
+
+void main()
+{
+ mat2 m = mat2(0.);
+ int i = u;
+
+ func(i, m[0][i]);
+ color = vec4(m[0].x, m[0].y, m[1].x, m[1].y);
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+draw rect -1 -1 2 2
+relative probe rgb (.5, .5) (0., 1., 0.)
diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element.shader_test
new file mode 100644
index 0000000..a210d63
--- /dev/null
+++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element.shader_test
@@ -0,0 +1,35 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+
+uniform int u = 1;
+varying vec4 color;
+
+void func(inout int i, inout float f)
+{
+ i = 0;
+ f = 1.;
+}
+
+void main()
+{
+ vec4 v[] = vec4[](vec4(0.), vec4(0.));
+ int i = u;
+
+ func(i, v[1][i]);
+ color = v[1];
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+draw rect -1 -1 2 2
+relative probe rgb (.5, .5) (0., 1., 0.)
diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array.shader_test
new file mode 100644
index 0000000..59aae8e
--- /dev/null
+++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array.shader_test
@@ -0,0 +1,35 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+
+uniform int u = 1;
+varying vec4 color;
+
+void func(inout int i, inout float f)
+{
+ i = 0;
+ f = 1.;
+}
+
+void main()
+{
+ vec4 v[] = vec4[](vec4(0.), vec4(0.));
+ int i = u;
+
+ func(i, v[i].y);
+ color = v[1];
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+draw rect -1 -1 2 2
+relative probe rgb (.5, .5) (0., 1., 0.)
diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4.shader_test
new file mode 100644
index 0000000..60655f4
--- /dev/null
+++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4.shader_test
@@ -0,0 +1,35 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+
+uniform int u = 1;
+varying vec4 color;
+
+void func(inout int i, inout float f)
+{
+ i = 0;
+ f = 1.;
+}
+
+void main()
+{
+ vec4 v = vec4(0.);
+ int i = u;
+
+ func(i, v[i]);
+ color = v;
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+draw rect -1 -1 2 2
+relative probe rgb (.5, .5) (0., 1., 0.)
--
1.8.1.4
More information about the Piglit
mailing list