[Piglit] [PATCH] Test bad interaction with optimizer and a uniform array as a function argument.
Matt Turner
mattst88 at gmail.com
Thu Sep 5 14:34:27 PDT 2013
These test that a uniform array used only as a function argument is not
improperly optimized out or has its length reduced.
v2: Use shader_tests to catch bug under non-debug builds.
Cc: Dominik Behr <dbehr at chromium.org>
Reported-by: Dominik Behr <dbehr at chromium.org>
---
...ax-array-access-forward-declaration.shader_test | 30 +++++++++++++++++++
.../glsl-fs-max-array-access-function.shader_test | 28 +++++++++++++++++
...ax-array-access-forward-declaration.shader_test | 35 ++++++++++++++++++++++
.../glsl-vs-max-array-access-function.shader_test | 33 ++++++++++++++++++++
4 files changed, 126 insertions(+)
create mode 100644 tests/shaders/glsl-fs-max-array-access-forward-declaration.shader_test
create mode 100644 tests/shaders/glsl-fs-max-array-access-function.shader_test
create mode 100644 tests/shaders/glsl-vs-max-array-access-forward-declaration.shader_test
create mode 100644 tests/shaders/glsl-vs-max-array-access-function.shader_test
diff --git a/tests/shaders/glsl-fs-max-array-access-forward-declaration.shader_test b/tests/shaders/glsl-fs-max-array-access-forward-declaration.shader_test
new file mode 100644
index 0000000..2f72e15
--- /dev/null
+++ b/tests/shaders/glsl-fs-max-array-access-forward-declaration.shader_test
@@ -0,0 +1,30 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+void main()
+{
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+uniform float a[3];
+
+float func(float array[3]);
+
+void main()
+{
+ gl_FragColor = vec4(func(a), vec3(1.0));
+}
+
+float func(float array[3])
+{
+ return array[2];
+}
+
+[test]
+uniform float a[0] 0.25
+uniform float a[1] 0.5
+uniform float a[2] 0.75
+draw rect -1 -1 2 2
+probe all rgba 0.75 1.0 1.0 1.0
diff --git a/tests/shaders/glsl-fs-max-array-access-function.shader_test b/tests/shaders/glsl-fs-max-array-access-function.shader_test
new file mode 100644
index 0000000..f3d8201
--- /dev/null
+++ b/tests/shaders/glsl-fs-max-array-access-function.shader_test
@@ -0,0 +1,28 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+void main()
+{
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+uniform float a[3];
+
+float func(float array[3])
+{
+ return array[2];
+}
+
+void main()
+{
+ gl_FragColor = vec4(func(a), vec3(1.0));
+}
+
+[test]
+uniform float a[0] 0.25
+uniform float a[1] 0.5
+uniform float a[2] 0.75
+draw rect -1 -1 2 2
+probe all rgba 0.75 1.0 1.0 1.0
diff --git a/tests/shaders/glsl-vs-max-array-access-forward-declaration.shader_test b/tests/shaders/glsl-vs-max-array-access-forward-declaration.shader_test
new file mode 100644
index 0000000..eff1748
--- /dev/null
+++ b/tests/shaders/glsl-vs-max-array-access-forward-declaration.shader_test
@@ -0,0 +1,35 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform float a[3];
+
+float func(float array[3]);
+
+varying vec4 color;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+ color = vec4(func(a), vec3(1.0));
+}
+
+float func(float array[3])
+{
+ return array[2];
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+uniform float a[0] 0.25
+uniform float a[1] 0.5
+uniform float a[2] 0.75
+draw rect -1 -1 2 2
+probe all rgba 0.75 1.0 1.0 1.0
diff --git a/tests/shaders/glsl-vs-max-array-access-function.shader_test b/tests/shaders/glsl-vs-max-array-access-function.shader_test
new file mode 100644
index 0000000..bf92f55
--- /dev/null
+++ b/tests/shaders/glsl-vs-max-array-access-function.shader_test
@@ -0,0 +1,33 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform float a[3];
+
+float func(float array[3])
+{
+ return array[2];
+}
+
+varying vec4 color;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+ color = vec4(func(a), vec3(1.0));
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+uniform float a[0] 0.25
+uniform float a[1] 0.5
+uniform float a[2] 0.75
+draw rect -1 -1 2 2
+probe all rgba 0.75 1.0 1.0 1.0
--
1.8.3.2
More information about the Piglit
mailing list