Debian Codegraph @

third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/glsl.std450.fxconly.comp

raw
1 struct ResType
2 {
3 float _m0;
4 int _m1;
5 };
6
7 static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
8
9 RWByteAddressBuffer _19 : register(u0);
10
11 uint SPIRV_Cross_packHalf2x16(float2 value)
12 {
13 uint2 Packed = f32tof16(value);
14 return Packed.x | (Packed.y << 16);
15 }
16
17 float2 SPIRV_Cross_unpackHalf2x16(uint value)
18 {
19 return f16tof32(uint2(value & 0xffff, value >> 16));
20 }
21
22 uint SPIRV_Cross_packUnorm4x8(float4 value)
23 {
24 uint4 Packed = uint4(round(saturate(value) * 255.0));
25 return Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24);
26 }
27
28 float4 SPIRV_Cross_unpackUnorm4x8(uint value)
29 {
30 uint4 Packed = uint4(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, value >> 24);
31 return float4(Packed) / 255.0;
32 }
33
34 uint SPIRV_Cross_packSnorm4x8(float4 value)
35 {
36 int4 Packed = int4(round(clamp(value, -1.0, 1.0) * 127.0)) & 0xff;
37 return uint(Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24));
38 }
39
40 float4 SPIRV_Cross_unpackSnorm4x8(uint value)
41 {
42 int SignedValue = int(value);
43 int4 Packed = int4(SignedValue << 24, SignedValue << 16, SignedValue << 8, SignedValue) >> 24;
44 return clamp(float4(Packed) / 127.0, -1.0, 1.0);
45 }
46
47 uint SPIRV_Cross_packUnorm2x16(float2 value)
48 {
49 uint2 Packed = uint2(round(saturate(value) * 65535.0));
50 return Packed.x | (Packed.y << 16);
51 }
52
53 float2 SPIRV_Cross_unpackUnorm2x16(uint value)
54 {
55 uint2 Packed = uint2(value & 0xffff, value >> 16);
56 return float2(Packed) / 65535.0;
57 }
58
59 uint SPIRV_Cross_packSnorm2x16(float2 value)
60 {
61 int2 Packed = int2(round(clamp(value, -1.0, 1.0) * 32767.0)) & 0xffff;
62 return uint(Packed.x | (Packed.y << 16));
63 }
64
65 float2 SPIRV_Cross_unpackSnorm2x16(uint value)
66 {
67 int SignedValue = int(value);
68 int2 Packed = int2(SignedValue << 16, SignedValue) >> 16;
69 return clamp(float2(Packed) / 32767.0, -1.0, 1.0);
70 }
71
72 // Returns the inverse of a matrix, by using the algorithm of calculating the classical
73 // adjoint and dividing by the determinant. The contents of the matrix are changed.
74 float2x2 SPIRV_Cross_Inverse(float2x2 m)
75 {
76 float2x2 adj; // The adjoint matrix (inverse after dividing by determinant)
77
78 // Create the transpose of the cofactors, as the classical adjoint of the matrix.
79 adj[0][0] = m[1][1];
80 adj[0][1] = -m[0][1];
81
82 adj[1][0] = -m[1][0];
83 adj[1][1] = m[0][0];
84
85 // Calculate the determinant as a combination of the cofactors of the first row.
86 float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]);
87
88 // Divide the classical adjoint matrix by the determinant.
89 // If determinant is zero, matrix is not invertable, so leave it unchanged.
90 return (det != 0.0f) ? (adj * (1.0f / det)) : m;
91 }
92
93 // Returns the determinant of a 2x2 matrix.
94 float SPIRV_Cross_Det2x2(float a1, float a2, float b1, float b2)
95 {
96 return a1 * b2 - b1 * a2;
97 }
98
99 // Returns the inverse of a matrix, by using the algorithm of calculating the classical
100 // adjoint and dividing by the determinant. The contents of the matrix are changed.
101 float3x3 SPIRV_Cross_Inverse(float3x3 m)
102 {
103 float3x3 adj; // The adjoint matrix (inverse after dividing by determinant)
104
105 // Create the transpose of the cofactors, as the classical adjoint of the matrix.
106 adj[0][0] = SPIRV_Cross_Det2x2(m[1][1], m[1][2], m[2][1], m[2][2]);
107 adj[0][1] = -SPIRV_Cross_Det2x2(m[0][1], m[0][2], m[2][1], m[2][2]);
108 adj[0][2] = SPIRV_Cross_Det2x2(m[0][1], m[0][2], m[1][1], m[1][2]);
109
110 adj[1][0] = -SPIRV_Cross_Det2x2(m[1][0], m[1][2], m[2][0], m[2][2]);
111 adj[1][1] = SPIRV_Cross_Det2x2(m[0][0], m[0][2], m[2][0], m[2][2]);
112 adj[1][2] = -SPIRV_Cross_Det2x2(m[0][0], m[0][2], m[1][0], m[1][2]);
113
114 adj[2][0] = SPIRV_Cross_Det2x2(m[1][0], m[1][1], m[2][0], m[2][1]);
115 adj[2][1] = -SPIRV_Cross_Det2x2(m[0][0], m[0][1], m[2][0], m[2][1]);
116 adj[2][2] = SPIRV_Cross_Det2x2(m[0][0], m[0][1], m[1][0], m[1][1]);
117
118 // Calculate the determinant as a combination of the cofactors of the first row.
119 float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]);
120
121 // Divide the classical adjoint matrix by the determinant.
122 // If determinant is zero, matrix is not invertable, so leave it unchanged.
123 return (det != 0.0f) ? (adj * (1.0f / det)) : m;
124 }
125
126 // Returns the determinant of a 3x3 matrix.
127 float SPIRV_Cross_Det3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
128 {
129 return a1 * SPIRV_Cross_Det2x2(b2, b3, c2, c3) - b1 * SPIRV_Cross_Det2x2(a2, a3, c2, c3) + c1 * SPIRV_Cross_Det2x2(a2, a3, b2, b3);
130 }
131
132 // Returns the inverse of a matrix, by using the algorithm of calculating the classical
133 // adjoint and dividing by the determinant. The contents of the matrix are changed.
134 float4x4 SPIRV_Cross_Inverse(float4x4 m)
135 {
136 float4x4 adj; // The adjoint matrix (inverse after dividing by determinant)
137
138 // Create the transpose of the cofactors, as the classical adjoint of the matrix.
139 adj[0][0] = SPIRV_Cross_Det3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]);
140 adj[0][1] = -SPIRV_Cross_Det3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]);
141 adj[0][2] = SPIRV_Cross_Det3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]);
142 adj[0][3] = -SPIRV_Cross_Det3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]);
143
144 adj[1][0] = -SPIRV_Cross_Det3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]);
145 adj[1][1] = SPIRV_Cross_Det3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]);
146 adj[1][2] = -SPIRV_Cross_Det3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]);
147 adj[1][3] = SPIRV_Cross_Det3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]);
148
149 adj[2][0] = SPIRV_Cross_Det3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]);
150 adj[2][1] = -SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]);
151 adj[2][2] = SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]);
152 adj[2][3] = -SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]);
153
154 adj[3][0] = -SPIRV_Cross_Det3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]);
155 adj[3][1] = SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]);
156 adj[3][2] = -SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]);
157 adj[3][3] = SPIRV_Cross_Det3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]);
158
159 // Calculate the determinant as a combination of the cofactors of the first row.
160 float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]);
161
162 // Divide the classical adjoint matrix by the determinant.
163 // If determinant is zero, matrix is not invertable, so leave it unchanged.
164 return (det != 0.0f) ? (adj * (1.0f / det)) : m;
165 }
166
167 float SPIRV_Cross_Reflect(float i, float n)
168 {
169 return i - 2.0 * dot(n, i) * n;
170 }
171
172 float SPIRV_Cross_Refract(float i, float n, float eta)
173 {
174 float NoI = n * i;
175 float NoI2 = NoI * NoI;
176 float k = 1.0 - eta * eta * (1.0 - NoI2);
177 if (k < 0.0)
178 {
179 return 0.0;
180 }
181 else
182 {
183 return eta * i - (eta * NoI + sqrt(k)) * n;
184 }
185 }
186
187 float SPIRV_Cross_FaceForward(float n, float i, float nref)
188 {
189 return i * nref < 0.0 ? n : -n;
190 }
191
192 void comp_main()
193 {
194 _19.Store(0, asuint(round(asfloat(_19.Load(16)))));
195 _19.Store(0, asuint(trunc(asfloat(_19.Load(16)))));
196 _19.Store(0, asuint(abs(asfloat(_19.Load(16)))));
197 _19.Store(4, uint(abs(int(_19.Load(32)))));
198 _19.Store(0, asuint(sign(asfloat(_19.Load(16)))));
199 _19.Store(4, uint(sign(int(_19.Load(32)))));
200 _19.Store(0, asuint(floor(asfloat(_19.Load(16)))));
201 _19.Store(0, asuint(ceil(asfloat(_19.Load(16)))));
202 _19.Store(0, asuint(frac(asfloat(_19.Load(16)))));
203 _19.Store(0, asuint(radians(asfloat(_19.Load(16)))));
204 _19.Store(0, asuint(degrees(asfloat(_19.Load(16)))));
205 _19.Store(0, asuint(sin(asfloat(_19.Load(16)))));
206 _19.Store(0, asuint(cos(asfloat(_19.Load(16)))));
207 _19.Store(0, asuint(tan(asfloat(_19.Load(16)))));
208 _19.Store(0, asuint(asin(asfloat(_19.Load(16)))));
209 _19.Store(0, asuint(acos(asfloat(_19.Load(16)))));
210 _19.Store(0, asuint(atan(asfloat(_19.Load(16)))));
211 _19.Store(0, asuint(sinh(asfloat(_19.Load(16)))));
212 _19.Store(0, asuint(cosh(asfloat(_19.Load(16)))));
213 _19.Store(0, asuint(tanh(asfloat(_19.Load(16)))));
214 _19.Store(0, asuint(atan2(asfloat(_19.Load(16)), asfloat(_19.Load(20)))));
215 _19.Store(0, asuint(pow(asfloat(_19.Load(16)), asfloat(_19.Load(20)))));
216 _19.Store(0, asuint(exp(asfloat(_19.Load(16)))));
217 _19.Store(0, asuint(log(asfloat(_19.Load(16)))));
218 _19.Store(0, asuint(exp2(asfloat(_19.Load(16)))));
219 _19.Store(0, asuint(log2(asfloat(_19.Load(16)))));
220 _19.Store(0, asuint(sqrt(asfloat(_19.Load(16)))));
221 _19.Store(0, asuint(rsqrt(asfloat(_19.Load(16)))));
222 _19.Store(0, asuint(length(asfloat(_19.Load(16)))));
223 _19.Store(0, asuint(distance(asfloat(_19.Load(16)), asfloat(_19.Load(20)))));
224 _19.Store(0, asuint(sign(asfloat(_19.Load(16)))));
225 _19.Store(0, asuint(SPIRV_Cross_FaceForward(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24)))));
226 _19.Store(0, asuint(SPIRV_Cross_Reflect(asfloat(_19.Load(16)), asfloat(_19.Load(20)))));
227 _19.Store(0, asuint(SPIRV_Cross_Refract(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24)))));
228 _19.Store(0, asuint(length(asfloat(_19.Load4(16)).xy)));
229 _19.Store(0, asuint(distance(asfloat(_19.Load4(16)).xy, asfloat(_19.Load4(16)).zw)));
230 float2 v2 = normalize(asfloat(_19.Load4(16)).xy);
231 v2 = faceforward(asfloat(_19.Load4(16)).xy, asfloat(_19.Load4(16)).yz, asfloat(_19.Load4(16)).zw);
232 v2 = reflect(asfloat(_19.Load4(16)).xy, asfloat(_19.Load4(16)).zw);
233 v2 = refract(asfloat(_19.Load4(16)).xy, asfloat(_19.Load4(16)).yz, asfloat(_19.Load(28)));
234 float3 v3 = cross(asfloat(_19.Load4(16)).xyz, asfloat(_19.Load4(16)).yzw);
235 float2x2 _240 = asfloat(uint2x2(_19.Load2(64), _19.Load2(72)));
236 _19.Store(0, asuint(determinant(_240)));
237 float3x3 _246 = asfloat(uint3x3(_19.Load3(80), _19.Load3(96), _19.Load3(112)));
238 _19.Store(0, asuint(determinant(_246)));
239 float4x4 _252 = asfloat(uint4x4(_19.Load4(128), _19.Load4(144), _19.Load4(160), _19.Load4(176)));
240 _19.Store(0, asuint(determinant(_252)));
241 float2x2 _256 = asfloat(uint2x2(_19.Load2(64), _19.Load2(72)));
242 float2x2 _257 = SPIRV_Cross_Inverse(_256);
243 _19.Store2(64, asuint(_257[0]));
244 _19.Store2(72, asuint(_257[1]));
245 float3x3 _260 = asfloat(uint3x3(_19.Load3(80), _19.Load3(96), _19.Load3(112)));
246 float3x3 _261 = SPIRV_Cross_Inverse(_260);
247 _19.Store3(80, asuint(_261[0]));
248 _19.Store3(96, asuint(_261[1]));
249 _19.Store3(112, asuint(_261[2]));
250 float4x4 _264 = asfloat(uint4x4(_19.Load4(128), _19.Load4(144), _19.Load4(160), _19.Load4(176)));
251 float4x4 _265 = SPIRV_Cross_Inverse(_264);
252 _19.Store4(128, asuint(_265[0]));
253 _19.Store4(144, asuint(_265[1]));
254 _19.Store4(160, asuint(_265[2]));
255 _19.Store4(176, asuint(_265[3]));
256 float tmp;
257 float _271 = modf(asfloat(_19.Load(16)), tmp);
258 _19.Store(0, asuint(_271));
259 _19.Store(0, asuint(min(asfloat(_19.Load(16)), asfloat(_19.Load(20)))));
260 _19.Store(8, min(_19.Load(48), _19.Load(52)));
261 _19.Store(4, uint(min(int(_19.Load(32)), int(_19.Load(36)))));
262 _19.Store(0, asuint(max(asfloat(_19.Load(16)), asfloat(_19.Load(20)))));
263 _19.Store(8, max(_19.Load(48), _19.Load(52)));
264 _19.Store(4, uint(max(int(_19.Load(32)), int(_19.Load(36)))));
265 _19.Store(0, asuint(clamp(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24)))));
266 _19.Store(8, clamp(_19.Load(48), _19.Load(52), _19.Load(56)));
267 _19.Store(4, uint(clamp(int(_19.Load(32)), int(_19.Load(36)), int(_19.Load(40)))));
268 _19.Store(0, asuint(lerp(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24)))));
269 _19.Store(0, asuint(step(asfloat(_19.Load(16)), asfloat(_19.Load(20)))));
270 _19.Store(0, asuint(smoothstep(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24)))));
271 _19.Store(0, asuint(mad(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24)))));
272 ResType _371;
273 _371._m0 = frexp(asfloat(_19.Load(16)), _371._m1);
274 int itmp = _371._m1;
275 _19.Store(0, asuint(_371._m0));
276 _19.Store(0, asuint(ldexp(asfloat(_19.Load(16)), itmp)));
277 _19.Store(8, SPIRV_Cross_packSnorm4x8(asfloat(_19.Load4(16))));
278 _19.Store(8, SPIRV_Cross_packUnorm4x8(asfloat(_19.Load4(16))));
279 _19.Store(8, SPIRV_Cross_packSnorm2x16(asfloat(_19.Load4(16)).xy));
280 _19.Store(8, SPIRV_Cross_packUnorm2x16(asfloat(_19.Load4(16)).xy));
281 _19.Store(8, SPIRV_Cross_packHalf2x16(asfloat(_19.Load4(16)).xy));
282 v2 = SPIRV_Cross_unpackSnorm2x16(_19.Load(48));
283 v2 = SPIRV_Cross_unpackUnorm2x16(_19.Load(48));
284 v2 = SPIRV_Cross_unpackHalf2x16(_19.Load(48));
285 float4 v4 = SPIRV_Cross_unpackSnorm4x8(_19.Load(48));
286 v4 = SPIRV_Cross_unpackUnorm4x8(_19.Load(48));
287 _19.Store4(32, uint4(firstbitlow(int4(_19.Load4(32)))));
288 _19.Store4(32, uint4(int4(firstbitlow(_19.Load4(48)))));
289 _19.Store4(32, uint4(firstbithigh(int4(_19.Load4(32)))));
290 _19.Store4(32, uint4(int4(firstbithigh(_19.Load4(48)))));
291 }
292
293 [numthreads(1, 1, 1)]
294 void main()
295 {
296 comp_main();
297 }