blob: 8a2d327b59b23cdda57cc3f2b6f6083a491ccec8 [file] [log] [blame]
dan sinclair949fa992024-09-16 17:26:13 +00001#version 310 es
dan sinclair6e93ca52024-08-28 23:58:04 +00002
dan sinclair949fa992024-09-16 17:26:13 +00003int a = 0;
4float b = 0.0f;
dan sinclairab4e99f2024-09-28 05:08:57 +00005float tint_float_modulo(float x, float y) {
6 return (x - (y * trunc((x / y))));
7}
dan sinclair949fa992024-09-16 17:26:13 +00008int tint_mod_i32(int lhs, int rhs) {
dan sinclair22f76822024-09-23 18:37:09 +00009 uint v = uint((lhs == (-2147483647 - 1)));
10 bool v_1 = bool((v & uint((rhs == -1))));
11 uint v_2 = uint((rhs == 0));
dan sinclaira6300bf2024-09-27 23:48:30 +000012 int v_3 = mix(rhs, 1, bool((v_2 | uint(v_1))));
dan sinclair22f76822024-09-23 18:37:09 +000013 return (lhs - ((lhs / v_3) * v_3));
dan sinclair949fa992024-09-16 17:26:13 +000014}
15int tint_div_i32(int lhs, int rhs) {
dan sinclair22f76822024-09-23 18:37:09 +000016 uint v_4 = uint((lhs == (-2147483647 - 1)));
17 bool v_5 = bool((v_4 & uint((rhs == -1))));
18 uint v_6 = uint((rhs == 0));
dan sinclaira6300bf2024-09-27 23:48:30 +000019 return (lhs / mix(rhs, 1, bool((v_6 | uint(v_5)))));
dan sinclair949fa992024-09-16 17:26:13 +000020}
21void foo(int maybe_zero) {
22 a = tint_div_i32(a, maybe_zero);
23 a = tint_mod_i32(a, maybe_zero);
24 b = (b / 0.0f);
dan sinclairab4e99f2024-09-28 05:08:57 +000025 b = tint_float_modulo(b, 0.0f);
dan sinclair22f76822024-09-23 18:37:09 +000026 float v_7 = float(maybe_zero);
27 b = (b / v_7);
28 float v_8 = float(maybe_zero);
dan sinclairab4e99f2024-09-28 05:08:57 +000029 b = tint_float_modulo(b, v_8);
dan sinclair949fa992024-09-16 17:26:13 +000030}
31layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
32void main() {
33}