summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Simiklit <andrii.simiklit@globallogic.com>2019-08-07 16:04:15 +0300
committerAndrii Simiklit <asimiklit.work@gmail.com>2020-02-14 12:46:02 +0200
commit4a1393708d50d18c239e103a49cd9f47345f75aa (patch)
tree47c7c8028194eb63abc1b2b335303ca56fc352df
parentf43cdc5e8e4880c74fa34d03ac53d92197aed8c5 (diff)
glsl-arrays-copy-size-mismatch: Add test case for nir_opt_find_array_copies
This test checks that nir_opt_find_array_copies handles correctly cases where arrays have a different length. copy_deref creation for arrays with different lengths leads to assertion in places like: "assert(glsl_get_length(parent->type) == glsl_get_length(leader_parent->type));" v2: aoa was used v3: increased the required glsl version to 1.2 due to GL_ARB_arrays_of_arrays ( Danylo Piliaiev <danylo.piliaiev@globallogic.com> ) Acked-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111286 Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
-rw-r--r--tests/shaders/glsl-arrays-copy-size-mismatch.shader_test61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/shaders/glsl-arrays-copy-size-mismatch.shader_test b/tests/shaders/glsl-arrays-copy-size-mismatch.shader_test
new file mode 100644
index 000000000..32395ed41
--- /dev/null
+++ b/tests/shaders/glsl-arrays-copy-size-mismatch.shader_test
@@ -0,0 +1,61 @@
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+#version 120
+#extension GL_ARB_separate_shader_objects: require
+#extension GL_ARB_arrays_of_arrays: require
+uniform vec4 incolor[4];
+in vec4 piglit_vertex;
+out vec4 vs_data[1][1][4];
+
+void main()
+{
+ vs_data[0][0][0] = incolor[0];
+ vs_data[0][0][1] = incolor[1];
+ vs_data[0][0][2] = incolor[2];
+ vs_data[0][0][3] = incolor[3];
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 120
+#extension GL_ARB_separate_shader_objects: require
+#extension GL_ARB_arrays_of_arrays: require
+uniform int idx;
+uniform int idx2;
+in vec4 vs_data[1][1][4];
+out vec4 out_put;
+
+void main()
+{
+ vec4 temp[3][3];
+ temp[0][0] = vs_data[0][0][0];
+ temp[0][1] = vs_data[0][0][1];
+ temp[0][2] = vs_data[0][0][2];
+
+ out_put = temp[idx2][idx];
+}
+
+[test]
+uniform vec4 incolor[0] 1.0 0.0 0.0 0.0
+uniform vec4 incolor[1] 0.0 1.0 0.0 0.0
+uniform vec4 incolor[2] 0.0 0.0 1.0 0.0
+uniform vec4 incolor[3] 1.0 1.0 1.0 0.0
+uniform int idx2 0
+#color 0
+clear color 0.0 0.0 0.0 0.0
+clear
+uniform int idx 0
+draw rect -1 -1 2 2
+probe all rgba 1.0 0.0 0.0 0.0
+#color 1
+clear
+uniform int idx 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 0.0
+#color 2
+clear
+uniform int idx 2
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.0 1.0 0.0 \ No newline at end of file