skia2/tests/sksl/shared/NumberConversions.sksl
John Stiles ab4ab20fcf Migrate most SkSL tests currently in /glsl/ to /shared/.
These tests will also be used for Metal and SPIR-V testing. A small
handful of GLSL-specific stragglers (#version-specific or type-precision
related) will remain in /glsl/.

Change-Id: I7f2b2bd92825c327922c8ce74e438d2daa440dff
Bug: skia:10649
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319408
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-09-25 17:13:53 +00:00

44 lines
1.1 KiB
Plaintext

short s = short(sqrt(1));
int i = int(sqrt(1));
ushort us = ushort(sqrt(1));
uint ui = uint(sqrt(1));
half h = half(sqrt(1));
float f = sqrt(1);
short s2s = s;
short i2s = short(i);
short us2s = short(us);
short ui2s = short(ui);
short h2s = short(h);
short f2s = short(f);
int s2i = s;
int i2i = i;
int us2i = int(us);
int ui2i = int(ui);
int h2i = int(h);
int f2i = int(f);
ushort s2us = ushort(s);
ushort i2us = ushort(i);
ushort us2us = us;
ushort ui2us = ushort(ui);
ushort h2us = ushort(h);
ushort f2us = ushort(f);
uint s2ui = uint(s);
uint i2ui = uint(i);
uint us2ui = us;
uint ui2ui = ui;
uint h2ui = uint(h);
uint f2ui = uint(f);
float s2f = s;
float i2f = i;
float us2f = us;
float ui2f = ui;
float h2f = h;
float f2f = f;
void main() {
sk_FragColor.r = half(s + i + us + half(ui) + h + f + s2s + i2s + us2s + ui2s + h2s + f2s +
s2i + i2i + us2i + ui2i + h2i + f2i + s2us + i2us + us2us);
sk_FragColor.r += half(ui2us + h2us + f2us + half(s2ui) + half(i2ui) + half(us2ui) + half(ui2ui)
+ half(h2ui) + half(f2ui) + s2f + i2f + us2f + ui2f + h2f + f2f);
}