typegpu 0.5.7 → 0.5.9

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/std/index.d.cts CHANGED
@@ -1,19 +1,50 @@
1
- import { cS as TgpuDualFn, cT as AnyNumericVecInstance, cU as AnyMatInstance, cV as vBaseForMat, cW as AnyFloatVecInstance, bx as v3f, cX as v3h, bt as v2f, cY as v2h, bu as v2i, by as v3i, bB as v4f, cZ as v4h, bC as v4i, bl as AnyVecInstance, c_ as AnyVec2Instance, bs as v2b, c$ as AnyVec3Instance, bw as v3b, bA as v4b, d0 as AnyBooleanVecInstance, d1 as atomicI32, d2 as atomicU32, ac as TgpuSampledTexture, d3 as TgpuStorageTexture, bv as v2u, bz as v3u, d4 as TexelData, bD as v4u, d5 as ChannelData, al as TgpuSampler } from '../tgpuComputeFn-DH8_PcIR.cjs';
1
+ import { cT as TgpuDualFn, cU as AnyNumericVecInstance, cV as AnyMatInstance, cW as vBaseForMat, cX as mBaseForVec, cY as AnyFloatVecInstance, by as v3f, cZ as v3h, bu as v2f, c_ as v2h, bv as v2i, bz as v3i, bC as v4f, c$ as v4h, bD as v4i, bo as m4x4f, bg as AnyVecInstance, d0 as AnyVec2Instance, bt as v2b, d1 as AnyVec3Instance, bx as v3b, bB as v4b, d2 as AnyBooleanVecInstance, d3 as atomicI32, d4 as atomicU32, ac as TgpuSampledTexture, d5 as TgpuStorageTexture, bw as v2u, bA as v3u, d6 as TexelData, bE as v4u, d7 as ChannelData, al as TgpuSampler } from '../tgpuComputeFn-BxPDI5hQ.cjs';
2
+ export { i as identity2, d as identity3, e as identity4, r as rotationX4, f as rotationY4, g as rotationZ4, s as scaling4, t as translation4 } from '../matrix-BnXitNJ7.cjs';
2
3
  import 'tinyest';
3
4
 
4
5
  declare const discard: TgpuDualFn<() => never>;
5
6
 
6
- declare const add: TgpuDualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => T)>;
7
- declare const sub: TgpuDualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => T)>;
8
- type MulOverload = {
9
- <T extends AnyMatInstance, TVec extends vBaseForMat<T>>(s: T, v: TVec): TVec;
10
- <T extends AnyMatInstance, TVec extends vBaseForMat<T>>(s: TVec, v: T): TVec;
11
- <T extends AnyNumericVecInstance | AnyMatInstance>(s: number | T, v: T): T;
12
- };
13
- declare const mul: MulOverload;
14
- declare const abs: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(value: T) => T)>;
7
+ type NumVec = AnyNumericVecInstance;
8
+ type Mat = AnyMatInstance;
9
+ declare function cpuAdd(lhs: number, rhs: number): number;
10
+ declare function cpuAdd<T extends NumVec>(lhs: number, rhs: T): T;
11
+ declare function cpuAdd<T extends NumVec>(lhs: T, rhs: number): T;
12
+ declare function cpuAdd<T extends NumVec | Mat>(lhs: T, rhs: T): T;
13
+ declare function cpuAdd<Lhs extends number | NumVec | Mat, Rhs extends (Lhs extends number ? number | NumVec : Lhs extends NumVec ? number | Lhs : Lhs extends Mat ? Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
14
+ declare const add: TgpuDualFn<typeof cpuAdd>;
15
+ declare function cpuSub(lhs: number, rhs: number): number;
16
+ declare function cpuSub<T extends NumVec>(lhs: number, rhs: T): T;
17
+ declare function cpuSub<T extends NumVec>(lhs: T, rhs: number): T;
18
+ declare function cpuSub<T extends NumVec | Mat>(lhs: T, rhs: T): T;
19
+ declare function cpuSub<Lhs extends number | NumVec | Mat, Rhs extends (Lhs extends number ? number | NumVec : Lhs extends NumVec ? number | Lhs : Lhs extends Mat ? Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
20
+ declare const sub: TgpuDualFn<typeof cpuSub>;
21
+ declare function cpuMul(lhs: number, rhs: number): number;
22
+ declare function cpuMul<MV extends NumVec | Mat>(lhs: number, rhs: MV): MV;
23
+ declare function cpuMul<MV extends NumVec | Mat>(lhs: MV, rhs: number): MV;
24
+ declare function cpuMul<V extends NumVec>(lhs: V, rhs: V): V;
25
+ declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: V, rhs: M): V;
26
+ declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: M, rhs: V): V;
27
+ declare function cpuMul<M extends Mat>(lhs: M, rhs: M): M;
28
+ declare function cpuMul<Lhs extends number | NumVec | Mat, Rhs extends (Lhs extends number ? number | NumVec | Mat : Lhs extends NumVec ? number | Lhs | mBaseForVec<Lhs> : Lhs extends Mat ? number | vBaseForMat<Lhs> | Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
29
+ declare const mul: TgpuDualFn<typeof cpuMul>;
30
+ declare function cpuDiv(lhs: number, rhs: number): number;
31
+ declare function cpuDiv<MV extends NumVec>(lhs: number, rhs: MV): MV;
32
+ declare function cpuDiv<MV extends NumVec>(lhs: MV, rhs: number): MV;
33
+ declare function cpuDiv<V extends NumVec>(lhs: V, rhs: V): V;
34
+ declare function cpuDiv<Lhs extends number | NumVec, Rhs extends (Lhs extends number ? number | NumVec : Lhs extends NumVec ? number | Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
35
+ declare const div: TgpuDualFn<typeof cpuDiv>;
36
+ declare const abs: TgpuDualFn<(<T extends NumVec | number>(value: T) => T)>;
15
37
  declare const atan2: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(y: T, x: T) => T)>;
16
38
  declare const acos: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
39
+ /**
40
+ * @privateRemarks
41
+ * https://www.w3.org/TR/WGSL/#acosh-builtin
42
+ */
43
+ declare const acosh: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
44
+ /**
45
+ * @privateRemarks
46
+ * https://www.w3.org/TR/WGSL/#asin-builtin
47
+ */
17
48
  declare const asin: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
18
49
  /**
19
50
  * @privateRemarks
@@ -24,12 +55,17 @@ declare const ceil: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value:
24
55
  * @privateRemarks
25
56
  * https://www.w3.org/TR/WGSL/#clamp
26
57
  */
27
- declare const clamp: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(value: T, low: T, high: T) => T)>;
58
+ declare const clamp: TgpuDualFn<(<T extends NumVec | number>(value: T, low: T, high: T) => T)>;
28
59
  /**
29
60
  * @privateRemarks
30
61
  * https://www.w3.org/TR/WGSL/#cos-builtin
31
62
  */
32
63
  declare const cos: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
64
+ /**
65
+ * @privateRemarks
66
+ * https://www.w3.org/TR/WGSL/#cosh-builtin
67
+ */
68
+ declare const cosh: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
33
69
  /**
34
70
  * @privateRemarks
35
71
  * https://www.w3.org/TR/WGSL/#cross-builtin
@@ -39,7 +75,7 @@ declare const cross: TgpuDualFn<(<T extends v3f | v3h>(a: T, b: T) => T)>;
39
75
  * @privateRemarks
40
76
  * https://www.w3.org/TR/WGSL/#dot-builtin
41
77
  */
42
- declare const dot: TgpuDualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => number)>;
78
+ declare const dot: TgpuDualFn<(<T extends NumVec>(lhs: T, rhs: T) => number)>;
43
79
  declare const normalize: TgpuDualFn<(<T extends AnyFloatVecInstance>(v: T) => T)>;
44
80
  /**
45
81
  * @privateRemarks
@@ -52,16 +88,26 @@ declare const fract: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(a: T)
52
88
  * https://www.w3.org/TR/WGSL/#length-builtin
53
89
  */
54
90
  declare const length: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => number)>;
91
+ /**
92
+ * @privateRemarks
93
+ * https://www.w3.org/TR/WGSL/#log-builtin
94
+ */
95
+ declare const log: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
96
+ /**
97
+ * @privateRemarks
98
+ * https://www.w3.org/TR/WGSL/#log2-builtin
99
+ */
100
+ declare const log2: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
55
101
  /**
56
102
  * @privateRemarks
57
103
  * https://www.w3.org/TR/WGSL/#max-float-builtin
58
104
  */
59
- declare const max: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(a: T, b: T) => T)>;
105
+ declare const max: TgpuDualFn<(<T extends NumVec | number>(a: T, b: T) => T)>;
60
106
  /**
61
107
  * @privateRemarks
62
108
  * https://www.w3.org/TR/WGSL/#min-float-builtin
63
109
  */
64
- declare const min: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(a: T, b: T) => T)>;
110
+ declare const min: TgpuDualFn<(<T extends NumVec | number>(a: T, b: T) => T)>;
65
111
  declare const sign: TgpuDualFn<(<T extends v2f | v2h | v2i | v3f | v3h | v3i | v4f | v4h | v4i | number>(e: T) => T)>;
66
112
  /**
67
113
  * @privateRemarks
@@ -73,6 +119,11 @@ declare const sin: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T
73
119
  * https://www.w3.org/TR/WGSL/#exp-builtin
74
120
  */
