xref: /aosp_15_r20/external/skia/tests/sksl/shared/ArrayUnsizedParam.wgsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1diagnostic(off, derivative_uniformity);
2diagnostic(off, chromium.unreachable_code);
3struct FSOut {
4  @location(0) sk_FragColor: vec4<f32>,
5};
6struct testStorageBuffer {
7  testArr: array<f32>,
8};
9@group(0) @binding(0) var<storage, read> _storage0 : testStorageBuffer;
10struct testStorageBufferStruct {
11  testArrStruct: array<S>,
12};
13@group(0) @binding(1) var<storage, read> _storage1 : testStorageBufferStruct;
14struct S {
15  y: f32,
16};
17fn unsizedInParameterA_ff(x: ptr<storage, array<f32>, read>) -> f32 {
18  {
19    return (*x)[0];
20  }
21}
22fn unsizedInParameterB_fS(x: ptr<storage, array<S>, read>) -> f32 {
23  {
24    return (*x)[0].y;
25  }
26}
27fn unsizedInParameterC_ff(x: ptr<storage, array<f32>, read>) -> f32 {
28  {
29    return (*x)[0];
30  }
31}
32fn unsizedInParameterD_fS(x: ptr<storage, array<S>, read>) -> f32 {
33  {
34    return (*x)[0].y;
35  }
36}
37fn unsizedInParameterE_ff(_skParam0: ptr<storage, array<f32>, read>) -> f32 {
38  {
39    return 0.0;
40  }
41}
42fn unsizedInParameterF_fS(_skParam0: ptr<storage, array<S>, read>) -> f32 {
43  {
44    return 0.0;
45  }
46}
47fn getColor_h4f(arr: ptr<storage, array<f32>, read>) -> vec4<f32> {
48  {
49    return vec4<f32>(f32((*arr)[0]), f32((*arr)[1]), f32((*arr)[2]), f32((*arr)[3]));
50  }
51}
52fn getColor_helper_h4f(arr: ptr<storage, array<f32>, read>) -> vec4<f32> {
53  {
54    let _skTemp2 = getColor_h4f(arr);
55    return _skTemp2;
56  }
57}
58fn _skslMain(_stageOut: ptr<function, FSOut>) {
59  {
60    let _skTemp3 = getColor_helper_h4f(&(_storage0.testArr));
61    (*_stageOut).sk_FragColor = _skTemp3;
62    let _skTemp4 = unsizedInParameterA_ff(&(_storage0.testArr));
63    let _skTemp5 = unsizedInParameterB_fS(&(_storage1.testArrStruct));
64    let _skTemp6 = unsizedInParameterC_ff(&(_storage0.testArr));
65    let _skTemp7 = unsizedInParameterD_fS(&(_storage1.testArrStruct));
66    let _skTemp8 = unsizedInParameterE_ff(&(_storage0.testArr));
67    let _skTemp9 = unsizedInParameterF_fS(&(_storage1.testArrStruct));
68  }
69}
70@fragment fn main() -> FSOut {
71  var _stageOut: FSOut;
72  _skslMain(&_stageOut);
73  return _stageOut;
74}
75