[Piglit] [PATCH] Test bad interaction with optimizer and a uniform array as a function argument.

Matt Turner mattst88 at gmail.com
Tue Sep 3 14:51:16 PDT 2013


These test that a uniform array used only as a function argument is not
improperly optimized out or has its length reduced.

Cc: Dominik Behr <dbehr at chromium.org>
Reported-by: Dominik Behr <dbehr at chromium.org>
---
 .../glsl-fs-max-array-access-forward-declaration.frag    | 16 ++++++++++++++++
 tests/shaders/glsl-fs-max-array-access-function.frag     | 14 ++++++++++++++
 .../glsl-vs-max-array-access-forward-declaration.vert    | 16 ++++++++++++++++
 tests/shaders/glsl-vs-max-array-access-function.vert     | 15 +++++++++++++++
 4 files changed, 61 insertions(+)
 create mode 100644 tests/shaders/glsl-fs-max-array-access-forward-declaration.frag
 create mode 100644 tests/shaders/glsl-fs-max-array-access-function.frag
 create mode 100644 tests/shaders/glsl-vs-max-array-access-forward-declaration.vert
 create mode 100644 tests/shaders/glsl-vs-max-array-access-function.vert

diff --git a/tests/shaders/glsl-fs-max-array-access-forward-declaration.frag b/tests/shaders/glsl-fs-max-array-access-forward-declaration.frag
new file mode 100644
index 0000000..e92859b
--- /dev/null
+++ b/tests/shaders/glsl-fs-max-array-access-forward-declaration.frag
@@ -0,0 +1,16 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.10
+// [end config]
+
+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];
+}
diff --git a/tests/shaders/glsl-fs-max-array-access-function.frag b/tests/shaders/glsl-fs-max-array-access-function.frag
new file mode 100644
index 0000000..a3208dc
--- /dev/null
+++ b/tests/shaders/glsl-fs-max-array-access-function.frag
@@ -0,0 +1,14 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.10
+// [end config]
+
+uniform float a[3];
+
+float func(float array[3]) {
+	return array[2];
+}
+
+void main() {
+	gl_FragColor = vec4(func(a), vec3(1.0));
+}
diff --git a/tests/shaders/glsl-vs-max-array-access-forward-declaration.vert b/tests/shaders/glsl-vs-max-array-access-forward-declaration.vert
new file mode 100644
index 0000000..4306e78
--- /dev/null
+++ b/tests/shaders/glsl-vs-max-array-access-forward-declaration.vert
@@ -0,0 +1,16 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.10
+// [end config]
+
+uniform float a[3];
+
+float func(float array[3]);
+
+void main() {
+	gl_Position = vec4(func(a), vec3(1.0));
+}
+
+float func(float array[3]) {
+	return array[2];
+}
diff --git a/tests/shaders/glsl-vs-max-array-access-function.vert b/tests/shaders/glsl-vs-max-array-access-function.vert
new file mode 100644
index 0000000..45592c5
--- /dev/null
+++ b/tests/shaders/glsl-vs-max-array-access-function.vert
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.10
+// [end config]
+
+uniform float a[3];
+
+float func(float array[3]) {
+	return array[2];
+}
+
+void main()
+{
+	gl_Position = vec4(func(a), vec3(1.0));
+}
-- 
1.8.3.2



More information about the Piglit mailing list