33fb008669
Because SkSL is much more permissive than GLSL about literal types, we don't actually need to treat values any differently when the `u` suffix is added. That is, `uint x = 4000000000;` already worked fine. When we encounter the `u`, we just ignore it. This also means that a literal like `-100u` would be accepted without complaint (although you'd get a range error if you tried `uint x = -100u;`). The value-add here is that it removes a speed bump when porting GLSL code to SkSL. The Filament example shader used the `u` suffix anywhere that bitwise ops were present; finding and removing all of them was a chore. Also of note: the `u` suffix was only added to GLSL in ES3, but we "support" it everywhere. (We could go out of our way to detect it in ES2 and flag an error, but that benefits no one.) Change-Id: I4bf643612c8cf17710e9bad50a0c16f5936bbe88 Bug: skia:12634 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471756 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
32 lines
751 B
Plaintext
32 lines
751 B
Plaintext
uniform half4 colorGreen, colorRed;
|
|
uniform float unknownInput;
|
|
|
|
half4 main(float2 coords) {
|
|
float x = 1, y = 2;
|
|
int z = 3U;
|
|
x = x - x + y * x * x * (y - x);
|
|
y = x / y / x;
|
|
z = (z / 2u % 3 << 4) >> 2 << 1;
|
|
bool b = (x > 4) == x < 2 || 2 >= unknownInput && y <= x;
|
|
bool c = unknownInput > 2;
|
|
bool d = b ^^ c;
|
|
bool e = b && c;
|
|
bool f = b || c;
|
|
x += 12;
|
|
x -= 12;
|
|
x *= y /= 10;
|
|
z |= 0;
|
|
z &= -1;
|
|
z ^= 0;
|
|
z >>= 2;
|
|
z <<= 4;
|
|
z %= 5;
|
|
x = (colorGreen.xy, 6);
|
|
y = (float(b) * float(c) * float(d) * float(e) * float(f), 6.0);
|
|
z = (colorRed.zw, 6);
|
|
int2 w = int2(~5);
|
|
w = ~w;
|
|
|
|
return (w.x == 5 && w.y == 5 && x == 6 && y == 6 && z == 6) ? colorGreen : colorRed;
|
|
}
|