summaryrefslogtreecommitdiff
path: root/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test')
-rw-r--r--tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test89
1 files changed, 89 insertions, 0 deletions
diff --git a/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test
new file mode 100644
index 000000000..f6a6ba542
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test
@@ -0,0 +1,89 @@
+[require]
+GL >= 4.0
+GLSL >= 4.00
+GL_ARB_gpu_shader_int64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 400
+#extension GL_ARB_gpu_shader_int64 : require
+
+uniform int64_t ival[] = int64_t[](0xBADDC0DEDEADBEEFl,
+ 0xDEADBEA7BA5EBA11l,
+ 0xF0F1F2F3F4F5F6F7l,
+ 0x0F1F2F3F4F5F6F7Fl,
+ 0x7071727374757677l,
+ 0x0717273747576777l,
+ 0x1F2E3D4C5B6A7988l,
+ 0xBADB100DDEADC0DEl);
+
+const int64_t expected[] = int64_t[](0xFFFFFFFFFFFFFFEFl,
+ 0xFFFFFFFFFFFFFFBAl,
+ 0xFFFFFFFFFFFFFFF5l,
+ 0x000000000000004Fl,
+ 0x0000000000000073l,
+ 0x0000000000000027l,
+ 0x000000000000002El,
+ 0xFFFFFFFFFFFFFFBAl);
+
+out vec4 piglit_fragcolor;
+
+void main()
+{
+ uint fail_mask = 0;
+ uint64_t result;
+ uint i;
+
+ /* This is INTENTIONALLY not a loop. Putting it in a loop causes the
+ * optimization that generates the extract instructions to trigger
+ * before the shift count is known to be a constant. The effectively
+ * prevents the bad code generation in the i965 driver from occuring.
+ */
+ i = 0;
+ result = (ival[i] << (56u - (i * 8u))) >> 56u;
+ fail_mask |= result != expected[i] ? 1u << i : 0u;
+
+ i = 1;
+ result = (ival[i] << (56u - (i * 8u))) >> 56u;
+ fail_mask |= result != expected[i] ? 1u << i : 0u;
+
+ i = 2;
+ result = (ival[i] << (56u - (i * 8u))) >> 56u;
+ fail_mask |= result != expected[i] ? 1u << i : 0u;
+
+ i = 3;
+ result = (ival[i] << (56u - (i * 8u))) >> 56u;
+ fail_mask |= result != expected[i] ? 1u << i : 0u;
+
+ i = 4;
+ result = (ival[i] << (56u - (i * 8u))) >> 56u;
+ fail_mask |= result != expected[i] ? 1u << i : 0u;
+
+ i = 5;
+ result = (ival[i] << (56u - (i * 8u))) >> 56u;
+ fail_mask |= result != expected[i] ? 1u << i : 0u;
+
+ i = 6;
+ result = (ival[i] << (56u - (i * 8u))) >> 56u;
+ fail_mask |= result != expected[i] ? 1u << i : 0u;
+
+ i = 7;
+ result = (ival[i] << (56u - (i * 8u))) >> 56u;
+ fail_mask |= result != expected[i] ? 1u << i : 0u;
+
+ /* Construct a clever color so that just looking at the "Observed:"
+ * output from shader_runner will tell you exactly which values did
+ * not match.
+ */
+ piglit_fragcolor = fail_mask == 0
+ ? vec4(0.0, 1.0, 0.0, 1.0)
+ : vec4(float(fail_mask) / 255.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0