xref: /aosp_15_r20/external/skia/resources/sksl/shared/IntegerDivisionES3.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform half4 colorGreen;
2
3int exact_division(int x, int y) {
4    int result = 0;
5    while (x >= y) {
6        ++result;
7        x -= y;
8    }
9    return result;
10}
11
12half4 main(float2 coords) {
13    int zero = int(colorGreen.r);
14    int one  = int(colorGreen.g);
15
16    for (int x = zero; x < 100; ++x) {
17        for (int y = one; y < 100; ++y) {
18            if ((x/y) != exact_division(x, y)) {
19                return half4(1, float(x) / 255, float(y) / 255, 1);
20            }
21        }
22    }
23
24    return colorGreen;
25}
26