[Piglit] [PATCH] shaders: Add non-trivial integer multiplication test.

Matt Turner mattst88 at gmail.com
Fri May 15 16:33:30 PDT 2015


---
Incorrectly setting force_sechalf = true on the first mov(8) in the patch

	i965/fs: Support integer multiplication in SIMD16 on Haswell.

will cause there to be small amounts of noise in the image generated by
this patch.

 .../glsl-fs-integer-multiplication.shader_test     | 130 +++++++++++++++++++++
 1 file changed, 130 insertions(+)
 create mode 100644 tests/shaders/glsl-fs-integer-multiplication.shader_test

diff --git a/tests/shaders/glsl-fs-integer-multiplication.shader_test b/tests/shaders/glsl-fs-integer-multiplication.shader_test
new file mode 100644
index 0000000..5b1936d
--- /dev/null
+++ b/tests/shaders/glsl-fs-integer-multiplication.shader_test
@@ -0,0 +1,130 @@
+# Test integer multiplication where 2x2 subspans of fragments do not
+# necessarily write the same color and some fragments may be disabled.
+#
+# In a 250x250 window, the test draws 36 250x7 rectangles. A height of 7 is
+# chosen to generate 2x2 subspans with some fragments disabled.
+#
+# Each of these rectangles is shaded with an identical 25-step gradient,
+# producing 25 columns that can be checked with "probe rect rgba".
+#
+# This C program generates the "probe rect rgba" tests, modulo minor manual
+# changes at the right and left boundaries of the image.
+#
+#
+# #include <math.h>
+# #include <stdio.h>
+#
+# int main() {
+#     float coord = 0.5;
+#
+#     for (int i = 1; i < 250; i += 10, coord += 1.0f) {
+#         int int_coord = coord * 10;
+#         float f = (float)int_coord / 10.0;
+#
+#         printf("probe rect rgba (%3d, %d, %d, %d) (%.2f, %.2f, %.2f, %.2f)\n",
+#                i, 0, 10, 250,
+#                ceilf(f) / 25.0f, ceilf(f) / 25.0f, 0.0, 1.0);
+#     }
+#
+#     return 0;
+# }
+#
+# This test is designed to detect bugs in i965's integer multiplication. In
+# SIMD16 mode on Gen7+ only 8 values can be multiplied at once, so the first
+# 8 fragments must be handled separately from the second 8 fragments. If
+# channel enables are not correct, small amounts of noise will appear in this
+# test.
+#
+# Borrows heavily from glsl-fs-ceil.shader_test.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+void main()
+{
+	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+}
+
+[fragment shader]
+uniform int i;
+
+void main()
+{
+    int coord = int(gl_FragCoord.x) * i;
+    float f = float(coord) / 100.0;
+
+    /* Divide by 25.0 to bring it into the [0, 1] range. */
+    gl_FragColor = vec4(ceil(f) / 25.0, ceil(f) / 25.0, 0.0, 1.0);
+}
+
+[test]
+ortho
+
+uniform int i 10
+
+# Draw horizontal rectangles
+draw rect 0   0 250 7
+draw rect 0   7 250 7
+draw rect 0  14 250 7
+draw rect 0  21 250 7
+draw rect 0  28 250 7
+draw rect 0  35 250 7
+draw rect 0  42 250 7
+draw rect 0  49 250 7
+draw rect 0  56 250 7
+draw rect 0  63 250 7
+draw rect 0  70 250 7
+draw rect 0  77 250 7
+draw rect 0  84 250 7
+draw rect 0  91 250 7
+draw rect 0  98 250 7
+draw rect 0 105 250 7
+draw rect 0 112 250 7
+draw rect 0 119 250 7
+draw rect 0 126 250 7
+draw rect 0 133 250 7
+draw rect 0 140 250 7
+draw rect 0 147 250 7
+draw rect 0 154 250 7
+draw rect 0 161 250 7
+draw rect 0 168 250 7
+draw rect 0 175 250 7
+draw rect 0 182 250 7
+draw rect 0 189 250 7
+draw rect 0 196 250 7
+draw rect 0 203 250 7
+draw rect 0 210 250 7
+draw rect 0 217 250 7
+draw rect 0 224 250 7
+draw rect 0 231 250 7
+draw rect 0 238 250 7
+draw rect 0 245 250 7
+
+# Probe vertical rectangles
+probe rect rgba (  0, 0,  1, 250) (0.00, 0.00, 0.0, 1.0)
+probe rect rgba (  1, 0, 10, 250) (0.04, 0.04, 0.0, 1.0)
+probe rect rgba ( 11, 0, 10, 250) (0.08, 0.08, 0.0, 1.0)
+probe rect rgba ( 21, 0, 10, 250) (0.12, 0.12, 0.0, 1.0)
+probe rect rgba ( 31, 0, 10, 250) (0.16, 0.16, 0.0, 1.0)
+probe rect rgba ( 41, 0, 10, 250) (0.20, 0.20, 0.0, 1.0)
+probe rect rgba ( 51, 0, 10, 250) (0.24, 0.24, 0.0, 1.0)
+probe rect rgba ( 61, 0, 10, 250) (0.28, 0.28, 0.0, 1.0)
+probe rect rgba ( 71, 0, 10, 250) (0.32, 0.32, 0.0, 1.0)
+probe rect rgba ( 81, 0, 10, 250) (0.36, 0.36, 0.0, 1.0)
+probe rect rgba ( 91, 0, 10, 250) (0.40, 0.40, 0.0, 1.0)
+probe rect rgba (101, 0, 10, 250) (0.44, 0.44, 0.0, 1.0)
+probe rect rgba (111, 0, 10, 250) (0.48, 0.48, 0.0, 1.0)
+probe rect rgba (121, 0, 10, 250) (0.52, 0.52, 0.0, 1.0)
+probe rect rgba (131, 0, 10, 250) (0.56, 0.56, 0.0, 1.0)
+probe rect rgba (141, 0, 10, 250) (0.60, 0.60, 0.0, 1.0)
+probe rect rgba (151, 0, 10, 250) (0.64, 0.64, 0.0, 1.0)
+probe rect rgba (161, 0, 10, 250) (0.68, 0.68, 0.0, 1.0)
+probe rect rgba (171, 0, 10, 250) (0.72, 0.72, 0.0, 1.0)
+probe rect rgba (181, 0, 10, 250) (0.76, 0.76, 0.0, 1.0)
+probe rect rgba (191, 0, 10, 250) (0.80, 0.80, 0.0, 1.0)
+probe rect rgba (201, 0, 10, 250) (0.84, 0.84, 0.0, 1.0)
+probe rect rgba (211, 0, 10, 250) (0.88, 0.88, 0.0, 1.0)
+probe rect rgba (221, 0, 10, 250) (0.92, 0.92, 0.0, 1.0)
+probe rect rgba (231, 0, 10, 250) (0.96, 0.96, 0.0, 1.0)
+probe rect rgba (241, 0,  9, 250) (1.00, 1.00, 0.0, 1.0)
-- 
2.3.6



More information about the Piglit mailing list