[Piglit] [PATCH 2/3] arb_gpu_shader5: add interpolateAtSample tests with input in an array

Nicolai Hähnle nhaehnle at gmail.com
Fri Jun 16 20:34:31 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 ...nterpolateAtSample-array-nonuniform.shader_test | 59 +++++++++++++++++
 ...-interpolateAtSample-array-of-array.shader_test | 76 ++++++++++++++++++++++
 2 files changed, 135 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
 create mode 100644 tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test

diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
new file mode 100644
index 0000000..0aac1ab
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-nonuniform.shader_test
@@ -0,0 +1,59 @@
+# From Section 8.13.2 (Interpolation Functions) of the GLSL 4.50 spec:
+#
+#   "Arrayed inputs can be indexed with general (nonuniform) integer
+#    expressions."
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out vec3 a[2];
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   a[0] = piglit_vertex.xyz;
+   a[1] = piglit_vertex.zxy;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+in vec3 a[2];
+
+out vec4 color;
+
+void main()
+{
+   ivec2 coord = ivec2(gl_FragCoord.xy);
+   int index =
+      /* Generate a pattern where some quads have alternating index on the X-axis,
+       * some on the Y-axis, and some on both or none. */
+      ((coord.x >> 1) & (coord.x)) ^
+      ((coord.y >> 1) & (coord.y)) ^
+      /* Flip the overall orientation of the alternating index within quads. */
+      (coord.x >> 2) ^ (coord.y >> 2);
+
+   index = index & 1;
+
+   /* There is no multi-sampling, so these should be the same. */
+   vec3 delta = a[index] - interpolateAtSample(a[index], 0);
+
+   if (delta != vec3(0.0)) {
+      color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+      color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test
new file mode 100644
index 0000000..8d18cf3
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateAtSample-array-of-array.shader_test
@@ -0,0 +1,76 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays : enable
+
+in vec4 piglit_vertex;
+
+out vec3 a[2][2];
+
+void main()
+{
+   gl_Position = piglit_vertex;
+
+   a[0][0] = piglit_vertex.xyz;
+   a[0][1] = piglit_vertex.zxy;
+   a[1][0] = piglit_vertex.xzy;
+   a[1][1] = piglit_vertex.zyx;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+#extension GL_ARB_arrays_of_arrays : enable
+
+in vec3 a[2][2];
+
+uniform int u_idx;
+
+out vec4 color;
+
+void main()
+{
+   /* There is no multi-sampling, so these should be the same. */
+   vec3 delta = a[u_idx / 2][u_idx % 2] - interpolateAtSample(a[u_idx / 2][u_idx % 2], 0);
+
+   if (delta != vec3(0.0)) {
+      color = vec4(1.0, delta.x + 0.5, delta.y + 0.5, delta.z + 0.5);
+   } else {
+      color = vec4(0.0, 1.0, 0.0, 1.0);
+   }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 1
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 2
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+uniform int u_idx 3
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.9.3



More information about the Piglit mailing list