e43714f490
The ES3 spec doesn't mandate that `isnan` actually has to do anything, so the Isnan test is not enabled. (It doesn't work on my personal machine unless I make the NaN detectable at compile-time.) We do not support these functions in constant-expressions, as we currently avoid optimizing anything into a non-finite value; we leave expressions alone if we calculate a NaN/inf result for their value. Change-Id: Ibfdfb47b6e6134165c8780db570de04a916d2bfa Bug: skia:12022 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441581 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
19 lines
713 B
Plaintext
19 lines
713 B
Plaintext
uniform half4 testInputs; // equals (-1.25, 0, 0.75, 2.25)
|
|
uniform half4 colorGreen, colorRed;
|
|
|
|
half4 main(float2 coords) {
|
|
// NOTE: the ES3 spec does not mandate NaN support. This test may not succeed on some GPUs.
|
|
|
|
half4 valueIsNaN = 0 / testInputs.yyyy;
|
|
half4 valueIsNumber = 1 / testInputs;
|
|
|
|
return ( (isnan(valueIsNaN.x)) &&
|
|
all(isnan(valueIsNaN.xy)) &&
|
|
all(isnan(valueIsNaN.xyz)) &&
|
|
all(isnan(valueIsNaN.xyzw)) &&
|
|
! (isnan(valueIsNumber.x)) &&
|
|
!any(isnan(valueIsNumber.xy)) &&
|
|
!any(isnan(valueIsNumber.xyz)) &&
|
|
!any(isnan(valueIsNumber.xyzw))) ? colorGreen : colorRed;
|
|
}
|