xref: /aosp_15_r20/external/skia/tests/sksl/shared/SampleLocations.hlsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1static float4 gl_Position;
2static int gl_VertexIndex;
3static int gl_InstanceIndex;
4static float2 vcoord_Stage0;
5
6struct SPIRV_Cross_Input
7{
8    uint gl_VertexIndex : SV_VertexID;
9    uint gl_InstanceIndex : SV_InstanceID;
10};
11
12struct SPIRV_Cross_Output
13{
14    noperspective float2 vcoord_Stage0 : TEXCOORD1;
15    float4 gl_Position : SV_Position;
16};
17
18void vert_main()
19{
20    int _22 = gl_InstanceIndex % 200;
21    int x = _22;
22    int _25 = gl_InstanceIndex / 200;
23    int y = _25;
24    int _31 = (gl_InstanceIndex * 929) % 17;
25    int ileft = _31;
26    int _40 = (_31 + 1) + ((gl_InstanceIndex * 1637) % (17 - _31));
27    int iright = _40;
28    int _45 = (gl_InstanceIndex * 313) % 17;
29    int itop = _45;
30    int _53 = (_45 + 1) + ((gl_InstanceIndex * 1901) % (17 - _45));
31    int ibot = _53;
32    float outset = 0.03125f;
33    float _63 = 0.0f;
34    if (0 == ((_22 + _25) % 2))
35    {
36        _63 = -0.03125f;
37    }
38    else
39    {
40        _63 = 0.03125f;
41    }
42    outset = _63;
43    float _73 = (float(_31) * 0.0625f) - _63;
44    float l = _73;
45    float _77 = (float(_40) * 0.0625f) + _63;
46    float r = _77;
47    float t = (float(_45) * 0.0625f) - _63;
48    float b = (float(_53) * 0.0625f) + _63;
49    float _92 = 0.0f;
50    if (0 == (gl_VertexIndex % 2))
51    {
52        _92 = _73;
53    }
54    else
55    {
56        _92 = _77;
57    }
58    float2 vertexpos = 0.0f.xx;
59    vertexpos.x = float(_22) + _92;
60    float _104 = 0.0f;
61    if (0 == (gl_VertexIndex / 2))
62    {
63        _104 = t;
64    }
65    else
66    {
67        _104 = b;
68    }
69    vertexpos.y = float(y) + _104;
70    vcoord_Stage0.x = float((0 == (gl_VertexIndex % 2)) ? (-1) : 1);
71    vcoord_Stage0.y = float((0 == (gl_VertexIndex / 2)) ? (-1) : 1);
72    gl_Position = float4(vertexpos.x, vertexpos.y, 0.0f, 1.0f);
73}
74
75SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
76{
77    gl_VertexIndex = int(stage_input.gl_VertexIndex);
78    gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
79    vert_main();
80    SPIRV_Cross_Output stage_output;
81    stage_output.gl_Position = gl_Position;
82    stage_output.vcoord_Stage0 = vcoord_Stage0;
83    return stage_output;
84}
85