75
121
  declare const exp: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
122
+ /**
123
+ * @privateRemarks
124
+ * https://www.w3.org/TR/WGSL/#exp2-builtin
125
+ */
126
+ declare const exp2: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
76
127
  type PowOverload = {
77
128
  (base: number, exponent: number): number;
78
129
  <T extends AnyFloatVecInstance>(base: T, exponent: T): T;
@@ -86,9 +137,45 @@ type MixOverload = {
86
137
  declare const mix: MixOverload;
87
138
  declare const reflect: TgpuDualFn<(<T extends AnyFloatVecInstance>(e1: T, e2: T) => T)>;
88
139
  declare const distance: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(a: T, b: T) => number)>;
89
- declare const neg: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(value: T) => T)>;
140
+ declare const neg: TgpuDualFn<(<T extends NumVec | number>(value: T) => T)>;
90
141
  declare const sqrt: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
91
- declare const div: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(lhs: T, rhs: T | number) => T)>;
142
+ declare const tanh: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
143
+
144
+ /**
145
+ * Translates the given 4-by-4 matrix by the given vector.
146
+ * @param {m4x4f} matrix - The matrix to be modified.
147
+ * @param {v3f} vector - The vector by which to translate the matrix.
148
+ * @returns {m4x4f} The translated matrix.
149
+ */
150
+ declare const translate4: TgpuDualFn<(matrix: m4x4f, vector: v3f) => m4x4f>;
151
+ /**
152
+ * Scales the given 4-by-4 matrix in each dimension by an amount given by the corresponding entry in the given vector.
153
+ * @param {m4x4f} matrix - The matrix to be modified.
154
+ * @param {v3f} vector - A vector of three entries specifying the factor by which to scale in each dimension.
155
+ * @returns {m4x4f} The scaled matrix.
156
+ */
157
+ declare const scale4: TgpuDualFn<(matrix: m4x4f, vector: v3f) => m4x4f>;
158
+ /**
159
+ * Rotates the given 4-by-4 matrix around the x-axis by the given angle.
160
+ * @param {m4x4f} matrix - The matrix to be modified.
161
+ * @param {number} angle - The angle by which to rotate (in radians).
162
+ * @returns {m4x4f} The rotated matrix.
163
+ */
164
+ declare const rotateX4: TgpuDualFn<(matrix: m4x4f, angle: number) => m4x4f>;
165
+ /**
166
+ * Rotates the given 4-by-4 matrix around the y-axis by the given angle.
167
+ * @param {m4x4f} matrix - The matrix to be modified.
168
+ * @param {number} angle - The angle by which to rotate (in radians).
169
+ * @returns {m4x4f} The rotated matrix.
170
+ */
171
+ declare const rotateY4: TgpuDualFn<(matrix: m4x4f, angle: number) => m4x4f>;
172
+ /**
173
+ * Rotates the given 4-by-4 matrix around the z-axis by the given angle.
174
+ * @param {m4x4f} matrix - The matrix to be modified.
175
+ * @param {number} angle - The angle by which to rotate (in radians).
176
+ * @returns {m4x4f} The rotated matrix.
177
+ */
178
+ declare const rotateZ4: TgpuDualFn<(matrix: m4x4f, angle: number) => m4x4f>;
92
179
 
93
180
  /**
94
181
  * Checks whether `lhs == rhs` on all components.
@@ -306,4 +393,4 @@ type TextureDimensionsOverload = {
306
393
  };
307
394
  declare const textureDimensions: TextureDimensionsOverload;
308
395
 
309
- export { abs, acos, add, all, allEq, and, any, arrayLength, asin, atan2, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, ceil, clamp, cos, cross, discard, distance, div, dot, eq, exp, floor, fract, ge, gt, isCloseTo, le, length, lt, max, min, mix, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, reflect, select, sign, sin, sqrt, storageBarrier, sub, textureBarrier, textureDimensions, textureLoad, textureSample, textureSampleLevel, textureStore, unpack2x16float, unpack4x8unorm, workgroupBarrier };
396
+ export { abs, acos, acosh, add, all, allEq, and, any, arrayLength, asin, atan2, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, ceil, clamp, cos, cosh, cross, discard, distance, div, dot, eq, exp, exp2, floor, fract, ge, gt, isCloseTo, le, length, log, log2, lt, max, min, mix, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, reflect, rotateX4, rotateY4, rotateZ4, scale4, select, sign, sin, sqrt, storageBarrier, sub, tanh, textureBarrier, textureDimensions, textureLoad, textureSample, textureSampleLevel, textureStore, translate4, unpack2x16float, unpack4x8unorm, workgroupBarrier };
package/std/index.d.ts CHANGED
@@ -1,19 +1,50 @@
1
- import { cS as TgpuDualFn, cT as AnyNumericVecInstance, cU as AnyMatInstance, cV as vBaseForMat, cW as AnyFloatVecInstance, bx as v3f, cX as v3h, bt as v2f, cY as v2h, bu as v2i, by as v3i, bB as v4f, cZ as v4h, bC as v4i, bl as AnyVecInstance, c_ as AnyVec2Instance, bs as v2b, c$ as AnyVec3Instance, bw as v3b, bA as v4b, d0 as AnyBooleanVecInstance, d1 as atomicI32, d2 as atomicU32, ac as TgpuSampledTexture, d3 as TgpuStorageTexture, bv as v2u, bz as v3u, d4 as TexelData, bD as v4u, d5 as ChannelData, al as TgpuSampler } from '../tgpuComputeFn-DH8_PcIR.js';
1
+ import { cT as TgpuDualFn, cU as AnyNumericVecInstance, cV as AnyMatInstance, cW as vBaseForMat, cX as mBaseForVec, cY as AnyFloatVecInstance, by as v3f, cZ as v3h, bu as v2f, c_ as v2h, bv as v2i, bz as v3i, bC as v4f, c$ as v4h, bD as v4i, bo as m4x4f, bg as AnyVecInstance, d0 as AnyVec2Instance, bt as v2b, d1 as AnyVec3Instance, bx as v3b, bB as v4b, d2 as AnyBooleanVecInstance, d3 as atomicI32, d4 as atomicU32, ac as TgpuSampledTexture, d5 as TgpuStorageTexture, bw as v2u, bA as v3u, d6 as TexelData, bE as v4u, d7 as ChannelData, al as TgpuSampler } from '../tgpuComputeFn-BxPDI5hQ.js';
2
+ export { i as identity2, d as identity3, e as identity4, r as rotationX4, f as rotationY4, g as rotationZ4, s as scaling4, t as translation4 } from '../matrix-BULDDGYa.js';
2
3
  import 'tinyest';
3
4
 
4
5
  declare const discard: TgpuDualFn<() => never>;
5
6
 
6
- declare const add: TgpuDualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => T)>;
7
- declare const sub: TgpuDualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => T)>;
8
- type MulOverload = {
9
- <T extends AnyMatInstance, TVec extends vBaseForMat<T>>(s: T, v: TVec): TVec;
10
- <T extends AnyMatInstance, TVec extends vBaseForMat<T>>(s: TVec, v: T): TVec;
11
- <T extends AnyNumericVecInstance | AnyMatInstance>(s: number | T, v: T): T;
12
- };
13
- declare const mul: MulOverload;
14
- declare const abs: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(value: T) => T)>;
7
+ type NumVec = AnyNumericVecInstance;
8
+ type Mat = AnyMatInstance;
9
+ declare function cpuAdd(lhs: number, rhs: number): number;
10
+ declare function cpuAdd<T extends NumVec>(lhs: number, rhs: T): T;
11
+ declare function cpuAdd<T extends NumVec>(lhs: T, rhs: number): T;
12
+ declare function cpuAdd<T extends NumVec | Mat>(lhs: T, rhs: T): T;
13
+ declare function cpuAdd<Lhs extends number | NumVec | Mat, Rhs extends (Lhs extends number ? number | NumVec : Lhs extends NumVec ? number | Lhs : Lhs extends Mat ? Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
14
+ declare const add: TgpuDualFn<typeof cpuAdd>;
15
+ declare function cpuSub(lhs: number, rhs: number): number;
16
+ declare function cpuSub<T extends NumVec>(lhs: number, rhs: T): T;
17
+ declare function cpuSub<T extends NumVec>(lhs: T, rhs: number): T;
18
+ declare function cpuSub<T extends NumVec | Mat>(lhs: T, rhs: T): T;
19
+ declare function cpuSub<Lhs extends number | NumVec | Mat, Rhs extends (Lhs extends number ? number | NumVec : Lhs extends NumVec ? number | Lhs : Lhs extends Mat ? Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
20
+ declare const sub: TgpuDualFn<typeof cpuSub>;
21
+ declare function cpuMul(lhs: number, rhs: number): number;
22
+ declare function cpuMul<MV extends NumVec | Mat>(lhs: number, rhs: MV): MV;
23
+ declare function cpuMul<MV extends NumVec | Mat>(lhs: MV, rhs: number): MV;
24
+ declare function cpuMul<V extends NumVec>(lhs: V, rhs: V): V;
25
+ declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: V, rhs: M): V;
26
+ declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: M, rhs: V): V;
27
+ declare function cpuMul<M extends Mat>(lhs: M, rhs: M): M;
28
+ declare function cpuMul<Lhs extends number | NumVec | Mat, Rhs extends (Lhs extends number ? number | NumVec | Mat : Lhs extends NumVec ? number | Lhs | mBaseForVec<Lhs> : Lhs extends Mat ? number | vBaseForMat<Lhs> | Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
29
+ declare const mul: TgpuDualFn<typeof cpuMul>;
30
+ declare function cpuDiv(lhs: number, rhs: number): number;
31
+ declare function cpuDiv<MV extends NumVec>(lhs: number, rhs: MV): MV;
32
+ declare function cpuDiv<MV extends NumVec>(lhs: MV, rhs: number): MV;
33
+ declare function cpuDiv<V extends NumVec>(lhs: V, rhs: V): V;
34
+ declare function cpuDiv<Lhs extends number | NumVec, Rhs extends (Lhs extends number ? number | NumVec : Lhs extends NumVec ? number | Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
35
+ declare const div: TgpuDualFn<typeof cpuDiv>;
36
+ declare const abs: TgpuDualFn<(<T extends NumVec | number>(value: T) => T)>;
15
37
  declare const atan2: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(y: T, x: T) => T)>;
16
38
  declare const acos: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
39
+ /**
40
+ * @privateRemarks
41
+ * https://www.w3.org/TR/WGSL/#acosh-builtin
42
+ */
43
+ declare const acosh: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
44
+ /**
45
+ * @privateRemarks
46
+ * https://www.w3.org/TR/WGSL/#asin-builtin
47
+ */
17
48
  declare const asin: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
