xref: /aosp_15_r20/external/skia/resources/sksl/wgsl/UniformArrays.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1// Our buffers are in std140 layout, so the generated code will need to compensate.
2
3layout(set=0, binding=1) uniform UniformBuffer {
4    float     uf[3];
5    float2    uf2[3];
6    float3    uf3[3];
7    float4    uf4[3];
8    half      uh[3];
9    half2     uh2[3];
10    half3     uh3[3];
11    half4     uh4[3];
12    int       ui[3];
13    int2      ui2[3];
14    int3      ui3[3];
15    int4      ui4[3];
16};
17
18layout(set=0, binding=2) buffer StorageBuffer {
19    float     sf[4];
20    float2    sf2[4];
21    float3    sf3[4];
22    float4    sf4[4];
23    half      sh[4];
24    half2     sh2[4];
25    half3     sh3[4];
26    half4     sh4[4];
27    int       si[4];
28    int2      si2[4];
29    int3      si3[4];
30    int4      si4[4];
31};
32
33half4 main() {
34    float value = float(uf [1]  ) +
35                  float(uf2[1].x) +
36                  float(uf3[1].x) +
37                  float(uf4[1].x) +
38                  float(uh [1]  ) +
39                  float(uh2[1].x) +
40                  float(uh3[1].x) +
41                  float(uh4[1].x) +
42                  float(ui [1]  ) +
43                  float(ui2[1].x) +
44                  float(ui3[1].x) +
45                  float(ui4[1].x) +
46                  float(sf [1]  ) +
47                  float(sf2[1].x) +
48                  float(sf3[1].x) +
49                  float(sf4[1].x) +
50                  float(sh [1]  ) +
51                  float(sh2[1].x) +
52                  float(sh3[1].x) +
53                  float(sh4[1].x) +
54                  float(si [1]  ) +
55                  float(si2[1].x) +
56                  float(si3[1].x) +
57                  float(si4[1].x);
58    return half4(value);
59}
60