diff options
-rw-r--r-- | tests/spec/arb_gpu_shader_int64/fs-shl-of-shr-int64.shader_test | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/spec/arb_gpu_shader_int64/fs-shl-of-shr-int64.shader_test b/tests/spec/arb_gpu_shader_int64/fs-shl-of-shr-int64.shader_test new file mode 100644 index 000000000..63806d045 --- /dev/null +++ b/tests/spec/arb_gpu_shader_int64/fs-shl-of-shr-int64.shader_test @@ -0,0 +1,43 @@ +[require] +GLSL >= 4.00 +GL_ARB_gpu_shader_int64 + +[vertex shader passthrough] + +[fragment shader] +#extension GL_ARB_gpu_shader_int64: require + +out vec4 piglit_fragcolor; + +void main() +{ + /* The scale factor and the bias values ensure that every fragment will + * generate a value larger than (1 << 32). It also ensures that at least + * some fragments will have some of the low four bits set. + */ + uint64_t a = uint64_t(int(gl_FragCoord.x) + 8179) * + uint64_t(int(gl_FragCoord.y) + 9931) * 1693ul; + + /* This should effectively mask off the low four bits, but leave + * the bits about the 32-bit boundary intact. + */ + uint64_t b = (a >> 4) << 4; + + if (b < (1ul << 32)) + piglit_fragcolor = vec4(1.0, 0.0, 0.0, 1.0); + else { + /* This tries to avoid a possible optimization of (x & y) & ~y -> 0 */ + uint64_t c = b & 31ul; + if (c != 0ul && c != 16ul) + piglit_fragcolor = vec4(0.0, 0.0, 1.0, 1.0); + else + piglit_fragcolor = vec4(0.0, 1.0, 0.0, 1.0); + } +} + +[test] +clear color 0.3 0.3 0.3 0.0 +clear + +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 |