18
49
  /**
19
50
  * @privateRemarks
@@ -24,12 +55,17 @@ declare const ceil: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value:
24
55
  * @privateRemarks
25
56
  * https://www.w3.org/TR/WGSL/#clamp
26
57
  */
27
- declare const clamp: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(value: T, low: T, high: T) => T)>;
58
+ declare const clamp: TgpuDualFn<(<T extends NumVec | number>(value: T, low: T, high: T) => T)>;
28
59
  /**
29
60
  * @privateRemarks
30
61
  * https://www.w3.org/TR/WGSL/#cos-builtin
31
62
  */
32
63
  declare const cos: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
64
+ /**
65
+ * @privateRemarks
66
+ * https://www.w3.org/TR/WGSL/#cosh-builtin
67
+ */
68
+ declare const cosh: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
33
69
  /**
34
70
  * @privateRemarks
35
71
  * https://www.w3.org/TR/WGSL/#cross-builtin
@@ -39,7 +75,7 @@ declare const cross: TgpuDualFn<(<T extends v3f | v3h>(a: T, b: T) => T)>;
39
75
  * @privateRemarks
40
76
  * https://www.w3.org/TR/WGSL/#dot-builtin
41
77
  */
42
- declare const dot: TgpuDualFn<(<T extends AnyNumericVecInstance>(lhs: T, rhs: T) => number)>;
78
+ declare const dot: TgpuDualFn<(<T extends NumVec>(lhs: T, rhs: T) => number)>;
43
79
  declare const normalize: TgpuDualFn<(<T extends AnyFloatVecInstance>(v: T) => T)>;
44
80
  /**
45
81
  * @privateRemarks
@@ -52,16 +88,26 @@ declare const fract: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(a: T)
52
88
  * https://www.w3.org/TR/WGSL/#length-builtin
53
89
  */
54
90
  declare const length: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => number)>;
91
+ /**
92
+ * @privateRemarks
93
+ * https://www.w3.org/TR/WGSL/#log-builtin
94
+ */
95
+ declare const log: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
96
+ /**
97
+ * @privateRemarks
98
+ * https://www.w3.org/TR/WGSL/#log2-builtin
99
+ */
100
+ declare const log2: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
55
101
  /**
56
102
  * @privateRemarks
57
103
  * https://www.w3.org/TR/WGSL/#max-float-builtin
58
104
  */
59
- declare const max: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(a: T, b: T) => T)>;
105
+ declare const max: TgpuDualFn<(<T extends NumVec | number>(a: T, b: T) => T)>;
60
106
  /**
61
107
  * @privateRemarks
62
108
  * https://www.w3.org/TR/WGSL/#min-float-builtin
63
109
  */
64
- declare const min: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(a: T, b: T) => T)>;
110
+ declare const min: TgpuDualFn<(<T extends NumVec | number>(a: T, b: T) => T)>;
65
111
  declare const sign: TgpuDualFn<(<T extends v2f | v2h | v2i | v3f | v3h | v3i | v4f | v4h | v4i | number>(e: T) => T)>;
66
112
  /**
67
113
  * @privateRemarks
@@ -73,6 +119,11 @@ declare const sin: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T
73
119
  * https://www.w3.org/TR/WGSL/#exp-builtin
74
120
  */
75
121
  declare const exp: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
122
+ /**
123
+ * @privateRemarks
124
+ * https://www.w3.org/TR/WGSL/#exp2-builtin
125
+ */
126
+ declare const exp2: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
76
127
  type PowOverload = {
77
128
  (base: number, exponent: number): number;
78
129
  <T extends AnyFloatVecInstance>(base: T, exponent: T): T;
@@ -86,9 +137,45 @@ type MixOverload = {
86
137
  declare const mix: MixOverload;
87
138
  declare const reflect: TgpuDualFn<(<T extends AnyFloatVecInstance>(e1: T, e2: T) => T)>;
88
139
  declare const distance: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(a: T, b: T) => number)>;
89
- declare const neg: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(value: T) => T)>;
140
+ declare const neg: TgpuDualFn<(<T extends NumVec | number>(value: T) => T)>;
90
141
  declare const sqrt: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
91
- declare const div: TgpuDualFn<(<T extends AnyNumericVecInstance | number>(lhs: T, rhs: T | number) => T)>;
142
+ declare const tanh: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
143
+
144
+ /**
145
+ * Translates the given 4-by-4 matrix by the given vector.
146
+ * @param {m4x4f} matrix - The matrix to be modified.
147
+ * @param {v3f} vector - The vector by which to translate the matrix.
148
+ * @returns {m4x4f} The translated matrix.
149
+ */
150
+ declare const translate4: TgpuDualFn<(matrix: m4x4f, vector: v3f) => m4x4f>;
151
+ /**
152
+ * Scales the given 4-by-4 matrix in each dimension by an amount given by the corresponding entry in the given vector.
153
+ * @param {m4x4f} matrix - The matrix to be modified.
154
+ * @param {v3f} vector - A vector of three entries specifying the factor by which to scale in each dimension.
155
+ * @returns {m4x4f} The scaled matrix.
156
+ */
157
+ declare const scale4: TgpuDualFn<(matrix: m4x4f, vector: v3f) => m4x4f>;
158
+ /**
159
+ * Rotates the given 4-by-4 matrix around the x-axis by the given angle.
160
+ * @param {m4x4f} matrix - The matrix to be modified.
161
+ * @param {number} angle - The angle by which to rotate (in radians).
162
+ * @returns {m4x4f} The rotated matrix.
163
+ */
164
+ declare const rotateX4: TgpuDualFn<(matrix: m4x4f, angle: number) => m4x4f>;
165
+ /**
166
+ * Rotates the given 4-by-4 matrix around the y-axis by the given angle.
167
+ * @param {m4x4f} matrix - The matrix to be modified.
168
+ * @param {number} angle - The angle by which to rotate (in radians).
169
+ * @returns {m4x4f} The rotated matrix.
170
+ */
171
+ declare const rotateY4: TgpuDualFn<(matrix: m4x4f, angle: number) => m4x4f>;
172
+ /**
173
+ * Rotates the given 4-by-4 matrix around the z-axis by the given angle.
174
+ * @param {m4x4f} matrix - The matrix to be modified.
175
+ * @param {number} angle - The angle by which to rotate (in radians).
176
+ * @returns {m4x4f} The rotated matrix.
177
+ */
178
+ declare const rotateZ4: TgpuDualFn<(matrix: m4x4f, angle: number) => m4x4f>;
92
179
 
