xref: /aosp_15_r20/external/skia/tests/sksl/shared/SampleLocations.glsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker
2*c8dee2aaSAndroid Build Coastguard Workerlayout (location = 1) noperspective out vec2 vcoord_Stage0;
3*c8dee2aaSAndroid Build Coastguard Workervoid main() {
4*c8dee2aaSAndroid Build Coastguard Worker    int x = gl_InstanceID % 200;
5*c8dee2aaSAndroid Build Coastguard Worker    int y = gl_InstanceID / 200;
6*c8dee2aaSAndroid Build Coastguard Worker    int ileft = (gl_InstanceID * 929) % 17;
7*c8dee2aaSAndroid Build Coastguard Worker    int iright = (ileft + 1) + (gl_InstanceID * 1637) % (17 - ileft);
8*c8dee2aaSAndroid Build Coastguard Worker    int itop = (gl_InstanceID * 313) % 17;
9*c8dee2aaSAndroid Build Coastguard Worker    int ibot = (itop + 1) + (gl_InstanceID * 1901) % (17 - itop);
10*c8dee2aaSAndroid Build Coastguard Worker    float outset = 0.03125;
11*c8dee2aaSAndroid Build Coastguard Worker    outset = 0 == (x + y) % 2 ? -outset : outset;
12*c8dee2aaSAndroid Build Coastguard Worker    float l = float(ileft) * 0.0625 - outset;
13*c8dee2aaSAndroid Build Coastguard Worker    float r = float(iright) * 0.0625 + outset;
14*c8dee2aaSAndroid Build Coastguard Worker    float t = float(itop) * 0.0625 - outset;
15*c8dee2aaSAndroid Build Coastguard Worker    float b = float(ibot) * 0.0625 + outset;
16*c8dee2aaSAndroid Build Coastguard Worker    vec2 vertexpos;
17*c8dee2aaSAndroid Build Coastguard Worker    vertexpos.x = float(x) + (0 == gl_VertexID % 2 ? l : r);
18*c8dee2aaSAndroid Build Coastguard Worker    vertexpos.y = float(y) + (0 == gl_VertexID / 2 ? t : b);
19*c8dee2aaSAndroid Build Coastguard Worker    vcoord_Stage0.x = float(0 == gl_VertexID % 2 ? -1 : 1);
20*c8dee2aaSAndroid Build Coastguard Worker    vcoord_Stage0.y = float(0 == gl_VertexID / 2 ? -1 : 1);
21*c8dee2aaSAndroid Build Coastguard Worker    gl_Position = vec4(vertexpos.x, vertexpos.y, 0.0, 1.0);
22*c8dee2aaSAndroid Build Coastguard Worker}
23