| |
| out vec4 sk_FragColor; |
| uniform vec4 colorRed; |
| uniform vec4 colorGreen; |
| bool test_matrix_op_matrix_half_b() { |
| bool ok = true; |
| { |
| const mat3 splat_4 = mat3(4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0); |
| const mat3 splat_2 = mat3(2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0); |
| mat3 m; |
| m = mat3(2.0); |
| m += splat_4; |
| ok = ok && m == mat3(6.0, 4.0, 4.0, 4.0, 6.0, 4.0, 4.0, 4.0, 6.0); |
| m = mat3(2.0); |
| m -= splat_4; |
| ok = ok && m == mat3(-2.0, -4.0, -4.0, -4.0, -2.0, -4.0, -4.0, -4.0, -2.0); |
| m = mat3(2.0); |
| m /= splat_4; |
| ok = ok && m == mat3(0.5); |
| m = splat_4; |
| m += mat3(2.0); |
| ok = ok && m == mat3(6.0, 4.0, 4.0, 4.0, 6.0, 4.0, 4.0, 4.0, 6.0); |
| m = splat_4; |
| m -= mat3(2.0); |
| ok = ok && m == mat3(2.0, 4.0, 4.0, 4.0, 2.0, 4.0, 4.0, 4.0, 2.0); |
| m = splat_4; |
| m /= splat_2; |
| ok = ok && m == mat3(2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0); |
| } |
| { |
| mat4 m = mat4(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0); |
| m += mat4(16.0, 15.0, 14.0, 13.0, 12.0, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0); |
| ok = ok && m == mat4(17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0); |
| } |
| { |
| mat2 m = mat2(10.0, 20.0, 30.0, 40.0); |
| m -= mat2(1.0, 2.0, 3.0, 4.0); |
| ok = ok && m == mat2(9.0, 18.0, 27.0, 36.0); |
| } |
| { |
| mat2 m = mat2(2.0, 4.0, 6.0, 8.0); |
| m /= mat2(2.0, 2.0, 2.0, 4.0); |
| ok = ok && m == mat2(1.0, 2.0, 3.0, 2.0); |
| } |
| { |
| mat2 m = mat2(1.0, 2.0, 7.0, 4.0); |
| m *= mat2(3.0, 5.0, 3.0, 2.0); |
| ok = ok && m == mat2(38.0, 26.0, 17.0, 14.0); |
| } |
| { |
| mat3 m = mat3(10.0, 4.0, 2.0, 20.0, 5.0, 3.0, 10.0, 6.0, 5.0); |
| m *= mat3(3.0, 3.0, 4.0, 2.0, 3.0, 4.0, 4.0, 9.0, 2.0); |
| ok = ok && m == mat3(130.0, 51.0, 35.0, 120.0, 47.0, 33.0, 240.0, 73.0, 45.0); |
| } |
| return ok; |
| } |
| vec4 main() { |
| bool _0_ok = true; |
| { |
| const mat3 _1_splat_4 = mat3(4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0); |
| const mat3 _2_splat_2 = mat3(2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0); |
| mat3 _3_m; |
| _3_m = mat3(2.0); |
| _3_m += _1_splat_4; |
| _0_ok = _0_ok && _3_m == mat3(6.0, 4.0, 4.0, 4.0, 6.0, 4.0, 4.0, 4.0, 6.0); |
| _3_m = mat3(2.0); |
| _3_m -= _1_splat_4; |
| _0_ok = _0_ok && _3_m == mat3(-2.0, -4.0, -4.0, -4.0, -2.0, -4.0, -4.0, -4.0, -2.0); |
| _3_m = mat3(2.0); |
| _3_m /= _1_splat_4; |
| _0_ok = _0_ok && _3_m == mat3(0.5); |
| _3_m = _1_splat_4; |
| _3_m += mat3(2.0); |
| _0_ok = _0_ok && _3_m == mat3(6.0, 4.0, 4.0, 4.0, 6.0, 4.0, 4.0, 4.0, 6.0); |
| _3_m = _1_splat_4; |
| _3_m -= mat3(2.0); |
| _0_ok = _0_ok && _3_m == mat3(2.0, 4.0, 4.0, 4.0, 2.0, 4.0, 4.0, 4.0, 2.0); |
| _3_m = _1_splat_4; |
| _3_m /= _2_splat_2; |
| _0_ok = _0_ok && _3_m == mat3(2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0); |
| } |
| { |
| mat4 _4_m = mat4(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0); |
| _4_m += mat4(16.0, 15.0, 14.0, 13.0, 12.0, 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0); |
| _0_ok = _0_ok && _4_m == mat4(17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0); |
| } |
| { |
| mat2 _5_m = mat2(10.0, 20.0, 30.0, 40.0); |
| _5_m -= mat2(1.0, 2.0, 3.0, 4.0); |
| _0_ok = _0_ok && _5_m == mat2(9.0, 18.0, 27.0, 36.0); |
| } |
| { |
| mat2 _6_m = mat2(2.0, 4.0, 6.0, 8.0); |
| _6_m /= mat2(2.0, 2.0, 2.0, 4.0); |
| _0_ok = _0_ok && _6_m == mat2(1.0, 2.0, 3.0, 2.0); |
| } |
| { |
| mat2 _7_m = mat2(1.0, 2.0, 7.0, 4.0); |
| _7_m *= mat2(3.0, 5.0, 3.0, 2.0); |
| _0_ok = _0_ok && _7_m == mat2(38.0, 26.0, 17.0, 14.0); |
| } |
| { |
| mat3 _8_m = mat3(10.0, 4.0, 2.0, 20.0, 5.0, 3.0, 10.0, 6.0, 5.0); |
| _8_m *= mat3(3.0, 3.0, 4.0, 2.0, 3.0, 4.0, 4.0, 9.0, 2.0); |
| _0_ok = _0_ok && _8_m == mat3(130.0, 51.0, 35.0, 120.0, 47.0, 33.0, 240.0, 73.0, 45.0); |
| } |
| return _0_ok && test_matrix_op_matrix_half_b() ? colorGreen : colorRed; |
| } |