edac7716aa
In particular, this optimizes abs() and sign() when all inputs are known at compile time. This resolves a TODO on a test case in `IllegalIndexing.rts`. Change-Id: Ica310522a85b42dc7ae255bd25004a6629d04176 Bug: skia:10835 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405676 Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
16 lines
667 B
Plaintext
16 lines
667 B
Plaintext
uniform half4 testInputs; // equals (-1.25, 0, 0.75, 2.25)
|
|
uniform half4 colorGreen, colorRed;
|
|
|
|
half4 main(float2 coords) {
|
|
const half4 constVal = half4(-1.25, 0, 0.75, 2.25);
|
|
half4 expected = half4(-1, 0, 1, 1);
|
|
return (sign(testInputs.x) == expected.x &&
|
|
sign(testInputs.xy) == expected.xy &&
|
|
sign(testInputs.xyz) == expected.xyz &&
|
|
sign(testInputs.xyzw) == expected.xyzw &&
|
|
sign(constVal.x) == expected.x &&
|
|
sign(constVal.xy) == expected.xy &&
|
|
sign(constVal.xyz) == expected.xyz &&
|
|
sign(constVal.xyzw) == expected.xyzw) ? colorGreen : colorRed;
|
|
}
|