typegpu 0.5.6 → 0.5.8
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/LICENSE.md +11 -12
- package/README.md +13 -5
- package/chunk-7ACLI4JY.cjs +2 -0
- package/chunk-7ACLI4JY.cjs.map +1 -0
- package/chunk-L7HIBZAX.js +4 -0
- package/chunk-L7HIBZAX.js.map +1 -0
- package/chunk-SFECI7OX.js +2 -0
- package/chunk-SFECI7OX.js.map +1 -0
- package/chunk-SLWTVY6K.js +2 -0
- package/chunk-SLWTVY6K.js.map +1 -0
- package/chunk-TF6YPHJS.cjs +2 -0
- package/chunk-TF6YPHJS.cjs.map +1 -0
- package/chunk-V4CSEIB2.cjs +4 -0
- package/chunk-V4CSEIB2.cjs.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.d.cts +5 -23
- package/data/index.d.ts +5 -23
- package/data/index.js +1 -1
- package/index.cjs +23 -19
- package/index.cjs.map +1 -1
- package/index.d.cts +4 -1045
- package/index.d.ts +4 -1045
- package/index.js +23 -19
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +87 -18
- package/std/index.d.ts +87 -18
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/tgpuComputeFn-S61HxwW-.d.cts +3063 -0
- package/tgpuComputeFn-S61HxwW-.d.ts +3063 -0
- package/attributes-B90UjSYb.d.ts +0 -159
- package/attributes-zljQ-iA7.d.cts +0 -159
- package/chunk-KJHEEZQT.js +0 -4
- package/chunk-KJHEEZQT.js.map +0 -1
- package/chunk-LB4TSIPN.cjs +0 -2
- package/chunk-LB4TSIPN.cjs.map +0 -1
- package/chunk-VTUUXD6H.cjs +0 -4
- package/chunk-VTUUXD6H.cjs.map +0 -1
- package/chunk-YVK55BVR.js +0 -2
- package/chunk-YVK55BVR.js.map +0 -1
- package/dataTypes-6k4EJeol.d.cts +0 -1405
- package/dataTypes-6k4EJeol.d.ts +0 -1405
- package/sampler-ByLNpSxj.d.ts +0 -369
- package/sampler-NRTAYTIW.d.cts +0 -369
package/std/index.d.cts
CHANGED
@@ -1,17 +1,38 @@
|
|
1
|
-
import {
|
2
|
-
import
|
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, bm 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-S61HxwW-.cjs';
|
2
|
+
import 'tinyest';
|
3
3
|
|
4
4
|
declare const discard: TgpuDualFn<() => never>;
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
declare const
|
14
|
-
declare
|
6
|
+
type NumVec = AnyNumericVecInstance;
|
7
|
+
type Mat = AnyMatInstance;
|
8
|
+
declare function cpuAdd(lhs: number, rhs: number): number;
|
9
|
+
declare function cpuAdd<T extends NumVec>(lhs: number, rhs: T): T;
|
10
|
+
declare function cpuAdd<T extends NumVec>(lhs: T, rhs: number): T;
|
11
|
+
declare function cpuAdd<T extends NumVec | Mat>(lhs: T, rhs: T): T;
|
12
|
+
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;
|
13
|
+
declare const add: TgpuDualFn<typeof cpuAdd>;
|
14
|
+
declare function cpuSub(lhs: number, rhs: number): number;
|
15
|
+
declare function cpuSub<T extends NumVec>(lhs: number, rhs: T): T;
|
16
|
+
declare function cpuSub<T extends NumVec>(lhs: T, rhs: number): T;
|
17
|
+
declare function cpuSub<T extends NumVec | Mat>(lhs: T, rhs: T): T;
|
18
|
+
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;
|
19
|
+
declare const sub: TgpuDualFn<typeof cpuSub>;
|
20
|
+
declare function cpuMul(lhs: number, rhs: number): number;
|
21
|
+
declare function cpuMul<MV extends NumVec | Mat>(lhs: number, rhs: MV): MV;
|
22
|
+
declare function cpuMul<MV extends NumVec | Mat>(lhs: MV, rhs: number): MV;
|
23
|
+
declare function cpuMul<V extends NumVec>(lhs: V, rhs: V): V;
|
24
|
+
declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: V, rhs: M): V;
|
25
|
+
declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: M, rhs: V): V;
|
26
|
+
declare function cpuMul<M extends Mat>(lhs: M, rhs: M): M;
|
27
|
+
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;
|
28
|
+
declare const mul: TgpuDualFn<typeof cpuMul>;
|
29
|
+
declare function cpuDiv(lhs: number, rhs: number): number;
|
30
|
+
declare function cpuDiv<MV extends NumVec>(lhs: number, rhs: MV): MV;
|
31
|
+
declare function cpuDiv<MV extends NumVec>(lhs: MV, rhs: number): MV;
|
32
|
+
declare function cpuDiv<V extends NumVec>(lhs: V, rhs: V): V;
|
33
|
+
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;
|
34
|
+
declare const div: TgpuDualFn<typeof cpuDiv>;
|
35
|
+
declare const abs: TgpuDualFn<(<T extends NumVec | number>(value: T) => T)>;
|
15
36
|
declare const atan2: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(y: T, x: T) => T)>;
|
16
37
|
declare const acos: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
|
17
38
|
declare const asin: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
|
@@ -24,7 +45,7 @@ declare const ceil: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value:
|
|
24
45
|
* @privateRemarks
|
25
46
|
* https://www.w3.org/TR/WGSL/#clamp
|
26
47
|
*/
|
27
|
-
declare const clamp: TgpuDualFn<(<T extends
|
48
|
+
declare const clamp: TgpuDualFn<(<T extends NumVec | number>(value: T, low: T, high: T) => T)>;
|
28
49
|
/**
|
29
50
|
* @privateRemarks
|
30
51
|
* https://www.w3.org/TR/WGSL/#cos-builtin
|
@@ -39,7 +60,7 @@ declare const cross: TgpuDualFn<(<T extends v3f | v3h>(a: T, b: T) => T)>;
|
|
39
60
|
* @privateRemarks
|
40
61
|
* https://www.w3.org/TR/WGSL/#dot-builtin
|
41
62
|
*/
|
42
|
-
declare const dot: TgpuDualFn<(<T extends
|
63
|
+
declare const dot: TgpuDualFn<(<T extends NumVec>(lhs: T, rhs: T) => number)>;
|
43
64
|
declare const normalize: TgpuDualFn<(<T extends AnyFloatVecInstance>(v: T) => T)>;
|
44
65
|
/**
|
45
66
|
* @privateRemarks
|
@@ -56,12 +77,13 @@ declare const length: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value
|
|
56
77
|
* @privateRemarks
|
57
78
|
* https://www.w3.org/TR/WGSL/#max-float-builtin
|
58
79
|
*/
|
59
|
-
declare const max: TgpuDualFn<(<T extends
|
80
|
+
declare const max: TgpuDualFn<(<T extends NumVec | number>(a: T, b: T) => T)>;
|
60
81
|
/**
|
61
82
|
* @privateRemarks
|
62
83
|
* https://www.w3.org/TR/WGSL/#min-float-builtin
|
63
84
|
*/
|
64
|
-
declare const min: TgpuDualFn<(<T extends
|
85
|
+
declare const min: TgpuDualFn<(<T extends NumVec | number>(a: T, b: T) => T)>;
|
86
|
+
declare const sign: TgpuDualFn<(<T extends v2f | v2h | v2i | v3f | v3h | v3i | v4f | v4h | v4i | number>(e: T) => T)>;
|
65
87
|
/**
|
66
88
|
* @privateRemarks
|
67
89
|
* https://www.w3.org/TR/WGSL/#sin-builtin
|
@@ -85,7 +107,8 @@ type MixOverload = {
|
|
85
107
|
declare const mix: MixOverload;
|
86
108
|
declare const reflect: TgpuDualFn<(<T extends AnyFloatVecInstance>(e1: T, e2: T) => T)>;
|
87
109
|
declare const distance: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(a: T, b: T) => number)>;
|
88
|
-
declare const neg: TgpuDualFn<(<T extends
|
110
|
+
declare const neg: TgpuDualFn<(<T extends NumVec | number>(value: T) => T)>;
|
111
|
+
declare const sqrt: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
|
89
112
|
|
90
113
|
/**
|
91
114
|
* Checks whether `lhs == rhs` on all components.
|
@@ -196,13 +219,15 @@ declare const any: TgpuDualFn<(value: AnyBooleanVecInstance) => boolean>;
|
|
196
219
|
*/
|
197
220
|
declare const isCloseTo: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(lhs: T, rhs: T, precision?: number) => boolean)>;
|
198
221
|
type SelectOverload = {
|
199
|
-
<T extends
|
222
|
+
<T extends number | boolean | AnyVecInstance>(f: T, t: T, cond: boolean): T;
|
200
223
|
<T extends AnyVecInstance>(f: T, t: T, cond: T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b): T;
|
201
224
|
};
|
202
225
|
/**
|
203
226
|
* Returns `t` if `cond` is `true`, and `f` otherwise.
|
204
227
|
* Component-wise if `cond` is a vector.
|
205
228
|
* @example
|
229
|
+
* select(1, 2, false) // returns 1
|
230
|
+
* select(1, 2, true) // returns 2
|
206
231
|
* select(vec2i(1, 2), vec2i(3, 4), true) // returns vec2i(3, 4)
|
207
232
|
* select(vec2i(1, 2), vec2i(3, 4), vec2b(false, true)) // returns vec2i(1, 4)
|
208
233
|
*/
|
@@ -256,5 +281,49 @@ type TextureSampleOverload = {
|
|
256
281
|
<T extends TgpuSampledTexture<'cube-array'>>(texture: T, sampler: TgpuSampler, coords: v3f, arrayIndex: number): v4f;
|
257
282
|
};
|
258
283
|
declare const textureSample: TextureSampleOverload;
|
284
|
+
type TextureSampleLevelOverload = {
|
285
|
+
<T extends TgpuSampledTexture<'2d'>>(texture: T, sampler: TgpuSampler, coords: v2f, level: number, offset?: v2i): v4f;
|
286
|
+
<T extends TgpuSampledTexture<'2d-array'>>(texture: T, sampler: TgpuSampler, coords: v2f, arrayIndex: number, level: number, offset?: v2i): v4f;
|
287
|
+
<T extends TgpuSampledTexture<'3d' | 'cube'>>(texture: T, sampler: TgpuSampler, coords: v3f, level: number, offset?: v3i): v4f;
|
288
|
+
<T extends TgpuSampledTexture<'cube-array'>>(texture: T, sampler: TgpuSampler, coords: v3f, arrayIndex: number, level: number): v4f;
|
289
|
+
};
|
290
|
+
declare const textureSampleLevel: TextureSampleLevelOverload;
|
291
|
+
type TexelDataToInstance<TF extends TexelData> = {
|
292
|
+
vec4f: v4f;
|
293
|
+
vec4i: v4i;
|
294
|
+
vec4u: v4u;
|
295
|
+
}[TF['type']];
|
296
|
+
type SampleTypeToInstance<TF extends ChannelData> = {
|
297
|
+
u32: v4u;
|
298
|
+
i32: v4i;
|
299
|
+
f32: v4f;
|
300
|
+
}[TF['type']];
|
301
|
+
type TextureLoadOverload = {
|
302
|
+
<T extends TgpuStorageTexture<'1d'>>(texture: T, coords: number): TexelDataToInstance<T['texelDataType']>;
|
303
|
+
<T extends TgpuStorageTexture<'2d'>>(texture: T, coords: v2i | v2u): TexelDataToInstance<T['texelDataType']>;
|
304
|
+
<T extends TgpuStorageTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number): TexelDataToInstance<T['texelDataType']>;
|
305
|
+
<T extends TgpuStorageTexture<'3d'>>(texture: T, coords: v3i | v3u): TexelDataToInstance<T['texelDataType']>;
|
306
|
+
<T extends TgpuSampledTexture<'1d'>>(texture: T, coords: number, level: number): SampleTypeToInstance<T['channelDataType']>;
|
307
|
+
<T extends TgpuSampledTexture<'2d'>>(texture: T, coords: v2i | v2u, level: number): SampleTypeToInstance<T['channelDataType']>;
|
308
|
+
<T extends TgpuSampledTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number, level: number): SampleTypeToInstance<T['channelDataType']>;
|
309
|
+
<T extends TgpuSampledTexture<'3d'>>(texture: T, coords: v3i | v3u, level: number): SampleTypeToInstance<T['channelDataType']>;
|
310
|
+
};
|
311
|
+
declare const textureLoad: TextureLoadOverload;
|
312
|
+
type TextureStoreOverload = {
|
313
|
+
<T extends TgpuStorageTexture<'1d'>>(texture: T, coords: number, value: TexelDataToInstance<T['texelDataType']>): void;
|
314
|
+
<T extends TgpuStorageTexture<'2d'>>(texture: T, coords: v2i | v2u, value: TexelDataToInstance<T['texelDataType']>): void;
|
315
|
+
<T extends TgpuStorageTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number, value: TexelDataToInstance<T['texelDataType']>): void;
|
316
|
+
<T extends TgpuStorageTexture<'3d'>>(texture: T, coords: v3i | v3u, value: TexelDataToInstance<T['texelDataType']>): void;
|
317
|
+
};
|
318
|
+
declare const textureStore: TextureStoreOverload;
|
319
|
+
type TextureDimensionsOverload = {
|
320
|
+
<T extends TgpuSampledTexture<'1d'> | TgpuStorageTexture<'1d'>>(texture: T): number;
|
321
|
+
<T extends TgpuSampledTexture<'1d'>>(texture: T, level: number): number;
|
322
|
+
<T extends TgpuSampledTexture<'2d'> | TgpuSampledTexture<'2d-array'> | TgpuSampledTexture<'cube'> | TgpuSampledTexture<'cube-array'> | TgpuStorageTexture<'2d'> | TgpuStorageTexture<'2d-array'>>(texture: T): v2u;
|
323
|
+
<T extends TgpuSampledTexture<'2d'> | TgpuSampledTexture<'2d-array'> | TgpuSampledTexture<'cube'> | TgpuSampledTexture<'cube-array'>>(texture: T, level: number): v2u;
|
324
|
+
<T extends TgpuSampledTexture<'3d'> | TgpuStorageTexture<'3d'>>(texture: T): v3u;
|
325
|
+
<T extends TgpuSampledTexture<'3d'>>(texture: T, level: number): v3u;
|
326
|
+
};
|
327
|
+
declare const textureDimensions: TextureDimensionsOverload;
|
259
328
|
|
260
|
-
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, 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, sin, storageBarrier, sub, textureBarrier, textureSample, unpack2x16float, unpack4x8unorm, workgroupBarrier };
|
329
|
+
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 };
|
package/std/index.d.ts
CHANGED
@@ -1,17 +1,38 @@
|
|
1
|
-
import {
|
2
|
-
import
|
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, bm 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-S61HxwW-.js';
|
2
|
+
import 'tinyest';
|
3
3
|
|
4
4
|
declare const discard: TgpuDualFn<() => never>;
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
declare const
|
14
|
-
declare
|
6
|
+
type NumVec = AnyNumericVecInstance;
|
7
|
+
type Mat = AnyMatInstance;
|
8
|
+
declare function cpuAdd(lhs: number, rhs: number): number;
|
9
|
+
declare function cpuAdd<T extends NumVec>(lhs: number, rhs: T): T;
|
10
|
+
declare function cpuAdd<T extends NumVec>(lhs: T, rhs: number): T;
|
11
|
+
declare function cpuAdd<T extends NumVec | Mat>(lhs: T, rhs: T): T;
|
12
|
+
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;
|
13
|
+
declare const add: TgpuDualFn<typeof cpuAdd>;
|
14
|
+
declare function cpuSub(lhs: number, rhs: number): number;
|
15
|
+
declare function cpuSub<T extends NumVec>(lhs: number, rhs: T): T;
|
16
|
+
declare function cpuSub<T extends NumVec>(lhs: T, rhs: number): T;
|
17
|
+
declare function cpuSub<T extends NumVec | Mat>(lhs: T, rhs: T): T;
|
18
|
+
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;
|
19
|
+
declare const sub: TgpuDualFn<typeof cpuSub>;
|
20
|
+
declare function cpuMul(lhs: number, rhs: number): number;
|
21
|
+
declare function cpuMul<MV extends NumVec | Mat>(lhs: number, rhs: MV): MV;
|
22
|
+
declare function cpuMul<MV extends NumVec | Mat>(lhs: MV, rhs: number): MV;
|
23
|
+
declare function cpuMul<V extends NumVec>(lhs: V, rhs: V): V;
|
24
|
+
declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: V, rhs: M): V;
|
25
|
+
declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: M, rhs: V): V;
|
26
|
+
declare function cpuMul<M extends Mat>(lhs: M, rhs: M): M;
|
27
|
+
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;
|
28
|
+
declare const mul: TgpuDualFn<typeof cpuMul>;
|
29
|
+
declare function cpuDiv(lhs: number, rhs: number): number;
|
30
|
+
declare function cpuDiv<MV extends NumVec>(lhs: number, rhs: MV): MV;
|
31
|
+
declare function cpuDiv<MV extends NumVec>(lhs: MV, rhs: number): MV;
|
32
|
+
declare function cpuDiv<V extends NumVec>(lhs: V, rhs: V): V;
|
33
|
+
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;
|
34
|
+
declare const div: TgpuDualFn<typeof cpuDiv>;
|
35
|
+
declare const abs: TgpuDualFn<(<T extends NumVec | number>(value: T) => T)>;
|
15
36
|
declare const atan2: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(y: T, x: T) => T)>;
|
16
37
|
declare const acos: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
|
17
38
|
declare const asin: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
|
@@ -24,7 +45,7 @@ declare const ceil: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value:
|
|
24
45
|
* @privateRemarks
|
25
46
|
* https://www.w3.org/TR/WGSL/#clamp
|
26
47
|
*/
|
27
|
-
declare const clamp: TgpuDualFn<(<T extends
|
48
|
+
declare const clamp: TgpuDualFn<(<T extends NumVec | number>(value: T, low: T, high: T) => T)>;
|
28
49
|
/**
|
29
50
|
* @privateRemarks
|
30
51
|
* https://www.w3.org/TR/WGSL/#cos-builtin
|
@@ -39,7 +60,7 @@ declare const cross: TgpuDualFn<(<T extends v3f | v3h>(a: T, b: T) => T)>;
|
|
39
60
|
* @privateRemarks
|
40
61
|
* https://www.w3.org/TR/WGSL/#dot-builtin
|
41
62
|
*/
|
42
|
-
declare const dot: TgpuDualFn<(<T extends
|
63
|
+
declare const dot: TgpuDualFn<(<T extends NumVec>(lhs: T, rhs: T) => number)>;
|
43
64
|
declare const normalize: TgpuDualFn<(<T extends AnyFloatVecInstance>(v: T) => T)>;
|
44
65
|
/**
|
45
66
|
* @privateRemarks
|
@@ -56,12 +77,13 @@ declare const length: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value
|
|
56
77
|
* @privateRemarks
|
57
78
|
* https://www.w3.org/TR/WGSL/#max-float-builtin
|
58
79
|
*/
|
59
|
-
declare const max: TgpuDualFn<(<T extends
|
80
|
+
declare const max: TgpuDualFn<(<T extends NumVec | number>(a: T, b: T) => T)>;
|
60
81
|
/**
|
61
82
|
* @privateRemarks
|
62
83
|
* https://www.w3.org/TR/WGSL/#min-float-builtin
|
63
84
|
*/
|
64
|
-
declare const min: TgpuDualFn<(<T extends
|
85
|
+
declare const min: TgpuDualFn<(<T extends NumVec | number>(a: T, b: T) => T)>;
|
86
|
+
declare const sign: TgpuDualFn<(<T extends v2f | v2h | v2i | v3f | v3h | v3i | v4f | v4h | v4i | number>(e: T) => T)>;
|
65
87
|
/**
|
66
88
|
* @privateRemarks
|
67
89
|
* https://www.w3.org/TR/WGSL/#sin-builtin
|
@@ -85,7 +107,8 @@ type MixOverload = {
|
|
85
107
|
declare const mix: MixOverload;
|
86
108
|
declare const reflect: TgpuDualFn<(<T extends AnyFloatVecInstance>(e1: T, e2: T) => T)>;
|
87
109
|
declare const distance: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(a: T, b: T) => number)>;
|
88
|
-
declare const neg: TgpuDualFn<(<T extends
|
110
|
+
declare const neg: TgpuDualFn<(<T extends NumVec | number>(value: T) => T)>;
|
111
|
+
declare const sqrt: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(value: T) => T)>;
|
89
112
|
|
90
113
|
/**
|
91
114
|
* Checks whether `lhs == rhs` on all components.
|
@@ -196,13 +219,15 @@ declare const any: TgpuDualFn<(value: AnyBooleanVecInstance) => boolean>;
|
|
196
219
|
*/
|
197
220
|
declare const isCloseTo: TgpuDualFn<(<T extends AnyFloatVecInstance | number>(lhs: T, rhs: T, precision?: number) => boolean)>;
|
198
221
|
type SelectOverload = {
|
199
|
-
<T extends
|
222
|
+
<T extends number | boolean | AnyVecInstance>(f: T, t: T, cond: boolean): T;
|
200
223
|
<T extends AnyVecInstance>(f: T, t: T, cond: T extends AnyVec2Instance ? v2b : T extends AnyVec3Instance ? v3b : v4b): T;
|
201
224
|
};
|
202
225
|
/**
|
203
226
|
* Returns `t` if `cond` is `true`, and `f` otherwise.
|
204
227
|
* Component-wise if `cond` is a vector.
|
205
228
|
* @example
|
229
|
+
* select(1, 2, false) // returns 1
|
230
|
+
* select(1, 2, true) // returns 2
|
206
231
|
* select(vec2i(1, 2), vec2i(3, 4), true) // returns vec2i(3, 4)
|
207
232
|
* select(vec2i(1, 2), vec2i(3, 4), vec2b(false, true)) // returns vec2i(1, 4)
|
208
233
|
*/
|
@@ -256,5 +281,49 @@ type TextureSampleOverload = {
|
|
256
281
|
<T extends TgpuSampledTexture<'cube-array'>>(texture: T, sampler: TgpuSampler, coords: v3f, arrayIndex: number): v4f;
|
257
282
|
};
|
258
283
|
declare const textureSample: TextureSampleOverload;
|
284
|
+
type TextureSampleLevelOverload = {
|
285
|
+
<T extends TgpuSampledTexture<'2d'>>(texture: T, sampler: TgpuSampler, coords: v2f, level: number, offset?: v2i): v4f;
|
286
|
+
<T extends TgpuSampledTexture<'2d-array'>>(texture: T, sampler: TgpuSampler, coords: v2f, arrayIndex: number, level: number, offset?: v2i): v4f;
|
287
|
+
<T extends TgpuSampledTexture<'3d' | 'cube'>>(texture: T, sampler: TgpuSampler, coords: v3f, level: number, offset?: v3i): v4f;
|
288
|
+
<T extends TgpuSampledTexture<'cube-array'>>(texture: T, sampler: TgpuSampler, coords: v3f, arrayIndex: number, level: number): v4f;
|
289
|
+
};
|
290
|
+
declare const textureSampleLevel: TextureSampleLevelOverload;
|
291
|
+
type TexelDataToInstance<TF extends TexelData> = {
|
292
|
+
vec4f: v4f;
|
293
|
+
vec4i: v4i;
|
294
|
+
vec4u: v4u;
|
295
|
+
}[TF['type']];
|
296
|
+
type SampleTypeToInstance<TF extends ChannelData> = {
|
297
|
+
u32: v4u;
|
298
|
+
i32: v4i;
|
299
|
+
f32: v4f;
|
300
|
+
}[TF['type']];
|
301
|
+
type TextureLoadOverload = {
|
302
|
+
<T extends TgpuStorageTexture<'1d'>>(texture: T, coords: number): TexelDataToInstance<T['texelDataType']>;
|
303
|
+
<T extends TgpuStorageTexture<'2d'>>(texture: T, coords: v2i | v2u): TexelDataToInstance<T['texelDataType']>;
|
304
|
+
<T extends TgpuStorageTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number): TexelDataToInstance<T['texelDataType']>;
|
305
|
+
<T extends TgpuStorageTexture<'3d'>>(texture: T, coords: v3i | v3u): TexelDataToInstance<T['texelDataType']>;
|
306
|
+
<T extends TgpuSampledTexture<'1d'>>(texture: T, coords: number, level: number): SampleTypeToInstance<T['channelDataType']>;
|
307
|
+
<T extends TgpuSampledTexture<'2d'>>(texture: T, coords: v2i | v2u, level: number): SampleTypeToInstance<T['channelDataType']>;
|
308
|
+
<T extends TgpuSampledTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number, level: number): SampleTypeToInstance<T['channelDataType']>;
|
309
|
+
<T extends TgpuSampledTexture<'3d'>>(texture: T, coords: v3i | v3u, level: number): SampleTypeToInstance<T['channelDataType']>;
|
310
|
+
};
|
311
|
+
declare const textureLoad: TextureLoadOverload;
|
312
|
+
type TextureStoreOverload = {
|
313
|
+
<T extends TgpuStorageTexture<'1d'>>(texture: T, coords: number, value: TexelDataToInstance<T['texelDataType']>): void;
|
314
|
+
<T extends TgpuStorageTexture<'2d'>>(texture: T, coords: v2i | v2u, value: TexelDataToInstance<T['texelDataType']>): void;
|
315
|
+
<T extends TgpuStorageTexture<'2d-array'>>(texture: T, coords: v2i | v2u, arrayIndex: number, value: TexelDataToInstance<T['texelDataType']>): void;
|
316
|
+
<T extends TgpuStorageTexture<'3d'>>(texture: T, coords: v3i | v3u, value: TexelDataToInstance<T['texelDataType']>): void;
|
317
|
+
};
|
318
|
+
declare const textureStore: TextureStoreOverload;
|
319
|
+
type TextureDimensionsOverload = {
|
320
|
+
<T extends TgpuSampledTexture<'1d'> | TgpuStorageTexture<'1d'>>(texture: T): number;
|
321
|
+
<T extends TgpuSampledTexture<'1d'>>(texture: T, level: number): number;
|
322
|
+
<T extends TgpuSampledTexture<'2d'> | TgpuSampledTexture<'2d-array'> | TgpuSampledTexture<'cube'> | TgpuSampledTexture<'cube-array'> | TgpuStorageTexture<'2d'> | TgpuStorageTexture<'2d-array'>>(texture: T): v2u;
|
323
|
+
<T extends TgpuSampledTexture<'2d'> | TgpuSampledTexture<'2d-array'> | TgpuSampledTexture<'cube'> | TgpuSampledTexture<'cube-array'>>(texture: T, level: number): v2u;
|
324
|
+
<T extends TgpuSampledTexture<'3d'> | TgpuStorageTexture<'3d'>>(texture: T): v3u;
|
325
|
+
<T extends TgpuSampledTexture<'3d'>>(texture: T, level: number): v3u;
|
326
|
+
};
|
327
|
+
declare const textureDimensions: TextureDimensionsOverload;
|
259
328
|
|
260
|
-
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, 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, sin, storageBarrier, sub, textureBarrier, textureSample, unpack2x16float, unpack4x8unorm, workgroupBarrier };
|
329
|
+
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 };
|
package/std/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{A as x,B as y,C as T,D as p,E as z,F as u,G as ee,H as te,I as ne,M as S,N as O,P as U,R as F,Y as h,p as s,r as o,s as i,t as m,u as f,v,w as l,x as w,y as d,z as g}from"../chunk-KJHEEZQT.js";var he=s(()=>{throw new Error("discard() can only be used on the GPU.")},()=>({value:"discard;",dataType:F}));var R=e=>Math.sqrt(e.x**2+e.y**2),K=e=>Math.sqrt(e.x**2+e.y**2+e.z**2),N=e=>Math.sqrt(e.x**2+e.y**2+e.z**2+e.w**2),D=(e,t)=>e.x*t.x+e.y*t.y,P=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z,G=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,r=(e,t,n)=>Math.min(Math.max(t,e),n),b=e=>t=>o(e(t.x),e(t.y)),M=e=>t=>i(e(t.x),e(t.y)),q=e=>t=>m(e(t.x),e(t.y)),J=e=>t=>f(e(t.x),e(t.y)),A=e=>t=>l(e(t.x),e(t.y),e(t.z)),V=e=>t=>w(e(t.x),e(t.y),e(t.z)),L=e=>t=>d(e(t.x),e(t.y),e(t.z)),j=e=>t=>g(e(t.x),e(t.y),e(t.z)),I=e=>t=>y(e(t.x),e(t.y),e(t.z),e(t.w)),$=e=>t=>T(e(t.x),e(t.y),e(t.z),e(t.w)),X=e=>t=>p(e(t.x),e(t.y),e(t.z),e(t.w)),Z=e=>t=>z(e(t.x),e(t.y),e(t.z),e(t.w)),ae=e=>(t,n)=>o(e(t.x,n.x),e(t.y,n.y)),se=e=>(t,n)=>i(e(t.x,n.x),e(t.y,n.y)),xe=e=>(t,n)=>m(e(t.x,n.x),e(t.y,n.y)),ue=e=>(t,n)=>f(e(t.x,n.x),e(t.y,n.y)),re=e=>(t,n)=>l(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ce=e=>(t,n)=>w(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),we=e=>(t,n)=>d(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ie=e=>(t,n)=>g(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z)),ye=e=>(t,n)=>y(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),oe=e=>(t,n)=>T(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),Te=e=>(t,n)=>p(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),me=e=>(t,n)=>z(e(t.x,n.x),e(t.y,n.y),e(t.z,n.z),e(t.w,n.w)),c={eq:{vec2f:(e,t)=>v(e.x===t.x,e.y===t.y),vec2h:(e,t)=>v(e.x===t.x,e.y===t.y),vec2i:(e,t)=>v(e.x===t.x,e.y===t.y),vec2u:(e,t)=>v(e.x===t.x,e.y===t.y),"vec2<bool>":(e,t)=>v(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)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4h:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4i:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),vec4u:(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w),"vec4<bool>":(e,t)=>u(e.x===t.x,e.y===t.y,e.z===t.z,e.w===t.w)},lt:{vec2f:(e,t)=>v(e.x<t.x,e.y<t.y),vec2h:(e,t)=>v(e.x<t.x,e.y<t.y),vec2i:(e,t)=>v(e.x<t.x,e.y<t.y),vec2u:(e,t)=>v(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)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4h:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4i:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w),vec4u:(e,t)=>u(e.x<t.x,e.y<t.y,e.z<t.z,e.w<t.w)},or:{"vec2<bool>":(e,t)=>v(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)=>u(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:b(Math.abs),vec2h:M(Math.abs),vec2i:q(Math.abs),vec2u:J(Math.abs),vec3f:A(Math.abs),vec3h:V(Math.abs),vec3i:L(Math.abs),vec3u:j(Math.abs),vec4f:I(Math.abs),vec4h:$(Math.abs),vec4i:X(Math.abs),vec4u:Z(Math.abs)},atan2:{vec2f:ae(Math.atan2),vec2h:se(Math.atan2),vec3f:re(Math.atan2),vec3h:ce(Math.atan2),vec4f:ye(Math.atan2),vec4h:oe(Math.atan2)},acos:{vec2f:b(Math.acos),vec2h:M(Math.acos),vec2i:q(Math.acos),vec2u:J(Math.acos),vec3f:A(Math.acos),vec3h:V(Math.acos),vec3i:L(Math.acos),vec3u:j(Math.acos),vec4f:I(Math.acos),vec4h:$(Math.acos),vec4i:X(Math.acos),vec4u:Z(Math.acos)},asin:{vec2f:b(Math.asin),vec2h:M(Math.asin),vec2i:q(Math.asin),vec2u:J(Math.asin),vec3f:A(Math.asin),vec3h:V(Math.asin),vec3i:L(Math.asin),vec3u:j(Math.asin),vec4f:I(Math.asin),vec4h:$(Math.asin),vec4i:X(Math.asin),vec4u:Z(Math.asin)},ceil:{vec2f:b(Math.ceil),vec2h:M(Math.ceil),vec3f:A(Math.ceil),vec3h:V(Math.ceil),vec4f:I(Math.ceil),vec4h:$(Math.ceil)},clamp:{vec2f:(e,t,n)=>o(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec2h:(e,t,n)=>i(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec2i:(e,t,n)=>m(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec2u:(e,t,n)=>f(r(e.x,t.x,n.x),r(e.y,t.y,n.y)),vec3f:(e,t,n)=>l(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z)),vec3h:(e,t,n)=>w(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z)),vec3i:(e,t,n)=>d(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z)),vec3u:(e,t,n)=>g(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z)),vec4f:(e,t,n)=>y(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z),r(e.w,t.w,n.w)),vec4h:(e,t,n)=>T(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z),r(e.w,t.w,n.w)),vec4i:(e,t,n)=>p(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z),r(e.w,t.w,n.w)),vec4u:(e,t,n)=>z(r(e.x,t.x,n.x),r(e.y,t.y,n.y),r(e.z,t.z,n.z),r(e.w,t.w,n.w))},length:{vec2f:R,vec2h:R,vec3f:K,vec3h:K,vec4f:N,vec4h:N},add:{vec2f:(e,t)=>o(e.x+t.x,e.y+t.y),vec2h:(e,t)=>i(e.x+t.x,e.y+t.y),vec2i:(e,t)=>m(e.x+t.x,e.y+t.y),vec2u:(e,t)=>f(e.x+t.x,e.y+t.y),vec3f:(e,t)=>l(e.x+t.x,e.y+t.y,e.z+t.z),vec3h:(e,t)=>w(e.x+t.x,e.y+t.y,e.z+t.z),vec3i:(e,t)=>d(e.x+t.x,e.y+t.y,e.z+t.z),vec3u:(e,t)=>g(e.x+t.x,e.y+t.y,e.z+t.z),vec4f:(e,t)=>y(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)=>p(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w),vec4u:(e,t)=>z(e.x+t.x,e.y+t.y,e.z+t.z,e.w+t.w)},sub:{vec2f:(e,t)=>o(e.x-t.x,e.y-t.y),vec2h:(e,t)=>i(e.x-t.x,e.y-t.y),vec2i:(e,t)=>m(e.x-t.x,e.y-t.y),vec2u:(e,t)=>f(e.x-t.x,e.y-t.y),vec3f:(e,t)=>l(e.x-t.x,e.y-t.y,e.z-t.z),vec3h:(e,t)=>w(e.x-t.x,e.y-t.y,e.z-t.z),vec3i:(e,t)=>d(e.x-t.x,e.y-t.y,e.z-t.z),vec3u:(e,t)=>g(e.x-t.x,e.y-t.y,e.z-t.z),vec4f:(e,t)=>y(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)=>p(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w),vec4u:(e,t)=>z(e.x-t.x,e.y-t.y,e.z-t.z,e.w-t.w)},mulSxV:{vec2f:(e,t)=>o(e*t.x,e*t.y),vec2h:(e,t)=>i(e*t.x,e*t.y),vec2i:(e,t)=>m(e*t.x,e*t.y),vec2u:(e,t)=>f(e*t.x,e*t.y),vec3f:(e,t)=>l(e*t.x,e*t.y,e*t.z),vec3h:(e,t)=>w(e*t.x,e*t.y,e*t.z),vec3i:(e,t)=>d(e*t.x,e*t.y,e*t.z),vec3u:(e,t)=>g(e*t.x,e*t.y,e*t.z),vec4f:(e,t)=>y(e*t.x,e*t.y,e*t.z,e*t.w),vec4h:(e,t)=>T(e*t.x,e*t.y,e*t.z,e*t.w),vec4i:(e,t)=>p(e*t.x,e*t.y,e*t.z,e*t.w),vec4u:(e,t)=>z(e*t.x,e*t.y,e*t.z,e*t.w),mat2x2f:(e,t)=>{let n=t.columns;return ee(e*n[0].x,e*n[0].y,e*n[1].x,e*n[1].y)},mat3x3f:(e,t)=>{let n=t.columns;return te(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 ne(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)=>o(e.x*t.x,e.y*t.y),vec2h:(e,t)=>i(e.x*t.x,e.y*t.y),vec2i:(e,t)=>m(e.x*t.x,e.y*t.y),vec2u:(e,t)=>f(e.x*t.x,e.y*t.y),vec3f:(e,t)=>l(e.x*t.x,e.y*t.y,e.z*t.z),vec3h:(e,t)=>w(e.x*t.x,e.y*t.y,e.z*t.z),vec3i:(e,t)=>d(e.x*t.x,e.y*t.y,e.z*t.z),vec3u:(e,t)=>g(e.x*t.x,e.y*t.y,e.z*t.z),vec4f:(e,t)=>y(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)=>p(e.x*t.x,e.y*t.y,e.z*t.z,e.w*t.w),vec4u:(e,t)=>z(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 ee(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 te(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 ne(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 o(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 l(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 y(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 o(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 l(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 y(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:D,vec2h:D,vec2i:D,vec2u:D,vec3f:P,vec3h:P,vec3i:P,vec3u:P,vec4f:G,vec4h:G,vec4i:G,vec4u:G},normalize:{vec2f:e=>{let t=R(e);return o(e.x/t,e.y/t)},vec2h:e=>{let t=R(e);return i(e.x/t,e.y/t)},vec2i:e=>{let t=R(e);return m(e.x/t,e.y/t)},vec2u:e=>{let t=R(e);return f(e.x/t,e.y/t)},vec3f:e=>{let t=K(e);return l(e.x/t,e.y/t,e.z/t)},vec3h:e=>{let t=K(e);return w(e.x/t,e.y/t,e.z/t)},vec3i:e=>{let t=K(e);return d(e.x/t,e.y/t,e.z/t)},vec3u:e=>{let t=K(e);return g(e.x/t,e.y/t,e.z/t)},vec4f:e=>{let t=N(e);return y(e.x/t,e.y/t,e.z/t,e.w/t)},vec4h:e=>{let t=N(e);return T(e.x/t,e.y/t,e.z/t,e.w/t)},vec4i:e=>{let t=N(e);return p(e.x/t,e.y/t,e.z/t,e.w/t)},vec4u:e=>{let t=N(e);return z(e.x/t,e.y/t,e.z/t,e.w/t)}},cross:{vec3f:(e,t)=>l(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)=>w(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:b(Math.floor),vec2h:M(Math.floor),vec3f:A(Math.floor),vec3h:V(Math.floor),vec4f:I(Math.floor),vec4h:$(Math.floor)},max:{vec2f:ae(Math.max),vec2h:se(Math.max),vec2i:xe(Math.max),vec2u:ue(Math.max),vec3f:re(Math.max),vec3h:ce(Math.max),vec3i:we(Math.max),vec3u:ie(Math.max),vec4f:ye(Math.max),vec4h:oe(Math.max),vec4i:Te(Math.max),vec4u:me(Math.max)},min:{vec2f:ae(Math.min),vec2h:se(Math.min),vec2i:xe(Math.min),vec2u:ue(Math.min),vec3f:re(Math.min),vec3h:ce(Math.min),vec3i:we(Math.min),vec3u:ie(Math.min),vec4f:ye(Math.min),vec4h:oe(Math.min),vec4i:Te(Math.min),vec4u:me(Math.min)},pow:{vec2f:(e,t)=>o(e.x**t.x,e.y**t.y),vec2h:(e,t)=>i(e.x**t.x,e.y**t.y),vec3f:(e,t)=>l(e.x**t.x,e.y**t.y,e.z**t.z),vec3h:(e,t)=>w(e.x**t.x,e.y**t.y,e.z**t.z),vec4f:(e,t)=>y(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)},mix:{vec2f:(e,t,n)=>typeof n=="number"?o(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):o(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"?i(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n):i(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"?l(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):l(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"?w(e.x*(1-n)+t.x*n,e.y*(1-n)+t.y*n,e.z*(1-n)+t.z*n):w(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"?y(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):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,e.w*(1-n.w)+t.w*n.w),vec4h:(e,t,n)=>typeof n=="number"?T(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):T(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:b(Math.sin),vec2h:M(Math.sin),vec3f:A(Math.sin),vec3h:V(Math.sin),vec4f:I(Math.sin),vec4h:$(Math.sin)},cos:{vec2f:b(Math.cos),vec2h:M(Math.cos),vec3f:A(Math.cos),vec3h:V(Math.cos),vec4f:I(Math.cos),vec4h:$(Math.cos)},exp:{vec2f:b(Math.exp),vec2h:M(Math.exp),vec3f:A(Math.exp),vec3h:V(Math.exp),vec4f:I(Math.exp),vec4h:$(Math.exp)},fract:{vec2f:b(e=>e-Math.floor(e)),vec2h:M(e=>e-Math.floor(e)),vec3f:A(e=>e-Math.floor(e)),vec3h:V(e=>e-Math.floor(e)),vec4f:I(e=>e-Math.floor(e)),vec4h:$(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:b(e=>-e),vec2h:M(e=>-e),vec2i:q(e=>-e),vec2u:J(e=>-e),"vec2<bool>":e=>v(!e.x,!e.y),vec3f:A(e=>-e),vec3h:V(e=>-e),vec3i:L(e=>-e),vec3u:j(e=>-e),"vec3<bool>":e=>x(!e.x,!e.y,!e.z),vec4f:I(e=>-e),vec4h:$(e=>-e),vec4i:X(e=>-e),vec4u:Z(e=>-e),"vec4<bool>":e=>u(!e.x,!e.y,!e.z,!e.w)},select:{vec2f:(e,t,n)=>o(n.x?t.x:e.x,n.y?t.y:e.y),vec2h:(e,t,n)=>i(n.x?t.x:e.x,n.y?t.y:e.y),vec2i:(e,t,n)=>m(n.x?t.x:e.x,n.y?t.y:e.y),vec2u:(e,t,n)=>f(n.x?t.x:e.x,n.y?t.y:e.y),"vec2<bool>":(e,t,n)=>v(n.x?t.x:e.x,n.y?t.y:e.y),vec3f:(e,t,n)=>l(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3h:(e,t,n)=>w(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3i:(e,t,n)=>d(n.x?t.x:e.x,n.y?t.y:e.y,n.z?t.z:e.z),vec3u:(e,t,n)=>g(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)=>y(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)=>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),vec4i:(e,t,n)=>p(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)=>z(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)=>u(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 W(e){let t=e.dataType.type;return t==="abstractInt"||t==="abstractFloat"||t==="f32"||t==="f16"||t==="i32"||t==="u32"}var be=s((e,t)=>c.add[e.kind](e,t),(e,t)=>({value:`(${e.value} + ${t.value})`,dataType:e.dataType})),_=s((e,t)=>c.sub[e.kind](e,t),(e,t)=>({value:`(${e.value} - ${t.value})`,dataType:e.dataType})),fe=s((e,t)=>{if(typeof e=="number")return c.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 c.mulMxV[e.kind](e,t);if(n&&!a)return c.mulVxM[t.kind](e,t)}return c.mulVxV[t.kind](e,t)},(e,t)=>{let n=W(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}}),Me=s(e=>typeof e=="number"?Math.abs(e):c.abs[e.kind](e),e=>({value:`abs(${e.value})`,dataType:e.dataType})),Ae=s((e,t)=>typeof e=="number"&&typeof t=="number"?Math.atan2(e,t):c.atan2[e.kind](e,t),(e,t)=>({value:`atan2(${e.value}, ${t.value})`,dataType:e.dataType})),Ve=s(e=>typeof e=="number"?Math.acos(e):c.acos[e.kind](e),e=>({value:`acos(${e.value})`,dataType:e.dataType})),Ie=s(e=>typeof e=="number"?Math.asin(e):c.asin[e.kind](e),e=>({value:`asin(${e.value})`,dataType:e.dataType})),$e=s(e=>typeof e=="number"?Math.ceil(e):c.ceil[e.kind](e),e=>({value:`ceil(${e.value})`,dataType:e.dataType})),Be=s((e,t,n)=>typeof e=="number"?Math.min(Math.max(t,e),n):c.clamp[e.kind](e,t,n),(e,t,n)=>({value:`clamp(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),ke=s(e=>typeof e=="number"?Math.cos(e):c.cos[e.kind](e),e=>({value:`cos(${e.value})`,dataType:e.dataType})),Se=s((e,t)=>c.cross[e.kind](e,t),(e,t)=>({value:`cross(${e.value}, ${t.value})`,dataType:e.dataType})),de=s((e,t)=>c.dot[e.kind](e,t),(e,t)=>({value:`dot(${e.value}, ${t.value})`,dataType:U})),Oe=s(e=>c.normalize[e.kind](e),e=>({value:`normalize(${e.value})`,dataType:e.dataType})),Fe=s(e=>typeof e=="number"?Math.floor(e):c.floor[e.kind](e),e=>({value:`floor(${e.value})`,dataType:e.dataType})),Ue=s(e=>typeof e=="number"?e-Math.floor(e):c.fract[e.kind](e),e=>({value:`fract(${e.value})`,dataType:e.dataType})),ge=s(e=>typeof e=="number"?Math.abs(e):c.length[e.kind](e),e=>({value:`length(${e.value})`,dataType:U})),Re=s((e,t)=>typeof e=="number"?Math.max(e,t):c.max[e.kind](e,t),(e,t)=>({value:`max(${e.value}, ${t.value})`,dataType:e.dataType})),Ke=s((e,t)=>typeof e=="number"?Math.min(e,t):c.min[e.kind](e,t),(e,t)=>({value:`min(${e.value}, ${t.value})`,dataType:e.dataType})),Ne=s(e=>typeof e=="number"?Math.sin(e):c.sin[e.kind](e),e=>({value:`sin(${e.value})`,dataType:e.dataType})),We=s(e=>typeof e=="number"?Math.exp(e):c.exp[e.kind](e),e=>({value:`exp(${e.value})`,dataType:e.dataType})),Ee=s((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 c.pow[e.kind](e,t);throw new Error("Invalid arguments to pow()")},(e,t)=>({value:`pow(${e.value}, ${t.value})`,dataType:e.dataType})),_e=s((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 c.mix[e.kind](e,t,n)},(e,t,n)=>({value:`mix(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType})),Ce=s((e,t)=>_(e,fe(2*de(t,e),t)),(e,t)=>({value:`reflect(${e.value}, ${t.value})`,dataType:e.dataType})),De=s((e,t)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t):ge(_(e,t)),(e,t)=>({value:`distance(${e.value}, ${t.value})`,dataType:U})),Pe=s(e=>typeof e=="number"?-e:c.neg[e.kind](e),e=>({value:`-(${e.value})`,dataType:e.dataType}));function E(e){return e.dataType.type.includes("2")?v:e.dataType.type.includes("3")?x:u}var Ge=s((e,t)=>ve(C(e,t)),(e,t)=>({value:`all(${e.value} == ${t.value})`,dataType:S})),C=s((e,t)=>c.eq[e.kind](e,t),(e,t)=>({value:`(${e.value} == ${t.value})`,dataType:E(e)})),qe=s((e,t)=>k(C(e,t)),(e,t)=>({value:`(${e.value} != ${t.value})`,dataType:E(e)})),H=s((e,t)=>c.lt[e.kind](e,t),(e,t)=>({value:`(${e.value} < ${t.value})`,dataType:E(e)})),Je=s((e,t)=>le(H(e,t),C(e,t)),(e,t)=>({value:`(${e.value} <= ${t.value})`,dataType:E(e)})),Le=s((e,t)=>pe(k(H(e,t)),k(C(e,t))),(e,t)=>({value:`(${e.value} > ${t.value})`,dataType:E(e)})),je=s((e,t)=>k(H(e,t)),(e,t)=>({value:`(${e.value} >= ${t.value})`,dataType:E(e)})),k=s(e=>c.neg[e.kind](e),e=>({value:`!(${e.value})`,dataType:e.dataType})),le=s((e,t)=>c.or[e.kind](e,t),(e,t)=>({value:`(${e.value} | ${t.value})`,dataType:e.dataType})),pe=s((e,t)=>k(le(k(e),k(t))),(e,t)=>({value:`(${e.value} & ${t.value})`,dataType:e.dataType})),ve=s(e=>c.all[e.kind](e),e=>({value:`all(${e.value})`,dataType:S})),Xe=s(e=>!ve(k(e)),e=>({value:`any(${e.value})`,dataType:S})),Ze=s((e,t,n=.01)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<n:typeof e!="number"&&typeof t!="number"?c.isCloseToZero[e.kind](_(e,t),n):!1,(e,t,n={value:.01,dataType:U})=>W(e)&&W(t)?{value:`(abs(f32(${e.value}) - f32(${t.value})) <= ${n.value})`,dataType:S}:!W(e)&&!W(t)?{value:`all(abs(${e.value} - ${t.value}) <= (${e.value} - ${e.value}) + ${n.value})`,dataType:S}:{value:"false",dataType:S}),He=s((e,t,n)=>typeof n=="boolean"?n?t:e:c.select[e.kind](e,t,n),(e,t,n)=>({value:`select(${e.value}, ${t.value}, ${n.value})`,dataType:e.dataType}));var Qe=s(()=>console.warn("workgroupBarrier is a no-op outside of GPU mode."),()=>({value:"workgroupBarrier()",dataType:F})),Ye=s(()=>console.warn("storageBarrier is a no-op outside of GPU mode."),()=>({value:"storageBarrier()",dataType:F})),et=s(()=>console.warn("textureBarrier is a no-op outside of GPU mode."),()=>({value:"textureBarrier()",dataType:F})),tt=s(e=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},e=>{if(h(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)}`)}),nt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(!h(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:F}}),at=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(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)}`)}),st=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(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)}`)}),rt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(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)}`)}),ct=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(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)}`)}),yt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(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)}`)}),ot=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(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)}`)}),lt=s((e,t)=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},(e,t)=>{if(h(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)}`)});var vt=s(e=>e.length,e=>({value:`arrayLength(&${e.value})`,dataType:O}));import*as B from"typed-binary";var xt=s(e=>{let t=new ArrayBuffer(4);new B.BufferWriter(t).writeUint32(e);let a=new B.BufferReader(t);return o(a.readFloat16(),a.readFloat16())},e=>({value:`unpack2x16float(${e.value})`,dataType:o})),ut=s(e=>{let t=new ArrayBuffer(4),n=new B.BufferWriter(t);n.writeFloat16(e.x),n.writeFloat16(e.y);let a=new B.BufferReader(t);return O(a.readUint32())},e=>({value:`pack2x16float(${e.value})`,dataType:O})),wt=s(e=>{let t=new ArrayBuffer(4);new B.BufferWriter(t).writeUint32(e);let a=new B.BufferReader(t);return y(a.readUint8()/255,a.readUint8()/255,a.readUint8()/255,a.readUint8()/255)},e=>({value:`unpack4x8unorm(${e.value})`,dataType:y})),it=s(e=>{let t=new ArrayBuffer(4),n=new B.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 B.BufferReader(t);return O(a.readUint32())},e=>({value:`pack4x8unorm(${e.value})`,dataType:O}));var Tt=s((e,t,n,a,Q)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,n,a,Q)=>{let Y=[e,t,n];return a!==void 0&&Y.push(a),Q!==void 0&&Y.push(Q),{value:`textureSample(${Y.map(ze=>ze.value).join(", ")})`,dataType:y}});export{Me as abs,Ve as acos,be as add,ve as all,Ge as allEq,pe as and,Xe as any,vt as arrayLength,Ie as asin,Ae as atan2,at as atomicAdd,yt as atomicAnd,tt as atomicLoad,rt as atomicMax,ct as atomicMin,ot as atomicOr,nt as atomicStore,st as atomicSub,lt as atomicXor,$e as ceil,Be as clamp,ke as cos,Se as cross,he as discard,De as distance,de as dot,C as eq,We as exp,Fe as floor,Ue as fract,je as ge,Le as gt,Ze as isCloseTo,Je as le,ge as length,H as lt,Re as max,Ke as min,_e as mix,fe as mul,qe as ne,Pe as neg,Oe as normalize,k as not,le as or,ut as pack2x16float,it as pack4x8unorm,Ee as pow,Ce as reflect,He as select,Ne as sin,Ye as storageBarrier,_ as sub,et as textureBarrier,Tt as textureSample,xt as unpack2x16float,wt as unpack4x8unorm,Qe as workgroupBarrier};
|
1
|
+
import{A as de,B as ie,C as me,D as se,E as le,a as l,b as f,d as J,e as I,f as C,g as M,h as q,i as j,j as R,k as X,l as z,m as Z,n as H,o as K,p as Q,q as Y,r as ee,s as te,t as re,u as ae,v as oe,w as ne,x as ue,y as pe,z as Te}from"../chunk-SLWTVY6K.js";import{Aa as h,Ga as F,I as T,J as B,L as V,ba as r,ea as a,fa as U,ha as c,ia as p,ja as k,ka as E,ma as A,pa as O,qa as _,ua as P,va as G,wa as x,y as i,ya as L,z as w,za as N}from"../chunk-L7HIBZAX.js";var ce=a(()=>{throw new Error("discard() can only be used on the GPU.")},()=>r("discard;",i));function v(e){return e.dataType.type.includes("2")?_:e.dataType.type.includes("3")?G:h}var xe=a((e,t)=>D(g(e,t)),(e,t)=>r(`all(${e.value} == ${t.value})`,c)),g=a((e,t)=>l.eq[e.kind](e,t),(e,t)=>r(`(${e.value} == ${t.value})`,v(e))),ye=a((e,t)=>m(g(e,t)),(e,t)=>r(`(${e.value} != ${t.value})`,v(e))),S=a((e,t)=>l.lt[e.kind](e,t),(e,t)=>r(`(${e.value} < ${t.value})`,v(e))),ve=a((e,t)=>$(S(e,t),g(e,t)),(e,t)=>r(`(${e.value} <= ${t.value})`,v(e))),fe=a((e,t)=>W(m(S(e,t)),m(g(e,t))),(e,t)=>r(`(${e.value} > ${t.value})`,v(e))),ge=a((e,t)=>m(S(e,t)),(e,t)=>r(`(${e.value} >= ${t.value})`,v(e))),m=a(e=>l.neg[e.kind](e),e=>r(`!(${e.value})`,e.dataType)),$=a((e,t)=>l.or[e.kind](e,t),(e,t)=>r(`(${e.value} | ${t.value})`,e.dataType)),W=a((e,t)=>m($(m(e),m(t))),(e,t)=>r(`(${e.value} & ${t.value})`,e.dataType)),D=a(e=>l.all[e.kind](e),e=>r(`all(${e.value})`,c)),Se=a(e=>!D(m(e)),e=>r(`any(${e.value})`,c)),be=a((e,t,o=.01)=>typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<o:w(e)&&w(t)?l.isCloseToZero[e.kind](I(e,t),o):!1,(e,t,o=r(.01,E))=>f(e)&&f(t)?r(`(abs(f32(${e.value}) - f32(${t.value})) <= ${o.value})`,c):!f(e)&&!f(t)?r(`all(abs(${e.value} - ${t.value}) <= (${e.value} - ${e.value}) + ${o.value})`,c):r("false",c)),we=a((e,t,o)=>typeof o=="boolean"?o?t:e:l.select[e.kind](e,t,o),(e,t,o)=>r(`select(${e.value}, ${t.value}, ${o.value})`,e.dataType));var Ae=a(()=>console.warn("workgroupBarrier is a no-op outside of GPU mode."),()=>r("workgroupBarrier()",i)),Ie=a(()=>console.warn("storageBarrier is a no-op outside of GPU mode."),()=>r("storageBarrier()",i)),$e=a(()=>console.warn("textureBarrier is a no-op outside of GPU mode."),()=>r("textureBarrier()",i)),De=a(e=>{throw new Error("Atomic operations are not supported outside of GPU mode.")},e=>{if(T(e.dataType)&&e.dataType.type==="atomic")return r(`atomicLoad(&${e.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)}),Be=a((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 r(`atomicStore(&${e.value}, ${t.value})`,i)}),y=(e,t)=>e.dataType.type==="atomic"&&e.dataType.inner.type==="i32"?[e.dataType,k]:[e.dataType,p],Ve=a((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 r(`atomicAdd(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},y),Ue=a((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 r(`atomicSub(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},y),ke=a((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 r(`atomicMax(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},y),Ee=a((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 r(`atomicMin(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},y),Oe=a((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 r(`atomicAnd(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},y),_e=a((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 r(`atomicOr(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},y),Pe=a((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 r(`atomicXor(&${e.value}, ${t.value})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${JSON.stringify(e.dataType,null,2)}`)},y);var Ge=a(e=>e.length,e=>V(e.dataType)&&B(e.dataType.inner)&&e.dataType.inner.elementCount>0?r(String(e.dataType.inner.elementCount),U):r(`arrayLength(${e.value})`,p),e=>[F(e.dataType)]);import*as d from"typed-binary";var Le=a(e=>{let t=new ArrayBuffer(4);new d.BufferWriter(t).writeUint32(e);let n=new d.BufferReader(t);return A(n.readFloat16(),n.readFloat16())},e=>r(`unpack2x16float(${e.value})`,A)),Ne=a(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=>r(`pack2x16float(${e.value})`,p)),he=a(e=>{let t=new ArrayBuffer(4);new d.BufferWriter(t).writeUint32(e);let n=new d.BufferReader(t);return x(n.readUint8()/255,n.readUint8()/255,n.readUint8()/255,n.readUint8()/255)},e=>r(`unpack4x8unorm(${e.value})`,x)),Fe=a(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=>r(`pack4x8unorm(${e.value})`,p));var We=a((e,t,o,n,u)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,o,n,u)=>{let s=[e,t,o];return n!==void 0&&s.push(n),u!==void 0&&s.push(u),r(`textureSample(${s.map(b=>b.value).join(", ")})`,x)}),Je=a((e,t,o,n,u)=>{throw new Error("Texture sampling is not supported outside of GPU mode.")},(e,t,o,n,u)=>{let s=[e,t,o,n];return u!==void 0&&s.push(u),r(`textureSampleLevel(${s.map(b=>b.value).join(", ")})`,x)}),Ce={u32:N,i32:L,f32:x},Me=a((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 r(`textureLoad(${n.map(s=>s.value).join(", ")})`,"texelDataType"in u?u.texelDataType:Ce[u.channelDataType.type])}),qe=a((e,t,o,n)=>{throw new Error("Texture storing is not supported outside of GPU mode.")},(e,t,o,n)=>r(`textureStore(${[e,t,o,n].filter(u=>u!==void 0).map(u=>u.value).join(", ")})`,i)),je=a((e,t)=>{throw new Error("Texture dimensions are not supported outside of GPU mode.")},(e,t)=>{let o=e.dataType.dimension;return r(`textureDimensions(${e.value}${t!==void 0?`, ${t.value}`:""})`,o==="1d"?p:o==="3d"?P:O)});export{q as abs,R as acos,J as add,D as all,xe as allEq,W as and,Se as any,Ge as arrayLength,X as asin,j as atan2,Ve as atomicAdd,Oe as atomicAnd,De as atomicLoad,ke as atomicMax,Ee as atomicMin,_e as atomicOr,Be as atomicStore,Ue as atomicSub,Pe as atomicXor,z as ceil,Z as clamp,H as cos,K as cross,ce as discard,me as distance,M as div,Q as dot,g as eq,pe as exp,ee as floor,te as fract,ge,fe as gt,be as isCloseTo,ve as le,re as length,S as lt,ae as max,oe as min,de as mix,C as mul,ye as ne,se as neg,Y as normalize,m as not,$ as or,Ne as pack2x16float,Fe as pack4x8unorm,Te as pow,ie as reflect,we as select,ne as sign,ue as sin,le as sqrt,Ie as storageBarrier,I as sub,$e as textureBarrier,je as textureDimensions,Me as textureLoad,We as textureSample,Je as textureSampleLevel,qe as textureStore,Le as unpack2x16float,he as unpack4x8unorm,Ae as workgroupBarrier};
|
2
2
|
//# sourceMappingURL=index.js.map
|