skia2/tests/sksl/runtime/ConversionConstructors.rte
John Stiles 32d68537a8 Add SkVM support for conversion constructors to and from boolean.
Change-Id: Ia4a1c38161046b94dc56a1a76704766f1e14aab7
Bug: skia:11131
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350019
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-06 15:23:09 +00:00

14 lines
289 B
Plaintext

uniform half f;
uniform int i;
uniform bool b;
half4 main() {
// Covers float -> bool, bool -> float, int -> float
half x = bool(f) ? half(b) : half(i);
// Covers int -> bool, bool -> int, float -> int
int y = bool(i) ? int(b) : int(f);
return half4(x) * half(y);
}