[13/15] arb_gpu_shader_int64: test two operands with indirect access simultaneously

Submitted by Marek Olšák on March 26, 2018, 11:32 p.m.

Details

Message ID 20180326233255.18529-13-maraeo@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Marek Olšák March 26, 2018, 11:32 p.m.
From: Nicolai Hähnle <nicolai.haehnle@amd.com>

This hits a bug in Mesa st/glsl_to_tgsi.
---
 .../indirect-array-two-accesses.shader_test        | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test b/tests/spec/arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test
new file mode 100644
index 000000000..e48f20c50
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test
@@ -0,0 +1,61 @@ 
+# Test an i64vec4 arithmetic operation that uses indirect array accesses in
+# both operands.
+
+[require]
+GLSL >= 1.40
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 140
+
+#extension GL_ARB_gpu_shader_int64: require
+
+uniform int u_src[5];
+uniform int u_idx1, u_idx2;
+uniform ivec4 u_expected;
+
+out vec4 outcolor;
+
+void main() {
+  i64vec4 t[5];
+  for (int i = 0; i < 5; ++i) {
+    for (int j = 0; j < 4; ++j)
+      t[i][j] = int(u_src[i]) + j;
+  }
+
+  i64vec4 sum = t[u_idx1] + t[u_idx2];
+
+  outcolor = vec4(0, 1, 0, 1);
+  for (int i = 0; i < 4; ++i) {
+    if (sum[i] != u_expected[i])
+      outcolor = vec4(1, float(i) / 255,
+                      float(sum[i]) / 255,
+                      float(u_expected[i]) / 255);
+  }
+}
+
+[test]
+clear color 0.0 0.0 0.0 1.0
+clear
+
+uniform int u_src[0] 12
+uniform int u_src[1] 3
+uniform int u_src[2] 7
+uniform int u_src[3] 19
+uniform int u_src[4] 11
+
+uniform int u_idx1 1
+uniform int u_idx2 4
+uniform ivec4 u_expected 14 16 18 20
+
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1
+
+uniform int u_idx1 0
+uniform int u_idx2 2
+uniform ivec4 u_expected 19 21 23 25
+
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1