@wonderyard/vivarium 1.4.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/automaton/types.d.ts +1 -0
- package/dist/blueprint/base-blueprint.js +1 -3
- package/dist/blueprint/ref-blueprint.js +2 -2
- package/dist/blueprint/rule-blueprint.js +2 -2
- package/dist/blueprint/utils.js +1 -1
- package/dist/blueprint/vivarium-blueprint.d.ts +3 -1
- package/dist/blueprint/vivarium-blueprint.js +7 -6
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +7 -6
- package/dist/common/utils.js +2 -2
- package/dist/constants-BT-9-x_4.js +3289 -0
- package/dist/main.d.ts +2 -2
- package/dist/main.js +1 -1
- package/dist/{rule-blueprint-DGODv9IV.js → rule-blueprint-C9qa6iP-.js} +1 -1
- package/dist/vivarium/vivarium.d.ts +4 -1
- package/dist/vivarium/vivarium.js +4 -4
- package/dist/webgpu/compiler.d.ts +2 -1
- package/dist/webgpu/compiler.js +37 -50
- package/dist/webgpu/setup.d.ts +5 -2
- package/dist/webgpu/setup.js +8452 -4915
- package/package.json +21 -20
- package/dist/constants-D4GX9YB2.js +0 -2301
|
@@ -0,0 +1,3289 @@
|
|
|
1
|
+
var F = "0.10.0";
|
|
2
|
+
const Ft = process.env.NODE_ENV === "development", ce = process.env.NODE_ENV === "test", i = /* @__PURE__ */ Symbol(`typegpu:${F}:$internal`), Fs = /* @__PURE__ */ Symbol(`typegpu:${F}:$gpuValueOf`), Jt = /* @__PURE__ */ Symbol(`typegpu:${F}:$getNameForward`), Yn = /* @__PURE__ */ Symbol(`typegpu:${F}:$providing`), De = /* @__PURE__ */ Symbol(`typegpu:${F}:$ownSnippet`), A = /* @__PURE__ */ Symbol(`typegpu:${F}:$resolve`), Ye = /* @__PURE__ */ Symbol(`typegpu:${F}:$cast`), ot = /* @__PURE__ */ Symbol(`typegpu:${F}:$gpuCallable`), qn = /* @__PURE__ */ Symbol(`typegpu:${F}:$repr`);
|
|
3
|
+
function m(t) {
|
|
4
|
+
return !!t?.[i];
|
|
5
|
+
}
|
|
6
|
+
const K = globalThis;
|
|
7
|
+
K.__TYPEGPU_VERSION__ !== void 0 && console.warn(`Found duplicate TypeGPU version. First was ${K.__TYPEGPU_VERSION__}, this one is ${F}. This may cause unexpected behavior.`);
|
|
8
|
+
K.__TYPEGPU_VERSION__ = F;
|
|
9
|
+
K.__TYPEGPU_AUTONAME__ = (t, e) => Hn(t) && m(t) && !ut(t) ? t.$name(e) : t;
|
|
10
|
+
const Us = (Ft || ce) && {
|
|
11
|
+
get enabled() {
|
|
12
|
+
return !!K.__TYPEGPU_MEASURE_PERF__;
|
|
13
|
+
},
|
|
14
|
+
record(t, e) {
|
|
15
|
+
const n = K.__TYPEGPU_PERF_RECORDS__ ??= /* @__PURE__ */ new Map();
|
|
16
|
+
let r = n.get(t);
|
|
17
|
+
r || (r = [], n.set(t, r)), r.push(e);
|
|
18
|
+
}
|
|
19
|
+
} || void 0;
|
|
20
|
+
function qe(t) {
|
|
21
|
+
return !!t?.[Jt];
|
|
22
|
+
}
|
|
23
|
+
function ut(t) {
|
|
24
|
+
return qe(t) ? ut(t[Jt]) : He(t)?.name;
|
|
25
|
+
}
|
|
26
|
+
function yt(t, e) {
|
|
27
|
+
if (qe(t)) {
|
|
28
|
+
yt(t[Jt], e);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
Zn(t, { name: e });
|
|
32
|
+
}
|
|
33
|
+
function Hn(t) {
|
|
34
|
+
return !!t?.$name;
|
|
35
|
+
}
|
|
36
|
+
function Kn(t) {
|
|
37
|
+
return !!He(t)?.ast;
|
|
38
|
+
}
|
|
39
|
+
function He(t) {
|
|
40
|
+
return K.__TYPEGPU_META__.get(t);
|
|
41
|
+
}
|
|
42
|
+
function Zn(t, e) {
|
|
43
|
+
K.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap();
|
|
44
|
+
const n = K.__TYPEGPU_META__;
|
|
45
|
+
n.set(t, {
|
|
46
|
+
...n.get(t),
|
|
47
|
+
...e
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const Xn = [
|
|
51
|
+
"uint8",
|
|
52
|
+
"uint8x2",
|
|
53
|
+
"uint8x4",
|
|
54
|
+
"sint8",
|
|
55
|
+
"sint8x2",
|
|
56
|
+
"sint8x4",
|
|
57
|
+
"unorm8",
|
|
58
|
+
"unorm8x2",
|
|
59
|
+
"unorm8x4",
|
|
60
|
+
"snorm8",
|
|
61
|
+
"snorm8x2",
|
|
62
|
+
"snorm8x4",
|
|
63
|
+
"uint16",
|
|
64
|
+
"uint16x2",
|
|
65
|
+
"uint16x4",
|
|
66
|
+
"sint16",
|
|
67
|
+
"sint16x2",
|
|
68
|
+
"sint16x4",
|
|
69
|
+
"unorm16",
|
|
70
|
+
"unorm16x2",
|
|
71
|
+
"unorm16x4",
|
|
72
|
+
"snorm16",
|
|
73
|
+
"snorm16x2",
|
|
74
|
+
"snorm16x4",
|
|
75
|
+
"float16",
|
|
76
|
+
"float16x2",
|
|
77
|
+
"float16x4",
|
|
78
|
+
"float32",
|
|
79
|
+
"float32x2",
|
|
80
|
+
"float32x3",
|
|
81
|
+
"float32x4",
|
|
82
|
+
"uint32",
|
|
83
|
+
"uint32x2",
|
|
84
|
+
"uint32x3",
|
|
85
|
+
"uint32x4",
|
|
86
|
+
"sint32",
|
|
87
|
+
"sint32x2",
|
|
88
|
+
"sint32x3",
|
|
89
|
+
"sint32x4",
|
|
90
|
+
"unorm10-10-10-2",
|
|
91
|
+
"unorm8x4-bgra"
|
|
92
|
+
], js = {
|
|
93
|
+
f32: "float32",
|
|
94
|
+
vec2f: "float32x2",
|
|
95
|
+
vec3f: "float32x3",
|
|
96
|
+
vec4f: "float32x4",
|
|
97
|
+
f16: "float16",
|
|
98
|
+
vec2h: "float16x2",
|
|
99
|
+
vec4h: "float16x4",
|
|
100
|
+
u32: "uint32",
|
|
101
|
+
vec2u: "uint32x2",
|
|
102
|
+
vec3u: "uint32x3",
|
|
103
|
+
vec4u: "uint32x4",
|
|
104
|
+
i32: "sint32",
|
|
105
|
+
vec2i: "sint32x2",
|
|
106
|
+
vec3i: "sint32x3",
|
|
107
|
+
vec4i: "sint32x4"
|
|
108
|
+
}, Bs = {
|
|
109
|
+
[i]: {},
|
|
110
|
+
type: "void",
|
|
111
|
+
toString() {
|
|
112
|
+
return "void";
|
|
113
|
+
}
|
|
114
|
+
}, Jn = [
|
|
115
|
+
"bool",
|
|
116
|
+
"f32",
|
|
117
|
+
"f16",
|
|
118
|
+
"i32",
|
|
119
|
+
"u32",
|
|
120
|
+
"u16",
|
|
121
|
+
"vec2f",
|
|
122
|
+
"vec2h",
|
|
123
|
+
"vec2i",
|
|
124
|
+
"vec2u",
|
|
125
|
+
"vec2<bool>",
|
|
126
|
+
"vec3f",
|
|
127
|
+
"vec3h",
|
|
128
|
+
"vec3i",
|
|
129
|
+
"vec3u",
|
|
130
|
+
"vec3<bool>",
|
|
131
|
+
"vec4f",
|
|
132
|
+
"vec4h",
|
|
133
|
+
"vec4i",
|
|
134
|
+
"vec4u",
|
|
135
|
+
"vec4<bool>",
|
|
136
|
+
"mat2x2f",
|
|
137
|
+
"mat3x3f",
|
|
138
|
+
"mat4x4f",
|
|
139
|
+
"struct",
|
|
140
|
+
"array",
|
|
141
|
+
"ptr",
|
|
142
|
+
"atomic",
|
|
143
|
+
"decorated",
|
|
144
|
+
"abstractInt",
|
|
145
|
+
"abstractFloat",
|
|
146
|
+
"void",
|
|
147
|
+
"texture_1d",
|
|
148
|
+
"texture_storage_1d",
|
|
149
|
+
"texture_2d",
|
|
150
|
+
"texture_storage_2d",
|
|
151
|
+
"texture_multisampled_2d",
|
|
152
|
+
"texture_depth_2d",
|
|
153
|
+
"texture_depth_multisampled_2d",
|
|
154
|
+
"texture_2d_array",
|
|
155
|
+
"texture_storage_2d_array",
|
|
156
|
+
"texture_depth_2d_array",
|
|
157
|
+
"texture_cube",
|
|
158
|
+
"texture_depth_cube",
|
|
159
|
+
"texture_cube_array",
|
|
160
|
+
"texture_depth_cube_array",
|
|
161
|
+
"texture_3d",
|
|
162
|
+
"texture_storage_3d",
|
|
163
|
+
"texture_external",
|
|
164
|
+
"sampler",
|
|
165
|
+
"sampler_comparison"
|
|
166
|
+
];
|
|
167
|
+
function w(t) {
|
|
168
|
+
const e = t;
|
|
169
|
+
return m(e) && typeof e.kind == "string" && e.kind.startsWith("vec");
|
|
170
|
+
}
|
|
171
|
+
function Qn(t) {
|
|
172
|
+
const e = t;
|
|
173
|
+
return m(e) && typeof e.type == "string" && e.type.startsWith("vec2");
|
|
174
|
+
}
|
|
175
|
+
function tr(t) {
|
|
176
|
+
const e = t;
|
|
177
|
+
return m(e) && typeof e.type == "string" && e.type.startsWith("vec3");
|
|
178
|
+
}
|
|
179
|
+
function er(t) {
|
|
180
|
+
const e = t;
|
|
181
|
+
return m(e) && typeof e.type == "string" && e.type.startsWith("vec4");
|
|
182
|
+
}
|
|
183
|
+
function C(t) {
|
|
184
|
+
return Qn(t) || tr(t) || er(t);
|
|
185
|
+
}
|
|
186
|
+
function Ls(t) {
|
|
187
|
+
return C(t) && t.type.includes("b");
|
|
188
|
+
}
|
|
189
|
+
function L(t) {
|
|
190
|
+
const e = t;
|
|
191
|
+
return m(e) && typeof e.kind?.startsWith == "function" && e.kind.startsWith("mat");
|
|
192
|
+
}
|
|
193
|
+
function nr(t) {
|
|
194
|
+
return m(t) && t?.type === "mat2x2f";
|
|
195
|
+
}
|
|
196
|
+
function rr(t) {
|
|
197
|
+
return m(t) && t?.type === "mat3x3f";
|
|
198
|
+
}
|
|
199
|
+
function sr(t) {
|
|
200
|
+
return m(t) && t?.type === "mat4x4f";
|
|
201
|
+
}
|
|
202
|
+
function ct(t) {
|
|
203
|
+
return nr(t) || rr(t) || sr(t);
|
|
204
|
+
}
|
|
205
|
+
function Ae(t) {
|
|
206
|
+
return w(t) && [
|
|
207
|
+
"vec2f",
|
|
208
|
+
"vec3f",
|
|
209
|
+
"vec4f"
|
|
210
|
+
].includes(t.kind);
|
|
211
|
+
}
|
|
212
|
+
function Ke(t) {
|
|
213
|
+
return m(t) && Jn.includes(t?.type);
|
|
214
|
+
}
|
|
215
|
+
function Rs(t) {
|
|
216
|
+
return m(t) && t?.type === "array";
|
|
217
|
+
}
|
|
218
|
+
function Ws(t) {
|
|
219
|
+
return m(t) && t?.type === "struct";
|
|
220
|
+
}
|
|
221
|
+
function at(t) {
|
|
222
|
+
return m(t) && t?.type === "ptr";
|
|
223
|
+
}
|
|
224
|
+
function Gs(t) {
|
|
225
|
+
return m(t) && t?.type === "atomic";
|
|
226
|
+
}
|
|
227
|
+
function cr(t) {
|
|
228
|
+
return m(t) && t?.type === "@align";
|
|
229
|
+
}
|
|
230
|
+
function or(t) {
|
|
231
|
+
return m(t) && t?.type === "@size";
|
|
232
|
+
}
|
|
233
|
+
function ar(t) {
|
|
234
|
+
return m(t) && t?.type === "@location";
|
|
235
|
+
}
|
|
236
|
+
function Ds(t) {
|
|
237
|
+
return m(t) && t?.type === "@interpolate";
|
|
238
|
+
}
|
|
239
|
+
function Ys(t) {
|
|
240
|
+
return m(t) && t?.type === "@builtin";
|
|
241
|
+
}
|
|
242
|
+
function ir(t) {
|
|
243
|
+
return m(t) && t?.type === "decorated";
|
|
244
|
+
}
|
|
245
|
+
function qs(t) {
|
|
246
|
+
return m(t) && t.type === "void";
|
|
247
|
+
}
|
|
248
|
+
function ur(t) {
|
|
249
|
+
const e = t?.type;
|
|
250
|
+
return m(t) && (e === "abstractInt" || e === "abstractFloat" || e === "f32" || e === "f16" || e === "i32" || e === "u32");
|
|
251
|
+
}
|
|
252
|
+
function Hs(t) {
|
|
253
|
+
const e = t?.type;
|
|
254
|
+
return m(t) && (e === "f16" || e === "vec2h" || e === "vec3h" || e === "vec4h");
|
|
255
|
+
}
|
|
256
|
+
const yr = [
|
|
257
|
+
"abstractInt",
|
|
258
|
+
"abstractFloat",
|
|
259
|
+
"f32",
|
|
260
|
+
"f16",
|
|
261
|
+
"i32",
|
|
262
|
+
"u32",
|
|
263
|
+
"bool"
|
|
264
|
+
];
|
|
265
|
+
function Ze(t) {
|
|
266
|
+
return !m(t) || yr.includes(t?.type);
|
|
267
|
+
}
|
|
268
|
+
function fr(t) {
|
|
269
|
+
return t.schema;
|
|
270
|
+
}
|
|
271
|
+
function St(t) {
|
|
272
|
+
return ir(t) || hr(t) ? t.inner : t;
|
|
273
|
+
}
|
|
274
|
+
function Ks(t) {
|
|
275
|
+
return at(t) ? t.inner : t;
|
|
276
|
+
}
|
|
277
|
+
const lr = [
|
|
278
|
+
"unstruct",
|
|
279
|
+
"disarray",
|
|
280
|
+
"loose-decorated",
|
|
281
|
+
...Xn
|
|
282
|
+
];
|
|
283
|
+
function mr(t) {
|
|
284
|
+
return m(t) && lr.includes(t?.type);
|
|
285
|
+
}
|
|
286
|
+
function Zs(t) {
|
|
287
|
+
return m(t) && t?.type === "disarray";
|
|
288
|
+
}
|
|
289
|
+
function Xs(t) {
|
|
290
|
+
return m(t) && t?.type === "unstruct";
|
|
291
|
+
}
|
|
292
|
+
function hr(t) {
|
|
293
|
+
return m(t) && t?.type === "loose-decorated";
|
|
294
|
+
}
|
|
295
|
+
function Js(t) {
|
|
296
|
+
return t.attribs?.find(cr)?.params[0];
|
|
297
|
+
}
|
|
298
|
+
function Qs(t) {
|
|
299
|
+
return t.attribs?.find(or)?.params[0];
|
|
300
|
+
}
|
|
301
|
+
function tc(t) {
|
|
302
|
+
return t.attribs?.find(ar)?.params[0];
|
|
303
|
+
}
|
|
304
|
+
function ec(t) {
|
|
305
|
+
return Ke(t) || mr(t);
|
|
306
|
+
}
|
|
307
|
+
const it = /* @__PURE__ */ Symbol("UNKNOWN");
|
|
308
|
+
var nc = class {
|
|
309
|
+
constructor(t, e, n) {
|
|
310
|
+
this.name = t, this.lhs = e, this.operator = n;
|
|
311
|
+
}
|
|
312
|
+
}, rc = class {
|
|
313
|
+
constructor(t) {
|
|
314
|
+
this.matrix = t;
|
|
315
|
+
}
|
|
316
|
+
}, sc = class {
|
|
317
|
+
[i] = !0;
|
|
318
|
+
constructor(t) {
|
|
319
|
+
this.op = t, yt(this, "consoleLog");
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
function pr(t) {
|
|
323
|
+
return t === "runtime" || t === "constant" || t === "argument";
|
|
324
|
+
}
|
|
325
|
+
function xr(t) {
|
|
326
|
+
return pr(t.origin);
|
|
327
|
+
}
|
|
328
|
+
const dr = {
|
|
329
|
+
uniform: {
|
|
330
|
+
space: "uniform",
|
|
331
|
+
access: "read"
|
|
332
|
+
},
|
|
333
|
+
readonly: {
|
|
334
|
+
space: "storage",
|
|
335
|
+
access: "read"
|
|
336
|
+
},
|
|
337
|
+
mutable: {
|
|
338
|
+
space: "storage",
|
|
339
|
+
access: "read-write"
|
|
340
|
+
},
|
|
341
|
+
workgroup: {
|
|
342
|
+
space: "workgroup",
|
|
343
|
+
access: "read-write"
|
|
344
|
+
},
|
|
345
|
+
private: {
|
|
346
|
+
space: "private",
|
|
347
|
+
access: "read-write"
|
|
348
|
+
},
|
|
349
|
+
function: {
|
|
350
|
+
space: "function",
|
|
351
|
+
access: "read-write"
|
|
352
|
+
},
|
|
353
|
+
"this-function": {
|
|
354
|
+
space: "function",
|
|
355
|
+
access: "read-write"
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
var Xe = class {
|
|
359
|
+
constructor(t, e, n) {
|
|
360
|
+
this.value = t, this.dataType = e, this.origin = n;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
function oe(t) {
|
|
364
|
+
return t instanceof Xe;
|
|
365
|
+
}
|
|
366
|
+
function cc(t) {
|
|
367
|
+
return ur(t.dataType);
|
|
368
|
+
}
|
|
369
|
+
function l(t, e, n) {
|
|
370
|
+
if (Ft && oe(t)) throw new Error("Cannot nest snippets");
|
|
371
|
+
return new Xe(t, St(e), n);
|
|
372
|
+
}
|
|
373
|
+
const ee = "Invariant failed";
|
|
374
|
+
function ae(t, e) {
|
|
375
|
+
if (t) return;
|
|
376
|
+
if (!Ft && !ce) throw new Error(ee);
|
|
377
|
+
const n = typeof e == "function" ? e() : e, r = n ? `${ee}: ${n}` : ee;
|
|
378
|
+
throw new Error(r);
|
|
379
|
+
}
|
|
380
|
+
var oc = class ne extends Error {
|
|
381
|
+
constructor(e, n) {
|
|
382
|
+
let r = n.map((s) => `- ${Kn(s) ? `fn*:${ut(s)}` : s}`);
|
|
383
|
+
r.length > 20 && (r = [
|
|
384
|
+
...r.slice(0, 11),
|
|
385
|
+
"...",
|
|
386
|
+
...r.slice(-10)
|
|
387
|
+
]), super(`Resolution of the following tree failed:
|
|
388
|
+
${r.join(`
|
|
389
|
+
`)}: ${e && typeof e == "object" && "message" in e ? e.message : e}`), this.cause = e, this.trace = n, Object.setPrototypeOf(this, ne.prototype);
|
|
390
|
+
}
|
|
391
|
+
appendToTrace(e) {
|
|
392
|
+
const n = [e, ...this.trace];
|
|
393
|
+
return new ne(this.cause, n);
|
|
394
|
+
}
|
|
395
|
+
}, ac = class re extends Error {
|
|
396
|
+
constructor(e, n) {
|
|
397
|
+
let r = n.map((s) => `- ${s}`);
|
|
398
|
+
r.length > 20 && (r = [
|
|
399
|
+
...r.slice(0, 11),
|
|
400
|
+
"...",
|
|
401
|
+
...r.slice(-10)
|
|
402
|
+
]), super(`Execution of the following tree failed:
|
|
403
|
+
${r.join(`
|
|
404
|
+
`)}: ${e && typeof e == "object" && "message" in e ? e.message : e}`), this.cause = e, this.trace = n, Object.setPrototypeOf(this, re.prototype);
|
|
405
|
+
}
|
|
406
|
+
appendToTrace(e) {
|
|
407
|
+
const n = [e, ...this.trace];
|
|
408
|
+
return new re(this.cause, n);
|
|
409
|
+
}
|
|
410
|
+
}, ic = class Je extends Error {
|
|
411
|
+
constructor(e) {
|
|
412
|
+
super(`Missing value for '${e}'`), this.slot = e, Object.setPrototypeOf(this, Je.prototype);
|
|
413
|
+
}
|
|
414
|
+
}, uc = class Qe extends Error {
|
|
415
|
+
constructor(e) {
|
|
416
|
+
super(`Buffer '${ut(e) ?? "<unnamed>"}' is not bindable as a uniform. Use .$usage('uniform') to allow it.`), Object.setPrototypeOf(this, Qe.prototype);
|
|
417
|
+
}
|
|
418
|
+
}, yc = class tn extends Error {
|
|
419
|
+
constructor(e, n) {
|
|
420
|
+
super(`The function '${e ?? "<unnamed>"}' is missing links to the following external values: ${n}.`), Object.setPrototypeOf(this, tn.prototype);
|
|
421
|
+
}
|
|
422
|
+
}, fc = class en extends Error {
|
|
423
|
+
constructor(e) {
|
|
424
|
+
super(`Missing bind groups for layouts: '${[...e].map((n) => ut(n) ?? "<unnamed>").join(", ")}'. Please provide it using pipeline.with(bindGroup).(...)`), Object.setPrototypeOf(this, en.prototype);
|
|
425
|
+
}
|
|
426
|
+
}, lc = class nn extends Error {
|
|
427
|
+
constructor(e) {
|
|
428
|
+
super(`Missing vertex buffers for layouts: '${[...e].map((n) => ut(n) ?? "<unnamed>").join(", ")}'. Please provide it using pipeline.with(layout, buffer).(...)`), Object.setPrototypeOf(this, nn.prototype);
|
|
429
|
+
}
|
|
430
|
+
}, mc = class rn extends Error {
|
|
431
|
+
constructor(e) {
|
|
432
|
+
super(e), Object.setPrototypeOf(this, rn.prototype);
|
|
433
|
+
}
|
|
434
|
+
}, hc = class sn extends Error {
|
|
435
|
+
constructor(e) {
|
|
436
|
+
super(e), Object.setPrototypeOf(this, sn.prototype);
|
|
437
|
+
}
|
|
438
|
+
}, Qt = class cn extends Error {
|
|
439
|
+
constructor(e) {
|
|
440
|
+
super(e), Object.setPrototypeOf(this, cn.prototype);
|
|
441
|
+
}
|
|
442
|
+
}, gr = class on extends Error {
|
|
443
|
+
constructor(e, n) {
|
|
444
|
+
super(`Unsupported data types: ${e.map((r) => r.type).join(", ")}. Supported types are: ${n.map((r) => r.type).join(", ")}.`), Object.setPrototypeOf(this, on.prototype);
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
function vr(t) {
|
|
448
|
+
return t?.resourceType === "slot";
|
|
449
|
+
}
|
|
450
|
+
function br(t) {
|
|
451
|
+
return t?.resourceType === "lazy";
|
|
452
|
+
}
|
|
453
|
+
function zr(t) {
|
|
454
|
+
return t?.[Yn] !== void 0;
|
|
455
|
+
}
|
|
456
|
+
function pc(t) {
|
|
457
|
+
return t?.resourceType === "accessor";
|
|
458
|
+
}
|
|
459
|
+
function xc(t) {
|
|
460
|
+
return t?.resourceType === "mutable-accessor";
|
|
461
|
+
}
|
|
462
|
+
var ie = class {
|
|
463
|
+
type = "normal";
|
|
464
|
+
}, dc = class {
|
|
465
|
+
type = "codegen";
|
|
466
|
+
}, gc = class {
|
|
467
|
+
type = "simulate";
|
|
468
|
+
constructor(t, e) {
|
|
469
|
+
this.buffers = t, this.vars = e;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
function wr(t) {
|
|
473
|
+
return !!t?.[A];
|
|
474
|
+
}
|
|
475
|
+
function an(t) {
|
|
476
|
+
return t?.[De];
|
|
477
|
+
}
|
|
478
|
+
function Mr(t) {
|
|
479
|
+
return !!t?.[ot];
|
|
480
|
+
}
|
|
481
|
+
function Tr(t) {
|
|
482
|
+
return !!t?.[Ye];
|
|
483
|
+
}
|
|
484
|
+
function Kt(t) {
|
|
485
|
+
return (typeof t.value != "string" || t.dataType === it) && an(t.value) === void 0;
|
|
486
|
+
}
|
|
487
|
+
function vc(t) {
|
|
488
|
+
return typeof t == "number" || typeof t == "boolean" || typeof t == "string" || wr(t) || Ke(t) || vr(t) || br(t) || zr(t);
|
|
489
|
+
}
|
|
490
|
+
function bc(t) {
|
|
491
|
+
return !!t && typeof t == "object" && "getMappedRange" in t && "mapAsync" in t;
|
|
492
|
+
}
|
|
493
|
+
let Ht = !1;
|
|
494
|
+
function zc(t) {
|
|
495
|
+
if (Ht) return t();
|
|
496
|
+
try {
|
|
497
|
+
return Ht = !0, t();
|
|
498
|
+
} finally {
|
|
499
|
+
Ht = !1;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function wc() {
|
|
503
|
+
return Ht;
|
|
504
|
+
}
|
|
505
|
+
let et;
|
|
506
|
+
function Mc(t, e) {
|
|
507
|
+
if (ae(et === void 0 || et === t, "Cannot nest context providers"), et === t) return e();
|
|
508
|
+
et = t;
|
|
509
|
+
try {
|
|
510
|
+
return e();
|
|
511
|
+
} finally {
|
|
512
|
+
et = void 0;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function _r() {
|
|
516
|
+
return et;
|
|
517
|
+
}
|
|
518
|
+
const Ir = new ie();
|
|
519
|
+
function Tc() {
|
|
520
|
+
return et?.mode ?? Ir;
|
|
521
|
+
}
|
|
522
|
+
function _c() {
|
|
523
|
+
return et?.mode.type === "codegen";
|
|
524
|
+
}
|
|
525
|
+
function f(t, ...e) {
|
|
526
|
+
const n = _r();
|
|
527
|
+
function r(c) {
|
|
528
|
+
return oe(c) ? n.resolve(c.value, c.dataType).value : c;
|
|
529
|
+
}
|
|
530
|
+
let s = "";
|
|
531
|
+
for (let c = 0; c < t.length; ++c) {
|
|
532
|
+
s += t[c];
|
|
533
|
+
const a = e[c];
|
|
534
|
+
Array.isArray(a) ? s += a.filter((o) => o !== void 0).map(r).join(", ") : a && (s += r(a));
|
|
535
|
+
}
|
|
536
|
+
return s;
|
|
537
|
+
}
|
|
538
|
+
function Ic(t) {
|
|
539
|
+
return Q("function", t, "read-write");
|
|
540
|
+
}
|
|
541
|
+
function $c(t) {
|
|
542
|
+
return Q("private", t, "read-write");
|
|
543
|
+
}
|
|
544
|
+
function Ec(t) {
|
|
545
|
+
return Q("workgroup", t, "read-write");
|
|
546
|
+
}
|
|
547
|
+
function Sc(t, e = "read") {
|
|
548
|
+
return Q("storage", t, e);
|
|
549
|
+
}
|
|
550
|
+
function kc(t) {
|
|
551
|
+
return Q("uniform", t, "read");
|
|
552
|
+
}
|
|
553
|
+
function Vc(t) {
|
|
554
|
+
return Q("handle", t, "read");
|
|
555
|
+
}
|
|
556
|
+
function Q(t, e, n, r = !1) {
|
|
557
|
+
return {
|
|
558
|
+
[i]: {},
|
|
559
|
+
type: "ptr",
|
|
560
|
+
addressSpace: t,
|
|
561
|
+
inner: e,
|
|
562
|
+
access: n,
|
|
563
|
+
implicit: r,
|
|
564
|
+
toString: () => `ptr<${t}, ${e}, ${n}>`
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function $r(t, e) {
|
|
568
|
+
const n = dr[t];
|
|
569
|
+
if (n) return Q(n.space, e, n.access);
|
|
570
|
+
}
|
|
571
|
+
function Oc(t) {
|
|
572
|
+
return Q(t.addressSpace, t.inner, t.access, !0);
|
|
573
|
+
}
|
|
574
|
+
function Er(t) {
|
|
575
|
+
return Q(t.addressSpace, t.inner, t.access, !1);
|
|
576
|
+
}
|
|
577
|
+
const Nc = (() => {
|
|
578
|
+
const t = ((e) => kr(e));
|
|
579
|
+
return yt(t, "ref"), t.toString = () => "ref", t[i] = !0, t[ot] = { call(e, [n]) {
|
|
580
|
+
if (n.origin === "argument") throw new Qt(f`d.ref(${n}) is illegal, cannot take a reference of an argument. Copy the value locally first, and take a reference of the copy.`);
|
|
581
|
+
if (at(n.dataType)) return l(n.value, Er(n.dataType), n.origin);
|
|
582
|
+
const r = $r(n.origin, n.dataType);
|
|
583
|
+
return l(new ue(n, r), r ?? it, "runtime");
|
|
584
|
+
} }, t;
|
|
585
|
+
})();
|
|
586
|
+
function Sr(t) {
|
|
587
|
+
return t?.[i]?.type === "ref";
|
|
588
|
+
}
|
|
589
|
+
function kr(t) {
|
|
590
|
+
const e = {
|
|
591
|
+
[i]: { type: "ref" },
|
|
592
|
+
get $() {
|
|
593
|
+
return t;
|
|
594
|
+
},
|
|
595
|
+
set $(n) {
|
|
596
|
+
if (n && typeof n == "object") for (const r of Object.keys(n)) t[r] = n[r];
|
|
597
|
+
else t = n;
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
if (t == null) throw new Error("Cannot create a ref from undefined or null");
|
|
601
|
+
return typeof t == "object" ? new Proxy(e, {
|
|
602
|
+
get(n, r) {
|
|
603
|
+
return r in n ? n[r] : t[r];
|
|
604
|
+
},
|
|
605
|
+
set(n, r, s) {
|
|
606
|
+
return r === i ? !1 : r === "$" ? (console.log("Setting ref value:", s), Reflect.set(e, r, s)) : Reflect.set(t, r, s);
|
|
607
|
+
}
|
|
608
|
+
}) : e;
|
|
609
|
+
}
|
|
610
|
+
var ue = class {
|
|
611
|
+
[i];
|
|
612
|
+
snippet;
|
|
613
|
+
#t;
|
|
614
|
+
constructor(t, e) {
|
|
615
|
+
this[i] = !0, this.snippet = t, this.#t = e;
|
|
616
|
+
}
|
|
617
|
+
get [De]() {
|
|
618
|
+
if (!this.#t) throw new Error(f`Cannot take a reference of ${this.snippet}`);
|
|
619
|
+
return l(this, this.#t, this.snippet.origin);
|
|
620
|
+
}
|
|
621
|
+
[A]() {
|
|
622
|
+
if (!this.#t) throw new Error(f`Cannot take a reference of ${this.snippet}`);
|
|
623
|
+
return l(f`(&${this.snippet})`, this.#t, this.snippet.origin);
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
function Vr(t) {
|
|
627
|
+
if (!at(t.dataType)) return t;
|
|
628
|
+
const e = t.dataType.inner, n = Ze(e) ? "runtime" : t.origin;
|
|
629
|
+
return t.value instanceof ue ? l(f`${t.value.snippet}`, e, n) : l(f`(*${t})`, e, n);
|
|
630
|
+
}
|
|
631
|
+
function Or(t, e) {
|
|
632
|
+
const n = t;
|
|
633
|
+
return Tr(n) ? n[Ye](e) : typeof n != "function" ? e : e === void 0 ? n() : n(e);
|
|
634
|
+
}
|
|
635
|
+
function Nr(t, e, n) {
|
|
636
|
+
if (!Mr(e)) return n;
|
|
637
|
+
const r = e;
|
|
638
|
+
return n === void 0 || n.value === void 0 ? r[ot].call(t, []) : r[ot].call(t, [n]);
|
|
639
|
+
}
|
|
640
|
+
function Pr(t) {
|
|
641
|
+
const e = String(t);
|
|
642
|
+
if (e !== "[object Object]") return e;
|
|
643
|
+
try {
|
|
644
|
+
return JSON.stringify(t);
|
|
645
|
+
} catch (n) {
|
|
646
|
+
return console.error("Error parsing JSON:", n), "<invalid json>";
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
function Fe(t) {
|
|
650
|
+
return w(t) || L(t) ? t.toString() : Array.isArray(t) ? `[${t.map(Fe).join(", ")}]` : t && typeof t == "object" ? `{ ${Object.entries(t).map(([e, n]) => `${e}: ${Fe(n)}`).join(", ")} }` : String(t);
|
|
651
|
+
}
|
|
652
|
+
function Cr(t, e) {
|
|
653
|
+
throw new Error(`Failed to handle ${t} at ${e}`);
|
|
654
|
+
}
|
|
655
|
+
const ye = {
|
|
656
|
+
rank: Number.POSITIVE_INFINITY,
|
|
657
|
+
action: "none"
|
|
658
|
+
};
|
|
659
|
+
function Zt(t, e) {
|
|
660
|
+
const n = St(t), r = St(e);
|
|
661
|
+
if (n.type === r.type) return {
|
|
662
|
+
rank: 0,
|
|
663
|
+
action: "none"
|
|
664
|
+
};
|
|
665
|
+
if (n.type === "abstractFloat") {
|
|
666
|
+
if (r.type === "f32") return {
|
|
667
|
+
rank: 1,
|
|
668
|
+
action: "none"
|
|
669
|
+
};
|
|
670
|
+
if (r.type === "f16") return {
|
|
671
|
+
rank: 2,
|
|
672
|
+
action: "none"
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
if (n.type === "abstractInt") {
|
|
676
|
+
if (r.type === "i32") return {
|
|
677
|
+
rank: 3,
|
|
678
|
+
action: "none"
|
|
679
|
+
};
|
|
680
|
+
if (r.type === "u32") return {
|
|
681
|
+
rank: 4,
|
|
682
|
+
action: "none"
|
|
683
|
+
};
|
|
684
|
+
if (r.type === "abstractFloat") return {
|
|
685
|
+
rank: 5,
|
|
686
|
+
action: "none"
|
|
687
|
+
};
|
|
688
|
+
if (r.type === "f32") return {
|
|
689
|
+
rank: 6,
|
|
690
|
+
action: "none"
|
|
691
|
+
};
|
|
692
|
+
if (r.type === "f16") return {
|
|
693
|
+
rank: 7,
|
|
694
|
+
action: "none"
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
return C(n) && C(r) && n.type[3] === r.type[3] ? Zt(n.primitive, r.primitive) : ct(n) && ct(r) && n.type[3] === r.type[3] ? {
|
|
698
|
+
rank: 0,
|
|
699
|
+
action: "none"
|
|
700
|
+
} : ye;
|
|
701
|
+
}
|
|
702
|
+
function Ar(t, e) {
|
|
703
|
+
const n = St(t), r = St(e);
|
|
704
|
+
if (at(n) && n.implicit && Zt(n.inner, r).rank < Number.POSITIVE_INFINITY) return {
|
|
705
|
+
rank: 0,
|
|
706
|
+
action: "deref"
|
|
707
|
+
};
|
|
708
|
+
if (at(r) && Zt(n, r.inner).rank < Number.POSITIVE_INFINITY) return {
|
|
709
|
+
rank: 1,
|
|
710
|
+
action: "ref"
|
|
711
|
+
};
|
|
712
|
+
const s = {
|
|
713
|
+
f32: 0,
|
|
714
|
+
f16: 1,
|
|
715
|
+
i32: 2,
|
|
716
|
+
u32: 3,
|
|
717
|
+
bool: 4
|
|
718
|
+
};
|
|
719
|
+
if (n.type in s && r.type in s) {
|
|
720
|
+
const c = n.type, a = r.type;
|
|
721
|
+
if (c !== a) {
|
|
722
|
+
const o = s[c];
|
|
723
|
+
return {
|
|
724
|
+
rank: s[a] < o ? 10 : 20,
|
|
725
|
+
action: "cast",
|
|
726
|
+
targetType: r
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (n.type === "abstractFloat") {
|
|
731
|
+
if (r.type === "u32") return {
|
|
732
|
+
rank: 2,
|
|
733
|
+
action: "cast",
|
|
734
|
+
targetType: r
|
|
735
|
+
};
|
|
736
|
+
if (r.type === "i32") return {
|
|
737
|
+
rank: 1,
|
|
738
|
+
action: "cast",
|
|
739
|
+
targetType: r
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
return ye;
|
|
743
|
+
}
|
|
744
|
+
function Fr(t, e, n) {
|
|
745
|
+
const r = Zt(t, e);
|
|
746
|
+
return r.rank < Number.POSITIVE_INFINITY ? r : n ? Ar(t, e) : ye;
|
|
747
|
+
}
|
|
748
|
+
function Ue(t, e, n) {
|
|
749
|
+
let r;
|
|
750
|
+
for (const c of e) {
|
|
751
|
+
const a = [];
|
|
752
|
+
let o = 0;
|
|
753
|
+
for (const b of t) {
|
|
754
|
+
const y = Fr(b, c, n);
|
|
755
|
+
if (o += y.rank, y.rank === Number.POSITIVE_INFINITY) break;
|
|
756
|
+
a.push(y);
|
|
757
|
+
}
|
|
758
|
+
o < (r?.sum ?? Number.POSITIVE_INFINITY) && (r = {
|
|
759
|
+
type: c,
|
|
760
|
+
details: a,
|
|
761
|
+
sum: o
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
if (!r) return;
|
|
765
|
+
const s = r.details.map((c, a) => ({
|
|
766
|
+
sourceIndex: a,
|
|
767
|
+
action: c.action,
|
|
768
|
+
...c.action === "cast" && { targetType: c.targetType }
|
|
769
|
+
}));
|
|
770
|
+
return {
|
|
771
|
+
targetType: r.type,
|
|
772
|
+
actions: s,
|
|
773
|
+
hasImplicitConversions: s.some((c) => c.action === "cast")
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function un(t, e) {
|
|
777
|
+
if (t.length === 0) return;
|
|
778
|
+
const n = [...new Set((e || t).map(St))], r = Ue(t, n, !1);
|
|
779
|
+
if (r) return r;
|
|
780
|
+
const s = Ue(t, n, !0);
|
|
781
|
+
if (s) return s;
|
|
782
|
+
}
|
|
783
|
+
function Ur(t, e, n, r) {
|
|
784
|
+
if (n.action === "none") return l(e.value, r, e.origin);
|
|
785
|
+
switch (n.action) {
|
|
786
|
+
case "ref":
|
|
787
|
+
return l(new ue(e, r), r, e.origin);
|
|
788
|
+
case "deref":
|
|
789
|
+
return Vr(e);
|
|
790
|
+
case "cast":
|
|
791
|
+
return Nr(t, r, e);
|
|
792
|
+
default:
|
|
793
|
+
Cr(n.action, "applyActionToSnippet");
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
function je(t, e) {
|
|
797
|
+
if (t.some((r) => r === it)) return;
|
|
798
|
+
const n = un(t, e);
|
|
799
|
+
if (n)
|
|
800
|
+
return t.map((r) => C(r) || ct(r) ? r : n.targetType);
|
|
801
|
+
}
|
|
802
|
+
function yn(t, e, n, r = !0) {
|
|
803
|
+
const s = e.map((a) => a.dataType);
|
|
804
|
+
if (s.some((a) => a === it)) return;
|
|
805
|
+
Ft && Array.isArray(n) && n.length === 0 && console.warn("convertToCommonType was called with an empty restrictTo array, which prevents any conversions from being made. If you intend to allow all conversions, pass undefined instead. If this was intended call the function conditionally since the result will always be undefined.");
|
|
806
|
+
const c = un(s, n);
|
|
807
|
+
if (c)
|
|
808
|
+
return (ce || Ft) && r && c.hasImplicitConversions && console.warn(`Implicit conversions from [
|
|
809
|
+
${e.map((a) => ` ${a.value}: ${Pr(a.dataType)}`).join(`,
|
|
810
|
+
`)}
|
|
811
|
+
] to ${c.targetType.type} are supported, but not recommended.
|
|
812
|
+
Consider using explicit conversions instead.`), e.map((a, o) => {
|
|
813
|
+
const b = c.actions[o];
|
|
814
|
+
return ae(b, "Action should not be undefined"), Ur(t, a, b, c.targetType);
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
function fn(t, e, n, r = !0) {
|
|
818
|
+
const s = Array.isArray(n) ? n : [n], { value: c, dataType: a, origin: o } = e;
|
|
819
|
+
if (s.length === 1) {
|
|
820
|
+
const y = s[0];
|
|
821
|
+
if (y === a) return l(c, y, o);
|
|
822
|
+
if (a === it) return l(f`${l(c, y, o)}`, y, o);
|
|
823
|
+
}
|
|
824
|
+
const b = yn(t, [e], s, r);
|
|
825
|
+
if (b) return b[0];
|
|
826
|
+
throw new Qt(`Cannot convert value of type '${String(a)}' to any of the target types: [${s.map((y) => y.type).join(", ")}]`);
|
|
827
|
+
}
|
|
828
|
+
function Pc(t, e, n) {
|
|
829
|
+
return Object.entries(e.propTypes).map(([r, s]) => {
|
|
830
|
+
const c = n[r];
|
|
831
|
+
if (!c) throw new Error(`Missing property ${r}`);
|
|
832
|
+
return yn(t, [c], [s])?.[0] ?? c;
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
function ft(t) {
|
|
836
|
+
const e = ((...n) => t.normalImpl(...n));
|
|
837
|
+
return yt(e, t.name), e.toString = () => t.name, e[ot] = {
|
|
838
|
+
get strictSignature() {
|
|
839
|
+
},
|
|
840
|
+
call(n, r) {
|
|
841
|
+
const { argTypes: s, returnType: c } = t.signature(...r.map((o) => at(o.dataType) && o.dataType.implicit ? o.dataType.inner : o.dataType)), a = r.map((o, b) => {
|
|
842
|
+
const y = s[b];
|
|
843
|
+
if (!y) throw new Error("Function called with invalid arguments");
|
|
844
|
+
return fn(n, o, y, !1);
|
|
845
|
+
});
|
|
846
|
+
if (a.every((o) => Kt(o))) {
|
|
847
|
+
n.pushMode(new ie());
|
|
848
|
+
try {
|
|
849
|
+
return l(t.normalImpl(...a.map((o) => o.value)), c, "constant");
|
|
850
|
+
} finally {
|
|
851
|
+
n.popMode("normal");
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return l(t.codegenImpl(n, a), c, "runtime");
|
|
855
|
+
}
|
|
856
|
+
}, e;
|
|
857
|
+
}
|
|
858
|
+
const jr = {
|
|
859
|
+
[i]: {},
|
|
860
|
+
type: "abstractInt",
|
|
861
|
+
toString() {
|
|
862
|
+
return "abstractInt";
|
|
863
|
+
}
|
|
864
|
+
}, se = {
|
|
865
|
+
[i]: {},
|
|
866
|
+
type: "abstractFloat",
|
|
867
|
+
toString() {
|
|
868
|
+
return "abstractFloat";
|
|
869
|
+
}
|
|
870
|
+
}, Br = ft({
|
|
871
|
+
name: "bool",
|
|
872
|
+
signature: (t) => ({
|
|
873
|
+
argTypes: t ? [t] : [],
|
|
874
|
+
returnType: Z
|
|
875
|
+
}),
|
|
876
|
+
normalImpl(t) {
|
|
877
|
+
return t === void 0 ? !1 : typeof t == "boolean" ? t : !!t;
|
|
878
|
+
},
|
|
879
|
+
codegenImpl: (t, [e]) => e?.dataType === Z ? f`${e}` : f`bool(${e})`
|
|
880
|
+
}), Z = Object.assign(Br, {
|
|
881
|
+
[i]: {},
|
|
882
|
+
type: "bool"
|
|
883
|
+
}), Lr = ft({
|
|
884
|
+
name: "u32",
|
|
885
|
+
signature: (t) => ({
|
|
886
|
+
argTypes: t ? [t] : [],
|
|
887
|
+
returnType: z
|
|
888
|
+
}),
|
|
889
|
+
normalImpl(t) {
|
|
890
|
+
if (t === void 0) return 0;
|
|
891
|
+
if (typeof t == "boolean") return t ? 1 : 0;
|
|
892
|
+
if (!Number.isInteger(t)) {
|
|
893
|
+
const e = Math.trunc(t);
|
|
894
|
+
return e < 0 ? 0 : e > 4294967295 ? 4294967295 : e;
|
|
895
|
+
}
|
|
896
|
+
return (t & 4294967295) >>> 0;
|
|
897
|
+
},
|
|
898
|
+
codegenImpl: (t, [e]) => e?.dataType === z ? f`${e}` : f`u32(${e})`
|
|
899
|
+
}), z = Object.assign(Lr, {
|
|
900
|
+
[i]: {},
|
|
901
|
+
type: "u32"
|
|
902
|
+
}), Rr = ft({
|
|
903
|
+
name: "i32",
|
|
904
|
+
signature: (t) => ({
|
|
905
|
+
argTypes: t ? [t] : [],
|
|
906
|
+
returnType: X
|
|
907
|
+
}),
|
|
908
|
+
normalImpl(t) {
|
|
909
|
+
return t === void 0 ? 0 : typeof t == "boolean" ? t ? 1 : 0 : t | 0;
|
|
910
|
+
},
|
|
911
|
+
codegenImpl: (t, [e]) => e?.dataType === X ? f`${e}` : f`i32(${e})`
|
|
912
|
+
}), Cc = {
|
|
913
|
+
[i]: {},
|
|
914
|
+
type: "u16"
|
|
915
|
+
}, X = Object.assign(Rr, {
|
|
916
|
+
[i]: {},
|
|
917
|
+
type: "i32"
|
|
918
|
+
}), Wr = ft({
|
|
919
|
+
name: "f32",
|
|
920
|
+
signature: (t) => ({
|
|
921
|
+
argTypes: t ? [t] : [],
|
|
922
|
+
returnType: T
|
|
923
|
+
}),
|
|
924
|
+
normalImpl(t) {
|
|
925
|
+
return t === void 0 ? 0 : typeof t == "boolean" ? t ? 1 : 0 : Math.fround(t);
|
|
926
|
+
},
|
|
927
|
+
codegenImpl: (t, [e]) => e?.dataType === T ? f`${e}` : f`f32(${e})`
|
|
928
|
+
}), T = Object.assign(Wr, {
|
|
929
|
+
[i]: {},
|
|
930
|
+
type: "f32"
|
|
931
|
+
}), ln = /* @__PURE__ */ new ArrayBuffer(4), Gr = new Float32Array(ln), Dr = new Uint32Array(ln);
|
|
932
|
+
function Yr(t) {
|
|
933
|
+
Gr[0] = t;
|
|
934
|
+
const e = Dr[0], n = e >>> 31 & 1;
|
|
935
|
+
let r = e >>> 23 & 255, s = e & 8388607;
|
|
936
|
+
return r === 255 ? n << 15 | 31744 | (s ? 512 : 0) : (r = r - 127 + 15, r <= 0 ? r < -10 ? n << 15 : (s = (s | 8388608) >> 1 - r, s = s + 4096 >> 13, n << 15 | s) : r >= 31 || (s = s + 4096, s & 8388608 && (s = 0, ++r, r >= 31)) ? n << 15 | 31744 : n << 15 | r << 10 | s >> 13);
|
|
937
|
+
}
|
|
938
|
+
function qr(t) {
|
|
939
|
+
const e = t & 32768 ? -1 : 1, n = t >> 10 & 31, r = t & 1023;
|
|
940
|
+
return n === 0 ? r ? e * r * 2 ** -24 : e * 0 : n === 31 ? r ? NaN : e === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : e * (1 + r / 1024) * 2 ** (n - 15);
|
|
941
|
+
}
|
|
942
|
+
function Hr(t) {
|
|
943
|
+
return qr(Yr(t));
|
|
944
|
+
}
|
|
945
|
+
const Kr = ft({
|
|
946
|
+
name: "f16",
|
|
947
|
+
signature: (t) => ({
|
|
948
|
+
argTypes: t ? [t] : [],
|
|
949
|
+
returnType: J
|
|
950
|
+
}),
|
|
951
|
+
normalImpl(t) {
|
|
952
|
+
return t === void 0 ? 0 : typeof t == "boolean" ? t ? 1 : 0 : Hr(t);
|
|
953
|
+
},
|
|
954
|
+
codegenImpl: (t, [e]) => e?.dataType === J ? f`${e}` : f`f16(${e})`
|
|
955
|
+
}), J = Object.assign(Kr, {
|
|
956
|
+
[i]: {},
|
|
957
|
+
type: "f16"
|
|
958
|
+
}), R = [
|
|
959
|
+
"x",
|
|
960
|
+
"y",
|
|
961
|
+
"z",
|
|
962
|
+
"w"
|
|
963
|
+
], W = [
|
|
964
|
+
"r",
|
|
965
|
+
"g",
|
|
966
|
+
"b",
|
|
967
|
+
"a"
|
|
968
|
+
];
|
|
969
|
+
var P, fe = (P = class extends Array {
|
|
970
|
+
castElement() {
|
|
971
|
+
return this[i].elementSchema;
|
|
972
|
+
}
|
|
973
|
+
[A]() {
|
|
974
|
+
const e = this[i].elementSchema;
|
|
975
|
+
return this.every((n) => !n) ? l(`${this.kind}()`, e, "constant") : this.every((n) => this[0] === n) ? l(`${this.kind}(${this[0]})`, e, "runtime") : l(`${this.kind}(${this.join(", ")})`, e, "runtime");
|
|
976
|
+
}
|
|
977
|
+
toString() {
|
|
978
|
+
return this[A]().value;
|
|
979
|
+
}
|
|
980
|
+
}, (() => {
|
|
981
|
+
for (let e = 0; e < 4; e++) for (let n = 0; n < 4; n++) for (let r = 0; r < 4; r++) for (let s = 0; s < 4; s++) {
|
|
982
|
+
const c = `${R[e]}${R[n]}${R[r]}${R[s]}`, a = `${W[e]}${W[n]}${W[r]}${W[s]}`;
|
|
983
|
+
Object.defineProperty(P.prototype, c, { get() {
|
|
984
|
+
return new this._Vec4(this[e], this[n], this[r], this[s]);
|
|
985
|
+
} }), Object.defineProperty(P.prototype, a, { get() {
|
|
986
|
+
return new this._Vec4(this[e], this[n], this[r], this[s]);
|
|
987
|
+
} });
|
|
988
|
+
}
|
|
989
|
+
for (let e = 0; e < 4; e++) for (let n = 0; n < 4; n++) for (let r = 0; r < 4; r++) {
|
|
990
|
+
const s = `${R[e]}${R[n]}${R[r]}`, c = `${W[e]}${W[n]}${W[r]}`;
|
|
991
|
+
Object.defineProperty(P.prototype, s, { get() {
|
|
992
|
+
return new this._Vec3(this[e], this[n], this[r]);
|
|
993
|
+
} }), Object.defineProperty(P.prototype, c, { get() {
|
|
994
|
+
return new this._Vec3(this[e], this[n], this[r]);
|
|
995
|
+
} });
|
|
996
|
+
}
|
|
997
|
+
for (let e = 0; e < 4; e++) for (let n = 0; n < 4; n++) {
|
|
998
|
+
const r = `${R[e]}${R[n]}`, s = `${W[e]}${W[n]}`;
|
|
999
|
+
Object.defineProperty(P.prototype, r, { get() {
|
|
1000
|
+
return new this._Vec2(this[e], this[n]);
|
|
1001
|
+
} }), Object.defineProperty(P.prototype, s, { get() {
|
|
1002
|
+
return new this._Vec2(this[e], this[n]);
|
|
1003
|
+
} });
|
|
1004
|
+
}
|
|
1005
|
+
})(), P), jt = class extends fe {
|
|
1006
|
+
e0;
|
|
1007
|
+
e1;
|
|
1008
|
+
constructor(t, e) {
|
|
1009
|
+
super(2), this.e0 = this.castElement()(t), this.e1 = this.castElement()(e ?? t);
|
|
1010
|
+
}
|
|
1011
|
+
get 0() {
|
|
1012
|
+
return this.e0;
|
|
1013
|
+
}
|
|
1014
|
+
get 1() {
|
|
1015
|
+
return this.e1;
|
|
1016
|
+
}
|
|
1017
|
+
set 0(t) {
|
|
1018
|
+
this.e0 = this.castElement()(t);
|
|
1019
|
+
}
|
|
1020
|
+
set 1(t) {
|
|
1021
|
+
this.e1 = this.castElement()(t);
|
|
1022
|
+
}
|
|
1023
|
+
get x() {
|
|
1024
|
+
return this[0];
|
|
1025
|
+
}
|
|
1026
|
+
get y() {
|
|
1027
|
+
return this[1];
|
|
1028
|
+
}
|
|
1029
|
+
set x(t) {
|
|
1030
|
+
this[0] = this.castElement()(t);
|
|
1031
|
+
}
|
|
1032
|
+
set y(t) {
|
|
1033
|
+
this[1] = this.castElement()(t);
|
|
1034
|
+
}
|
|
1035
|
+
get r() {
|
|
1036
|
+
return this[0];
|
|
1037
|
+
}
|
|
1038
|
+
get g() {
|
|
1039
|
+
return this[1];
|
|
1040
|
+
}
|
|
1041
|
+
set r(t) {
|
|
1042
|
+
this[0] = this.castElement()(t);
|
|
1043
|
+
}
|
|
1044
|
+
set g(t) {
|
|
1045
|
+
this[1] = this.castElement()(t);
|
|
1046
|
+
}
|
|
1047
|
+
}, Bt = class extends fe {
|
|
1048
|
+
e0;
|
|
1049
|
+
e1;
|
|
1050
|
+
e2;
|
|
1051
|
+
constructor(t, e, n) {
|
|
1052
|
+
super(3), this.e0 = this.castElement()(t), this.e1 = this.castElement()(e ?? t), this.e2 = this.castElement()(n ?? t);
|
|
1053
|
+
}
|
|
1054
|
+
get 0() {
|
|
1055
|
+
return this.e0;
|
|
1056
|
+
}
|
|
1057
|
+
get 1() {
|
|
1058
|
+
return this.e1;
|
|
1059
|
+
}
|
|
1060
|
+
get 2() {
|
|
1061
|
+
return this.e2;
|
|
1062
|
+
}
|
|
1063
|
+
set 0(t) {
|
|
1064
|
+
this.e0 = this.castElement()(t);
|
|
1065
|
+
}
|
|
1066
|
+
set 1(t) {
|
|
1067
|
+
this.e1 = this.castElement()(t);
|
|
1068
|
+
}
|
|
1069
|
+
set 2(t) {
|
|
1070
|
+
this.e2 = this.castElement()(t);
|
|
1071
|
+
}
|
|
1072
|
+
get x() {
|
|
1073
|
+
return this[0];
|
|
1074
|
+
}
|
|
1075
|
+
get y() {
|
|
1076
|
+
return this[1];
|
|
1077
|
+
}
|
|
1078
|
+
get z() {
|
|
1079
|
+
return this[2];
|
|
1080
|
+
}
|
|
1081
|
+
set x(t) {
|
|
1082
|
+
this[0] = this.castElement()(t);
|
|
1083
|
+
}
|
|
1084
|
+
set y(t) {
|
|
1085
|
+
this[1] = this.castElement()(t);
|
|
1086
|
+
}
|
|
1087
|
+
set z(t) {
|
|
1088
|
+
this[2] = this.castElement()(t);
|
|
1089
|
+
}
|
|
1090
|
+
get r() {
|
|
1091
|
+
return this[0];
|
|
1092
|
+
}
|
|
1093
|
+
get g() {
|
|
1094
|
+
return this[1];
|
|
1095
|
+
}
|
|
1096
|
+
get b() {
|
|
1097
|
+
return this[2];
|
|
1098
|
+
}
|
|
1099
|
+
set r(t) {
|
|
1100
|
+
this[0] = this.castElement()(t);
|
|
1101
|
+
}
|
|
1102
|
+
set g(t) {
|
|
1103
|
+
this[1] = this.castElement()(t);
|
|
1104
|
+
}
|
|
1105
|
+
set b(t) {
|
|
1106
|
+
this[2] = this.castElement()(t);
|
|
1107
|
+
}
|
|
1108
|
+
}, Lt = class extends fe {
|
|
1109
|
+
e0;
|
|
1110
|
+
e1;
|
|
1111
|
+
e2;
|
|
1112
|
+
e3;
|
|
1113
|
+
constructor(t, e, n, r) {
|
|
1114
|
+
super(4), this.e0 = this.castElement()(t), this.e1 = this.castElement()(e ?? t), this.e2 = this.castElement()(n ?? t), this.e3 = this.castElement()(r ?? t);
|
|
1115
|
+
}
|
|
1116
|
+
get 0() {
|
|
1117
|
+
return this.e0;
|
|
1118
|
+
}
|
|
1119
|
+
get 1() {
|
|
1120
|
+
return this.e1;
|
|
1121
|
+
}
|
|
1122
|
+
get 2() {
|
|
1123
|
+
return this.e2;
|
|
1124
|
+
}
|
|
1125
|
+
get 3() {
|
|
1126
|
+
return this.e3;
|
|
1127
|
+
}
|
|
1128
|
+
set 0(t) {
|
|
1129
|
+
this.e0 = this.castElement()(t);
|
|
1130
|
+
}
|
|
1131
|
+
set 1(t) {
|
|
1132
|
+
this.e1 = this.castElement()(t);
|
|
1133
|
+
}
|
|
1134
|
+
set 2(t) {
|
|
1135
|
+
this.e2 = this.castElement()(t);
|
|
1136
|
+
}
|
|
1137
|
+
set 3(t) {
|
|
1138
|
+
this.e3 = this.castElement()(t);
|
|
1139
|
+
}
|
|
1140
|
+
get x() {
|
|
1141
|
+
return this[0];
|
|
1142
|
+
}
|
|
1143
|
+
get y() {
|
|
1144
|
+
return this[1];
|
|
1145
|
+
}
|
|
1146
|
+
get r() {
|
|
1147
|
+
return this[0];
|
|
1148
|
+
}
|
|
1149
|
+
get g() {
|
|
1150
|
+
return this[1];
|
|
1151
|
+
}
|
|
1152
|
+
get b() {
|
|
1153
|
+
return this[2];
|
|
1154
|
+
}
|
|
1155
|
+
get a() {
|
|
1156
|
+
return this[3];
|
|
1157
|
+
}
|
|
1158
|
+
set r(t) {
|
|
1159
|
+
this[0] = t;
|
|
1160
|
+
}
|
|
1161
|
+
set g(t) {
|
|
1162
|
+
this[1] = t;
|
|
1163
|
+
}
|
|
1164
|
+
set b(t) {
|
|
1165
|
+
this[2] = t;
|
|
1166
|
+
}
|
|
1167
|
+
set a(t) {
|
|
1168
|
+
this[3] = t;
|
|
1169
|
+
}
|
|
1170
|
+
get z() {
|
|
1171
|
+
return this[2];
|
|
1172
|
+
}
|
|
1173
|
+
get w() {
|
|
1174
|
+
return this[3];
|
|
1175
|
+
}
|
|
1176
|
+
set x(t) {
|
|
1177
|
+
this[0] = t;
|
|
1178
|
+
}
|
|
1179
|
+
set y(t) {
|
|
1180
|
+
this[1] = t;
|
|
1181
|
+
}
|
|
1182
|
+
set z(t) {
|
|
1183
|
+
this[2] = t;
|
|
1184
|
+
}
|
|
1185
|
+
set w(t) {
|
|
1186
|
+
this[3] = t;
|
|
1187
|
+
}
|
|
1188
|
+
}, le = class mn extends jt {
|
|
1189
|
+
get [i]() {
|
|
1190
|
+
return { elementSchema: T };
|
|
1191
|
+
}
|
|
1192
|
+
get kind() {
|
|
1193
|
+
return "vec2f";
|
|
1194
|
+
}
|
|
1195
|
+
get _Vec2() {
|
|
1196
|
+
return mn;
|
|
1197
|
+
}
|
|
1198
|
+
get _Vec3() {
|
|
1199
|
+
return de;
|
|
1200
|
+
}
|
|
1201
|
+
get _Vec4() {
|
|
1202
|
+
return we;
|
|
1203
|
+
}
|
|
1204
|
+
}, me = class hn extends jt {
|
|
1205
|
+
get [i]() {
|
|
1206
|
+
return { elementSchema: J };
|
|
1207
|
+
}
|
|
1208
|
+
get kind() {
|
|
1209
|
+
return "vec2h";
|
|
1210
|
+
}
|
|
1211
|
+
get _Vec2() {
|
|
1212
|
+
return hn;
|
|
1213
|
+
}
|
|
1214
|
+
get _Vec3() {
|
|
1215
|
+
return ge;
|
|
1216
|
+
}
|
|
1217
|
+
get _Vec4() {
|
|
1218
|
+
return Me;
|
|
1219
|
+
}
|
|
1220
|
+
}, he = class pn extends jt {
|
|
1221
|
+
get [i]() {
|
|
1222
|
+
return { elementSchema: X };
|
|
1223
|
+
}
|
|
1224
|
+
get kind() {
|
|
1225
|
+
return "vec2i";
|
|
1226
|
+
}
|
|
1227
|
+
get _Vec2() {
|
|
1228
|
+
return pn;
|
|
1229
|
+
}
|
|
1230
|
+
get _Vec3() {
|
|
1231
|
+
return ve;
|
|
1232
|
+
}
|
|
1233
|
+
get _Vec4() {
|
|
1234
|
+
return Te;
|
|
1235
|
+
}
|
|
1236
|
+
}, pe = class xn extends jt {
|
|
1237
|
+
get [i]() {
|
|
1238
|
+
return { elementSchema: z };
|
|
1239
|
+
}
|
|
1240
|
+
get kind() {
|
|
1241
|
+
return "vec2u";
|
|
1242
|
+
}
|
|
1243
|
+
get _Vec2() {
|
|
1244
|
+
return xn;
|
|
1245
|
+
}
|
|
1246
|
+
get _Vec3() {
|
|
1247
|
+
return be;
|
|
1248
|
+
}
|
|
1249
|
+
get _Vec4() {
|
|
1250
|
+
return _e;
|
|
1251
|
+
}
|
|
1252
|
+
}, xe = class dn extends jt {
|
|
1253
|
+
get [i]() {
|
|
1254
|
+
return { elementSchema: Z };
|
|
1255
|
+
}
|
|
1256
|
+
get kind() {
|
|
1257
|
+
return "vec2<bool>";
|
|
1258
|
+
}
|
|
1259
|
+
get _Vec2() {
|
|
1260
|
+
return dn;
|
|
1261
|
+
}
|
|
1262
|
+
get _Vec3() {
|
|
1263
|
+
return ze;
|
|
1264
|
+
}
|
|
1265
|
+
get _Vec4() {
|
|
1266
|
+
return Ie;
|
|
1267
|
+
}
|
|
1268
|
+
}, de = class gn extends Bt {
|
|
1269
|
+
get [i]() {
|
|
1270
|
+
return { elementSchema: T };
|
|
1271
|
+
}
|
|
1272
|
+
get kind() {
|
|
1273
|
+
return "vec3f";
|
|
1274
|
+
}
|
|
1275
|
+
get _Vec2() {
|
|
1276
|
+
return le;
|
|
1277
|
+
}
|
|
1278
|
+
get _Vec3() {
|
|
1279
|
+
return gn;
|
|
1280
|
+
}
|
|
1281
|
+
get _Vec4() {
|
|
1282
|
+
return we;
|
|
1283
|
+
}
|
|
1284
|
+
}, ge = class vn extends Bt {
|
|
1285
|
+
get [i]() {
|
|
1286
|
+
return { elementSchema: J };
|
|
1287
|
+
}
|
|
1288
|
+
get kind() {
|
|
1289
|
+
return "vec3h";
|
|
1290
|
+
}
|
|
1291
|
+
get _Vec2() {
|
|
1292
|
+
return me;
|
|
1293
|
+
}
|
|
1294
|
+
get _Vec3() {
|
|
1295
|
+
return vn;
|
|
1296
|
+
}
|
|
1297
|
+
get _Vec4() {
|
|
1298
|
+
return Me;
|
|
1299
|
+
}
|
|
1300
|
+
}, ve = class bn extends Bt {
|
|
1301
|
+
get [i]() {
|
|
1302
|
+
return { elementSchema: X };
|
|
1303
|
+
}
|
|
1304
|
+
get kind() {
|
|
1305
|
+
return "vec3i";
|
|
1306
|
+
}
|
|
1307
|
+
get _Vec2() {
|
|
1308
|
+
return he;
|
|
1309
|
+
}
|
|
1310
|
+
get _Vec3() {
|
|
1311
|
+
return bn;
|
|
1312
|
+
}
|
|
1313
|
+
get _Vec4() {
|
|
1314
|
+
return Te;
|
|
1315
|
+
}
|
|
1316
|
+
}, be = class zn extends Bt {
|
|
1317
|
+
get [i]() {
|
|
1318
|
+
return { elementSchema: z };
|
|
1319
|
+
}
|
|
1320
|
+
get kind() {
|
|
1321
|
+
return "vec3u";
|
|
1322
|
+
}
|
|
1323
|
+
get _Vec2() {
|
|
1324
|
+
return pe;
|
|
1325
|
+
}
|
|
1326
|
+
get _Vec3() {
|
|
1327
|
+
return zn;
|
|
1328
|
+
}
|
|
1329
|
+
get _Vec4() {
|
|
1330
|
+
return _e;
|
|
1331
|
+
}
|
|
1332
|
+
}, ze = class wn extends Bt {
|
|
1333
|
+
get [i]() {
|
|
1334
|
+
return { elementSchema: Z };
|
|
1335
|
+
}
|
|
1336
|
+
get kind() {
|
|
1337
|
+
return "vec3<bool>";
|
|
1338
|
+
}
|
|
1339
|
+
get _Vec2() {
|
|
1340
|
+
return xe;
|
|
1341
|
+
}
|
|
1342
|
+
get _Vec3() {
|
|
1343
|
+
return wn;
|
|
1344
|
+
}
|
|
1345
|
+
get _Vec4() {
|
|
1346
|
+
return Ie;
|
|
1347
|
+
}
|
|
1348
|
+
}, we = class Mn extends Lt {
|
|
1349
|
+
get [i]() {
|
|
1350
|
+
return { elementSchema: T };
|
|
1351
|
+
}
|
|
1352
|
+
get kind() {
|
|
1353
|
+
return "vec4f";
|
|
1354
|
+
}
|
|
1355
|
+
get _Vec2() {
|
|
1356
|
+
return le;
|
|
1357
|
+
}
|
|
1358
|
+
get _Vec3() {
|
|
1359
|
+
return de;
|
|
1360
|
+
}
|
|
1361
|
+
get _Vec4() {
|
|
1362
|
+
return Mn;
|
|
1363
|
+
}
|
|
1364
|
+
}, Me = class Tn extends Lt {
|
|
1365
|
+
get [i]() {
|
|
1366
|
+
return { elementSchema: J };
|
|
1367
|
+
}
|
|
1368
|
+
get kind() {
|
|
1369
|
+
return "vec4h";
|
|
1370
|
+
}
|
|
1371
|
+
get _Vec2() {
|
|
1372
|
+
return me;
|
|
1373
|
+
}
|
|
1374
|
+
get _Vec3() {
|
|
1375
|
+
return ge;
|
|
1376
|
+
}
|
|
1377
|
+
get _Vec4() {
|
|
1378
|
+
return Tn;
|
|
1379
|
+
}
|
|
1380
|
+
}, Te = class _n extends Lt {
|
|
1381
|
+
get [i]() {
|
|
1382
|
+
return { elementSchema: X };
|
|
1383
|
+
}
|
|
1384
|
+
get kind() {
|
|
1385
|
+
return "vec4i";
|
|
1386
|
+
}
|
|
1387
|
+
get _Vec2() {
|
|
1388
|
+
return he;
|
|
1389
|
+
}
|
|
1390
|
+
get _Vec3() {
|
|
1391
|
+
return ve;
|
|
1392
|
+
}
|
|
1393
|
+
get _Vec4() {
|
|
1394
|
+
return _n;
|
|
1395
|
+
}
|
|
1396
|
+
}, _e = class In extends Lt {
|
|
1397
|
+
get [i]() {
|
|
1398
|
+
return { elementSchema: z };
|
|
1399
|
+
}
|
|
1400
|
+
get kind() {
|
|
1401
|
+
return "vec4u";
|
|
1402
|
+
}
|
|
1403
|
+
get _Vec2() {
|
|
1404
|
+
return pe;
|
|
1405
|
+
}
|
|
1406
|
+
get _Vec3() {
|
|
1407
|
+
return be;
|
|
1408
|
+
}
|
|
1409
|
+
get _Vec4() {
|
|
1410
|
+
return In;
|
|
1411
|
+
}
|
|
1412
|
+
}, Ie = class $n extends Lt {
|
|
1413
|
+
get [i]() {
|
|
1414
|
+
return { elementSchema: Z };
|
|
1415
|
+
}
|
|
1416
|
+
get kind() {
|
|
1417
|
+
return "vec4<bool>";
|
|
1418
|
+
}
|
|
1419
|
+
get _Vec2() {
|
|
1420
|
+
return xe;
|
|
1421
|
+
}
|
|
1422
|
+
get _Vec3() {
|
|
1423
|
+
return ze;
|
|
1424
|
+
}
|
|
1425
|
+
get _Vec4() {
|
|
1426
|
+
return $n;
|
|
1427
|
+
}
|
|
1428
|
+
};
|
|
1429
|
+
const $e = I(le, T), En = I(me, J), Sn = I(he, X), Ut = I(pe, z), kn = I(xe, Z), Rt = I(de, T), Vn = I(ge, J), On = I(ve, X), Nn = I(be, z), Pn = I(ze, Z), Ee = I(we, T), Cn = I(Me, J), An = I(Te, X), Fn = I(_e, z), Un = I(Ie, Z), Xt = {
|
|
1430
|
+
vec2f: $e,
|
|
1431
|
+
vec2h: En,
|
|
1432
|
+
vec2i: Sn,
|
|
1433
|
+
vec2u: Ut,
|
|
1434
|
+
"vec2<bool>": kn,
|
|
1435
|
+
vec3f: Rt,
|
|
1436
|
+
vec3h: Vn,
|
|
1437
|
+
vec3i: On,
|
|
1438
|
+
vec3u: Nn,
|
|
1439
|
+
"vec3<bool>": Pn,
|
|
1440
|
+
vec4f: Ee,
|
|
1441
|
+
vec4h: Cn,
|
|
1442
|
+
vec4i: An,
|
|
1443
|
+
vec4u: Fn,
|
|
1444
|
+
"vec4<bool>": Un
|
|
1445
|
+
};
|
|
1446
|
+
function I(t, e) {
|
|
1447
|
+
const { kind: n, length: r } = new t(), s = r, a = ft({
|
|
1448
|
+
name: n,
|
|
1449
|
+
signature: (...b) => ({
|
|
1450
|
+
argTypes: b.map((y) => C(y) ? y : e),
|
|
1451
|
+
returnType: o
|
|
1452
|
+
}),
|
|
1453
|
+
normalImpl: (...b) => {
|
|
1454
|
+
const y = Array.from({ length: b.length });
|
|
1455
|
+
let tt = 0;
|
|
1456
|
+
for (const kt of b) if (typeof kt == "number" || typeof kt == "boolean") y[tt++] = kt;
|
|
1457
|
+
else for (let te = 0; te < kt.length; ++te) y[tt++] = kt[te];
|
|
1458
|
+
if (y.length <= 1 || y.length === s) return new t(...y);
|
|
1459
|
+
throw new Error(`'${n}' constructor called with invalid number of arguments.`);
|
|
1460
|
+
},
|
|
1461
|
+
codegenImpl: (b, y) => y.length === 1 && y[0]?.dataType === o ? f`${y[0]}` : f`${n}(${y})`
|
|
1462
|
+
}), o = Object.assign(a, {
|
|
1463
|
+
[i]: {},
|
|
1464
|
+
type: n,
|
|
1465
|
+
primitive: e,
|
|
1466
|
+
componentCount: s,
|
|
1467
|
+
[qn]: void 0
|
|
1468
|
+
});
|
|
1469
|
+
return t.prototype.schema = o, o;
|
|
1470
|
+
}
|
|
1471
|
+
const Se = /* @__PURE__ */ new Set([
|
|
1472
|
+
"alias",
|
|
1473
|
+
"break",
|
|
1474
|
+
"case",
|
|
1475
|
+
"const",
|
|
1476
|
+
"const_assert",
|
|
1477
|
+
"continue",
|
|
1478
|
+
"continuing",
|
|
1479
|
+
"default",
|
|
1480
|
+
"diagnostic",
|
|
1481
|
+
"discard",
|
|
1482
|
+
"else",
|
|
1483
|
+
"enable",
|
|
1484
|
+
"false",
|
|
1485
|
+
"fn",
|
|
1486
|
+
"for",
|
|
1487
|
+
"if",
|
|
1488
|
+
"let",
|
|
1489
|
+
"loop",
|
|
1490
|
+
"override",
|
|
1491
|
+
"requires",
|
|
1492
|
+
"return",
|
|
1493
|
+
"struct",
|
|
1494
|
+
"switch",
|
|
1495
|
+
"true",
|
|
1496
|
+
"var",
|
|
1497
|
+
"while",
|
|
1498
|
+
"NULL",
|
|
1499
|
+
"Self",
|
|
1500
|
+
"abstract",
|
|
1501
|
+
"active",
|
|
1502
|
+
"alignas",
|
|
1503
|
+
"alignof",
|
|
1504
|
+
"as",
|
|
1505
|
+
"asm",
|
|
1506
|
+
"asm_fragment",
|
|
1507
|
+
"async",
|
|
1508
|
+
"attribute",
|
|
1509
|
+
"auto",
|
|
1510
|
+
"await",
|
|
1511
|
+
"become",
|
|
1512
|
+
"cast",
|
|
1513
|
+
"catch",
|
|
1514
|
+
"class",
|
|
1515
|
+
"co_await",
|
|
1516
|
+
"co_return",
|
|
1517
|
+
"co_yield",
|
|
1518
|
+
"coherent",
|
|
1519
|
+
"column_major",
|
|
1520
|
+
"common",
|
|
1521
|
+
"compile",
|
|
1522
|
+
"compile_fragment",
|
|
1523
|
+
"concept",
|
|
1524
|
+
"const_cast",
|
|
1525
|
+
"consteval",
|
|
1526
|
+
"constexpr",
|
|
1527
|
+
"constinit",
|
|
1528
|
+
"crate",
|
|
1529
|
+
"debugger",
|
|
1530
|
+
"decltype",
|
|
1531
|
+
"delete",
|
|
1532
|
+
"demote",
|
|
1533
|
+
"demote_to_helper",
|
|
1534
|
+
"do",
|
|
1535
|
+
"dynamic_cast",
|
|
1536
|
+
"enum",
|
|
1537
|
+
"explicit",
|
|
1538
|
+
"export",
|
|
1539
|
+
"extends",
|
|
1540
|
+
"extern",
|
|
1541
|
+
"external",
|
|
1542
|
+
"fallthrough",
|
|
1543
|
+
"filter",
|
|
1544
|
+
"final",
|
|
1545
|
+
"finally",
|
|
1546
|
+
"friend",
|
|
1547
|
+
"from",
|
|
1548
|
+
"fxgroup",
|
|
1549
|
+
"get",
|
|
1550
|
+
"goto",
|
|
1551
|
+
"groupshared",
|
|
1552
|
+
"highp",
|
|
1553
|
+
"impl",
|
|
1554
|
+
"implements",
|
|
1555
|
+
"import",
|
|
1556
|
+
"inline",
|
|
1557
|
+
"instanceof",
|
|
1558
|
+
"interface",
|
|
1559
|
+
"layout",
|
|
1560
|
+
"lowp",
|
|
1561
|
+
"macro",
|
|
1562
|
+
"macro_rules",
|
|
1563
|
+
"match",
|
|
1564
|
+
"mediump",
|
|
1565
|
+
"meta",
|
|
1566
|
+
"mod",
|
|
1567
|
+
"module",
|
|
1568
|
+
"move",
|
|
1569
|
+
"mut",
|
|
1570
|
+
"mutable",
|
|
1571
|
+
"namespace",
|
|
1572
|
+
"new",
|
|
1573
|
+
"nil",
|
|
1574
|
+
"noexcept",
|
|
1575
|
+
"noinline",
|
|
1576
|
+
"nointerpolation",
|
|
1577
|
+
"non_coherent",
|
|
1578
|
+
"noncoherent",
|
|
1579
|
+
"noperspective",
|
|
1580
|
+
"null",
|
|
1581
|
+
"nullptr",
|
|
1582
|
+
"of",
|
|
1583
|
+
"operator",
|
|
1584
|
+
"package",
|
|
1585
|
+
"packoffset",
|
|
1586
|
+
"partition",
|
|
1587
|
+
"pass",
|
|
1588
|
+
"patch",
|
|
1589
|
+
"pixelfragment",
|
|
1590
|
+
"precise",
|
|
1591
|
+
"precision",
|
|
1592
|
+
"premerge",
|
|
1593
|
+
"priv",
|
|
1594
|
+
"protected",
|
|
1595
|
+
"pub",
|
|
1596
|
+
"public",
|
|
1597
|
+
"readonly",
|
|
1598
|
+
"ref",
|
|
1599
|
+
"regardless",
|
|
1600
|
+
"register",
|
|
1601
|
+
"reinterpret_cast",
|
|
1602
|
+
"require",
|
|
1603
|
+
"resource",
|
|
1604
|
+
"restrict",
|
|
1605
|
+
"self",
|
|
1606
|
+
"set",
|
|
1607
|
+
"shared",
|
|
1608
|
+
"sizeof",
|
|
1609
|
+
"smooth",
|
|
1610
|
+
"snorm",
|
|
1611
|
+
"static",
|
|
1612
|
+
"static_assert",
|
|
1613
|
+
"static_cast",
|
|
1614
|
+
"std",
|
|
1615
|
+
"subroutine",
|
|
1616
|
+
"super",
|
|
1617
|
+
"target",
|
|
1618
|
+
"template",
|
|
1619
|
+
"this",
|
|
1620
|
+
"thread_local",
|
|
1621
|
+
"throw",
|
|
1622
|
+
"trait",
|
|
1623
|
+
"try",
|
|
1624
|
+
"type",
|
|
1625
|
+
"typedef",
|
|
1626
|
+
"typeid",
|
|
1627
|
+
"typename",
|
|
1628
|
+
"typeof",
|
|
1629
|
+
"union",
|
|
1630
|
+
"unless",
|
|
1631
|
+
"unorm",
|
|
1632
|
+
"unsafe",
|
|
1633
|
+
"unsized",
|
|
1634
|
+
"use",
|
|
1635
|
+
"using",
|
|
1636
|
+
"varying",
|
|
1637
|
+
"virtual",
|
|
1638
|
+
"volatile",
|
|
1639
|
+
"wgsl",
|
|
1640
|
+
"where",
|
|
1641
|
+
"with",
|
|
1642
|
+
"writeonly",
|
|
1643
|
+
"yield",
|
|
1644
|
+
"sampler",
|
|
1645
|
+
"uniform",
|
|
1646
|
+
"storage"
|
|
1647
|
+
]), jn = /* @__PURE__ */ new Set([
|
|
1648
|
+
"array",
|
|
1649
|
+
"bool",
|
|
1650
|
+
"f16",
|
|
1651
|
+
"f32",
|
|
1652
|
+
"i32",
|
|
1653
|
+
"u32",
|
|
1654
|
+
"mat2x2",
|
|
1655
|
+
"mat2x3",
|
|
1656
|
+
"mat2x4",
|
|
1657
|
+
"mat3x2",
|
|
1658
|
+
"mat3x3",
|
|
1659
|
+
"mat3x4",
|
|
1660
|
+
"mat4x2",
|
|
1661
|
+
"mat4x3",
|
|
1662
|
+
"mat4x4",
|
|
1663
|
+
"vec2",
|
|
1664
|
+
"vec3",
|
|
1665
|
+
"vec4",
|
|
1666
|
+
"bitcast",
|
|
1667
|
+
"all",
|
|
1668
|
+
"any",
|
|
1669
|
+
"select",
|
|
1670
|
+
"arrayLength",
|
|
1671
|
+
"abs",
|
|
1672
|
+
"acos",
|
|
1673
|
+
"acosh",
|
|
1674
|
+
"asin",
|
|
1675
|
+
"asinh",
|
|
1676
|
+
"atan",
|
|
1677
|
+
"atanh",
|
|
1678
|
+
"atan2",
|
|
1679
|
+
"ceil",
|
|
1680
|
+
"clamp",
|
|
1681
|
+
"cos",
|
|
1682
|
+
"cosh",
|
|
1683
|
+
"countLeadingZeros",
|
|
1684
|
+
"countOneBits",
|
|
1685
|
+
"countTrailingZeros",
|
|
1686
|
+
"cross",
|
|
1687
|
+
"degrees",
|
|
1688
|
+
"determinant",
|
|
1689
|
+
"distance",
|
|
1690
|
+
"dot",
|
|
1691
|
+
"dot4U8Packed",
|
|
1692
|
+
"dot4I8Packed",
|
|
1693
|
+
"exp",
|
|
1694
|
+
"exp2",
|
|
1695
|
+
"extractBits",
|
|
1696
|
+
"faceForward",
|
|
1697
|
+
"firstLeadingBit",
|
|
1698
|
+
"firstTrailingBit",
|
|
1699
|
+
"floor",
|
|
1700
|
+
"fma",
|
|
1701
|
+
"fract",
|
|
1702
|
+
"frexp",
|
|
1703
|
+
"insertBits",
|
|
1704
|
+
"inverseSqrt",
|
|
1705
|
+
"ldexp",
|
|
1706
|
+
"length",
|
|
1707
|
+
"log",
|
|
1708
|
+
"log2",
|
|
1709
|
+
"max",
|
|
1710
|
+
"min",
|
|
1711
|
+
"mix",
|
|
1712
|
+
"modf",
|
|
1713
|
+
"normalize",
|
|
1714
|
+
"pow",
|
|
1715
|
+
"quantizeToF16",
|
|
1716
|
+
"radians",
|
|
1717
|
+
"reflect",
|
|
1718
|
+
"refract",
|
|
1719
|
+
"reverseBits",
|
|
1720
|
+
"round",
|
|
1721
|
+
"saturate",
|
|
1722
|
+
"sign",
|
|
1723
|
+
"sin",
|
|
1724
|
+
"sinh",
|
|
1725
|
+
"smoothstep",
|
|
1726
|
+
"sqrt",
|
|
1727
|
+
"step",
|
|
1728
|
+
"tan",
|
|
1729
|
+
"tanh",
|
|
1730
|
+
"transpose",
|
|
1731
|
+
"trunc",
|
|
1732
|
+
"dpdx",
|
|
1733
|
+
"dpdxCoarse",
|
|
1734
|
+
"dpdxFine",
|
|
1735
|
+
"dpdy",
|
|
1736
|
+
"dpdyCoarse",
|
|
1737
|
+
"dpdyFine",
|
|
1738
|
+
"fwidth",
|
|
1739
|
+
"fwidthCoarse",
|
|
1740
|
+
"fwidthFine",
|
|
1741
|
+
"textureDimensions",
|
|
1742
|
+
"textureGather",
|
|
1743
|
+
"textureGatherCompare",
|
|
1744
|
+
"textureLoad",
|
|
1745
|
+
"textureNumLayers",
|
|
1746
|
+
"textureNumLevels",
|
|
1747
|
+
"textureNumSamples",
|
|
1748
|
+
"textureSample",
|
|
1749
|
+
"textureSampleBias",
|
|
1750
|
+
"textureSampleCompare",
|
|
1751
|
+
"textureSampleCompareLevel",
|
|
1752
|
+
"textureSampleGrad",
|
|
1753
|
+
"textureSampleLevel",
|
|
1754
|
+
"textureSampleBaseClampToEdge",
|
|
1755
|
+
"textureStore",
|
|
1756
|
+
"atomicLoad",
|
|
1757
|
+
"atomicStore",
|
|
1758
|
+
"atomicAdd",
|
|
1759
|
+
"atomicSub",
|
|
1760
|
+
"atomicMax",
|
|
1761
|
+
"atomicMin",
|
|
1762
|
+
"atomicAnd",
|
|
1763
|
+
"atomicOr",
|
|
1764
|
+
"atomicXor",
|
|
1765
|
+
"atomicExchange",
|
|
1766
|
+
"atomicCompareExchangeWeak",
|
|
1767
|
+
"pack4x8snorm",
|
|
1768
|
+
"pack4x8unorm",
|
|
1769
|
+
"pack4xI8",
|
|
1770
|
+
"pack4xU8",
|
|
1771
|
+
"pack4xI8Clamp",
|
|
1772
|
+
"pack4xU8Clamp",
|
|
1773
|
+
"pack2x16snorm",
|
|
1774
|
+
"pack2x16unorm",
|
|
1775
|
+
"pack2x16float",
|
|
1776
|
+
"unpack4x8snorm",
|
|
1777
|
+
"unpack4x8unorm",
|
|
1778
|
+
"unpack4xI8",
|
|
1779
|
+
"unpack4xU8",
|
|
1780
|
+
"unpack2x16snorm",
|
|
1781
|
+
"unpack2x16unorm",
|
|
1782
|
+
"unpack2x16float",
|
|
1783
|
+
"storageBarrier",
|
|
1784
|
+
"textureBarrier",
|
|
1785
|
+
"workgroupBarrier",
|
|
1786
|
+
"workgroupUniformLoad",
|
|
1787
|
+
"subgroupAdd",
|
|
1788
|
+
"subgroupExclusiveAdd",
|
|
1789
|
+
"subgroupInclusiveAdd",
|
|
1790
|
+
"subgroupAll",
|
|
1791
|
+
"subgroupAnd",
|
|
1792
|
+
"subgroupAny",
|
|
1793
|
+
"subgroupBallot",
|
|
1794
|
+
"subgroupBroadcast",
|
|
1795
|
+
"subgroupBroadcastFirst",
|
|
1796
|
+
"subgroupElect",
|
|
1797
|
+
"subgroupMax",
|
|
1798
|
+
"subgroupMin",
|
|
1799
|
+
"subgroupMul",
|
|
1800
|
+
"subgroupExclusiveMul",
|
|
1801
|
+
"subgroupInclusiveMul",
|
|
1802
|
+
"subgroupOr",
|
|
1803
|
+
"subgroupShuffle",
|
|
1804
|
+
"subgroupShuffleDown",
|
|
1805
|
+
"subgroupShuffleUp",
|
|
1806
|
+
"subgroupShuffleXor",
|
|
1807
|
+
"subgroupXor",
|
|
1808
|
+
"quadBroadcast",
|
|
1809
|
+
"quadSwapDiagonal",
|
|
1810
|
+
"quadSwapX",
|
|
1811
|
+
"quadSwapY"
|
|
1812
|
+
]);
|
|
1813
|
+
function Zr(t) {
|
|
1814
|
+
return t ? t.replaceAll(/\s/g, "_").replaceAll(/[^\w\d]/g, "") : "item";
|
|
1815
|
+
}
|
|
1816
|
+
function Xr(t) {
|
|
1817
|
+
if (t === "_" || t.startsWith("__") || /\s/.test(t)) throw new Error(`Invalid identifier '${t}'. Choose an identifier without whitespaces or leading underscores.`);
|
|
1818
|
+
const e = t.split("_")[0];
|
|
1819
|
+
return !Se.has(e) && !jn.has(e);
|
|
1820
|
+
}
|
|
1821
|
+
function Jr(t) {
|
|
1822
|
+
if (t === "_" || t.startsWith("__") || /\s/.test(t)) throw new Error(`Invalid identifier '${t}'. Choose an identifier without whitespaces or leading underscores.`);
|
|
1823
|
+
const e = t.split("_")[0];
|
|
1824
|
+
return !Se.has(e);
|
|
1825
|
+
}
|
|
1826
|
+
var Bn = class {
|
|
1827
|
+
#t;
|
|
1828
|
+
#e;
|
|
1829
|
+
constructor() {
|
|
1830
|
+
this.#t = /* @__PURE__ */ new Set([...Se, ...jn]), this.#e = [];
|
|
1831
|
+
}
|
|
1832
|
+
get #n() {
|
|
1833
|
+
return this.#e[this.#e.length - 1]?.usedBlockScopeNames;
|
|
1834
|
+
}
|
|
1835
|
+
makeUnique(t, e) {
|
|
1836
|
+
const n = Zr(t), r = this.getUniqueVariant(n);
|
|
1837
|
+
return e ? this.#t.add(r) : this.#n?.add(r), r;
|
|
1838
|
+
}
|
|
1839
|
+
#r(t) {
|
|
1840
|
+
const e = this.#e.findLastIndex((n) => n.type === "functionScope");
|
|
1841
|
+
return this.#e.slice(e + 1).some((n) => n.usedBlockScopeNames.has(t));
|
|
1842
|
+
}
|
|
1843
|
+
makeValid(t) {
|
|
1844
|
+
return Xr(t) && !this.#t.has(t) && !this.#r(t) ? (this.#n?.add(t), t) : this.makeUnique(t, !1);
|
|
1845
|
+
}
|
|
1846
|
+
isUsed(t) {
|
|
1847
|
+
return this.#t.has(t) || this.#r(t);
|
|
1848
|
+
}
|
|
1849
|
+
pushFunctionScope() {
|
|
1850
|
+
this.#e.push({ type: "functionScope" }), this.#e.push({
|
|
1851
|
+
type: "blockScope",
|
|
1852
|
+
usedBlockScopeNames: /* @__PURE__ */ new Set()
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
popFunctionScope() {
|
|
1856
|
+
const t = this.#e.findLastIndex((e) => e.type === "functionScope");
|
|
1857
|
+
if (t === -1) throw new Error("Tried to pop function scope when no scope was present.");
|
|
1858
|
+
this.#e.splice(t);
|
|
1859
|
+
}
|
|
1860
|
+
pushBlockScope() {
|
|
1861
|
+
this.#e.push({
|
|
1862
|
+
type: "blockScope",
|
|
1863
|
+
usedBlockScopeNames: /* @__PURE__ */ new Set()
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
popBlockScope() {
|
|
1867
|
+
ae(this.#e[this.#e.length - 1]?.type === "blockScope", "Tried to pop block scope, but it is not present"), this.#e.pop();
|
|
1868
|
+
}
|
|
1869
|
+
}, Ac = class extends Bn {
|
|
1870
|
+
#t = 0;
|
|
1871
|
+
getUniqueVariant(t) {
|
|
1872
|
+
let e = `${t}_${this.#t++}`;
|
|
1873
|
+
for (; this.isUsed(e); ) e = `${t}_${this.#t++}`;
|
|
1874
|
+
return e;
|
|
1875
|
+
}
|
|
1876
|
+
}, Fc = class extends Bn {
|
|
1877
|
+
getUniqueVariant(t) {
|
|
1878
|
+
let e = 0, n = t;
|
|
1879
|
+
for (; this.isUsed(n); )
|
|
1880
|
+
e++, n = `${t}_${e}`;
|
|
1881
|
+
return n;
|
|
1882
|
+
}
|
|
1883
|
+
};
|
|
1884
|
+
function ke(t) {
|
|
1885
|
+
return Ln(t, !1);
|
|
1886
|
+
}
|
|
1887
|
+
function Uc(t) {
|
|
1888
|
+
return Ln(t, !0);
|
|
1889
|
+
}
|
|
1890
|
+
function Ln(t, e) {
|
|
1891
|
+
Object.keys(t).forEach((r) => {
|
|
1892
|
+
if (!Jr(r)) throw new Error(`Property key '${r}' is a reserved WGSL word. Choose a different name.`);
|
|
1893
|
+
});
|
|
1894
|
+
const n = (r) => Object.fromEntries(Object.entries(t).map(([s, c]) => [s, Or(c, r?.[s])]));
|
|
1895
|
+
return Object.setPrototypeOf(n, Qr), n.propTypes = t, Object.defineProperty(n, i, { value: { isAbstruct: e } }), n;
|
|
1896
|
+
}
|
|
1897
|
+
const Qr = {
|
|
1898
|
+
type: "struct",
|
|
1899
|
+
$name(t) {
|
|
1900
|
+
return yt(this, t), this;
|
|
1901
|
+
},
|
|
1902
|
+
toString() {
|
|
1903
|
+
return `struct:${ut(this) ?? "<unnamed>"}`;
|
|
1904
|
+
}
|
|
1905
|
+
};
|
|
1906
|
+
function ts(t) {
|
|
1907
|
+
return t >= 2 ** 63 || t < -9223372036854776e3 ? l(t, se, "constant") : Number.isInteger(t) ? (Number.isSafeInteger(t) || console.warn(`The integer ${t} exceeds the safe integer range and may have lost precision.`), l(t, jr, "constant")) : l(t, se, "constant");
|
|
1908
|
+
}
|
|
1909
|
+
function Ve(t) {
|
|
1910
|
+
return t.type === "abstractFloat" ? T : t.type === "abstractInt" ? X : t;
|
|
1911
|
+
}
|
|
1912
|
+
function es(t) {
|
|
1913
|
+
return l(t.value, Ve(t.dataType), t.origin);
|
|
1914
|
+
}
|
|
1915
|
+
function jc(t) {
|
|
1916
|
+
return t.map(es);
|
|
1917
|
+
}
|
|
1918
|
+
function ns(t) {
|
|
1919
|
+
if (oe(t)) return t;
|
|
1920
|
+
if (Sr(t)) throw new Error("Cannot use refs (d.ref(...)) from the outer scope.");
|
|
1921
|
+
const e = an(t);
|
|
1922
|
+
return e || (w(t) || L(t) ? l(t, fr(t), "constant") : typeof t == "string" || typeof t == "function" || typeof t == "object" || typeof t == "symbol" || typeof t > "u" || t === null ? l(t, it, "constant") : typeof t == "number" ? ts(t) : typeof t == "boolean" ? l(t, Z, "constant") : l(t, it, "constant"));
|
|
1923
|
+
}
|
|
1924
|
+
var Bc = class {
|
|
1925
|
+
[i] = !0;
|
|
1926
|
+
constructor(t, e) {
|
|
1927
|
+
this.type = t, this.elements = e;
|
|
1928
|
+
}
|
|
1929
|
+
toString() {
|
|
1930
|
+
return "ArrayExpression";
|
|
1931
|
+
}
|
|
1932
|
+
[A](t) {
|
|
1933
|
+
for (const e of this.elements) if (e.origin === "argument" && !Ze(e.dataType) || !xr(e)) {
|
|
1934
|
+
const n = t.resolve(e.value, e.dataType).value, r = t.resolve(Ve(e.dataType)).value;
|
|
1935
|
+
throw new Qt(`'${n}' reference cannot be used in an array constructor.
|
|
1936
|
+
-----
|
|
1937
|
+
Try '${r}(${n})' or 'arrayOf(${r}, count)([...])' to copy the value instead.
|
|
1938
|
+
-----`);
|
|
1939
|
+
}
|
|
1940
|
+
return l(f`${`array<${t.resolve(this.type.elementType).value}, ${this.elements.length}>`}(${this.elements})`, this.type, "runtime");
|
|
1941
|
+
}
|
|
1942
|
+
}, Be = class extends Error {
|
|
1943
|
+
constructor(t) {
|
|
1944
|
+
super(t), this.name = this.constructor.name;
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
function U(t) {
|
|
1948
|
+
const e = ((...n) => {
|
|
1949
|
+
if (typeof t.normalImpl == "string") throw new Be(t.normalImpl);
|
|
1950
|
+
return t.normalImpl(...n);
|
|
1951
|
+
});
|
|
1952
|
+
return yt(e, t.name), e.toString = () => t.name ?? "<unknown>", e[ot] = {
|
|
1953
|
+
get strictSignature() {
|
|
1954
|
+
return typeof t.signature != "function" ? t.signature : void 0;
|
|
1955
|
+
},
|
|
1956
|
+
call(n, r) {
|
|
1957
|
+
const { argTypes: s, returnType: c } = typeof t.signature == "function" ? t.signature(...r.map((o) => at(o.dataType) && o.dataType.implicit ? o.dataType.inner : o.dataType)) : t.signature, a = r.map((o, b) => {
|
|
1958
|
+
const y = s[b];
|
|
1959
|
+
if (!y) throw new Error("Function called with invalid arguments");
|
|
1960
|
+
return fn(n, o, y, !t.ignoreImplicitCastWarning);
|
|
1961
|
+
});
|
|
1962
|
+
if (!t.noComptime && a.every((o) => Kt(o)) && typeof t.normalImpl == "function") {
|
|
1963
|
+
n.pushMode(new ie());
|
|
1964
|
+
try {
|
|
1965
|
+
return l(t.normalImpl(...a.map((o) => o.value)), c, "constant");
|
|
1966
|
+
} catch (o) {
|
|
1967
|
+
if (!(o instanceof Be)) throw o;
|
|
1968
|
+
} finally {
|
|
1969
|
+
n.popMode("normal");
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
return l(t.codegenImpl(n, a), Ve(c), "runtime");
|
|
1973
|
+
}
|
|
1974
|
+
}, e;
|
|
1975
|
+
}
|
|
1976
|
+
function Oe(t) {
|
|
1977
|
+
const e = ((...n) => t(...n));
|
|
1978
|
+
return e.toString = () => "comptime", e[Jt] = t, e[ot] = { call(n, r) {
|
|
1979
|
+
if (!r.every((s) => Kt(s))) throw new Qt(`Called comptime function with runtime-known values: ${r.filter((s) => !Kt(s)).map((s) => `'${s.value}'`).join(", ")}`);
|
|
1980
|
+
return ns(t(...r.map((s) => s.value)));
|
|
1981
|
+
} }, e.$name = (n) => (yt(t, n), e), Object.defineProperty(e, i, { value: { isComptime: !0 } }), e;
|
|
1982
|
+
}
|
|
1983
|
+
var Ne = class {
|
|
1984
|
+
};
|
|
1985
|
+
function Pe(t) {
|
|
1986
|
+
const e = ft({
|
|
1987
|
+
name: t.type,
|
|
1988
|
+
normalImpl: (...r) => {
|
|
1989
|
+
const s = [];
|
|
1990
|
+
for (const c of r) if (typeof c == "number") s.push(c);
|
|
1991
|
+
else for (let a = 0; a < c.length; ++a) s.push(c[a]);
|
|
1992
|
+
if (s.length !== 0 && s.length !== t.columns * t.rows) throw new Error(`'${t.type}' constructor called with invalid number of arguments.`);
|
|
1993
|
+
for (let c = s.length; c < t.columns * t.rows; ++c) s.push(0);
|
|
1994
|
+
return new t.MatImpl(...s);
|
|
1995
|
+
},
|
|
1996
|
+
signature: (...r) => ({
|
|
1997
|
+
argTypes: r.map((s) => C(s) ? s : T),
|
|
1998
|
+
returnType: n
|
|
1999
|
+
}),
|
|
2000
|
+
codegenImpl: (r, s) => f`${t.type}(${s})`
|
|
2001
|
+
}), n = Object.assign(e, {
|
|
2002
|
+
[i]: {},
|
|
2003
|
+
type: t.type,
|
|
2004
|
+
primitive: T,
|
|
2005
|
+
identity: ls[t.columns],
|
|
2006
|
+
translation: t.columns === 4 ? ms : void 0,
|
|
2007
|
+
scaling: t.columns === 4 ? hs : void 0,
|
|
2008
|
+
rotationX: t.columns === 4 ? ps : void 0,
|
|
2009
|
+
rotationY: t.columns === 4 ? xs : void 0,
|
|
2010
|
+
rotationZ: t.columns === 4 ? ds : void 0
|
|
2011
|
+
});
|
|
2012
|
+
return t.MatImpl.prototype.schema = n, n;
|
|
2013
|
+
}
|
|
2014
|
+
var rs = class extends Ne {
|
|
2015
|
+
[i] = !0;
|
|
2016
|
+
columns;
|
|
2017
|
+
length = 4;
|
|
2018
|
+
constructor(...t) {
|
|
2019
|
+
super(), this.columns = [this.makeColumn(t[0], t[1]), this.makeColumn(t[2], t[3])];
|
|
2020
|
+
}
|
|
2021
|
+
get 0() {
|
|
2022
|
+
return this.columns[0].x;
|
|
2023
|
+
}
|
|
2024
|
+
get 1() {
|
|
2025
|
+
return this.columns[0].y;
|
|
2026
|
+
}
|
|
2027
|
+
get 2() {
|
|
2028
|
+
return this.columns[1].x;
|
|
2029
|
+
}
|
|
2030
|
+
get 3() {
|
|
2031
|
+
return this.columns[1].y;
|
|
2032
|
+
}
|
|
2033
|
+
set 0(t) {
|
|
2034
|
+
this.columns[0].x = t;
|
|
2035
|
+
}
|
|
2036
|
+
set 1(t) {
|
|
2037
|
+
this.columns[0].y = t;
|
|
2038
|
+
}
|
|
2039
|
+
set 2(t) {
|
|
2040
|
+
this.columns[1].x = t;
|
|
2041
|
+
}
|
|
2042
|
+
set 3(t) {
|
|
2043
|
+
this.columns[1].y = t;
|
|
2044
|
+
}
|
|
2045
|
+
*[Symbol.iterator]() {
|
|
2046
|
+
yield this[0], yield this[1], yield this[2], yield this[3];
|
|
2047
|
+
}
|
|
2048
|
+
[A]() {
|
|
2049
|
+
return l(`${this.kind}(${Array.from({ length: this.length }).map((t, e) => this[e]).join(", ")})`, Wt, "runtime");
|
|
2050
|
+
}
|
|
2051
|
+
toString() {
|
|
2052
|
+
return this[A]().value;
|
|
2053
|
+
}
|
|
2054
|
+
}, ss = class extends rs {
|
|
2055
|
+
kind = "mat2x2f";
|
|
2056
|
+
makeColumn(t, e) {
|
|
2057
|
+
return $e(t, e);
|
|
2058
|
+
}
|
|
2059
|
+
}, cs = class extends Ne {
|
|
2060
|
+
[i] = !0;
|
|
2061
|
+
columns;
|
|
2062
|
+
length = 12;
|
|
2063
|
+
constructor(...t) {
|
|
2064
|
+
super(), this.columns = [
|
|
2065
|
+
this.makeColumn(t[0], t[1], t[2]),
|
|
2066
|
+
this.makeColumn(t[3], t[4], t[5]),
|
|
2067
|
+
this.makeColumn(t[6], t[7], t[8])
|
|
2068
|
+
];
|
|
2069
|
+
}
|
|
2070
|
+
get 0() {
|
|
2071
|
+
return this.columns[0].x;
|
|
2072
|
+
}
|
|
2073
|
+
get 1() {
|
|
2074
|
+
return this.columns[0].y;
|
|
2075
|
+
}
|
|
2076
|
+
get 2() {
|
|
2077
|
+
return this.columns[0].z;
|
|
2078
|
+
}
|
|
2079
|
+
get 3() {
|
|
2080
|
+
return 0;
|
|
2081
|
+
}
|
|
2082
|
+
get 4() {
|
|
2083
|
+
return this.columns[1].x;
|
|
2084
|
+
}
|
|
2085
|
+
get 5() {
|
|
2086
|
+
return this.columns[1].y;
|
|
2087
|
+
}
|
|
2088
|
+
get 6() {
|
|
2089
|
+
return this.columns[1].z;
|
|
2090
|
+
}
|
|
2091
|
+
get 7() {
|
|
2092
|
+
return 0;
|
|
2093
|
+
}
|
|
2094
|
+
get 8() {
|
|
2095
|
+
return this.columns[2].x;
|
|
2096
|
+
}
|
|
2097
|
+
get 9() {
|
|
2098
|
+
return this.columns[2].y;
|
|
2099
|
+
}
|
|
2100
|
+
get 10() {
|
|
2101
|
+
return this.columns[2].z;
|
|
2102
|
+
}
|
|
2103
|
+
get 11() {
|
|
2104
|
+
return 0;
|
|
2105
|
+
}
|
|
2106
|
+
set 0(t) {
|
|
2107
|
+
this.columns[0].x = t;
|
|
2108
|
+
}
|
|
2109
|
+
set 1(t) {
|
|
2110
|
+
this.columns[0].y = t;
|
|
2111
|
+
}
|
|
2112
|
+
set 2(t) {
|
|
2113
|
+
this.columns[0].z = t;
|
|
2114
|
+
}
|
|
2115
|
+
set 3(t) {
|
|
2116
|
+
}
|
|
2117
|
+
set 4(t) {
|
|
2118
|
+
this.columns[1].x = t;
|
|
2119
|
+
}
|
|
2120
|
+
set 5(t) {
|
|
2121
|
+
this.columns[1].y = t;
|
|
2122
|
+
}
|
|
2123
|
+
set 6(t) {
|
|
2124
|
+
this.columns[1].z = t;
|
|
2125
|
+
}
|
|
2126
|
+
set 7(t) {
|
|
2127
|
+
}
|
|
2128
|
+
set 8(t) {
|
|
2129
|
+
this.columns[2].x = t;
|
|
2130
|
+
}
|
|
2131
|
+
set 9(t) {
|
|
2132
|
+
this.columns[2].y = t;
|
|
2133
|
+
}
|
|
2134
|
+
set 10(t) {
|
|
2135
|
+
this.columns[2].z = t;
|
|
2136
|
+
}
|
|
2137
|
+
set 11(t) {
|
|
2138
|
+
}
|
|
2139
|
+
*[Symbol.iterator]() {
|
|
2140
|
+
for (let t = 0; t < 12; t++) yield this[t];
|
|
2141
|
+
}
|
|
2142
|
+
[A]() {
|
|
2143
|
+
return l(`${this.kind}(${this[0]}, ${this[1]}, ${this[2]}, ${this[4]}, ${this[5]}, ${this[6]}, ${this[8]}, ${this[9]}, ${this[10]})`, Gt, "runtime");
|
|
2144
|
+
}
|
|
2145
|
+
toString() {
|
|
2146
|
+
return this[A]().value;
|
|
2147
|
+
}
|
|
2148
|
+
}, os = class extends cs {
|
|
2149
|
+
kind = "mat3x3f";
|
|
2150
|
+
makeColumn(t, e, n) {
|
|
2151
|
+
return Rt(t, e, n);
|
|
2152
|
+
}
|
|
2153
|
+
}, as = class extends Ne {
|
|
2154
|
+
[i] = !0;
|
|
2155
|
+
columns;
|
|
2156
|
+
constructor(...t) {
|
|
2157
|
+
super(), this.columns = [
|
|
2158
|
+
this.makeColumn(t[0], t[1], t[2], t[3]),
|
|
2159
|
+
this.makeColumn(t[4], t[5], t[6], t[7]),
|
|
2160
|
+
this.makeColumn(t[8], t[9], t[10], t[11]),
|
|
2161
|
+
this.makeColumn(t[12], t[13], t[14], t[15])
|
|
2162
|
+
];
|
|
2163
|
+
}
|
|
2164
|
+
length = 16;
|
|
2165
|
+
get 0() {
|
|
2166
|
+
return this.columns[0].x;
|
|
2167
|
+
}
|
|
2168
|
+
get 1() {
|
|
2169
|
+
return this.columns[0].y;
|
|
2170
|
+
}
|
|
2171
|
+
get 2() {
|
|
2172
|
+
return this.columns[0].z;
|
|
2173
|
+
}
|
|
2174
|
+
get 3() {
|
|
2175
|
+
return this.columns[0].w;
|
|
2176
|
+
}
|
|
2177
|
+
get 4() {
|
|
2178
|
+
return this.columns[1].x;
|
|
2179
|
+
}
|
|
2180
|
+
get 5() {
|
|
2181
|
+
return this.columns[1].y;
|
|
2182
|
+
}
|
|
2183
|
+
get 6() {
|
|
2184
|
+
return this.columns[1].z;
|
|
2185
|
+
}
|
|
2186
|
+
get 7() {
|
|
2187
|
+
return this.columns[1].w;
|
|
2188
|
+
}
|
|
2189
|
+
get 8() {
|
|
2190
|
+
return this.columns[2].x;
|
|
2191
|
+
}
|
|
2192
|
+
get 9() {
|
|
2193
|
+
return this.columns[2].y;
|
|
2194
|
+
}
|
|
2195
|
+
get 10() {
|
|
2196
|
+
return this.columns[2].z;
|
|
2197
|
+
}
|
|
2198
|
+
get 11() {
|
|
2199
|
+
return this.columns[2].w;
|
|
2200
|
+
}
|
|
2201
|
+
get 12() {
|
|
2202
|
+
return this.columns[3].x;
|
|
2203
|
+
}
|
|
2204
|
+
get 13() {
|
|
2205
|
+
return this.columns[3].y;
|
|
2206
|
+
}
|
|
2207
|
+
get 14() {
|
|
2208
|
+
return this.columns[3].z;
|
|
2209
|
+
}
|
|
2210
|
+
get 15() {
|
|
2211
|
+
return this.columns[3].w;
|
|
2212
|
+
}
|
|
2213
|
+
set 0(t) {
|
|
2214
|
+
this.columns[0].x = t;
|
|
2215
|
+
}
|
|
2216
|
+
set 1(t) {
|
|
2217
|
+
this.columns[0].y = t;
|
|
2218
|
+
}
|
|
2219
|
+
set 2(t) {
|
|
2220
|
+
this.columns[0].z = t;
|
|
2221
|
+
}
|
|
2222
|
+
set 3(t) {
|
|
2223
|
+
this.columns[0].w = t;
|
|
2224
|
+
}
|
|
2225
|
+
set 4(t) {
|
|
2226
|
+
this.columns[1].x = t;
|
|
2227
|
+
}
|
|
2228
|
+
set 5(t) {
|
|
2229
|
+
this.columns[1].y = t;
|
|
2230
|
+
}
|
|
2231
|
+
set 6(t) {
|
|
2232
|
+
this.columns[1].z = t;
|
|
2233
|
+
}
|
|
2234
|
+
set 7(t) {
|
|
2235
|
+
this.columns[1].w = t;
|
|
2236
|
+
}
|
|
2237
|
+
set 8(t) {
|
|
2238
|
+
this.columns[2].x = t;
|
|
2239
|
+
}
|
|
2240
|
+
set 9(t) {
|
|
2241
|
+
this.columns[2].y = t;
|
|
2242
|
+
}
|
|
2243
|
+
set 10(t) {
|
|
2244
|
+
this.columns[2].z = t;
|
|
2245
|
+
}
|
|
2246
|
+
set 11(t) {
|
|
2247
|
+
this.columns[2].w = t;
|
|
2248
|
+
}
|
|
2249
|
+
set 12(t) {
|
|
2250
|
+
this.columns[3].x = t;
|
|
2251
|
+
}
|
|
2252
|
+
set 13(t) {
|
|
2253
|
+
this.columns[3].y = t;
|
|
2254
|
+
}
|
|
2255
|
+
set 14(t) {
|
|
2256
|
+
this.columns[3].z = t;
|
|
2257
|
+
}
|
|
2258
|
+
set 15(t) {
|
|
2259
|
+
this.columns[3].w = t;
|
|
2260
|
+
}
|
|
2261
|
+
*[Symbol.iterator]() {
|
|
2262
|
+
for (let t = 0; t < 16; t++) yield this[t];
|
|
2263
|
+
}
|
|
2264
|
+
[A]() {
|
|
2265
|
+
return l(`${this.kind}(${Array.from({ length: this.length }).map((t, e) => this[e]).join(", ")})`, _, "runtime");
|
|
2266
|
+
}
|
|
2267
|
+
toString() {
|
|
2268
|
+
return this[A]().value;
|
|
2269
|
+
}
|
|
2270
|
+
}, is = class extends as {
|
|
2271
|
+
kind = "mat4x4f";
|
|
2272
|
+
makeColumn(t, e, n, r) {
|
|
2273
|
+
return Ee(t, e, n, r);
|
|
2274
|
+
}
|
|
2275
|
+
};
|
|
2276
|
+
const us = Oe(() => Wt(1, 0, 0, 1)).$name("identity2"), ys = Oe(() => Gt(1, 0, 0, 0, 1, 0, 0, 0, 1)).$name("identity3"), fs = Oe(() => _(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)).$name("identity4"), ls = {
|
|
2277
|
+
2: us,
|
|
2278
|
+
3: ys,
|
|
2279
|
+
4: fs
|
|
2280
|
+
}, ms = U({
|
|
2281
|
+
name: "translation4",
|
|
2282
|
+
normalImpl: (t) => _(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, t.x, t.y, t.z, 1),
|
|
2283
|
+
get signature() {
|
|
2284
|
+
return {
|
|
2285
|
+
argTypes: [Rt],
|
|
2286
|
+
returnType: _
|
|
2287
|
+
};
|
|
2288
|
+
},
|
|
2289
|
+
codegenImpl: (t, [e]) => f`mat4x4f(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, ${e}.x, ${e}.y, ${e}.z, 1)`
|
|
2290
|
+
}), hs = U({
|
|
2291
|
+
name: "scaling4",
|
|
2292
|
+
normalImpl: (t) => _(t.x, 0, 0, 0, 0, t.y, 0, 0, 0, 0, t.z, 0, 0, 0, 0, 1),
|
|
2293
|
+
get signature() {
|
|
2294
|
+
return {
|
|
2295
|
+
argTypes: [Rt],
|
|
2296
|
+
returnType: _
|
|
2297
|
+
};
|
|
2298
|
+
},
|
|
2299
|
+
codegenImpl: (t, [e]) => f`mat4x4f(${e}.x, 0, 0, 0, 0, ${e}.y, 0, 0, 0, 0, ${e}.z, 0, 0, 0, 0, 1)`
|
|
2300
|
+
}), ps = U({
|
|
2301
|
+
name: "rotationX4",
|
|
2302
|
+
normalImpl: (t) => _(1, 0, 0, 0, 0, Math.cos(t), Math.sin(t), 0, 0, -Math.sin(t), Math.cos(t), 0, 0, 0, 0, 1),
|
|
2303
|
+
get signature() {
|
|
2304
|
+
return {
|
|
2305
|
+
argTypes: [T],
|
|
2306
|
+
returnType: _
|
|
2307
|
+
};
|
|
2308
|
+
},
|
|
2309
|
+
codegenImpl: (t, [e]) => f`mat4x4f(1, 0, 0, 0, 0, cos(${e}), sin(${e}), 0, 0, -sin(${e}), cos(${e}), 0, 0, 0, 0, 1)`
|
|
2310
|
+
}), xs = U({
|
|
2311
|
+
name: "rotationY4",
|
|
2312
|
+
normalImpl: (t) => _(Math.cos(t), 0, -Math.sin(t), 0, 0, 1, 0, 0, Math.sin(t), 0, Math.cos(t), 0, 0, 0, 0, 1),
|
|
2313
|
+
get signature() {
|
|
2314
|
+
return {
|
|
2315
|
+
argTypes: [T],
|
|
2316
|
+
returnType: _
|
|
2317
|
+
};
|
|
2318
|
+
},
|
|
2319
|
+
codegenImpl: (t, [e]) => f`mat4x4f(cos(${e}), 0, -sin(${e}), 0, 0, 1, 0, 0, sin(${e}), 0, cos(${e}), 0, 0, 0, 0, 1)`
|
|
2320
|
+
}), ds = U({
|
|
2321
|
+
name: "rotationZ4",
|
|
2322
|
+
normalImpl: (t) => _(Math.cos(t), Math.sin(t), 0, 0, -Math.sin(t), Math.cos(t), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
|
|
2323
|
+
get signature() {
|
|
2324
|
+
return {
|
|
2325
|
+
argTypes: [T],
|
|
2326
|
+
returnType: _
|
|
2327
|
+
};
|
|
2328
|
+
},
|
|
2329
|
+
codegenImpl: (t, [e]) => f`mat4x4f(cos(${e}), sin(${e}), 0, 0, -sin(${e}), cos(${e}), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)`
|
|
2330
|
+
}), Wt = Pe({
|
|
2331
|
+
type: "mat2x2f",
|
|
2332
|
+
rows: 2,
|
|
2333
|
+
columns: 2,
|
|
2334
|
+
MatImpl: ss
|
|
2335
|
+
}), Gt = Pe({
|
|
2336
|
+
type: "mat3x3f",
|
|
2337
|
+
rows: 3,
|
|
2338
|
+
columns: 3,
|
|
2339
|
+
MatImpl: os
|
|
2340
|
+
}), _ = Pe({
|
|
2341
|
+
type: "mat4x4f",
|
|
2342
|
+
rows: 4,
|
|
2343
|
+
columns: 4,
|
|
2344
|
+
MatImpl: is
|
|
2345
|
+
});
|
|
2346
|
+
function Lc(t) {
|
|
2347
|
+
return t.kind === "mat3x3f" ? [
|
|
2348
|
+
t[0],
|
|
2349
|
+
t[1],
|
|
2350
|
+
t[2],
|
|
2351
|
+
t[4],
|
|
2352
|
+
t[5],
|
|
2353
|
+
t[6],
|
|
2354
|
+
t[8],
|
|
2355
|
+
t[9],
|
|
2356
|
+
t[10]
|
|
2357
|
+
] : Array.from({ length: t.length }).map((e, n) => t[n]);
|
|
2358
|
+
}
|
|
2359
|
+
const lt = (t, e, n) => {
|
|
2360
|
+
if (t === e) return 0;
|
|
2361
|
+
const r = u((n - t) / (e - t), 0, 1);
|
|
2362
|
+
return r * r * (3 - 2 * r);
|
|
2363
|
+
}, u = (t, e, n) => Math.min(Math.max(e, t), n), mt = (t, e) => e === 0 ? t : Math.trunc(t / e);
|
|
2364
|
+
function G(t) {
|
|
2365
|
+
const e = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
|
|
2366
|
+
return e.setUint32(0, t, !0), e.getFloat32(0, !0);
|
|
2367
|
+
}
|
|
2368
|
+
function D(t) {
|
|
2369
|
+
const e = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(4));
|
|
2370
|
+
return e.setUint32(0, t, !0), e.getInt32(0, !0);
|
|
2371
|
+
}
|
|
2372
|
+
const E = kn, V = $e, q = En, It = Sn, Pt = Ut, S = Pn, $ = Rt, j = Vn, $t = On, Ct = Nn, k = Un, O = Ee, H = Cn, Et = An, At = Fn, ht = (t) => Math.sqrt(t.x ** 2 + t.y ** 2), pt = (t) => Math.sqrt(t.x ** 2 + t.y ** 2 + t.z ** 2), xt = (t) => Math.sqrt(t.x ** 2 + t.y ** 2 + t.z ** 2 + t.w ** 2), Dt = (t, e) => t.x * e.x + t.y * e.y, Yt = (t, e) => t.x * e.x + t.y * e.y + t.z * e.z, qt = (t, e) => t.x * e.x + t.y * e.y + t.z * e.z + t.w * e.w, x = (t) => (e) => V(t(e.x), t(e.y)), d = (t) => (e) => q(t(e.x), t(e.y)), dt = (t) => (e) => It(t(e.x), t(e.y)), Vt = (t) => (e) => Pt(t(e.x), t(e.y)), p = (t) => (e) => $(t(e.x), t(e.y), t(e.z)), g = (t) => (e) => j(t(e.x), t(e.y), t(e.z)), gt = (t) => (e) => $t(t(e.x), t(e.y), t(e.z)), Ot = (t) => (e) => Ct(t(e.x), t(e.y), t(e.z)), h = (t) => (e) => O(t(e.x), t(e.y), t(e.z), t(e.w)), v = (t) => (e) => H(t(e.x), t(e.y), t(e.z), t(e.w)), vt = (t) => (e) => Et(t(e.x), t(e.y), t(e.z), t(e.w)), Nt = (t) => (e) => At(t(e.x), t(e.y), t(e.z), t(e.w)), Le = (t) => (e) => {
|
|
2373
|
+
const n = e.columns;
|
|
2374
|
+
return Wt(x(t)(n[0]), x(t)(n[1]));
|
|
2375
|
+
}, Re = (t) => (e) => {
|
|
2376
|
+
const n = e.columns;
|
|
2377
|
+
return Gt(p(t)(n[0]), p(t)(n[1]), p(t)(n[2]));
|
|
2378
|
+
}, We = (t) => (e) => {
|
|
2379
|
+
const n = e.columns;
|
|
2380
|
+
return _(h(t)(n[0]), h(t)(n[1]), h(t)(n[2]), h(t)(n[3]));
|
|
2381
|
+
}, Y = (t) => (e, n) => V(t(e.x, n.x), t(e.y, n.y)), nt = (t) => (e, n) => q(t(e.x, n.x), t(e.y, n.y)), bt = (t) => (e, n) => It(t(e.x, n.x), t(e.y, n.y)), zt = (t) => (e, n) => Pt(t(e.x, n.x), t(e.y, n.y)), B = (t) => (e, n) => $(t(e.x, n.x), t(e.y, n.y), t(e.z, n.z)), rt = (t) => (e, n) => j(t(e.x, n.x), t(e.y, n.y), t(e.z, n.z)), wt = (t) => (e, n) => $t(t(e.x, n.x), t(e.y, n.y), t(e.z, n.z)), Mt = (t) => (e, n) => Ct(t(e.x, n.x), t(e.y, n.y), t(e.z, n.z)), N = (t) => (e, n) => O(t(e.x, n.x), t(e.y, n.y), t(e.z, n.z), t(e.w, n.w)), st = (t) => (e, n) => H(t(e.x, n.x), t(e.y, n.y), t(e.z, n.z), t(e.w, n.w)), Tt = (t) => (e, n) => Et(t(e.x, n.x), t(e.y, n.y), t(e.z, n.z), t(e.w, n.w)), _t = (t) => (e, n) => At(t(e.x, n.x), t(e.y, n.y), t(e.z, n.z), t(e.w, n.w)), gs = (t) => (e, n) => {
|
|
2382
|
+
const r = e.columns, s = n.columns;
|
|
2383
|
+
return Wt(Y(t)(r[0], s[0]), Y(t)(r[1], s[1]));
|
|
2384
|
+
}, vs = (t) => (e, n) => {
|
|
2385
|
+
const r = e.columns, s = n.columns;
|
|
2386
|
+
return Gt(B(t)(r[0], s[0]), B(t)(r[1], s[1]), B(t)(r[2], s[2]));
|
|
2387
|
+
}, bs = (t) => (e, n) => {
|
|
2388
|
+
const r = e.columns, s = n.columns;
|
|
2389
|
+
return _(N(t)(r[0], s[0]), N(t)(r[1], s[1]), N(t)(r[2], s[2]), N(t)(r[3], s[3]));
|
|
2390
|
+
}, zs = (t) => (e, n, r) => V(t(e.x, n.x, r.x), t(e.y, n.y, r.y)), ws = (t) => (e, n, r) => q(t(e.x, n.x, r.x), t(e.y, n.y, r.y)), Ms = (t) => (e, n, r) => $(t(e.x, n.x, r.x), t(e.y, n.y, r.y), t(e.z, n.z, r.z)), Ts = (t) => (e, n, r) => j(t(e.x, n.x, r.x), t(e.y, n.y, r.y), t(e.z, n.z, r.z)), _s = (t) => (e, n, r) => O(t(e.x, n.x, r.x), t(e.y, n.y, r.y), t(e.z, n.z, r.z), t(e.w, n.w, r.w)), Is = (t) => (e, n, r) => H(t(e.x, n.x, r.x), t(e.y, n.y, r.y), t(e.z, n.z, r.z), t(e.w, n.w, r.w)), M = {
|
|
2391
|
+
eq: {
|
|
2392
|
+
vec2f: (t, e) => E(t.x === e.x, t.y === e.y),
|
|
2393
|
+
vec2h: (t, e) => E(t.x === e.x, t.y === e.y),
|
|
2394
|
+
vec2i: (t, e) => E(t.x === e.x, t.y === e.y),
|
|
2395
|
+
vec2u: (t, e) => E(t.x === e.x, t.y === e.y),
|
|
2396
|
+
"vec2<bool>": (t, e) => E(t.x === e.x, t.y === e.y),
|
|
2397
|
+
vec3f: (t, e) => S(t.x === e.x, t.y === e.y, t.z === e.z),
|
|
2398
|
+
vec3h: (t, e) => S(t.x === e.x, t.y === e.y, t.z === e.z),
|
|
2399
|
+
vec3i: (t, e) => S(t.x === e.x, t.y === e.y, t.z === e.z),
|
|
2400
|
+
vec3u: (t, e) => S(t.x === e.x, t.y === e.y, t.z === e.z),
|
|
2401
|
+
"vec3<bool>": (t, e) => S(t.x === e.x, t.y === e.y, t.z === e.z),
|
|
2402
|
+
vec4f: (t, e) => k(t.x === e.x, t.y === e.y, t.z === e.z, t.w === e.w),
|
|
2403
|
+
vec4h: (t, e) => k(t.x === e.x, t.y === e.y, t.z === e.z, t.w === e.w),
|
|
2404
|
+
vec4i: (t, e) => k(t.x === e.x, t.y === e.y, t.z === e.z, t.w === e.w),
|
|
2405
|
+
vec4u: (t, e) => k(t.x === e.x, t.y === e.y, t.z === e.z, t.w === e.w),
|
|
2406
|
+
"vec4<bool>": (t, e) => k(t.x === e.x, t.y === e.y, t.z === e.z, t.w === e.w)
|
|
2407
|
+
},
|
|
2408
|
+
lt: {
|
|
2409
|
+
vec2f: (t, e) => E(t.x < e.x, t.y < e.y),
|
|
2410
|
+
vec2h: (t, e) => E(t.x < e.x, t.y < e.y),
|
|
2411
|
+
vec2i: (t, e) => E(t.x < e.x, t.y < e.y),
|
|
2412
|
+
vec2u: (t, e) => E(t.x < e.x, t.y < e.y),
|
|
2413
|
+
vec3f: (t, e) => S(t.x < e.x, t.y < e.y, t.z < e.z),
|
|
2414
|
+
vec3h: (t, e) => S(t.x < e.x, t.y < e.y, t.z < e.z),
|
|
2415
|
+
vec3i: (t, e) => S(t.x < e.x, t.y < e.y, t.z < e.z),
|
|
2416
|
+
vec3u: (t, e) => S(t.x < e.x, t.y < e.y, t.z < e.z),
|
|
2417
|
+
vec4f: (t, e) => k(t.x < e.x, t.y < e.y, t.z < e.z, t.w < e.w),
|
|
2418
|
+
vec4h: (t, e) => k(t.x < e.x, t.y < e.y, t.z < e.z, t.w < e.w),
|
|
2419
|
+
vec4i: (t, e) => k(t.x < e.x, t.y < e.y, t.z < e.z, t.w < e.w),
|
|
2420
|
+
vec4u: (t, e) => k(t.x < e.x, t.y < e.y, t.z < e.z, t.w < e.w)
|
|
2421
|
+
},
|
|
2422
|
+
or: {
|
|
2423
|
+
"vec2<bool>": (t, e) => E(t.x || e.x, t.y || e.y),
|
|
2424
|
+
"vec3<bool>": (t, e) => S(t.x || e.x, t.y || e.y, t.z || e.z),
|
|
2425
|
+
"vec4<bool>": (t, e) => k(t.x || e.x, t.y || e.y, t.z || e.z, t.w || e.w)
|
|
2426
|
+
},
|
|
2427
|
+
all: {
|
|
2428
|
+
"vec2<bool>": (t) => t.x && t.y,
|
|
2429
|
+
"vec3<bool>": (t) => t.x && t.y && t.z,
|
|
2430
|
+
"vec4<bool>": (t) => t.x && t.y && t.z && t.w
|
|
2431
|
+
},
|
|
2432
|
+
abs: {
|
|
2433
|
+
vec2f: x(Math.abs),
|
|
2434
|
+
vec2h: d(Math.abs),
|
|
2435
|
+
vec2i: dt(Math.abs),
|
|
2436
|
+
vec2u: Vt(Math.abs),
|
|
2437
|
+
vec3f: p(Math.abs),
|
|
2438
|
+
vec3h: g(Math.abs),
|
|
2439
|
+
vec3i: gt(Math.abs),
|
|
2440
|
+
vec3u: Ot(Math.abs),
|
|
2441
|
+
vec4f: h(Math.abs),
|
|
2442
|
+
vec4h: v(Math.abs),
|
|
2443
|
+
vec4i: vt(Math.abs),
|
|
2444
|
+
vec4u: Nt(Math.abs)
|
|
2445
|
+
},
|
|
2446
|
+
atan2: {
|
|
2447
|
+
vec2f: Y(Math.atan2),
|
|
2448
|
+
vec2h: nt(Math.atan2),
|
|
2449
|
+
vec3f: B(Math.atan2),
|
|
2450
|
+
vec3h: rt(Math.atan2),
|
|
2451
|
+
vec4f: N(Math.atan2),
|
|
2452
|
+
vec4h: st(Math.atan2)
|
|
2453
|
+
},
|
|
2454
|
+
acos: {
|
|
2455
|
+
vec2f: x(Math.acos),
|
|
2456
|
+
vec2h: d(Math.acos),
|
|
2457
|
+
vec2i: dt(Math.acos),
|
|
2458
|
+
vec2u: Vt(Math.acos),
|
|
2459
|
+
vec3f: p(Math.acos),
|
|
2460
|
+
vec3h: g(Math.acos),
|
|
2461
|
+
vec3i: gt(Math.acos),
|
|
2462
|
+
vec3u: Ot(Math.acos),
|
|
2463
|
+
vec4f: h(Math.acos),
|
|
2464
|
+
vec4h: v(Math.acos),
|
|
2465
|
+
vec4i: vt(Math.acos),
|
|
2466
|
+
vec4u: Nt(Math.acos)
|
|
2467
|
+
},
|
|
2468
|
+
acosh: {
|
|
2469
|
+
vec2f: x(Math.acosh),
|
|
2470
|
+
vec2h: d(Math.acosh),
|
|
2471
|
+
vec3f: p(Math.acosh),
|
|
2472
|
+
vec3h: g(Math.acosh),
|
|
2473
|
+
vec4f: h(Math.acosh),
|
|
2474
|
+
vec4h: v(Math.acosh)
|
|
2475
|
+
},
|
|
2476
|
+
asin: {
|
|
2477
|
+
vec2f: x(Math.asin),
|
|
2478
|
+
vec2h: d(Math.asin),
|
|
2479
|
+
vec3f: p(Math.asin),
|
|
2480
|
+
vec3h: g(Math.asin),
|
|
2481
|
+
vec4f: h(Math.asin),
|
|
2482
|
+
vec4h: v(Math.asin)
|
|
2483
|
+
},
|
|
2484
|
+
asinh: {
|
|
2485
|
+
vec2f: x(Math.asinh),
|
|
2486
|
+
vec2h: d(Math.asinh),
|
|
2487
|
+
vec3f: p(Math.asinh),
|
|
2488
|
+
vec3h: g(Math.asinh),
|
|
2489
|
+
vec4f: h(Math.asinh),
|
|
2490
|
+
vec4h: v(Math.asinh)
|
|
2491
|
+
},
|
|
2492
|
+
atan: {
|
|
2493
|
+
vec2f: x(Math.atan),
|
|
2494
|
+
vec2h: d(Math.atan),
|
|
2495
|
+
vec3f: p(Math.atan),
|
|
2496
|
+
vec3h: g(Math.atan),
|
|
2497
|
+
vec4f: h(Math.atan),
|
|
2498
|
+
vec4h: v(Math.atan)
|
|
2499
|
+
},
|
|
2500
|
+
atanh: {
|
|
2501
|
+
vec2f: x(Math.atanh),
|
|
2502
|
+
vec2h: d(Math.atanh),
|
|
2503
|
+
vec3f: p(Math.atanh),
|
|
2504
|
+
vec3h: g(Math.atanh),
|
|
2505
|
+
vec4f: h(Math.atanh),
|
|
2506
|
+
vec4h: v(Math.atanh)
|
|
2507
|
+
},
|
|
2508
|
+
ceil: {
|
|
2509
|
+
vec2f: x(Math.ceil),
|
|
2510
|
+
vec2h: d(Math.ceil),
|
|
2511
|
+
vec3f: p(Math.ceil),
|
|
2512
|
+
vec3h: g(Math.ceil),
|
|
2513
|
+
vec4f: h(Math.ceil),
|
|
2514
|
+
vec4h: v(Math.ceil)
|
|
2515
|
+
},
|
|
2516
|
+
clamp: {
|
|
2517
|
+
vec2f: (t, e, n) => V(u(t.x, e.x, n.x), u(t.y, e.y, n.y)),
|
|
2518
|
+
vec2h: (t, e, n) => q(u(t.x, e.x, n.x), u(t.y, e.y, n.y)),
|
|
2519
|
+
vec2i: (t, e, n) => It(u(t.x, e.x, n.x), u(t.y, e.y, n.y)),
|
|
2520
|
+
vec2u: (t, e, n) => Pt(u(t.x, e.x, n.x), u(t.y, e.y, n.y)),
|
|
2521
|
+
vec3f: (t, e, n) => $(u(t.x, e.x, n.x), u(t.y, e.y, n.y), u(t.z, e.z, n.z)),
|
|
2522
|
+
vec3h: (t, e, n) => j(u(t.x, e.x, n.x), u(t.y, e.y, n.y), u(t.z, e.z, n.z)),
|
|
2523
|
+
vec3i: (t, e, n) => $t(u(t.x, e.x, n.x), u(t.y, e.y, n.y), u(t.z, e.z, n.z)),
|
|
2524
|
+
vec3u: (t, e, n) => Ct(u(t.x, e.x, n.x), u(t.y, e.y, n.y), u(t.z, e.z, n.z)),
|
|
2525
|
+
vec4f: (t, e, n) => O(u(t.x, e.x, n.x), u(t.y, e.y, n.y), u(t.z, e.z, n.z), u(t.w, e.w, n.w)),
|
|
2526
|
+
vec4h: (t, e, n) => H(u(t.x, e.x, n.x), u(t.y, e.y, n.y), u(t.z, e.z, n.z), u(t.w, e.w, n.w)),
|
|
2527
|
+
vec4i: (t, e, n) => Et(u(t.x, e.x, n.x), u(t.y, e.y, n.y), u(t.z, e.z, n.z), u(t.w, e.w, n.w)),
|
|
2528
|
+
vec4u: (t, e, n) => At(u(t.x, e.x, n.x), u(t.y, e.y, n.y), u(t.z, e.z, n.z), u(t.w, e.w, n.w))
|
|
2529
|
+
},
|
|
2530
|
+
length: {
|
|
2531
|
+
vec2f: ht,
|
|
2532
|
+
vec2h: ht,
|
|
2533
|
+
vec3f: pt,
|
|
2534
|
+
vec3h: pt,
|
|
2535
|
+
vec4f: xt,
|
|
2536
|
+
vec4h: xt
|
|
2537
|
+
},
|
|
2538
|
+
add: {
|
|
2539
|
+
vec2f: Y((t, e) => t + e),
|
|
2540
|
+
vec2h: nt((t, e) => t + e),
|
|
2541
|
+
vec2i: bt((t, e) => t + e),
|
|
2542
|
+
vec2u: zt((t, e) => t + e),
|
|
2543
|
+
vec3f: B((t, e) => t + e),
|
|
2544
|
+
vec3h: rt((t, e) => t + e),
|
|
2545
|
+
vec3i: wt((t, e) => t + e),
|
|
2546
|
+
vec3u: Mt((t, e) => t + e),
|
|
2547
|
+
vec4f: N((t, e) => t + e),
|
|
2548
|
+
vec4h: st((t, e) => t + e),
|
|
2549
|
+
vec4i: Tt((t, e) => t + e),
|
|
2550
|
+
vec4u: _t((t, e) => t + e),
|
|
2551
|
+
mat2x2f: gs((t, e) => t + e),
|
|
2552
|
+
mat3x3f: vs((t, e) => t + e),
|
|
2553
|
+
mat4x4f: bs((t, e) => t + e)
|
|
2554
|
+
},
|
|
2555
|
+
smoothstep: {
|
|
2556
|
+
vec2f: zs(lt),
|
|
2557
|
+
vec2h: ws(lt),
|
|
2558
|
+
vec3f: Ms(lt),
|
|
2559
|
+
vec3h: Ts(lt),
|
|
2560
|
+
vec4f: _s(lt),
|
|
2561
|
+
vec4h: Is(lt)
|
|
2562
|
+
},
|
|
2563
|
+
addMixed: {
|
|
2564
|
+
vec2f: (t, e) => x((n) => n + e)(t),
|
|
2565
|
+
vec2h: (t, e) => d((n) => n + e)(t),
|
|
2566
|
+
vec2i: (t, e) => dt((n) => n + e)(t),
|
|
2567
|
+
vec2u: (t, e) => Vt((n) => n + e)(t),
|
|
2568
|
+
vec3f: (t, e) => p((n) => n + e)(t),
|
|
2569
|
+
vec3h: (t, e) => g((n) => n + e)(t),
|
|
2570
|
+
vec3i: (t, e) => gt((n) => n + e)(t),
|
|
2571
|
+
vec3u: (t, e) => Ot((n) => n + e)(t),
|
|
2572
|
+
vec4f: (t, e) => h((n) => n + e)(t),
|
|
2573
|
+
vec4h: (t, e) => v((n) => n + e)(t),
|
|
2574
|
+
vec4i: (t, e) => vt((n) => n + e)(t),
|
|
2575
|
+
vec4u: (t, e) => Nt((n) => n + e)(t),
|
|
2576
|
+
mat2x2f: (t, e) => Le((n) => n + e)(t),
|
|
2577
|
+
mat3x3f: (t, e) => Re((n) => n + e)(t),
|
|
2578
|
+
mat4x4f: (t, e) => We((n) => n + e)(t)
|
|
2579
|
+
},
|
|
2580
|
+
mulSxV: {
|
|
2581
|
+
vec2f: (t, e) => x((n) => t * n)(e),
|
|
2582
|
+
vec2h: (t, e) => d((n) => t * n)(e),
|
|
2583
|
+
vec2i: (t, e) => dt((n) => t * n)(e),
|
|
2584
|
+
vec2u: (t, e) => Vt((n) => t * n)(e),
|
|
2585
|
+
vec3f: (t, e) => p((n) => t * n)(e),
|
|
2586
|
+
vec3h: (t, e) => g((n) => t * n)(e),
|
|
2587
|
+
vec3i: (t, e) => gt((n) => t * n)(e),
|
|
2588
|
+
vec3u: (t, e) => Ot((n) => t * n)(e),
|
|
2589
|
+
vec4f: (t, e) => h((n) => t * n)(e),
|
|
2590
|
+
vec4h: (t, e) => v((n) => t * n)(e),
|
|
2591
|
+
vec4i: (t, e) => vt((n) => t * n)(e),
|
|
2592
|
+
vec4u: (t, e) => Nt((n) => t * n)(e),
|
|
2593
|
+
mat2x2f: (t, e) => Le((n) => t * n)(e),
|
|
2594
|
+
mat3x3f: (t, e) => Re((n) => t * n)(e),
|
|
2595
|
+
mat4x4f: (t, e) => We((n) => t * n)(e)
|
|
2596
|
+
},
|
|
2597
|
+
mulVxV: {
|
|
2598
|
+
vec2f: Y((t, e) => t * e),
|
|
2599
|
+
vec2h: nt((t, e) => t * e),
|
|
2600
|
+
vec2i: bt((t, e) => t * e),
|
|
2601
|
+
vec2u: zt((t, e) => t * e),
|
|
2602
|
+
vec3f: B((t, e) => t * e),
|
|
2603
|
+
vec3h: rt((t, e) => t * e),
|
|
2604
|
+
vec3i: wt((t, e) => t * e),
|
|
2605
|
+
vec3u: Mt((t, e) => t * e),
|
|
2606
|
+
vec4f: N((t, e) => t * e),
|
|
2607
|
+
vec4h: st((t, e) => t * e),
|
|
2608
|
+
vec4i: Tt((t, e) => t * e),
|
|
2609
|
+
vec4u: _t((t, e) => t * e),
|
|
2610
|
+
mat2x2f: (t, e) => {
|
|
2611
|
+
const n = t.columns, r = e.columns;
|
|
2612
|
+
return Wt(n[0].x * r[0].x + n[1].x * r[0].y, n[0].y * r[0].x + n[1].y * r[0].y, n[0].x * r[1].x + n[1].x * r[1].y, n[0].y * r[1].x + n[1].y * r[1].y);
|
|
2613
|
+
},
|
|
2614
|
+
mat3x3f: (t, e) => {
|
|
2615
|
+
const n = t.columns, r = e.columns;
|
|
2616
|
+
return Gt(n[0].x * r[0].x + n[1].x * r[0].y + n[2].x * r[0].z, n[0].y * r[0].x + n[1].y * r[0].y + n[2].y * r[0].z, n[0].z * r[0].x + n[1].z * r[0].y + n[2].z * r[0].z, n[0].x * r[1].x + n[1].x * r[1].y + n[2].x * r[1].z, n[0].y * r[1].x + n[1].y * r[1].y + n[2].y * r[1].z, n[0].z * r[1].x + n[1].z * r[1].y + n[2].z * r[1].z, n[0].x * r[2].x + n[1].x * r[2].y + n[2].x * r[2].z, n[0].y * r[2].x + n[1].y * r[2].y + n[2].y * r[2].z, n[0].z * r[2].x + n[1].z * r[2].y + n[2].z * r[2].z);
|
|
2617
|
+
},
|
|
2618
|
+
mat4x4f: (t, e) => {
|
|
2619
|
+
const n = t.columns, r = e.columns;
|
|
2620
|
+
return _(n[0].x * r[0].x + n[1].x * r[0].y + n[2].x * r[0].z + n[3].x * r[0].w, n[0].y * r[0].x + n[1].y * r[0].y + n[2].y * r[0].z + n[3].y * r[0].w, n[0].z * r[0].x + n[1].z * r[0].y + n[2].z * r[0].z + n[3].z * r[0].w, n[0].w * r[0].x + n[1].w * r[0].y + n[2].w * r[0].z + n[3].w * r[0].w, n[0].x * r[1].x + n[1].x * r[1].y + n[2].x * r[1].z + n[3].x * r[1].w, n[0].y * r[1].x + n[1].y * r[1].y + n[2].y * r[1].z + n[3].y * r[1].w, n[0].z * r[1].x + n[1].z * r[1].y + n[2].z * r[1].z + n[3].z * r[1].w, n[0].w * r[1].x + n[1].w * r[1].y + n[2].w * r[1].z + n[3].w * r[1].w, n[0].x * r[2].x + n[1].x * r[2].y + n[2].x * r[2].z + n[3].x * r[2].w, n[0].y * r[2].x + n[1].y * r[2].y + n[2].y * r[2].z + n[3].y * r[2].w, n[0].z * r[2].x + n[1].z * r[2].y + n[2].z * r[2].z + n[3].z * r[2].w, n[0].w * r[2].x + n[1].w * r[2].y + n[2].w * r[2].z + n[3].w * r[2].w, n[0].x * r[3].x + n[1].x * r[3].y + n[2].x * r[3].z + n[3].x * r[3].w, n[0].y * r[3].x + n[1].y * r[3].y + n[2].y * r[3].z + n[3].y * r[3].w, n[0].z * r[3].x + n[1].z * r[3].y + n[2].z * r[3].z + n[3].z * r[3].w, n[0].w * r[3].x + n[1].w * r[3].y + n[2].w * r[3].z + n[3].w * r[3].w);
|
|
2621
|
+
}
|
|
2622
|
+
},
|
|
2623
|
+
mulMxV: {
|
|
2624
|
+
mat2x2f: (t, e) => {
|
|
2625
|
+
const n = t.columns;
|
|
2626
|
+
return V(n[0].x * e.x + n[1].x * e.y, n[0].y * e.x + n[1].y * e.y);
|
|
2627
|
+
},
|
|
2628
|
+
mat3x3f: (t, e) => {
|
|
2629
|
+
const n = t.columns;
|
|
2630
|
+
return $(n[0].x * e.x + n[1].x * e.y + n[2].x * e.z, n[0].y * e.x + n[1].y * e.y + n[2].y * e.z, n[0].z * e.x + n[1].z * e.y + n[2].z * e.z);
|
|
2631
|
+
},
|
|
2632
|
+
mat4x4f: (t, e) => {
|
|
2633
|
+
const n = t.columns;
|
|
2634
|
+
return O(n[0].x * e.x + n[1].x * e.y + n[2].x * e.z + n[3].x * e.w, n[0].y * e.x + n[1].y * e.y + n[2].y * e.z + n[3].y * e.w, n[0].z * e.x + n[1].z * e.y + n[2].z * e.z + n[3].z * e.w, n[0].w * e.x + n[1].w * e.y + n[2].w * e.z + n[3].w * e.w);
|
|
2635
|
+
}
|
|
2636
|
+
},
|
|
2637
|
+
mulVxM: {
|
|
2638
|
+
mat2x2f: (t, e) => {
|
|
2639
|
+
const n = e.columns;
|
|
2640
|
+
return V(t.x * n[0].x + t.y * n[0].y, t.x * n[1].x + t.y * n[1].y);
|
|
2641
|
+
},
|
|
2642
|
+
mat3x3f: (t, e) => {
|
|
2643
|
+
const n = e.columns;
|
|
2644
|
+
return $(t.x * n[0].x + t.y * n[0].y + t.z * n[0].z, t.x * n[1].x + t.y * n[1].y + t.z * n[1].z, t.x * n[2].x + t.y * n[2].y + t.z * n[2].z);
|
|
2645
|
+
},
|
|
2646
|
+
mat4x4f: (t, e) => {
|
|
2647
|
+
const n = e.columns;
|
|
2648
|
+
return O(t.x * n[0].x + t.y * n[0].y + t.z * n[0].z + t.w * n[0].w, t.x * n[1].x + t.y * n[1].y + t.z * n[1].z + t.w * n[1].w, t.x * n[2].x + t.y * n[2].y + t.z * n[2].z + t.w * n[2].w, t.x * n[3].x + t.y * n[3].y + t.z * n[3].z + t.w * n[3].w);
|
|
2649
|
+
}
|
|
2650
|
+
},
|
|
2651
|
+
div: {
|
|
2652
|
+
vec2f: Y((t, e) => t / e),
|
|
2653
|
+
vec2h: nt((t, e) => t / e),
|
|
2654
|
+
vec2i: bt(mt),
|
|
2655
|
+
vec2u: zt(mt),
|
|
2656
|
+
vec3f: B((t, e) => t / e),
|
|
2657
|
+
vec3h: rt((t, e) => t / e),
|
|
2658
|
+
vec3i: wt(mt),
|
|
2659
|
+
vec3u: Mt(mt),
|
|
2660
|
+
vec4f: N((t, e) => t / e),
|
|
2661
|
+
vec4h: st((t, e) => t / e),
|
|
2662
|
+
vec4i: Tt(mt),
|
|
2663
|
+
vec4u: _t(mt)
|
|
2664
|
+
},
|
|
2665
|
+
dot: {
|
|
2666
|
+
vec2f: Dt,
|
|
2667
|
+
vec2h: Dt,
|
|
2668
|
+
vec2i: Dt,
|
|
2669
|
+
vec2u: Dt,
|
|
2670
|
+
vec3f: Yt,
|
|
2671
|
+
vec3h: Yt,
|
|
2672
|
+
vec3i: Yt,
|
|
2673
|
+
vec3u: Yt,
|
|
2674
|
+
vec4f: qt,
|
|
2675
|
+
vec4h: qt,
|
|
2676
|
+
vec4i: qt,
|
|
2677
|
+
vec4u: qt
|
|
2678
|
+
},
|
|
2679
|
+
normalize: {
|
|
2680
|
+
vec2f: (t) => {
|
|
2681
|
+
const e = ht(t);
|
|
2682
|
+
return V(t.x / e, t.y / e);
|
|
2683
|
+
},
|
|
2684
|
+
vec2h: (t) => {
|
|
2685
|
+
const e = ht(t);
|
|
2686
|
+
return q(t.x / e, t.y / e);
|
|
2687
|
+
},
|
|
2688
|
+
vec2i: (t) => {
|
|
2689
|
+
const e = ht(t);
|
|
2690
|
+
return It(t.x / e, t.y / e);
|
|
2691
|
+
},
|
|
2692
|
+
vec2u: (t) => {
|
|
2693
|
+
const e = ht(t);
|
|
2694
|
+
return Pt(t.x / e, t.y / e);
|
|
2695
|
+
},
|
|
2696
|
+
vec3f: (t) => {
|
|
2697
|
+
const e = pt(t);
|
|
2698
|
+
return $(t.x / e, t.y / e, t.z / e);
|
|
2699
|
+
},
|
|
2700
|
+
vec3h: (t) => {
|
|
2701
|
+
const e = pt(t);
|
|
2702
|
+
return j(t.x / e, t.y / e, t.z / e);
|
|
2703
|
+
},
|
|
2704
|
+
vec3i: (t) => {
|
|
2705
|
+
const e = pt(t);
|
|
2706
|
+
return $t(t.x / e, t.y / e, t.z / e);
|
|
2707
|
+
},
|
|
2708
|
+
vec3u: (t) => {
|
|
2709
|
+
const e = pt(t);
|
|
2710
|
+
return Ct(t.x / e, t.y / e, t.z / e);
|
|
2711
|
+
},
|
|
2712
|
+
vec4f: (t) => {
|
|
2713
|
+
const e = xt(t);
|
|
2714
|
+
return O(t.x / e, t.y / e, t.z / e, t.w / e);
|
|
2715
|
+
},
|
|
2716
|
+
vec4h: (t) => {
|
|
2717
|
+
const e = xt(t);
|
|
2718
|
+
return H(t.x / e, t.y / e, t.z / e, t.w / e);
|
|
2719
|
+
},
|
|
2720
|
+
vec4i: (t) => {
|
|
2721
|
+
const e = xt(t);
|
|
2722
|
+
return Et(t.x / e, t.y / e, t.z / e, t.w / e);
|
|
2723
|
+
},
|
|
2724
|
+
vec4u: (t) => {
|
|
2725
|
+
const e = xt(t);
|
|
2726
|
+
return At(t.x / e, t.y / e, t.z / e, t.w / e);
|
|
2727
|
+
}
|
|
2728
|
+
},
|
|
2729
|
+
cross: {
|
|
2730
|
+
vec3f: (t, e) => $(t.y * e.z - t.z * e.y, t.z * e.x - t.x * e.z, t.x * e.y - t.y * e.x),
|
|
2731
|
+
vec3h: (t, e) => j(t.y * e.z - t.z * e.y, t.z * e.x - t.x * e.z, t.x * e.y - t.y * e.x)
|
|
2732
|
+
},
|
|
2733
|
+
mod: {
|
|
2734
|
+
vec2f: Y((t, e) => t % e),
|
|
2735
|
+
vec2h: nt((t, e) => t % e),
|
|
2736
|
+
vec2i: bt((t, e) => t % e),
|
|
2737
|
+
vec2u: zt((t, e) => t % e),
|
|
2738
|
+
vec3f: B((t, e) => t % e),
|
|
2739
|
+
vec3h: rt((t, e) => t % e),
|
|
2740
|
+
vec3i: wt((t, e) => t % e),
|
|
2741
|
+
vec3u: Mt((t, e) => t % e),
|
|
2742
|
+
vec4f: N((t, e) => t % e),
|
|
2743
|
+
vec4h: st((t, e) => t % e),
|
|
2744
|
+
vec4i: Tt((t, e) => t % e),
|
|
2745
|
+
vec4u: _t((t, e) => t % e)
|
|
2746
|
+
},
|
|
2747
|
+
floor: {
|
|
2748
|
+
vec2f: x(Math.floor),
|
|
2749
|
+
vec2h: d(Math.floor),
|
|
2750
|
+
vec3f: p(Math.floor),
|
|
2751
|
+
vec3h: g(Math.floor),
|
|
2752
|
+
vec4f: h(Math.floor),
|
|
2753
|
+
vec4h: v(Math.floor)
|
|
2754
|
+
},
|
|
2755
|
+
max: {
|
|
2756
|
+
vec2f: Y(Math.max),
|
|
2757
|
+
vec2h: nt(Math.max),
|
|
2758
|
+
vec2i: bt(Math.max),
|
|
2759
|
+
vec2u: zt(Math.max),
|
|
2760
|
+
vec3f: B(Math.max),
|
|
2761
|
+
vec3h: rt(Math.max),
|
|
2762
|
+
vec3i: wt(Math.max),
|
|
2763
|
+
vec3u: Mt(Math.max),
|
|
2764
|
+
vec4f: N(Math.max),
|
|
2765
|
+
vec4h: st(Math.max),
|
|
2766
|
+
vec4i: Tt(Math.max),
|
|
2767
|
+
vec4u: _t(Math.max)
|
|
2768
|
+
},
|
|
2769
|
+
min: {
|
|
2770
|
+
vec2f: Y(Math.min),
|
|
2771
|
+
vec2h: nt(Math.min),
|
|
2772
|
+
vec2i: bt(Math.min),
|
|
2773
|
+
vec2u: zt(Math.min),
|
|
2774
|
+
vec3f: B(Math.min),
|
|
2775
|
+
vec3h: rt(Math.min),
|
|
2776
|
+
vec3i: wt(Math.min),
|
|
2777
|
+
vec3u: Mt(Math.min),
|
|
2778
|
+
vec4f: N(Math.min),
|
|
2779
|
+
vec4h: st(Math.min),
|
|
2780
|
+
vec4i: Tt(Math.min),
|
|
2781
|
+
vec4u: _t(Math.min)
|
|
2782
|
+
},
|
|
2783
|
+
pow: {
|
|
2784
|
+
vec2f: (t, e) => V(t.x ** e.x, t.y ** e.y),
|
|
2785
|
+
vec2h: (t, e) => q(t.x ** e.x, t.y ** e.y),
|
|
2786
|
+
vec3f: (t, e) => $(t.x ** e.x, t.y ** e.y, t.z ** e.z),
|
|
2787
|
+
vec3h: (t, e) => j(t.x ** e.x, t.y ** e.y, t.z ** e.z),
|
|
2788
|
+
vec4f: (t, e) => O(t.x ** e.x, t.y ** e.y, t.z ** e.z, t.w ** e.w),
|
|
2789
|
+
vec4h: (t, e) => H(t.x ** e.x, t.y ** e.y, t.z ** e.z, t.w ** e.w)
|
|
2790
|
+
},
|
|
2791
|
+
sign: {
|
|
2792
|
+
vec2f: x(Math.sign),
|
|
2793
|
+
vec2h: d(Math.sign),
|
|
2794
|
+
vec2i: dt(Math.sign),
|
|
2795
|
+
vec3f: p(Math.sign),
|
|
2796
|
+
vec3h: g(Math.sign),
|
|
2797
|
+
vec3i: gt(Math.sign),
|
|
2798
|
+
vec4f: h(Math.sign),
|
|
2799
|
+
vec4h: v(Math.sign),
|
|
2800
|
+
vec4i: vt(Math.sign)
|
|
2801
|
+
},
|
|
2802
|
+
sqrt: {
|
|
2803
|
+
vec2f: x(Math.sqrt),
|
|
2804
|
+
vec2h: d(Math.sqrt),
|
|
2805
|
+
vec3f: p(Math.sqrt),
|
|
2806
|
+
vec3h: g(Math.sqrt),
|
|
2807
|
+
vec4f: h(Math.sqrt),
|
|
2808
|
+
vec4h: v(Math.sqrt)
|
|
2809
|
+
},
|
|
2810
|
+
mix: {
|
|
2811
|
+
vec2f: (t, e, n) => typeof n == "number" ? V(t.x * (1 - n) + e.x * n, t.y * (1 - n) + e.y * n) : V(t.x * (1 - n.x) + e.x * n.x, t.y * (1 - n.y) + e.y * n.y),
|
|
2812
|
+
vec2h: (t, e, n) => typeof n == "number" ? q(t.x * (1 - n) + e.x * n, t.y * (1 - n) + e.y * n) : q(t.x * (1 - n.x) + e.x * n.x, t.y * (1 - n.y) + e.y * n.y),
|
|
2813
|
+
vec3f: (t, e, n) => typeof n == "number" ? $(t.x * (1 - n) + e.x * n, t.y * (1 - n) + e.y * n, t.z * (1 - n) + e.z * n) : $(t.x * (1 - n.x) + e.x * n.x, t.y * (1 - n.y) + e.y * n.y, t.z * (1 - n.z) + e.z * n.z),
|
|
2814
|
+
vec3h: (t, e, n) => typeof n == "number" ? j(t.x * (1 - n) + e.x * n, t.y * (1 - n) + e.y * n, t.z * (1 - n) + e.z * n) : j(t.x * (1 - n.x) + e.x * n.x, t.y * (1 - n.y) + e.y * n.y, t.z * (1 - n.z) + e.z * n.z),
|
|
2815
|
+
vec4f: (t, e, n) => typeof n == "number" ? O(t.x * (1 - n) + e.x * n, t.y * (1 - n) + e.y * n, t.z * (1 - n) + e.z * n, t.w * (1 - n) + e.w * n) : O(t.x * (1 - n.x) + e.x * n.x, t.y * (1 - n.y) + e.y * n.y, t.z * (1 - n.z) + e.z * n.z, t.w * (1 - n.w) + e.w * n.w),
|
|
2816
|
+
vec4h: (t, e, n) => typeof n == "number" ? H(t.x * (1 - n) + e.x * n, t.y * (1 - n) + e.y * n, t.z * (1 - n) + e.z * n, t.w * (1 - n) + e.w * n) : H(t.x * (1 - n.x) + e.x * n.x, t.y * (1 - n.y) + e.y * n.y, t.z * (1 - n.z) + e.z * n.z, t.w * (1 - n.w) + e.w * n.w)
|
|
2817
|
+
},
|
|
2818
|
+
sin: {
|
|
2819
|
+
vec2f: x(Math.sin),
|
|
2820
|
+
vec2h: d(Math.sin),
|
|
2821
|
+
vec3f: p(Math.sin),
|
|
2822
|
+
vec3h: g(Math.sin),
|
|
2823
|
+
vec4f: h(Math.sin),
|
|
2824
|
+
vec4h: v(Math.sin)
|
|
2825
|
+
},
|
|
2826
|
+
cos: {
|
|
2827
|
+
vec2f: x(Math.cos),
|
|
2828
|
+
vec2h: d(Math.cos),
|
|
2829
|
+
vec3f: p(Math.cos),
|
|
2830
|
+
vec3h: g(Math.cos),
|
|
2831
|
+
vec4f: h(Math.cos),
|
|
2832
|
+
vec4h: v(Math.cos)
|
|
2833
|
+
},
|
|
2834
|
+
cosh: {
|
|
2835
|
+
vec2f: x(Math.cosh),
|
|
2836
|
+
vec2h: d(Math.cosh),
|
|
2837
|
+
vec3f: p(Math.cosh),
|
|
2838
|
+
vec3h: g(Math.cosh),
|
|
2839
|
+
vec4f: h(Math.cosh),
|
|
2840
|
+
vec4h: v(Math.cosh)
|
|
2841
|
+
},
|
|
2842
|
+
exp: {
|
|
2843
|
+
vec2f: x(Math.exp),
|
|
2844
|
+
vec2h: d(Math.exp),
|
|
2845
|
+
vec3f: p(Math.exp),
|
|
2846
|
+
vec3h: g(Math.exp),
|
|
2847
|
+
vec4f: h(Math.exp),
|
|
2848
|
+
vec4h: v(Math.exp)
|
|
2849
|
+
},
|
|
2850
|
+
exp2: {
|
|
2851
|
+
vec2f: x((t) => 2 ** t),
|
|
2852
|
+
vec2h: d((t) => 2 ** t),
|
|
2853
|
+
vec3f: p((t) => 2 ** t),
|
|
2854
|
+
vec3h: g((t) => 2 ** t),
|
|
2855
|
+
vec4f: h((t) => 2 ** t),
|
|
2856
|
+
vec4h: v((t) => 2 ** t)
|
|
2857
|
+
},
|
|
2858
|
+
log: {
|
|
2859
|
+
vec2f: x(Math.log),
|
|
2860
|
+
vec2h: d(Math.log),
|
|
2861
|
+
vec3f: p(Math.log),
|
|
2862
|
+
vec3h: g(Math.log),
|
|
2863
|
+
vec4f: h(Math.log),
|
|
2864
|
+
vec4h: v(Math.log)
|
|
2865
|
+
},
|
|
2866
|
+
log2: {
|
|
2867
|
+
vec2f: x(Math.log2),
|
|
2868
|
+
vec2h: d(Math.log2),
|
|
2869
|
+
vec3f: p(Math.log2),
|
|
2870
|
+
vec3h: g(Math.log2),
|
|
2871
|
+
vec4f: h(Math.log2),
|
|
2872
|
+
vec4h: v(Math.log2)
|
|
2873
|
+
},
|
|
2874
|
+
fract: {
|
|
2875
|
+
vec2f: x((t) => t - Math.floor(t)),
|
|
2876
|
+
vec2h: d((t) => t - Math.floor(t)),
|
|
2877
|
+
vec3f: p((t) => t - Math.floor(t)),
|
|
2878
|
+
vec3h: g((t) => t - Math.floor(t)),
|
|
2879
|
+
vec4f: h((t) => t - Math.floor(t)),
|
|
2880
|
+
vec4h: v((t) => t - Math.floor(t))
|
|
2881
|
+
},
|
|
2882
|
+
isCloseToZero: {
|
|
2883
|
+
vec2f: (t, e) => Math.abs(t.x) <= e && Math.abs(t.y) <= e,
|
|
2884
|
+
vec2h: (t, e) => Math.abs(t.x) <= e && Math.abs(t.y) <= e,
|
|
2885
|
+
vec3f: (t, e) => Math.abs(t.x) <= e && Math.abs(t.y) <= e && Math.abs(t.z) <= e,
|
|
2886
|
+
vec3h: (t, e) => Math.abs(t.x) <= e && Math.abs(t.y) <= e && Math.abs(t.z) <= e,
|
|
2887
|
+
vec4f: (t, e) => Math.abs(t.x) <= e && Math.abs(t.y) <= e && Math.abs(t.z) <= e && Math.abs(t.w) <= e,
|
|
2888
|
+
vec4h: (t, e) => Math.abs(t.x) <= e && Math.abs(t.y) <= e && Math.abs(t.z) <= e && Math.abs(t.w) <= e
|
|
2889
|
+
},
|
|
2890
|
+
neg: {
|
|
2891
|
+
vec2f: x((t) => -t),
|
|
2892
|
+
vec2h: d((t) => -t),
|
|
2893
|
+
vec2i: dt((t) => -t),
|
|
2894
|
+
vec2u: Vt((t) => -t),
|
|
2895
|
+
"vec2<bool>": (t) => E(!t.x, !t.y),
|
|
2896
|
+
vec3f: p((t) => -t),
|
|
2897
|
+
vec3h: g((t) => -t),
|
|
2898
|
+
vec3i: gt((t) => -t),
|
|
2899
|
+
vec3u: Ot((t) => -t),
|
|
2900
|
+
"vec3<bool>": (t) => S(!t.x, !t.y, !t.z),
|
|
2901
|
+
vec4f: h((t) => -t),
|
|
2902
|
+
vec4h: v((t) => -t),
|
|
2903
|
+
vec4i: vt((t) => -t),
|
|
2904
|
+
vec4u: Nt((t) => -t),
|
|
2905
|
+
"vec4<bool>": (t) => k(!t.x, !t.y, !t.z, !t.w)
|
|
2906
|
+
},
|
|
2907
|
+
select: {
|
|
2908
|
+
vec2f: (t, e, n) => V(n.x ? e.x : t.x, n.y ? e.y : t.y),
|
|
2909
|
+
vec2h: (t, e, n) => q(n.x ? e.x : t.x, n.y ? e.y : t.y),
|
|
2910
|
+
vec2i: (t, e, n) => It(n.x ? e.x : t.x, n.y ? e.y : t.y),
|
|
2911
|
+
vec2u: (t, e, n) => Pt(n.x ? e.x : t.x, n.y ? e.y : t.y),
|
|
2912
|
+
"vec2<bool>": (t, e, n) => E(n.x ? e.x : t.x, n.y ? e.y : t.y),
|
|
2913
|
+
vec3f: (t, e, n) => $(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z),
|
|
2914
|
+
vec3h: (t, e, n) => j(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z),
|
|
2915
|
+
vec3i: (t, e, n) => $t(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z),
|
|
2916
|
+
vec3u: (t, e, n) => Ct(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z),
|
|
2917
|
+
"vec3<bool>": (t, e, n) => S(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z),
|
|
2918
|
+
vec4f: (t, e, n) => O(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z, n.w ? e.w : t.w),
|
|
2919
|
+
vec4h: (t, e, n) => H(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z, n.w ? e.w : t.w),
|
|
2920
|
+
vec4i: (t, e, n) => Et(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z, n.w ? e.w : t.w),
|
|
2921
|
+
vec4u: (t, e, n) => At(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z, n.w ? e.w : t.w),
|
|
2922
|
+
"vec4<bool>": (t, e, n) => k(n.x ? e.x : t.x, n.y ? e.y : t.y, n.z ? e.z : t.z, n.w ? e.w : t.w)
|
|
2923
|
+
},
|
|
2924
|
+
tanh: {
|
|
2925
|
+
vec2f: x(Math.tanh),
|
|
2926
|
+
vec2h: d(Math.tanh),
|
|
2927
|
+
vec3f: p(Math.tanh),
|
|
2928
|
+
vec3h: g(Math.tanh),
|
|
2929
|
+
vec4f: h(Math.tanh),
|
|
2930
|
+
vec4h: v(Math.tanh)
|
|
2931
|
+
},
|
|
2932
|
+
bitcastU32toF32: {
|
|
2933
|
+
vec2u: (t) => V(G(t.x), G(t.y)),
|
|
2934
|
+
vec3u: (t) => $(G(t.x), G(t.y), G(t.z)),
|
|
2935
|
+
vec4u: (t) => O(G(t.x), G(t.y), G(t.z), G(t.w))
|
|
2936
|
+
},
|
|
2937
|
+
bitcastU32toI32: {
|
|
2938
|
+
vec2u: (t) => It(D(t.x), D(t.y)),
|
|
2939
|
+
vec3u: (t) => $t(D(t.x), D(t.y), D(t.z)),
|
|
2940
|
+
vec4u: (t) => Et(D(t.x), D(t.y), D(t.z), D(t.w))
|
|
2941
|
+
}
|
|
2942
|
+
}, Ge = (t) => "primitive" in t ? t.primitive : t, Ce = (t) => (e, n) => {
|
|
2943
|
+
const { restrict: r } = t ?? {}, s = (tt) => {
|
|
2944
|
+
throw r ? new gr([e, n], r) : new Error(`Cannot apply operator to ${e.type} and ${n.type}: ${tt}`);
|
|
2945
|
+
};
|
|
2946
|
+
if (t?.noMat && (ct(e) || ct(n))) return s("matrices not supported");
|
|
2947
|
+
const c = C(e) || ct(e), a = C(n) || ct(n);
|
|
2948
|
+
if (!c && !a) {
|
|
2949
|
+
const tt = je([e, n], r);
|
|
2950
|
+
return tt ? {
|
|
2951
|
+
argTypes: tt,
|
|
2952
|
+
returnType: tt[0]
|
|
2953
|
+
} : s("incompatible scalar types");
|
|
2954
|
+
}
|
|
2955
|
+
if (c && a)
|
|
2956
|
+
return t?.matVecProduct && C(e) !== C(n) ? {
|
|
2957
|
+
argTypes: [e, n],
|
|
2958
|
+
returnType: C(e) ? e : n
|
|
2959
|
+
} : e.type !== n.type ? s("operands must have the same type") : {
|
|
2960
|
+
argTypes: [e, n],
|
|
2961
|
+
returnType: e
|
|
2962
|
+
};
|
|
2963
|
+
const [o, b] = c ? [n, e] : [e, n], y = je([o], [Ge(b)]);
|
|
2964
|
+
return y ? {
|
|
2965
|
+
argTypes: c ? [e, y[0]] : [y[0], n],
|
|
2966
|
+
returnType: b
|
|
2967
|
+
} : s(`scalar not convertible to ${Ge(b).type}`);
|
|
2968
|
+
}, Rn = Ce(), $s = Ce({ matVecProduct: !0 }), Wn = Ce({
|
|
2969
|
+
noMat: !0,
|
|
2970
|
+
restrict: [
|
|
2971
|
+
T,
|
|
2972
|
+
J,
|
|
2973
|
+
se
|
|
2974
|
+
]
|
|
2975
|
+
});
|
|
2976
|
+
function Gn(t, e) {
|
|
2977
|
+
if (typeof t == "number" && typeof e == "number") return t + e;
|
|
2978
|
+
if (typeof t == "number" && w(e)) return M.addMixed[e.kind](e, t);
|
|
2979
|
+
if (w(t) && typeof e == "number") return M.addMixed[t.kind](t, e);
|
|
2980
|
+
if (w(t) && w(e) || L(t) && L(e)) return M.add[t.kind](t, e);
|
|
2981
|
+
throw new Error("Add/Sub called with invalid arguments.");
|
|
2982
|
+
}
|
|
2983
|
+
const Rc = U({
|
|
2984
|
+
name: "add",
|
|
2985
|
+
signature: Rn,
|
|
2986
|
+
normalImpl: Gn,
|
|
2987
|
+
codegenImpl: (t, [e, n]) => f`(${e} + ${n})`
|
|
2988
|
+
});
|
|
2989
|
+
function Es(t, e) {
|
|
2990
|
+
return Gn(t, Dn(-1, e));
|
|
2991
|
+
}
|
|
2992
|
+
const Wc = U({
|
|
2993
|
+
name: "sub",
|
|
2994
|
+
signature: Rn,
|
|
2995
|
+
normalImpl: Es,
|
|
2996
|
+
codegenImpl: (t, [e, n]) => f`(${e} - ${n})`
|
|
2997
|
+
});
|
|
2998
|
+
function Dn(t, e) {
|
|
2999
|
+
if (typeof t == "number" && typeof e == "number") return t * e;
|
|
3000
|
+
if (typeof t == "number" && (w(e) || L(e))) return M.mulSxV[e.kind](t, e);
|
|
3001
|
+
if ((w(t) || L(t)) && typeof e == "number") return M.mulSxV[t.kind](e, t);
|
|
3002
|
+
if (w(t) && w(e)) return M.mulVxV[t.kind](t, e);
|
|
3003
|
+
if (Ae(t) && L(e)) return M.mulVxM[e.kind](t, e);
|
|
3004
|
+
if (L(t) && Ae(e)) return M.mulMxV[t.kind](t, e);
|
|
3005
|
+
if (L(t) && L(e)) return M.mulVxV[t.kind](t, e);
|
|
3006
|
+
throw new Error("Mul called with invalid arguments.");
|
|
3007
|
+
}
|
|
3008
|
+
const Gc = U({
|
|
3009
|
+
name: "mul",
|
|
3010
|
+
signature: $s,
|
|
3011
|
+
normalImpl: Dn,
|
|
3012
|
+
codegenImpl: (t, [e, n]) => f`(${e} * ${n})`
|
|
3013
|
+
});
|
|
3014
|
+
function Ss(t, e) {
|
|
3015
|
+
if (typeof t == "number" && typeof e == "number") return t / e;
|
|
3016
|
+
if (typeof t == "number" && w(e)) {
|
|
3017
|
+
const n = Xt[e.kind];
|
|
3018
|
+
return M.div[e.kind](n(t), e);
|
|
3019
|
+
}
|
|
3020
|
+
if (w(t) && typeof e == "number") {
|
|
3021
|
+
const n = Xt[t.kind];
|
|
3022
|
+
return M.div[t.kind](t, n(e));
|
|
3023
|
+
}
|
|
3024
|
+
if (w(t) && w(e)) return M.div[t.kind](t, e);
|
|
3025
|
+
throw new Error("Div called with invalid arguments.");
|
|
3026
|
+
}
|
|
3027
|
+
const Dc = U({
|
|
3028
|
+
name: "div",
|
|
3029
|
+
signature: Wn,
|
|
3030
|
+
normalImpl: Ss,
|
|
3031
|
+
codegenImpl: (t, [e, n]) => f`(${e} / ${n})`,
|
|
3032
|
+
ignoreImplicitCastWarning: !0
|
|
3033
|
+
}), Yc = U({
|
|
3034
|
+
name: "mod",
|
|
3035
|
+
signature: Wn,
|
|
3036
|
+
normalImpl: ((t, e) => {
|
|
3037
|
+
if (typeof t == "number" && typeof e == "number") return t % e;
|
|
3038
|
+
if (typeof t == "number" && w(e)) {
|
|
3039
|
+
const n = Xt[e.kind];
|
|
3040
|
+
return M.mod[e.kind](n(t), e);
|
|
3041
|
+
}
|
|
3042
|
+
if (w(t) && typeof e == "number") {
|
|
3043
|
+
const n = Xt[t.kind];
|
|
3044
|
+
return M.mod[t.kind](t, n(e));
|
|
3045
|
+
}
|
|
3046
|
+
if (w(t) && w(e)) return M.mod[t.kind](t, e);
|
|
3047
|
+
throw new Error("Mod called with invalid arguments, expected types: number or vector.");
|
|
3048
|
+
}),
|
|
3049
|
+
codegenImpl: (t, [e, n]) => f`(${e} % ${n})`
|
|
3050
|
+
});
|
|
3051
|
+
function ks(t) {
|
|
3052
|
+
return typeof t == "number" ? -t : M.neg[t.kind](t);
|
|
3053
|
+
}
|
|
3054
|
+
const qc = U({
|
|
3055
|
+
name: "neg",
|
|
3056
|
+
signature: (t) => ({
|
|
3057
|
+
argTypes: [t],
|
|
3058
|
+
returnType: t
|
|
3059
|
+
}),
|
|
3060
|
+
normalImpl: ks,
|
|
3061
|
+
codegenImpl: (t, [e]) => f`-(${e})`
|
|
3062
|
+
});
|
|
3063
|
+
var Vs = /* @__PURE__ */ ((t) => (t.TOP_LEFT = "TOP_LEFT", t.TOP = "TOP", t.TOP_RIGHT = "TOP_RIGHT", t.LEFT = "LEFT", t.SELF = "SELF", t.RIGHT = "RIGHT", t.BOTTOM_LEFT = "BOTTOM_LEFT", t.BOTTOM = "BOTTOM", t.BOTTOM_RIGHT = "BOTTOM_RIGHT", t))(Vs || {}), Os = /* @__PURE__ */ ((t) => (t.TOP = "TOP", t.LEFT = "LEFT", t.SELF = "SELF", t.RIGHT = "RIGHT", t.BOTTOM = "BOTTOM", t))(Os || {});
|
|
3064
|
+
const Hc = {
|
|
3065
|
+
TOP_LEFT: { x: -1, y: -1 },
|
|
3066
|
+
TOP: { x: 0, y: -1 },
|
|
3067
|
+
TOP_RIGHT: { x: 1, y: -1 },
|
|
3068
|
+
LEFT: { x: -1, y: 0 },
|
|
3069
|
+
SELF: { x: 0, y: 0 },
|
|
3070
|
+
RIGHT: { x: 1, y: 0 },
|
|
3071
|
+
BOTTOM_LEFT: { x: -1, y: 1 },
|
|
3072
|
+
BOTTOM: { x: 0, y: 1 },
|
|
3073
|
+
BOTTOM_RIGHT: { x: 1, y: 1 }
|
|
3074
|
+
};
|
|
3075
|
+
var Ns = /* @__PURE__ */ ((t) => (t[t.ELEMENT_ID = 0] = "ELEMENT_ID", t[t.POINT = 1] = "POINT", t))(Ns || {}), Ps = /* @__PURE__ */ ((t) => (t[t.NOOP = 0] = "NOOP", t[t.COUNT_ELEMENT = 1] = "COUNT_ELEMENT", t[t.COUNT_POINT = 2] = "COUNT_POINT", t[t.COUNT_KIND = 3] = "COUNT_KIND", t[t.IS_ELEMENT = 4] = "IS_ELEMENT", t[t.IS_POINT = 5] = "IS_POINT", t[t.IS_KIND = 6] = "IS_KIND", t[t.CHANCE = 7] = "CHANCE", t))(Ps || {}), Cs = /* @__PURE__ */ ((t) => (t[t.ALL = 0] = "ALL", t[t.ANY = 1] = "ANY", t[t.ONE = 2] = "ONE", t[t.NONE = 3] = "NONE", t))(Cs || {});
|
|
3076
|
+
const Kc = {
|
|
3077
|
+
all: 0,
|
|
3078
|
+
any: 1,
|
|
3079
|
+
one: 2,
|
|
3080
|
+
none: 3
|
|
3081
|
+
/* NONE */
|
|
3082
|
+
}, Zc = (globalThis.__TYPEGPU_AUTONAME__ ?? ((t) => t))(ke({
|
|
3083
|
+
color: z,
|
|
3084
|
+
ruleStart: z,
|
|
3085
|
+
ruleEnd: z
|
|
3086
|
+
}), "GpuElement"), Xc = (globalThis.__TYPEGPU_AUTONAME__ ?? ((t) => t))(ke({
|
|
3087
|
+
toType: z,
|
|
3088
|
+
toId: z,
|
|
3089
|
+
toNeighbor: Ut,
|
|
3090
|
+
accept: z,
|
|
3091
|
+
conditionsStart: z,
|
|
3092
|
+
conditionsEnd: z
|
|
3093
|
+
}), "GpuRule"), Jc = (globalThis.__TYPEGPU_AUTONAME__ ?? ((t) => t))(ke({
|
|
3094
|
+
opcode: z,
|
|
3095
|
+
checkId: z,
|
|
3096
|
+
countOrWithId: z,
|
|
3097
|
+
checkPointOrComparePoint: Ut,
|
|
3098
|
+
withPoint: Ut,
|
|
3099
|
+
chance: T
|
|
3100
|
+
}), "GpuCondition"), As = [8, 8], Qc = As[0];
|
|
3101
|
+
export {
|
|
3102
|
+
i as $,
|
|
3103
|
+
Cs as A,
|
|
3104
|
+
Ws as B,
|
|
3105
|
+
Os as C,
|
|
3106
|
+
Rs as D,
|
|
3107
|
+
Xs as E,
|
|
3108
|
+
Js as F,
|
|
3109
|
+
Zc as G,
|
|
3110
|
+
Zs as H,
|
|
3111
|
+
Pr as I,
|
|
3112
|
+
cr as J,
|
|
3113
|
+
or as K,
|
|
3114
|
+
Ke as L,
|
|
3115
|
+
Qs as M,
|
|
3116
|
+
St as N,
|
|
3117
|
+
Ps as O,
|
|
3118
|
+
Z as P,
|
|
3119
|
+
Yc as Q,
|
|
3120
|
+
Dc as R,
|
|
3121
|
+
Vs as S,
|
|
3122
|
+
Ns as T,
|
|
3123
|
+
Gc as U,
|
|
3124
|
+
Wc as V,
|
|
3125
|
+
Rc as W,
|
|
3126
|
+
ec as X,
|
|
3127
|
+
qs as Y,
|
|
3128
|
+
tc as Z,
|
|
3129
|
+
Ln as _,
|
|
3130
|
+
Xc as a,
|
|
3131
|
+
G as a$,
|
|
3132
|
+
l as a0,
|
|
3133
|
+
it as a1,
|
|
3134
|
+
nc as a2,
|
|
3135
|
+
f as a3,
|
|
3136
|
+
jr as a4,
|
|
3137
|
+
ct as a5,
|
|
3138
|
+
rc as a6,
|
|
3139
|
+
xr as a7,
|
|
3140
|
+
Ze as a8,
|
|
3141
|
+
at as a9,
|
|
3142
|
+
Lc as aA,
|
|
3143
|
+
_ as aB,
|
|
3144
|
+
Gt as aC,
|
|
3145
|
+
Wt as aD,
|
|
3146
|
+
ar as aE,
|
|
3147
|
+
Ds as aF,
|
|
3148
|
+
Bs as aG,
|
|
3149
|
+
fe as aH,
|
|
3150
|
+
Ne as aI,
|
|
3151
|
+
Fs as aJ,
|
|
3152
|
+
an as aK,
|
|
3153
|
+
De as aL,
|
|
3154
|
+
Hn as aM,
|
|
3155
|
+
Jt as aN,
|
|
3156
|
+
vc as aO,
|
|
3157
|
+
Kn as aP,
|
|
3158
|
+
He as aQ,
|
|
3159
|
+
yc as aR,
|
|
3160
|
+
_r as aS,
|
|
3161
|
+
U as aT,
|
|
3162
|
+
M as aU,
|
|
3163
|
+
gr as aV,
|
|
3164
|
+
je as aW,
|
|
3165
|
+
se as aX,
|
|
3166
|
+
Hs as aY,
|
|
3167
|
+
Uc as aZ,
|
|
3168
|
+
Sr as a_,
|
|
3169
|
+
Vr as aa,
|
|
3170
|
+
C as ab,
|
|
3171
|
+
Un as ac,
|
|
3172
|
+
Pn as ad,
|
|
3173
|
+
kn as ae,
|
|
3174
|
+
Cn as af,
|
|
3175
|
+
Vn as ag,
|
|
3176
|
+
En as ah,
|
|
3177
|
+
J as ai,
|
|
3178
|
+
Kt as aj,
|
|
3179
|
+
ns as ak,
|
|
3180
|
+
Jr as al,
|
|
3181
|
+
ut as am,
|
|
3182
|
+
yt as an,
|
|
3183
|
+
A as ao,
|
|
3184
|
+
qn as ap,
|
|
3185
|
+
Gs as aq,
|
|
3186
|
+
Cc as ar,
|
|
3187
|
+
ke as as,
|
|
3188
|
+
Nc as at,
|
|
3189
|
+
Ec as au,
|
|
3190
|
+
kc as av,
|
|
3191
|
+
Sc as aw,
|
|
3192
|
+
$c as ax,
|
|
3193
|
+
Vc as ay,
|
|
3194
|
+
Ic as az,
|
|
3195
|
+
Jc as b,
|
|
3196
|
+
rr as b$,
|
|
3197
|
+
D as b0,
|
|
3198
|
+
cc as b1,
|
|
3199
|
+
w as b2,
|
|
3200
|
+
ms as b3,
|
|
3201
|
+
hs as b4,
|
|
3202
|
+
ps as b5,
|
|
3203
|
+
xs as b6,
|
|
3204
|
+
ds as b7,
|
|
3205
|
+
Be as b8,
|
|
3206
|
+
lt as b9,
|
|
3207
|
+
ts as bA,
|
|
3208
|
+
Qt as bB,
|
|
3209
|
+
Ir as bC,
|
|
3210
|
+
ue as bD,
|
|
3211
|
+
fn as bE,
|
|
3212
|
+
yn as bF,
|
|
3213
|
+
sc as bG,
|
|
3214
|
+
Bc as bH,
|
|
3215
|
+
Mr as bI,
|
|
3216
|
+
Pc as bJ,
|
|
3217
|
+
Ks as bK,
|
|
3218
|
+
$r as bL,
|
|
3219
|
+
Oc as bM,
|
|
3220
|
+
_c as bN,
|
|
3221
|
+
Xn as bO,
|
|
3222
|
+
js as bP,
|
|
3223
|
+
oe as bQ,
|
|
3224
|
+
fc as bR,
|
|
3225
|
+
lc as bS,
|
|
3226
|
+
uc as bT,
|
|
3227
|
+
ac as bU,
|
|
3228
|
+
jc as bV,
|
|
3229
|
+
pr as bW,
|
|
3230
|
+
bc as bX,
|
|
3231
|
+
Us as bY,
|
|
3232
|
+
Ls as bZ,
|
|
3233
|
+
nr as b_,
|
|
3234
|
+
qc as ba,
|
|
3235
|
+
fs as bb,
|
|
3236
|
+
ys as bc,
|
|
3237
|
+
us as bd,
|
|
3238
|
+
mc as be,
|
|
3239
|
+
Cr as bf,
|
|
3240
|
+
Yn as bg,
|
|
3241
|
+
gc as bh,
|
|
3242
|
+
Mc as bi,
|
|
3243
|
+
Fc as bj,
|
|
3244
|
+
Ac as bk,
|
|
3245
|
+
pc as bl,
|
|
3246
|
+
xc as bm,
|
|
3247
|
+
Tc as bn,
|
|
3248
|
+
zc as bo,
|
|
3249
|
+
ae as bp,
|
|
3250
|
+
un as bq,
|
|
3251
|
+
Ve as br,
|
|
3252
|
+
ic as bs,
|
|
3253
|
+
zr as bt,
|
|
3254
|
+
vr as bu,
|
|
3255
|
+
br as bv,
|
|
3256
|
+
ie as bw,
|
|
3257
|
+
oc as bx,
|
|
3258
|
+
wr as by,
|
|
3259
|
+
dc as bz,
|
|
3260
|
+
Kc as c,
|
|
3261
|
+
hc as c0,
|
|
3262
|
+
Fe as c1,
|
|
3263
|
+
wc as c2,
|
|
3264
|
+
As as c3,
|
|
3265
|
+
Qc as c4,
|
|
3266
|
+
Ee as d,
|
|
3267
|
+
An as e,
|
|
3268
|
+
On as f,
|
|
3269
|
+
Sn as g,
|
|
3270
|
+
Fn as h,
|
|
3271
|
+
X as i,
|
|
3272
|
+
Nn as j,
|
|
3273
|
+
Rt as k,
|
|
3274
|
+
$e as l,
|
|
3275
|
+
T as m,
|
|
3276
|
+
Hc as n,
|
|
3277
|
+
Oe as o,
|
|
3278
|
+
ot as p,
|
|
3279
|
+
Ye as q,
|
|
3280
|
+
Or as r,
|
|
3281
|
+
Nr as s,
|
|
3282
|
+
ir as t,
|
|
3283
|
+
z as u,
|
|
3284
|
+
Ut as v,
|
|
3285
|
+
hr as w,
|
|
3286
|
+
Ys as x,
|
|
3287
|
+
m as y,
|
|
3288
|
+
mr as z
|
|
3289
|
+
};
|