diff options
Diffstat (limited to '')
-rw-r--r-- | dom/canvas/test/webgl-conf/checkout/deqp/data/gles2/shaders/conditionals.test | 333 |
1 files changed, 333 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/deqp/data/gles2/shaders/conditionals.test b/dom/canvas/test/webgl-conf/checkout/deqp/data/gles2/shaders/conditionals.test new file mode 100644 index 0000000000..7b5f591149 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/deqp/data/gles2/shaders/conditionals.test @@ -0,0 +1,333 @@ +group if "If Statements" + + case single_statement + values + { + input float in0 = [ 0.0 | 1.0 | 2.0 ]; + output float out0 = [ 0.0 | 1.0 | 1.0 ]; + } + + both "" + precision mediump float; + ${DECLARATIONS} + void main() + { + out0 = 0.0; + if (in0 >= 1.0) + out0 = 1.0; + ${OUTPUT} + } + "" + end + + case compound_statement + values + { + input float in0 = [ 0.0 | 1.0 | 2.0 ]; + output float out0 = [ 0.0 | 1.0 | 1.0 ]; + output float out1 = [ 1.0 | 0.0 | 0.0 ]; + } + + both "" + precision mediump float; + ${DECLARATIONS} + void main() + { + out0 = 0.0; + out1 = 1.0; + if (in0 >= 1.0) + { + out0 = 1.0; + out1 = 0.0; + } + ${OUTPUT} + } + "" + end + + case sequence_statements + values + { + input float in0 = [ 0.0 | 1.0 | 2.0 ]; + output float out0 = [ 0.0 | 1.0 | 1.0 ]; + output float out1 = [ 1.0 | 0.0 | 0.0 ]; + } + + both "" + precision mediump float; + ${DECLARATIONS} + void main() + { + out0 = 0.0; + out1 = 1.0; + if (in0 >= 1.0) + out0 = 1.0, out1 = 0.0; + ${OUTPUT} + } + "" + end + + case sequence_condition + values + { + input float in0 = [ 0.0 | 1.0 | 2.0 ]; + output float out0 = [ 0.0 | 1.0 | 1.0 ]; + output float out1 = [ 1.0 | 0.0 | 0.0 ]; + } + + both "" + precision mediump float; + ${DECLARATIONS} + void main() + { + out0 = 0.0; + out1 = 1.0; + if (false, in0 >= 1.0) + out0 = 1.0, out1 = 0.0; + ${OUTPUT} + } + "" + end + + case complex_condition + values + { + input float in0 = [ 0.0 | 1.0 | 2.0 ]; + output float out0 = [ 0.0 | 1.0 | 1.0 ]; + output float out1 = [ 1.0 | 0.0 | 0.0 ]; + } + + both "" + precision mediump float; + ${DECLARATIONS} + void main() + { + out0 = 0.0; + out1 = 1.0; + if (false || (in0 >= 1.0) && (in0 - 2.0*in0 < 0.0)) + out0 = 1.0, out1 = 0.0; + ${OUTPUT} + } + "" + end + + case if_else + values + { + input float in0 = [ 0.0 | 1.0 | 2.0 ]; + output float out0 = [ 0.0 | 1.0 | 1.0 ]; + } + + both "" + precision mediump float; + ${DECLARATIONS} + void main() + { + if (in0 >= 1.0) + out0 = 1.0; + else + out0 = 0.0; + ${OUTPUT} + } + "" + end + + case if_elseif + values + { + input float in0 = [ 0.0 | 1.0 | 2.0 ]; + output float out0 = [ 0.0 | 1.0 | 2.0 ]; + } + + both "" + precision mediump float; + ${DECLARATIONS} + void main() + { + out0 = 0.0; + if (in0 >= 2.0) + out0 = 2.0; + else if (in0 >= 1.0) + out0 = 1.0; + ${OUTPUT} + } + "" + end + + case if_elseif_else + values + { + input float in0 = [ 0.0 | 1.0 | 2.0 ]; + output float out0 = [ 0.0 | 1.0 | 2.0 ]; + } + + both "" + precision mediump float; + ${DECLARATIONS} + void main() + { + if (in0 >= 2.0) + out0 = 2.0; + else if (in0 >= 1.0) + out0 = 1.0; + else + out0 = 0.0; + ${OUTPUT} + } + "" + end + + case mixed_if_elseif_else + values + { + input float in0 = [ 0.0 | 1.0 | 2.0 ]; + output float out0 = [ 0.0 | 1.0 | 2.0 ]; + } + + both "" + precision mediump float; + ${DECLARATIONS} + void main() + { + if (in0 >= 2.0) + { + out0 = 2.0; + } + else if (in0 >= 1.0) + out0 = 2.0, out0 = 1.0; + else + out0 = 0.0; + ${OUTPUT} + } + "" + end + +end # if + +group invalid_if "Invalid If Conditionals" + + case missing_parenthesis + expect compile_fail + both "" + precision mediump float; + void main() + { + if true + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + + case unclosed_parenthesis + expect compile_fail + both "" + precision mediump float; + void main() + { + if (true + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + + case int_condition + expect compile_fail + both "" + precision mediump float; + void main() + { + if (5) + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + + case int_zero_condition + expect compile_fail + both "" + precision mediump float; + void main() + { + if (0) + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + + case int_one_condition + expect compile_fail + both "" + precision mediump float; + void main() + { + if (1) + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + + case int_uniform_condition + expect compile_fail + + both "" + precision mediump float; + precision mediump int; + uniform int u0; + void main() + { + if (u0) + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + + case float_condition + expect compile_fail + both "" + precision mediump float; + void main() + { + if (5.0) + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + + case float_zero_condition + expect compile_fail + both "" + precision mediump float; + void main() + { + if (0.0) + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + + case float_one_condition + expect compile_fail + both "" + precision mediump float; + void main() + { + if (1.0) + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + + case sampler_condition + expect compile_fail + both "" + precision mediump float; + uniform sampler2D s0; + void main() + { + if (s0) + ${POSITION_FRAG_COLOR} = vec4(1.0); + } + "" + end + +end # invalid_if |