skia2/tests/sksl/shared/SampleLocations.vert
John Stiles a65441b3c4 Update tests which mix int and float types without casts.
These need to change because type coercion in SkSL is about to become
more strict in a followup CL; we are disallowing expressions that mix
ints and floats without a cast.

Change-Id: I0f6c3cba53fb67078f447345338262c153236c51
Bug: skia:11164
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353102
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-13 19:47:13 +00:00

23 lines
876 B
GLSL

layout(location=1) noperspective out float2 vcoord_Stage0;
void main()
{
int x = sk_InstanceID % 200;
int y = sk_InstanceID / 200;
int ileft = (sk_InstanceID*929) % 17;
int iright = ileft + 1 + ((sk_InstanceID*1637) % (17 - ileft));
int itop = (sk_InstanceID*313) % 17;
int ibot = itop + 1 + ((sk_InstanceID*1901) % (17 - itop));
float outset = 1/32.0;
outset = (0 == (x + y) % 2) ? -outset : +outset;
float l = float(ileft)/16.0 - outset;
float r = float(iright)/16.0 + outset;
float t = float(itop)/16.0 - outset;
float b = float(ibot)/16.0 + outset;
float2 vertexpos;
vertexpos.x = float(x) + ((0 == (sk_VertexID % 2)) ? l : r);
vertexpos.y = float(y) + ((0 == (sk_VertexID / 2)) ? t : b);
vcoord_Stage0.x = (0 == (sk_VertexID % 2)) ? -1 : +1;
vcoord_Stage0.y = (0 == (sk_VertexID / 2)) ? -1 : +1;
sk_Position = float4(vertexpos.x , vertexpos.y, 0, 1);
}