xref: /aosp_15_r20/external/skia/tests/sksl/wgsl/UniformMatrices.wgsl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1diagnostic(off, derivative_uniformity);
2diagnostic(off, chromium.unreachable_code);
3struct FSOut {
4  @location(0) sk_FragColor: vec4<f32>,
5};
6struct UniformBuffer {
7  u22: _skMatrix22,
8  u23: mat2x3<f32>,
9  u24: mat2x4<f32>,
10  R_u32: _skMatrix32,
11  u33: mat3x3<f32>,
12  u34: mat3x4<f32>,
13  u42: _skMatrix42,
14  u43: mat4x3<f32>,
15  u44: mat4x4<f32>,
16  au22: array<_skArrayElement_f22, 3>,
17  au23: array<mat2x3<f32>, 3>,
18  au24: array<mat2x4<f32>, 3>,
19  au32: array<_skArrayElement_f32, 3>,
20  au33: array<mat3x3<f32>, 3>,
21  au34: array<mat3x4<f32>, 3>,
22  au42: array<_skArrayElement_f42, 3>,
23  au43: array<mat4x3<f32>, 3>,
24  au44: array<mat4x4<f32>, 3>,
25};
26@group(0) @binding(1) var<uniform> _uniform0 : UniformBuffer;
27struct StorageBuffer {
28  s22: _skMatrix22,
29  s23: mat2x3<f32>,
30  s24: mat2x4<f32>,
31  s32: _skMatrix32,
32  s33: mat3x3<f32>,
33  s34: mat3x4<f32>,
34  s42: _skMatrix42,
35  s43: mat4x3<f32>,
36  s44: mat4x4<f32>,
37  as22: array<_skArrayElement_f22, 3>,
38  as23: array<mat2x3<f32>, 3>,
39  as24: array<mat2x4<f32>, 3>,
40  as32: array<_skArrayElement_f32, 3>,
41  as33: array<mat3x3<f32>, 3>,
42  as34: array<mat3x4<f32>, 3>,
43  as42: array<_skArrayElement_f42, 3>,
44  as43: array<mat4x3<f32>, 3>,
45  as44: array<mat4x4<f32>, 3>,
46};
47@group(0) @binding(2) var<storage, read_write> _storage1 : StorageBuffer;
48fn _skslMain() -> vec4<f32> {
49  {
50    let value: f32 = ((((((((((((((((((((((((((((((((((_skUnpacked__uniform0_u22[0].x + _uniform0.u23[0].x) + _uniform0.u24[0].x) + _skUnpacked__uniform0_R_u32[0].x) + _uniform0.u33[0].x) + _uniform0.u34[0].x) + _skUnpacked__uniform0_u42[0].x) + _uniform0.u43[0].x) + _uniform0.au44[0][0].x) + _skUnpacked__uniform0_au22[0][0].x) + _uniform0.au23[0][0].x) + _uniform0.au24[0][0].x) + _skUnpacked__uniform0_au32[0][0].x) + _uniform0.au33[0][0].x) + _uniform0.au34[0][0].x) + _skUnpacked__uniform0_au42[0][0].x) + _uniform0.au43[0][0].x) + _uniform0.au44[0][0].x) + _skUnpacked__storage1_s22[0].x) + _storage1.s23[0].x) + _storage1.s24[0].x) + _skUnpacked__storage1_s32[0].x) + _storage1.s33[0].x) + _storage1.s34[0].x) + _skUnpacked__storage1_s42[0].x) + _storage1.s43[0].x) + _storage1.as44[0][0].x) + _skUnpacked__storage1_as22[0][0].x) + _storage1.as23[0][0].x) + _storage1.as24[0][0].x) + _skUnpacked__storage1_as32[0][0].x) + _storage1.as33[0][0].x) + _storage1.as34[0][0].x) + _skUnpacked__storage1_as42[0][0].x) + _storage1.as43[0][0].x) + _storage1.as44[0][0].x;
51    return vec4<f32>(f32(value));
52  }
53}
54@fragment fn main() -> FSOut {
55  _skInitializePolyfilledUniforms();
56  var _stageOut: FSOut;
57  _stageOut.sk_FragColor = _skslMain();
58  return _stageOut;
59}
60struct _skArrayElement_f22 {
61  e : _skMatrix22
62};
63struct _skRow2 {
64  @size(16) r : vec2<f32>
65};
66struct _skMatrix22 {
67  c : array<_skRow2, 2>
68};
69var<private> _skUnpacked__storage1_as22: array<mat2x2<f32>, 3>;
70struct _skArrayElement_f32 {
71  e : _skMatrix32
72};
73struct _skMatrix32 {
74  c : array<_skRow2, 3>
75};
76var<private> _skUnpacked__storage1_as32: array<mat3x2<f32>, 3>;
77struct _skArrayElement_f42 {
78  e : _skMatrix42
79};
80struct _skMatrix42 {
81  c : array<_skRow2, 4>
82};
83var<private> _skUnpacked__storage1_as42: array<mat4x2<f32>, 3>;
84var<private> _skUnpacked__storage1_s22: mat2x2<f32>;
85var<private> _skUnpacked__storage1_s32: mat3x2<f32>;
86var<private> _skUnpacked__storage1_s42: mat4x2<f32>;
87var<private> _skUnpacked__uniform0_R_u32: mat3x2<f32>;
88var<private> _skUnpacked__uniform0_au22: array<mat2x2<f32>, 3>;
89var<private> _skUnpacked__uniform0_au32: array<mat3x2<f32>, 3>;
90var<private> _skUnpacked__uniform0_au42: array<mat4x2<f32>, 3>;
91var<private> _skUnpacked__uniform0_u22: mat2x2<f32>;
92var<private> _skUnpacked__uniform0_u42: mat4x2<f32>;
93fn _skInitializePolyfilledUniforms() {
94  _skUnpacked__storage1_as22 = array<mat2x2<f32>, 3>(mat2x2<f32>(_storage1.as22[0].e.c[0].r, _storage1.as22[0].e.c[1].r), mat2x2<f32>(_storage1.as22[1].e.c[0].r, _storage1.as22[1].e.c[1].r), mat2x2<f32>(_storage1.as22[2].e.c[0].r, _storage1.as22[2].e.c[1].r));
95  _skUnpacked__storage1_as32 = array<mat3x2<f32>, 3>(mat3x2<f32>(_storage1.as32[0].e.c[0].r, _storage1.as32[0].e.c[1].r, _storage1.as32[0].e.c[2].r), mat3x2<f32>(_storage1.as32[1].e.c[0].r, _storage1.as32[1].e.c[1].r, _storage1.as32[1].e.c[2].r), mat3x2<f32>(_storage1.as32[2].e.c[0].r, _storage1.as32[2].e.c[1].r, _storage1.as32[2].e.c[2].r));
96  _skUnpacked__storage1_as42 = array<mat4x2<f32>, 3>(mat4x2<f32>(_storage1.as42[0].e.c[0].r, _storage1.as42[0].e.c[1].r, _storage1.as42[0].e.c[2].r, _storage1.as42[0].e.c[3].r), mat4x2<f32>(_storage1.as42[1].e.c[0].r, _storage1.as42[1].e.c[1].r, _storage1.as42[1].e.c[2].r, _storage1.as42[1].e.c[3].r), mat4x2<f32>(_storage1.as42[2].e.c[0].r, _storage1.as42[2].e.c[1].r, _storage1.as42[2].e.c[2].r, _storage1.as42[2].e.c[3].r));
97  _skUnpacked__storage1_s22 = mat2x2<f32>(_storage1.s22.c[0].r, _storage1.s22.c[1].r);
98  _skUnpacked__storage1_s32 = mat3x2<f32>(_storage1.s32.c[0].r, _storage1.s32.c[1].r, _storage1.s32.c[2].r);
99  _skUnpacked__storage1_s42 = mat4x2<f32>(_storage1.s42.c[0].r, _storage1.s42.c[1].r, _storage1.s42.c[2].r, _storage1.s42.c[3].r);
100  _skUnpacked__uniform0_R_u32 = mat3x2<f32>(_uniform0.R_u32.c[0].r, _uniform0.R_u32.c[1].r, _uniform0.R_u32.c[2].r);
101  _skUnpacked__uniform0_au22 = array<mat2x2<f32>, 3>(mat2x2<f32>(_uniform0.au22[0].e.c[0].r, _uniform0.au22[0].e.c[1].r), mat2x2<f32>(_uniform0.au22[1].e.c[0].r, _uniform0.au22[1].e.c[1].r), mat2x2<f32>(_uniform0.au22[2].e.c[0].r, _uniform0.au22[2].e.c[1].r));
102  _skUnpacked__uniform0_au32 = array<mat3x2<f32>, 3>(mat3x2<f32>(_uniform0.au32[0].e.c[0].r, _uniform0.au32[0].e.c[1].r, _uniform0.au32[0].e.c[2].r), mat3x2<f32>(_uniform0.au32[1].e.c[0].r, _uniform0.au32[1].e.c[1].r, _uniform0.au32[1].e.c[2].r), mat3x2<f32>(_uniform0.au32[2].e.c[0].r, _uniform0.au32[2].e.c[1].r, _uniform0.au32[2].e.c[2].r));
103  _skUnpacked__uniform0_au42 = array<mat4x2<f32>, 3>(mat4x2<f32>(_uniform0.au42[0].e.c[0].r, _uniform0.au42[0].e.c[1].r, _uniform0.au42[0].e.c[2].r, _uniform0.au42[0].e.c[3].r), mat4x2<f32>(_uniform0.au42[1].e.c[0].r, _uniform0.au42[1].e.c[1].r, _uniform0.au42[1].e.c[2].r, _uniform0.au42[1].e.c[3].r), mat4x2<f32>(_uniform0.au42[2].e.c[0].r, _uniform0.au42[2].e.c[1].r, _uniform0.au42[2].e.c[2].r, _uniform0.au42[2].e.c[3].r));
104  _skUnpacked__uniform0_u22 = mat2x2<f32>(_uniform0.u22.c[0].r, _uniform0.u22.c[1].r);
105  _skUnpacked__uniform0_u42 = mat4x2<f32>(_uniform0.u42.c[0].r, _uniform0.u42.c[1].r, _uniform0.u42.c[2].r, _uniform0.u42.c[3].r);
106}
107