xref: /aosp_15_r20/external/skia/resources/sksl/errors/SwitchTypes.rts (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform float uf;
2uniform int ui;
3const float cf = 1;
4const int ci = 1;
5int i = 1;
6
7// OK
8void switch_test_uniorm_int_var()  { switch (ui) { case 1: break; } }
9void switch_test_const_int_var()   { switch (ci) { case 1: break; } }
10void switch_case_const_int_var()   { switch (1)  { case ci: break; } }
11
12// Disallowed
13void switch_test_float2()          { switch (float2(1)) { case 1: break; } }
14void switch_case_float2()          { switch (1) { case float2(1): break; } }
15void switch_test_const_float_var() { switch (cf) { case 1: break; } }
16void switch_case_float()           { switch (1) { case 0.5: break; } }
17void switch_case_integral_float()  { switch (1) { case 1.0: break; } }
18void switch_case_uniform_float()   { switch (1) { case uf: break; } }
19void switch_case_uniform_int()     { switch (1) { case ui: break; } }
20void switch_case_const_float_var() { switch (1) { case cf: break; } }
21void switch_case_int_var()         { switch (1) { case i: break; } }
22
23/*%%*
24expected 'int', but found 'float2'
25expected 'int', but found 'float2'
26expected 'int', but found 'float'
27expected 'int', but found 'float'
28expected 'int', but found 'float'
29expected 'int', but found 'float'
30case value must be a constant integer
31expected 'int', but found 'float'
32case value must be a constant integer
33*%%*/
34