93
180
  /**
94
181
  * Checks whether `lhs == rhs` on all components.
@@ -306,4 +393,4 @@ type TextureDimensionsOverload = {
306
393
  };
307
394
  declare const textureDimensions: TextureDimensionsOverload;
308
395
 
309
- export { abs, acos, add, all, allEq, and, any, arrayLength, asin, atan2, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, ceil, clamp, cos, cross, discard, distance, div, dot, eq, exp, floor, fract, ge, gt, isCloseTo, le, length, lt, max, min, mix, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, reflect, select, sign, sin, sqrt, storageBarrier, sub, textureBarrier, textureDimensions, textureLoad, textureSample, textureSampleLevel, textureStore, unpack2x16float, unpack4x8unorm, workgroupBarrier };
396
+ export { abs, acos, acosh, add, all, allEq, and, any, arrayLength, asin, atan2, atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, ceil, clamp, cos, cosh, cross, discard, distance, div, dot, eq, exp, exp2, floor, fract, ge, gt, isCloseTo, le, length, log, log2, lt, max, min, mix, mul, ne, neg, normalize, not, or, pack2x16float, pack4x8unorm, pow, reflect, rotateX4, rotateY4, rotateZ4, scale4, select, sign, sin, sqrt, storageBarrier, sub, tanh, textureBarrier, textureDimensions, textureLoad, textureSample, textureSampleLevel, textureStore, translate4, unpack2x16float, unpack4x8unorm, workgroupBarrier };
package/std/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{$ as i,A as S,N as r,Q as U,R as I,S as ge,T as R,V as u,W as w,X as $,Y as p,Z as l,_ as y,aa as B,ba as m,ca as x,da as o,ea as d,fa as g,ga as f,ha as T,ja as ue,ka as ye,la as ve,na as fe,t as O}from"../chunk-5RYM4COI.js";var Ae=r(()=>{throw new Error("discard() can only be used on the GPU.")},()=>({value:"discard;",dataType:O}));var K=e=>Math.sqrt(e.x**2+e.y**2),_=e=>Math.sqrt(e.x**2+e.y**2+e.z**2),W=e=>Math.sqrt(e.x**2+e.y**2+e.z**2+e.w**2),j=(e,t)=>e.x*t.x+e.y*t.y,X=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z,Z=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,c=(e,t,n)=>Math.min(Math.max(t,e),n),z=e=>t=>u(e(t.x),e(t.y)),h=e=>t=>w(e(t.x),e(t.y)),P=e=>t=>$(e(t.x),e(t.y)),H=e=>t=>p(e(t.x),e(t.y)),b=e=>t=>y(e(t.x),e(t.y),e(t.z)),M=e=>t=>i(e(t.x),e(t.y),e(t.z)),C=e=>t=>B(e(t.x),e(t.y),e(t.z)),Q=e=>t=>m(e(t.x),e(t.y),e(t.z)),A=e=>t=>o(e(t.x),e(t.y),e(t.z),e(t.w)),V=e=>t=>d(e(t.x),e(t.y),e(t.z),e(t.w)),G=e=>t=>g(e(t.x),e(t.y),e(t.z),e(t.w)),Y=e=>t=>f(e(t.x),e(t.y),e(t.z),e(t.w)),ee=e=>(t,n)=>u(e(t.x,n.x),e(t.y,n.y)),te=e=>(t,n)=>w(e(t.x,n.x),e(t.y,n.y)),le=e=>(t,n)=>$(e(t.x,n.x),e(t.y,n.y)),xe=e=>(t,n)=>p(e(t.x,n.x),e(t.y,n.y)),ne=e=>(t,n)=>y(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ae=e=>(t,n)=>i(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),Te=e=>(t,n)=>B(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ie=e=>(t,n)=>m(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),re=e=>(t,n)=>o(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),se=e=>(t,n)=>d(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),we=e=>(t,n)=>g(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),de=e=>(t,n)=>f(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),s={eq:{vec2f:(e,t)=>l(e.x===t.x,e.y===t.y),vec2h:(e,t)=>l(e.x===t.x,e.y===t.y),vec2i:(e,t)=>l(e.x===t.x,e.y===t.y),vec2u:(e,t)=>l(e.x===t.x,e.y===t.y),"vec2<bool>":(e,t)=>l(e.x===t.x,e.y===t.y),vec3f:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3h:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3i:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec3u:(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),"vec3<bool>":(e,t)=>x(e.x===t.x,e.y===t.y,e.z===t.z),vec4f:(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4h:(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4i:(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4u:(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),"vec4<bool>":(e,t)=>T(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w)},lt:{vec2f:(e,t)=>l(e.x<t.x,e.y<t.y),vec2h:(e,t)=>l(e.x<t.x,e.y<t.y),vec2i:(e,t)=>l(e.x<t.x,e.y<t.y),vec2u:(e,t)=>l(e.x<t.x,e.y<t.y),vec3f:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3h:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3i:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec3u:(e,t)=>x(e.x<t.x,e.y<t.y,e.z<t.z),vec4f:(e,t)=>T(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4h:(e,t)=>T(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4i:(e,t)=>T(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4u:(e,t)=>T(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w)},or:{"vec2<bool>":(e,t)=>l(e.x||t.x,e.y||t.y),"vec3<bool>":(e,t)=>x(e.x||t.x,e.y||t.y,e.z||t.z),"vec4<bool>":(e,t)=>T(e.x||t.x,e.y||t.y,e.z||t.z,e.w||t.w)},all:{"vec2<bool>":e=>e.x&&e.y,"vec3<bool>":e=>e.x&&e.y&&e.z,"vec4<bool>":e=>e.x&&e.y&&e.z&&e.w},abs:{vec2f:z(Math.abs),vec2h:h(Math.abs),vec2i:P(Math.abs),vec2u:H(Math.abs),vec3f:b(Math.abs),vec3h:M(Math.abs),vec3i:C(Math.abs),vec3u:Q(Math.abs),vec4f:A(Math.abs),vec4h:V(Math.abs),vec4i:G(Math.abs),vec4u:Y(Math.abs)},atan2:{vec2f:ee(Math.atan2),vec2h:te(Math.atan2),vec3f:ne(Math.atan2),vec3h:ae(Math.atan2),vec4f:re(Math.atan2),vec4h:se(Math.atan2)},acos:{vec2f:z(Math.acos),vec2h:h(Math.acos),vec2i:P(Math.acos),vec2u:H(Math.acos),vec3f:b(Math.acos),vec3h:M(Math.acos),vec3i:C(Math.acos),vec3u:Q(Math.acos),vec4f:A(Math.acos),vec4h:V(Math.acos),vec4i:G(Math.acos),vec4u:Y(Math.acos)},asin:{vec2f:z(Math.asin),vec2h:h(Math.asin),vec2i:P(Math.asin),vec2u:H(Math.asin),vec3f:b(Math.asin),vec3h:M(Math.asin),vec3i:C(Math.asin),vec3u:Q(Math.asin),vec4f:A(Math.asin),vec4h:V(Math.asin),vec4i:G(Math.asin),vec4u:Y(Math.asin)},ceil:{vec2f:z(Math.ceil),vec2h:h(Math.ceil),vec3f:b(Math.ceil),vec3h:M(Math.ceil),vec4f:A(Math.ceil),vec4h:V(Math.ceil)},clamp:{vec2f:(e,t,n)=>u(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec2h:(e,t,n)=>w(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec2i:(e,t,n)=>$(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec2u:(e,t,n)=>p(c(e.x,t.x,n.x),c(e.y,t.y,n.y)),vec3f:(e,t,n)=>y(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec3h:(e,t,n)=>i(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec3i:(e,t,n)=>B(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec3u:(e,t,n)=>m(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z)),vec4f:(e,t,n)=>o(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w)),vec4h:(e,t,n)=>d(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w)),vec4i:(e,t,n)=>g(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w)),vec4u:(e,t,n)=>f(c(e.x,t.x,n.x),c(e.y,t.y,n.y),c(e.z,t.z,n.z),c(e.w,t.w,n.w))},length:{vec2f:K,vec2h:K,vec3f:_,vec3h:_,vec4f:W,vec4h:W},add:{vec2f:(e,t)=>u(e.x+t.x,e.y+t.y),vec2h:(e,t)=>w(e.x+t.x,e.y+t.y),vec2i:(e,t)=>$(e.x+t.x,e.y+t.y),vec2u:(e,t)=>p(e.x+t.x,e.y+t.y),vec3f:(e,t)=>y(e.x+t.x,e.y+t.y,e.z+t.z),vec3h:(e,t)=>i(e.x+t.x,e.y+t.y,e.z+t.z),vec3i:(e,t)=>B(e.x+t.x,e.y+t.y,e.z+t.z),vec3u:(e,t)=>m(e.x+t.x,e.y+t.y,e.z+t.z),vec4f:(e,t)=>o(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4h:(e,t)=>d(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4i:(e,t)=>g(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4u:(e,t)=>f(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w)},sub:{vec2f:(e,t)=>u(e.x-t.x,e.y-t.y),vec2h:(e,t)=>w(e.x-t.x,e.y-t.y),vec2i:(e,t)=>$(e.x-t.x,e.y-t.y),vec2u:(e,t)=>p(e.x-t.x,e.y-t.y),vec3f:(e,t)=>y(e.x-t.x,e.y-t.y,e.z-t.z),vec3h:(e,t)=>i(e.x-t.x,e.y-t.y,e.z-t.z),vec3i:(e,t)=>B(e.x-t.x,e.y-t.y,e.z-t.z),vec3u:(e,t)=>m(e.x-t.x,e.y-t.y,e.z-t.z),vec4f:(e,t)=>o(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4h:(e,t)=>d(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4i:(e,t)=>g(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4u:(e,t)=>f(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w)},mulSxV:{vec2f:(e,t)=>u(e*t.x,e*t.y),vec2h:(e,t)=>w(e*t.x,e*t.y),vec2i:(e,t)=>$(e*t.x,e*t.y),vec2u:(e,t)=>p(e*t.x,e*t.y),vec3f:(e,t)=>y(e*t.x,e*t.y,e*t.z),vec3h:(e,t)=>i(e*t.x,e*t.y,e*t.z),vec3i:(e,t)=>B(e*t.x,e*t.y,e*t.z),vec3u:(e,t)=>m(e*t.x,e*t.y,e*t.z),vec4f:(e,t)=>o(e*t.x,e*t.y,e*t.z,e*t.w),vec4h:(e,t)=>d(e*t.x,e*t.y,e*t.z,e*t.w),vec4i:(e,t)=>g(e*t.x,e*t.y,e*t.z,e*t.w),vec4u:(e,t)=>f(e*t.x,e*t.y,e*t.z,e*t.w),mat2x2f:(e,t)=>{let n=t.columns;return ue(e*n[0].x,e*n[0].y,e*n[1].x,e*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return ye(e*n[0].x,e*n[0].y,e*n[0].z,e*n[1].x,e*n[1].y,e*n[1].z,e*n[2].x,e*n[2].y,e*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return ve(e*n[0].x,e*n[0].y,e*n[0].z,e*n[0].w,e*n[1].x,e*n[1].y,e*n[1].z,e*n[1].w,e*n[2].x,e*n[2].y,e*n[2].z,e*n[2].w,e*n[3].x,e*n[3].y,e*n[3].z,e*n[3].w)}},mulVxV:{vec2f:(e,t)=>u(e.x*t.x,e.y*t.y),vec2h:(e,t)=>w(e.x*t.x,e.y*t.y),vec2i:(e,t)=>$(e.x*t.x,e.y*t.y),vec2u:(e,t)=>p(e.x*t.x,e.y*t.y),vec3f:(e,t)=>y(e.x*t.x,e.y*t.y,e.z*t.z),vec3h:(e,t)=>i(e.x*t.x,e.y*t.y,e.z*t.z),vec3i:(e,t)=>B(e.x*t.x,e.y*t.y,e.z*t.z),vec3u:(e,t)=>m(e.x*t.x,e.y*t.y,e.z*t.z),vec4f:(e,t)=>o(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4h:(e,t)=>d(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4i:(e,t)=>g(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4u:(e,t)=>f(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),mat2x2f:(e,t)=>{let n=e.columns,a=t.columns;return ue(n[0].x*a[0].x+n[1].x*a[0].y,n[0].y*a[0].x+n[1].y*a[0].y,n[0].x*a[1].x+n[1].x*a[1].y,n[0].y*a[1].x+n[1].y*a[1].y)},mat3x3f:(e,t)=>{let n=e.columns,a=t.columns;return ye(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z)},mat4x4f:(e,t)=>{let n=e.columns,a=t.columns;return ve(n[0].x*a[0].x+n[1].x*a[0].y+n[2].x*a[0].z+n[3].x*a[0].w,n[0].y*a[0].x+n[1].y*a[0].y+n[2].y*a[0].z+n[3].y*a[0].w,n[0].z*a[0].x+n[1].z*a[0].y+n[2].z*a[0].z+n[3].z*a[0].w,n[0].w*a[0].x+n[1].w*a[0].y+n[2].w*a[0].z+n[3].w*a[0].w,n[0].x*a[1].x+n[1].x*a[1].y+n[2].x*a[1].z+n[3].x*a[1].w,n[0].y*a[1].x+n[1].y*a[1].y+n[2].y*a[1].z+n[3].y*a[1].w,n[0].z*a[1].x+n[1].z*a[1].y+n[2].z*a[1].z+n[3].z*a[1].w,n[0].w*a[1].x+n[1].w*a[1].y+n[2].w*a[1].z+n[3].w*a[1].w,n[0].x*a[2].x+n[1].x*a[2].y+n[2].x*a[2].z+n[3].x*a[2].w,n[0].y*a[2].x+n[1].y*a[2].y+n[2].y*a[2].z+n[3].y*a[2].w,n[0].z*a[2].x+n[1].z*a[2].y+n[2].z*a[2].z+n[3].z*a[2].w,n[0].w*a[2].x+n[1].w*a[2].y+n[2].w*a[2].z+n[3].w*a[2].w,n[0].x*a[3].x+n[1].x*a[3].y+n[2].x*a[3].z+n[3].x*a[3].w,n[0].y*a[3].x+n[1].y*a[3].y+n[2].y*a[3].z+n[3].y*a[3].w,n[0].z*a[3].x+n[1].z*a[3].y+n[2].z*a[3].z+n[3].z*a[3].w,n[0].w*a[3].x+n[1].w*a[3].y+n[2].w*a[3].z+n[3].w*a[3].w)}},mulMxV:{mat2x2f:(e,t)=>{let n=e.columns;return u(n[0].x*t.x+n[1].x*t.y,n[0].y*t.x+n[1].y*t.y)},mat3x3f:(e,t)=>{let n=e.columns;return y(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z)},mat4x4f:(e,t)=>{let n=e.columns;return o(n[0].x*t.x+n[1].x*t.y+n[2].x*t.z+n[3].x*t.w,n[0].y*t.x+n[1].y*t.y+n[2].y*t.z+n[3].y*t.w,n[0].z*t.x+n[1].z*t.y+n[2].z*t.z+n[3].z*t.w,n[0].w*t.x+n[1].w*t.y+n[2].w*t.z+n[3].w*t.w)}},mulVxM:{mat2x2f:(e,t)=>{let n=t.columns;return u(e.x*n[0].x+e.y*n[0].y,e.x*n[1].x+e.y*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return y(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z)},mat4x4f:(e,t)=>{let n=t.columns;return o(e.x*n[0].x+e.y*n[0].y+e.z*n[0].z+e.w*n[0].w,e.x*n[1].x+e.y*n[1].y+e.z*n[1].z+e.w*n[1].w,e.x*n[2].x+e.y*n[2].y+e.z*n[2].z+e.w*n[2].w,e.x*n[3].x+e.y*n[3].y+e.z*n[3].z+e.w*n[3].w)}},dot:{vec2f:j,vec2h:j,vec2i:j,vec2u:j,vec3f:X,vec3h:X,vec3i:X,vec3u:X,vec4f:Z,vec4h:Z,vec4i:Z,vec4u:Z},normalize:{vec2f:e=>{let t=K(e);return u(e.x/t,e.y/t)},vec2h:e=>{let t=K(e);return w(e.x/t,e.y/t)},vec2i:e=>{let t=K(e);return $(e.x/t,e.y/t)},vec2u:e=>{let t=K(e);return p(e.x/t,e.y/t)},vec3f:e=>{let t=_(e);return y(e.x/t,e.y/t,e.z/t)},vec3h:e=>{let t=_(e);return i(e.x/t,e.y/t,e.z/t)},vec3i:e=>{let t=_(e);return B(e.x/t,e.y/t,e.z/t)},vec3u:e=>{let t=_(e);return m(e.x/t,e.y/t,e.z/t)},vec4f:e=>{let t=W(e);return o(e.x/t,e.y/t,e.z/t,e.w/t)},vec4h:e=>{let t=W(e);return d(e.x/t,e.y/t,e.z/t,e.w/t)},vec4i:e=>{let t=W(e);return g(e.x/t,e.y/t,e.z/t,e.w/t)},vec4u:e=>{let t=W(e);return f(e.x/t,e.y/t,e.z/t,e.w/t)}},cross:{vec3f:(e,t)=>y(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x),vec3h:(e,t)=>i(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)},floor:{vec2f:z(Math.floor),vec2h:h(Math.floor),vec3f:b(Math.floor),vec3h:M(Math.floor),vec4f:A(Math.floor),vec4h:V(Math.floor)},max:{vec2f:ee(Math.max),vec2h:te(Math.max),vec2i:le(Math.max),vec2u:xe(Math.max),vec3f:ne(Math.max),vec3h:ae(Math.max),vec3i:Te(Math.max),vec3u:ie(Math.max),vec4f:re(Math.max),vec4h:se(Math.max),vec4i:we(Math.max),vec4u:de(Math.max)},min:{vec2f:ee(Math.min),vec2h:te(Math.min),vec2i:le(Math.min),vec2u:xe(Math.min),vec3f:ne(Math.min),vec3h:ae(Math.min),vec3i:Te(Math.min),vec3u:ie(Math.min),vec4f:re(Math.min),vec4h:se(Math.min),vec4i:we(Math.min),vec4u:de(Math.min)},pow:{vec2f:(e,t)=>u(e.x**t.x,e.y**t.y),vec2h:(e,t)=>w(e.x**t.x,e.y**t.y),vec3f:(e,t)=>y(e.x**t.x,e.y**t.y,e.z**t.z),vec3h:(e,t)=>i(e.x**t.x,e.y**t.y,e.z**t.z),vec4f:(e,t)=>o(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w),vec4h:(e,t)=>d(e.x**t.x,e.y**t.y,e.z**t.z,e.w**t.w)},sign:{vec2f:z(Math.sign),vec2h:h(Math.sign),vec2i:P(Math.sign),vec3f:b(Math.sign),vec3h:M(Math.sign),vec3i:C(Math.sign),vec4f:A(Math.sign),vec4h:V(Math.sign),vec4i:G(Math.sign)},sqrt:{vec2f:z(Math.sqrt),vec2h:h(Math.sqrt),vec3f:b(Math.sqrt),vec3h:M(Math.sqrt),vec4f:A(Math.sqrt),vec4h:V(Math.sqrt)},div:{vec2f:ee((e,t)=>e/t),vec2h:te((e,t)=>e/t),vec2i:le((e,t)=>e/t),vec2u:xe((e,t)=>e/t),vec3f:ne((e,t)=>e/t),vec3h:ae((e,t)=>e/t),vec3i:Te((e,t)=>e/t),vec3u:ie((e,t)=>e/t),vec4f:re((e,t)=>e/t),vec4h:se((e,t)=>e/t),vec4i:we((e,t)=>e/t),vec4u:de((e,t)=>e/t)},mix:{vec2f:(e,t,n)=>typeof n=="number"?u(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):u(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec2h:(e,t,n)=>typeof n=="number"?w(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):w(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y),vec3f:(e,t,n)=>typeof n=="number"?y(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):y(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec3h:(e,t,n)=>typeof n=="number"?i(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):i(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z),vec4f:(e,t,n)=>typeof n=="number"?o(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):o(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w),vec4h:(e,t,n)=>typeof n=="number"?d(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n,e.w*(1-n)+t.w*n):d(e.x*(1-n.x)+t.x*n.x,e.y*(1-n.y)+t.y*n.y,e.z*(1-n.z)+t.z*n.z,e.w*(1-n.w)+t.w*n.w)},sin:{vec2f:z(Math.sin),vec2h:h(Math.sin),vec3f:b(Math.sin),vec3h:M(Math.sin),vec4f:A(Math.sin),vec4h:V(Math.sin)},cos:{vec2f:z(Math.cos),vec2h:h(Math.cos),vec3f:b(Math.cos),vec3h:M(Math.cos),vec4f:A(Math.cos),vec4h:V(Math.cos)},exp:{vec2f:z(Math.exp),vec2h:h(Math.exp),vec3f:b(Math.exp),vec3h:M(Math.exp),vec4f:A(Math.exp),vec4h:V(Math.exp)},fract:{vec2f:z(e=>e-Math.floor(e)),vec2h:h(e=>e-Math.floor(e)),vec3f:b(e=>e-Math.floor(e)),vec3h:M(e=>e-Math.floor(e)),vec4f:A(e=>e-Math.floor(e)),vec4h:V(e=>e-Math.floor(e))},isCloseToZero:{vec2f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec2h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t,vec3f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec3h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t,vec4f:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t,vec4h:(e,t)=>Math.abs(e.x)<=t&&Math.abs(e.y)<=t&&Math.abs(e.z)<=t&&Math.abs(e.w)<=t},neg:{vec2f:z(e=>-e),vec2h:h(e=>-e),vec2i:P(e=>-e),vec2u:H(e=>-e),"vec2<bool>":e=>l(!e.x,!e.y),vec3f:b(e=>-e),vec3h:M(e=>-e),vec3i:C(e=>-e),vec3u:Q(e=>-e),"vec3<bool>":e=>x(!e.x,!e.y,!e.z),vec4f:A(e=>-e),vec4h:V(e=>-e),vec4i:G(e=>-e),vec4u:Y(e=>-e),"vec4<bool>":e=>T(!e.x,!e.y,!e.z,!e.w)},select:{vec2f:(e,t,n)=>u(n.x?t.x:e.x,n.y?t.y:e.y),vec2h:(e,t,n)=>w(n.x?t.x:e.x,n.y?t.y:e.y),vec2i:(e,t,n)=>$(n.x?t.x:e.x,n.y?t.y:e.y),vec2u:(e,t,n)=>p(n.x?t.x:e.x,n.y?t.y:e.y),"vec2<bool>":(e,t,n)=>l(n.x?t.x:e.x,n.y?t.y:e.y),vec3f:(e,t,n)=>y(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3h:(e,t,n)=>i(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3i:(e,t,n)=>B(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3u:(e,t,n)=>m(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),"vec3<bool>":(e,t,n)=>x(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec4f:(e,t,n)=>o(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4h:(e,t,n)=>d(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4i:(e,t,n)=>g(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),vec4u:(e,t,n)=>f(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w),"vec4<bool>":(e,t,n)=>T(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z,n.w?t.w:e.w)}};function E(e){let t=e.dataType.type;return t==="abstractInt"||t==="abstractFloat"||t==="f32"||t==="f16"||t==="i32"||t==="u32"}var Ve=r((e,t)=>s.add[e.kind](e,t),(e,t)=>({value:`(${e.value} + ${t.value})`,dataType:e.dataType}),"coerce"),L=r((e,t)=>s.sub[e.kind](e,t),(e,t)=>({value:`(${e.value} - ${t.value})`,dataType:e.dataType}),"coerce"),ze=r((e,t)=>{if(typeof e=="number")return s.mulSxV[t.kind](e,t);if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t){let n=!e.kind.startsWith("mat"),a=!t.kind.startsWith("mat");if(!n&&a)return s.mulMxV[e.kind](e,t);if(n&&!a)return s.mulVxM[t.kind](e,t)}return s.mulVxV[t.kind](e,t)},(e,t)=>{let n=E(e)?t.dataType:e.dataType.type.startsWith("mat")?t.dataType.type.startsWith("mat")?e.dataType:t.dataType:e.dataType;return{value:`(${e.value} * ${t.value})`,dataType:n}}),Ie=r(e=>typeof e=="number"?Math.abs(e):s.abs[e.kind](e),e=>({value:`abs(${e.value})`,dataType:e.dataType})),Se=r((e,t)=>typeof e=="number"&&typeof t=="number"?Math.atan2(e,t):s.atan2[e.kind](e,t),(e,t)=>({value:`atan2(${e.value}, ${t.value})`,dataType:e.dataType})),$e=r(e=>typeof e=="number"?Math.acos(e):s.acos[e.kind](e),e=>({value:`acos(${e.value})`,dataType:e.dataType})),Be=r(e=>typeof e=="number"?Math.asin(e):s.asin[e.kind](e),e=>({value:`asin(${e.value})`,dataType:e.dataType})),ke=r(e=>typeof e=="number"?Math.ceil(e):s.ceil[e.kind](e),e=>({value:`ceil(${e.value})`,dataType:e.dataType})),Oe=r((e,t,n)=>typeof e=="number"?Math.min(Math.max(t,e),n):s.clamp[e.kind](e,t,n),(e,t,n)=>({value:`clamp(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),De=r(e=>typeof e=="number"?Math.cos(e):s.cos[e.kind](e),e=>({value:`cos(${e.value})`,dataType:e.dataType})),Fe=r((e,t)=>s.cross[e.kind](e,t),(e,t)=>({value:`cross(${e.value}, ${t.value})`,dataType:e.dataType})),he=r((e,t)=>s.dot[e.kind](e,t),(e,t)=>({value:`dot(${e.value}, ${t.value})`,dataType:R})),Ue=r(e=>s.normalize[e.kind](e),e=>({value:`normalize(${e.value})`,dataType:e.dataType})),Ne=r(e=>typeof e=="number"?Math.floor(e):s.floor[e.kind](e),e=>({value:`floor(${e.value})`,dataType:e.dataType})),Re=r(e=>typeof e=="number"?e-Math.floor(e):s.fract[e.kind](e),e=>({value:`fract(${e.value})`,dataType:e.dataType})),be=r(e=>typeof e=="number"?Math.abs(e):s.length[e.kind](e),e=>({value:`length(${e.value})`,dataType:R})),Ke=r((e,t)=>typeof e=="number"?Math.max(e,t):s.max[e.kind](e,t),(e,t)=>({value:`max(${e.value}, ${t.value})`,dataType:e.dataType}),"coerce"),_e=r((e,t)=>typeof e=="number"?Math.min(e,t):s.min[e.kind](e,t),(e,t)=>({value:`min(${e.value}, ${t.value})`,dataType:e.dataType}),"coerce"),We=r(e=>typeof e=="number"?Math.sign(e):s.sign[e.kind](e),e=>({value:`sign(${e.value})`,dataType:e.dataType})),Ee=r(e=>typeof e=="number"?Math.sin(e):s.sin[e.kind](e),e=>({value:`sin(${e.value})`,dataType:e.dataType})),qe=r(e=>typeof e=="number"?Math.exp(e):s.exp[e.kind](e),e=>({value:`exp(${e.value})`,dataType:e.dataType})),Pe=r((e,t)=>{if(typeof e=="number"&&typeof t=="number")return e**t;if(typeof e=="object"&&typeof t=="object"&&"kind"in e&&"kind"in t)return s.pow[e.kind](e,t);throw new Error("Invalid arguments to pow()")},(e,t)=>({value:`pow(${e.value}, ${t.value})`,dataType:e.dataType})),Ce=r((e,t,n)=>{if(typeof e=="number"){if(typeof n!="number"||typeof t!="number")throw new Error("When e1 and e2 are numbers, the blend factor must be a number.");return e*(1-n)+t*n}if(typeof e=="number"||typeof t=="number")throw new Error("e1 and e2 need to both be vectors of the same kind.");return s.mix[e.kind](e,t,n)},(e,t,n)=>({value:`mix(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),Ge=r((e,t)=>L(e,ze(2*he(t,e),t)),(e,t)=>({value:`reflect(${e.value}, ${t.value})`,dataType:e.dataType})),Le=r((e,t)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t):be(L(e,t)),(e,t)=>({value:`distance(${e.value}, ${t.value})`,dataType:R})),Je=r(e=>typeof e=="number"?-e:s.neg[e.kind](e),e=>({value:`-(${e.value})`,dataType:e.dataType})),je=r(e=>typeof e=="number"?Math.sqrt(e):s.sqrt[e.kind](e),e=>({value:`sqrt(${e.value})`,dataType:e.dataType})),Xe=r((e,t)=>typeof e=="number"&&typeof t=="number"?e/t:typeof t=="number"?s.mulSxV[e.kind](1/t,e):s.div[e.kind](e,t),(e,t)=>({value:`(${e.value} / ${t.value})`,dataType:e.dataType}));function q(e){return e.dataType.type.includes("2")?l:e.dataType.type.includes("3")?x:T}var Ze=r((e,t)=>me(J(e,t)),(e,t)=>({value:`all(${e.value} == ${t.value})`,dataType:U})),J=r((e,t)=>s.eq[e.kind](e,t),(e,t)=>({value:`(${e.value} == ${t.value})`,dataType:q(e)})),He=r((e,t)=>D(J(e,t)),(e,t)=>({value:`(${e.value} != ${t.value})`,dataType:q(e)})),ce=r((e,t)=>s.lt[e.kind](e,t),(e,t)=>({value:`(${e.value} < ${t.value})`,dataType:q(e)})),Qe=r((e,t)=>pe(ce(e,t),J(e,t)),(e,t)=>({value:`(${e.value} <= ${t.value})`,dataType:q(e)})),Ye=r((e,t)=>Me(D(ce(e,t)),D(J(e,t))),(e,t)=>({value:`(${e.value} > ${t.value})`,dataType:q(e)})),et=r((e,t)=>D(ce(e,t)),(e,t)=>({value:`(${e.value} >= ${t.value})`,dataType:q(e)})),D=r(e=>s.neg[e.kind](e),e=>({value:`!(${e.value})`,dataType:e.dataType})),pe=r((e,t)=>s.or[e.kind](e,t),(e,t)=>({value:`(${e.value} | ${t.value})`,dataType:e.dataType})),Me=r((e,t)=>D(pe(D(e),D(t))),(e,t)=>({value:`(${e.value} & ${t.value})`,dataType:e.dataType})),me=r(e=>s.all[e.kind](e),e=>({value:`all(${e.value})`,dataType:U})),tt=r(e=>!me(D(e)),e=>({value:`any(${e.value})`,dataType:U})),nt=r((e,t,n=.01)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<n:typeof e!="number"&&typeof t!="number"?s.isCloseToZero[e.kind](L(e,t),n):!1,(e,t,n={value:.01,dataType:R})=>E(e)&&E(t)?{value:`(abs(f32(${e.value}) - f32(${t.value})) <= ${n.value})`,dataType:U}:!E(e)&&!E(t)?{value:`all(abs(${e.value} - ${t.value}) <= (${e.value} - ${e.value}) + ${n.value})`,dataType:U}:{value:"false",dataType:U}),at=r((e,t,n)=>typeof n=="boolean"?n?t:e:s.select[e.kind](e,t,n),(e,t,n)=>({value:`select(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType}));var rt=r(()=>console.warn("workgroupBarrier is a no-op outside of GPU mode."),()=>({value:"workgroupBarrier()",dataType:O})),st=r(()=>console.warn("storageBarrier is a no-op outside of GPU mode."),()=>({value:"storageBarrier()",dataType:O})),ct=r(()=>console.warn("textureBarrier is a no-op outside of GPU mode."),()=>({value:"textureBarrier()",dataType:O})),ot=r(e=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},e=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicLoad(&${e.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),ut=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(!S(e.dataType)||e.dataType.type!=="atomic")throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`);return{value:`atomicStore(&${e.value}, ${t.value})`,dataType:O}}),N=(e,t)=>e.dataType.type==="atomic"&&e.dataType.inner.type==="i32"?[e.dataType,ge]:[e.dataType,I],yt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAdd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),vt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicSub(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),lt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMax(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),xt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicMin(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),Tt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicAnd(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),it=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicOr(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N),wt=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(S(e.dataType)&&e.dataType.type==="atomic")return{value:`atomicXor(&${e.value}, ${t.value})`,dataType:e.dataType.inner};throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},N);var dt=r(e=>e.length,e=>({value:`arrayLength(${e.value})`,dataType:I}),e=>[fe(e.dataType)]);import*as k from"typed-binary";var pt=r(e=>{let t=new ArrayBuffer(4);new k.BufferWriter(t).writeUint32(e);let a=new k.BufferReader(t);return u(a.readFloat16(),a.readFloat16())},e=>({value:`unpack2x16float(${e.value})`,dataType:u})),mt=r(e=>{let t=new ArrayBuffer(4),n=new k.BufferWriter(t);n.writeFloat16(e.x),n.writeFloat16(e.y);let a=new k.BufferReader(t);return I(a.readUint32())},e=>({value:`pack2x16float(${e.value})`,dataType:I})),gt=r(e=>{let t=new ArrayBuffer(4);new k.BufferWriter(t).writeUint32(e);let a=new k.BufferReader(t);return o(a.readUint8()/255,a.readUint8()/255,a.readUint8()/255,a.readUint8()/255)},e=>({value:`unpack4x8unorm(${e.value})`,dataType:o})),ft=r(e=>{let t=new ArrayBuffer(4),n=new k.BufferWriter(t);n.writeUint8(e.x*255),n.writeUint8(e.y*255),n.writeUint8(e.z*255),n.writeUint8(e.w*255);let a=new k.BufferReader(t);return I(a.readUint32())},e=>({value:`pack4x8unorm(${e.value})`,dataType:I}));var zt=r((e,t,n,a,v)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,n,a,v)=>{let F=[e,t,n];return a!==void 0&&F.push(a),v!==void 0&&F.push(v),{value:`textureSample(${F.map(oe=>oe.value).join(", ")})`,dataType:o}}),ht=r((e,t,n,a,v)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,n,a,v)=>{let F=[e,t,n,a];return v!==void 0&&F.push(v),{value:`textureSampleLevel(${F.map(oe=>oe.value).join(", ")})`,dataType:o}}),bt={u32:f,i32:g,f32:o},Mt=r((e,t,n)=>{throw new Error("Texture loading is not supported outside of GPU mode.")},(e,t,n)=>{let a=[e,t];n!==void 0&&a.push(n);let v=e.dataType;return{value:`textureLoad(${a.map(F=>F.value).join(", ")})`,dataType:"texelDataType"in v?v.texelDataType:bt[v.channelDataType.type]}}),At=r((e,t,n,a)=>{throw new Error("Texture storing is not supported outside of GPU mode.")},(e,t,n,a)=>({value:`textureStore(${[e,t,n,a].filter(v=>v!==void 0).map(v=>v.value).join(", ")})`,dataType:O})),Vt=r((e,t)=>{throw new Error("Texture dimensions are not supported outside of GPU mode.")},(e,t)=>{let n=e.dataType.dimension;return{value:`textureDimensions(${e.value}${t!==void 0?`, ${t.value}`:""})`,dataType:n==="1d"?I:n==="3d"?m:p}});export{Ie as abs,$e as acos,Ve as add,me as all,Ze as allEq,Me as and,tt as any,dt as arrayLength,Be as asin,Se as atan2,yt as atomicAdd,Tt as atomicAnd,ot as atomicLoad,lt as atomicMax,xt as atomicMin,it as atomicOr,ut as atomicStore,vt as atomicSub,wt as atomicXor,ke as ceil,Oe as clamp,De as cos,Fe as cross,Ae as discard,Le as distance,Xe as div,he as dot,J as eq,qe as exp,Ne as floor,Re as fract,et as ge,Ye as gt,nt as isCloseTo,Qe as le,be as length,ce as lt,Ke as max,_e as min,Ce as mix,ze as mul,He as ne,Je as neg,Ue as normalize,D as not,pe as or,mt as pack2x16float,ft as pack4x8unorm,Pe as pow,Ge as reflect,at as select,We as sign,Ee as sin,je as sqrt,st as storageBarrier,L as sub,ct as textureBarrier,Vt as textureDimensions,Mt as textureLoad,zt as textureSample,ht as textureSampleLevel,At as textureStore,pt as unpack2x16float,gt as unpack4x8unorm,rt as workgroupBarrier};
1
+ import{A as fe,B as ge,C as Se,D as be,E as we,F as $e,G as Ae,H as Ie,I as De,J as Be,K as ke,a as c,b as S,d as H,e as D,f as v,g as K,h as Q,i as ee,j as te,k as re,l as ae,m as oe,n as ne,o as ue,p as pe,q as ie,r as Te,s as de,t as se,u as me,v as le,w as ce,x as xe,y as ye,z as ve}from"../chunk-CGVYLGBG.js";import{A as s,Aa as N,B as A,Ba as F,Ca as W,Ea as M,Fa as q,Ga as C,Ha as Z,Ia as Y,Ja as j,K as T,Ka as R,L as V,La as z,N as U,Oa as i,Qa as X,da as a,ga as r,ha as E,ja as x,ka as p,la as O,ma as L,oa as I,ra as _,sa as P,wa as h,xa as G,ya as y}from"../chunk-SWJVYRFM.js";var Ve=r(()=>{throw new Error("discard() can only be used on the GPU.")},()=>a("discard;",s),"discard");var Ue=r((e,t)=>v(i.translation(t),e),(e,t)=>({value:`(${i.translation(t).value} * ${e.value})`,dataType:e.dataType}),"translate4"),Ee=r((e,t)=>v(i.scaling(t),e),(e,t)=>({value:`(${i.scaling(t).value} * ${e.value})`,dataType:e.dataType}),"scale4"),Oe=r((e,t)=>v(i.rotationX(t),e),(e,t)=>({value:`(${i.rotationX(t).value} * ${e.value})`,dataType:e.dataType}),"rotateX4"),Le=r((e,t)=>v(i.rotationY(t),e),(e,t)=>({value:`(${i.rotationY(t).value} * ${e.value})`,dataType:e.dataType}),"rotateY4"),_e=r((e,t)=>v(i.rotationZ(t),e),(e,t)=>({value:`(${i.rotationZ(t).value} * ${e.value})`,dataType:e.dataType}),"rotateZ4");function g(e){return e.dataType.type.includes("2")?P:e.dataType.type.includes("3")?G:W}var Pe=r((e,t)=>k(b(e,t)),(e,t)=>a(`all(${e.value} == ${t.value})`,x),"allEq"),b=r((e,t)=>c.eq[e.kind](e,t),(e,t)=>a(`(${e.value} == ${t.value})`,g(e)),"eq"),he=r((e,t)=>m(b(e,t)),(e,t)=>a(`(${e.value} != ${t.value})`,g(e)),"ne"),w=r((e,t)=>c.lt[e.kind](e,t),(e,t)=>a(`(${e.value} < ${t.value})`,g(e)),"lt"),Ge=r((e,t)=>B(w(e,t),b(e,t)),(e,t)=>a(`(${e.value} <= ${t.value})`,g(e)),"le"),Ne=r((e,t)=>J(m(w(e,t)),m(b(e,t))),(e,t)=>a(`(${e.value} > ${t.value})`,g(e)),"gt"),Fe=r((e,t)=>m(w(e,t)),(e,t)=>a(`(${e.value} >= ${t.value})`,g(e)),"ge"),m=r(e=>c.neg[e.kind](e),e=>a(`!(${e.value})`,e.dataType),"not"),B=r((e,t)=>c.or[e.kind](e,t),(e,t)=>a(`(${e.value} | ${t.value})`,e.dataType),"or"),J=r((e,t)=>m(B(m(e),m(t))),(e,t)=>a(`(${e.value} & ${t.value})`,e.dataType),"and"),k=r(e=>c.all[e.kind](e),e=>a(`all(${e.value})`,x),"all"),We=r(e=>!k(m(e)),e=>a(`any(${e.value})`,x),"any"),Xe=r((e,t,o=.01)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<o:A(e)&&A(t)?c.isCloseToZero[e.kind](D(e,t),o):!1,(e,t,o=a(.01,L))=>S(e)&&S(t)?a(`(abs(f32(${e.value}) - f32(${t.value})) <= ${o.value})`,x):!S(e)&&!S(t)?a(`all(abs(${e.value} - ${t.value}) <= (${e.value} - ${e.value}) + ${o.value})`,x):a("false",x),"isCloseTo"),Je=r((e,t,o)=>typeof o=="boolean"?o?t:e:c.select[e.kind](e,t,o),(e,t,o)=>a(`select(${e.value}, ${t.value}, ${o.value})`,e.dataType),"select");var Me=r(()=>console.warn("workgroupBarrier is a no-op outside of GPU mode."),()=>a("workgroupBarrier()",s),"workgroupBarrier"),qe=r(()=>console.warn("storageBarrier is a no-op outside of GPU mode."),()=>a("storageBarrier()",s),"storageBarrier"),Ce=r(()=>console.warn("textureBarrier is a no-op outside of GPU mode."),()=>a("textureBarrier()",s),"textureBarrier"),Ze=r(e=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},e=>{if(T(e.dataType)&&e.dataType.type==="atomic")return a(`atomicLoad(&${e.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},"atomicLoad"),Ye=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(!T(e.dataType)||e.dataType.type!=="atomic")throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`);return a(`atomicStore(&${e.value}, ${t.value})`,s)},"atomicStore"),f=(e,t)=>e.dataType.type==="atomic"&&e.dataType.inner.type==="i32"?[e.dataType,O]:[e.dataType,p],je=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(T(e.dataType)&&e.dataType.type==="atomic")return a(`atomicAdd(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},"atomicAdd",f),Re=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(T(e.dataType)&&e.dataType.type==="atomic")return a(`atomicSub(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},"atomicSub",f),ze=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(T(e.dataType)&&e.dataType.type==="atomic")return a(`atomicMax(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},"atomicMax",f),He=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(T(e.dataType)&&e.dataType.type==="atomic")return a(`atomicMin(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},"atomicMin",f),Ke=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(T(e.dataType)&&e.dataType.type==="atomic")return a(`atomicAnd(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},"atomicAnd",f),Qe=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(T(e.dataType)&&e.dataType.type==="atomic")return a(`atomicOr(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},"atomicOr",f),et=r((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(T(e.dataType)&&e.dataType.type==="atomic")return a(`atomicXor(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},"atomicXor",f);var tt=r(e=>e.length,e=>U(e.dataType)&&V(e.dataType.inner)&&e.dataType.inner.elementCount>0?a(String(e.dataType.inner.elementCount),E):a(`arrayLength(${e.value})`,p),"arrayLength",e=>[X(e.dataType)]);import*as d from"typed-binary";var rt=r(e=>{let t=new ArrayBuffer(4);new d.BufferWriter(t).writeUint32(e);let n=new d.BufferReader(t);return I(n.readFloat16(),n.readFloat16())},e=>a(`unpack2x16float(${e.value})`,I),"unpack2x16float"),at=r(e=>{let t=new ArrayBuffer(4),o=new d.BufferWriter(t);o.writeFloat16(e.x),o.writeFloat16(e.y);let n=new d.BufferReader(t);return p(n.readUint32())},e=>a(`pack2x16float(${e.value})`,p),"pack2x16float"),ot=r(e=>{let t=new ArrayBuffer(4);new d.BufferWriter(t).writeUint32(e);let n=new d.BufferReader(t);return y(n.readUint8()/255,n.readUint8()/255,n.readUint8()/255,n.readUint8()/255)},e=>a(`unpack4x8unorm(${e.value})`,y),"unpack4x8unorm"),nt=r(e=>{let t=new ArrayBuffer(4),o=new d.BufferWriter(t);o.writeUint8(e.x*255),o.writeUint8(e.y*255),o.writeUint8(e.z*255),o.writeUint8(e.w*255);let n=new d.BufferReader(t);return p(n.readUint32())},e=>a(`pack4x8unorm(${e.value})`,p),"pack4x8unorm");var ut=r((e,t,o,n,u)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,o,n,u)=>{let l=[e,t,o];return n!==void 0&&l.push(n),u!==void 0&&l.push(u),a(`textureSample(${l.map($=>$.value).join(", ")})`,y)},"textureSample"),pt=r((e,t,o,n,u)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,o,n,u)=>{let l=[e,t,o,n];return u!==void 0&&l.push(u),a(`textureSampleLevel(${l.map($=>$.value).join(", ")})`,y)},"textureSampleLevel"),it={u32:F,i32:N,f32:y},Tt=r((e,t,o)=>{throw new Error("Texture loading is not supported outside of GPU mode.")},(e,t,o)=>{let n=[e,t];o!==void 0&&n.push(o);let u=e.dataType;return a(`textureLoad(${n.map(l=>l.value).join(", ")})`,"texelDataType"in u?u.texelDataType:it[u.channelDataType.type])},"textureLoad"),dt=r((e,t,o,n)=>{throw new Error("Texture storing is not supported outside of GPU mode.")},(e,t,o,n)=>a(`textureStore(${[e,t,o,n].filter(u=>u!==void 0).map(u=>u.value).join(", ")})`,s),"textureStore"),st=r((e,t)=>{throw new Error("Texture dimensions are not supported outside of GPU mode.")},(e,t)=>{let o=e.dataType.dimension;return a(`textureDimensions(${e.value}${t!==void 0?`, ${t.value}`:""})`,o==="1d"?p:o==="3d"?h:_)},"textureDimensions");export{Q as abs,te as acos,re as acosh,H as add,k as all,Pe as allEq,J as and,We as any,tt as arrayLength,ae as asin,ee as atan2,je as atomicAdd,Ke as atomicAnd,Ze as atomicLoad,ze as atomicMax,He as atomicMin,Qe as atomicOr,Ye as atomicStore,Re as atomicSub,et as atomicXor,oe as ceil,ne as clamp,ue as cos,pe as cosh,ie as cross,Ve as discard,Ie as distance,K as div,Te as dot,b as eq,Se as exp,be as exp2,se as floor,me as fract,Fe as ge,Ne as gt,M as identity2,q as identity3,C as identity4,Xe as isCloseTo,Ge as le,le as length,ce as log,xe as log2,w as lt,ye as max,ve as min,$e as mix,v as mul,he as ne,De as neg,de as normalize,m as not,B as or,at as pack2x16float,nt as pack4x8unorm,we as pow,Ae as reflect,Oe as rotateX4,Le as rotateY4,_e as rotateZ4,j as rotationX4,R as rotationY4,z as rotationZ4,Ee as scale4,Y as scaling4,Je as select,fe as sign,ge as sin,Be as sqrt,qe as storageBarrier,D as sub,ke as tanh,Ce as textureBarrier,st as textureDimensions,Tt as textureLoad,ut as textureSample,pt as textureSampleLevel,dt as textureStore,Ue as translate4,Z as translation4,rt as unpack2x16float,ot as unpack4x8unorm,Me as workgroupBarrier};
2
2
  //# sourceMappingURL=index.js.map