diff options
author | Matt Turner <mattst88@gmail.com> | 2013-04-21 16:22:22 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2013-04-30 15:44:58 -0700 |
commit | 0c0f2a1cd55481d747b9571aaeab8b10683fd5a1 (patch) | |
tree | ba4006e852bb5b63da59591a34364cbfef3cd99d | |
parent | b92c0774decaaf5fa37f4b4c1578d4e3d5f215eb (diff) |
arb_gpu_shader5: Add a constant eval findMSB execution test.
v2: Subtract return value from 31 to get the count in LSB terms.
Call nonexistent bad_constant_folding() function if test fails.
-rw-r--r-- | tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findMSB.shader_test | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findMSB.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findMSB.shader_test new file mode 100644 index 000000000..fec20f166 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findMSB.shader_test @@ -0,0 +1,58 @@ +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader] +in vec4 vertex; + +void main() { + gl_Position = vertex; +} + +[fragment shader] +#extension GL_ARB_gpu_shader5 : enable + +void bad_constant_folding(); + +out vec4 color; + +void main() +{ + /* Green if both pass. */ + color = vec4(0.0, 1.0, 0.0, 1.0); + + if (ivec4(-1) != findMSB(ivec4(0, -1, -1, 0))) + bad_constant_folding(); + + if (ivec4(-1) != findMSB(uvec4(0u))) + bad_constant_folding(); + + if (ivec4(0, 1, 1, 2) != findMSB(ivec4(1, 2, 3, 4))) + bad_constant_folding(); + + if (ivec4(30, 29, 28, 27) != findMSB(ivec4(2147483647, 1073741823, 536870911, 268435455))) + bad_constant_folding(); + + if (ivec4(0, 1, 2, 3) != findMSB(ivec4(-2, -3, -5, -9))) + bad_constant_folding(); + + if (ivec4(30, 30, 29, 28) != findMSB(ivec4(-2147483648, -1879048192, -1073741824, -536870912))) + bad_constant_folding(); + + if (ivec4(0, 1, 1, 2) != findMSB(uvec4(1u, 2u, 3u, 4u))) + bad_constant_folding(); + + if (ivec4(31, 30, 29, 28) != findMSB(uvec4(0xFFFFFFFFu, 0x7FFFFFFFu, 0x3FFFFFFFu, 0x1FFFFFFFu))) + bad_constant_folding(); +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 1.0 |