typegpu 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/chunk-5ABKYSJD.js +2 -0
- package/chunk-5ABKYSJD.js.map +1 -0
- package/chunk-D5UYO3OX.js +3 -0
- package/chunk-D5UYO3OX.js.map +1 -0
- package/chunk-EHLRP4V2.js +2 -0
- package/chunk-EHLRP4V2.js.map +1 -0
- package/chunk-LMPPDGRD.js +2 -0
- package/chunk-LMPPDGRD.js.map +1 -0
- package/chunk-MBB2XFH6.js +2 -0
- package/chunk-MBB2XFH6.js.map +1 -0
- package/chunk-SHSILTWI.js +10 -0
- package/chunk-SHSILTWI.js.map +1 -0
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/common/index.js.map +1 -1
- package/comptime-DKpw1IVu.d.ts +28 -0
- package/data/index.d.ts +124 -123
- package/data/index.js +1 -1
- package/data/index.js.map +1 -1
- package/index.d.ts +114 -25
- package/index.js +169 -164
- package/index.js.map +1 -1
- package/{matrix-DHFT4O8f.d.cts → matrix-C4IFKU1R.d.ts} +5 -4
- package/package.json +6 -14
- package/std/index.d.ts +25 -41
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/{tgpuConstant-BU72w5qs.d.cts → tgpuConstant-BOn7U_lv.d.ts} +135 -1296
- package/chunk-2UXPGML5.js +0 -7
- package/chunk-2UXPGML5.js.map +0 -1
- package/chunk-3246CM7C.cjs +0 -2
- package/chunk-3246CM7C.cjs.map +0 -1
- package/chunk-4W5Z7BO4.js +0 -10
- package/chunk-4W5Z7BO4.js.map +0 -1
- package/chunk-5Y6GTBWR.cjs +0 -3
- package/chunk-5Y6GTBWR.cjs.map +0 -1
- package/chunk-7S3IK3D4.js +0 -2
- package/chunk-7S3IK3D4.js.map +0 -1
- package/chunk-7XFSK632.js +0 -3
- package/chunk-7XFSK632.js.map +0 -1
- package/chunk-PRMFGUQT.cjs +0 -2
- package/chunk-PRMFGUQT.cjs.map +0 -1
- package/chunk-TRE7NUKE.cjs +0 -10
- package/chunk-TRE7NUKE.cjs.map +0 -1
- package/chunk-VOVQAOVG.js +0 -2
- package/chunk-VOVQAOVG.js.map +0 -1
- package/chunk-ZYGTVBDH.cjs +0 -7
- package/chunk-ZYGTVBDH.cjs.map +0 -1
- package/common/index.cjs +0 -7
- package/common/index.cjs.map +0 -1
- package/common/index.d.cts +0 -24
- package/data/index.cjs +0 -2
- package/data/index.cjs.map +0 -1
- package/data/index.d.cts +0 -402
- package/index.cjs +0 -192
- package/index.cjs.map +0 -1
- package/index.d.cts +0 -369
- package/matrix-DLipCOZF.d.ts +0 -122
- package/std/index.cjs +0 -2
- package/std/index.cjs.map +0 -1
- package/std/index.d.cts +0 -639
- package/tgpuConstant-BU72w5qs.d.ts +0 -5192
package/common/index.d.ts
CHANGED
package/common/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as n}from"../chunk-
|
|
1
|
+
import{h as n}from"../chunk-D5UYO3OX.js";import{o as e}from"../chunk-MBB2XFH6.js";import{nb as r}from"../chunk-SHSILTWI.js";var o=n({in:{vertexIndex:e.vertexIndex},out:{pos:e.position,uv:r}})`{
|
|
2
2
|
const pos = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));
|
|
3
3
|
const uv = array<vec2f, 3>(vec2f(0, 1), vec2f(2, 1), vec2f(0, -1));
|
|
4
4
|
|
package/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/common/fullScreenTriangle.ts"],"sourcesContent":["import { builtin } from '../builtin.ts';\nimport { vertexFn } from '../core/function/tgpuVertexFn.ts';\nimport { vec2f } from '../data/vector.ts';\n\n/**\n * A vertex function that defines a single full-screen triangle out\n * of three points.\n *\n * @example\n * ```ts\n * import { fullScreenTriangle } from 'typegpu/common';\n *\n * const pipeline = root['~unstable']\n * .withVertex(fullScreenTriangle)\n * .withFragment(yourFragmentShader)\n * .createPipeline();\n *\n * pipeline.draw(3);\n * ```\n */\nexport const fullScreenTriangle = vertexFn({\n in: { vertexIndex: builtin.vertexIndex },\n out: { pos: builtin.position, uv: vec2f },\n})`{\n const pos = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n const uv = array<vec2f, 3>(vec2f(0, 1), vec2f(2, 1), vec2f(0, -1));\n\n return Out(vec4f(pos[in.vertexIndex], 0, 1), uv[in.vertexIndex]);\n}`;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/common/fullScreenTriangle.ts"],"sourcesContent":["import { builtin } from '../builtin.ts';\nimport { vertexFn } from '../core/function/tgpuVertexFn.ts';\nimport { vec2f } from '../data/vector.ts';\n\n/**\n * A vertex function that defines a single full-screen triangle out\n * of three points.\n *\n * @example\n * ```ts\n * import { fullScreenTriangle } from 'typegpu/common';\n *\n * const pipeline = root['~unstable']\n * .withVertex(fullScreenTriangle)\n * .withFragment(yourFragmentShader)\n * .createPipeline();\n *\n * pipeline.draw(3);\n * ```\n */\nexport const fullScreenTriangle = vertexFn({\n in: { vertexIndex: builtin.vertexIndex },\n out: { pos: builtin.position, uv: vec2f },\n})`{\n const pos = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n const uv = array<vec2f, 3>(vec2f(0, 1), vec2f(2, 1), vec2f(0, -1));\n\n return Out(vec4f(pos[in.vertexIndex], 0, 1), uv[in.vertexIndex]);\n}`;\n"],"mappings":"4HAoBO,IAAMA,EAAqBC,EAAS,CACzC,GAAI,CAAE,YAAaC,EAAQ,WAAY,EACvC,IAAK,CAAE,IAAKA,EAAQ,SAAU,GAAIC,CAAM,CAC1C,CAAC;AAAA;AAAA;AAAA;AAAA;","names":["fullScreenTriangle","vertexFn","builtin","vec2f"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { dO as DualFn, e8 as TgpuNamable, e9 as $getNameForward } from './tgpuConstant-BOn7U_lv.js';
|
|
2
|
+
|
|
3
|
+
type TgpuComptime<T extends (...args: never[]) => unknown> = DualFn<T> & TgpuNamable & {
|
|
4
|
+
[$getNameForward]: unknown;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Creates a version of `func` that can called safely in a TypeGPU function to
|
|
8
|
+
* precompute and inject a value into the final shader code.
|
|
9
|
+
*
|
|
10
|
+
* Note how the function passed into `comptime` doesn't have to be marked with
|
|
11
|
+
* 'use gpu'. That's because the function doesn't execute on the GPU, it gets
|
|
12
|
+
* executed before the shader code gets sent to the GPU.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const injectRand01 = tgpu['~unstable']
|
|
17
|
+
* .comptime(() => Math.random());
|
|
18
|
+
*
|
|
19
|
+
* const getColor = (diffuse: d.v3f) => {
|
|
20
|
+
* 'use gpu';
|
|
21
|
+
* const albedo = hsvToRgb(injectRand01(), 1, 0.5);
|
|
22
|
+
* return albedo.mul(diffuse);
|
|
23
|
+
* };
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare function comptime<T extends (...args: never[]) => unknown>(func: T): TgpuComptime<T>;
|
|
27
|
+
|
|
28
|
+
export { type TgpuComptime as T, comptime as c };
|
package/data/index.d.ts
CHANGED
|
@@ -1,8 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { aU as Bool, aV as F16, aW as F32, aX as I32, aY as U16, aZ as U32, k as AnyWgslData, a_ as WgslStruct, r as WgslArray, a$ as StorableData, b0 as Ptr, b1 as Vec2b, aT as Vec2f, b2 as Vec2h, b3 as Vec2i, b4 as Vec2u, b5 as Vec3b, b6 as Vec3f, b7 as Vec3h, b8 as Vec3i, b9 as Vec3u, ba as Vec4b, bb as Vec4f, bc as Vec4h, bd as Vec4i, be as Vec4u, A as AnyData, D as Disarray, bf as BaseData, bg as Unstruct, bh as Atomic } from '../tgpuConstant-BOn7U_lv.js';
|
|
2
|
+
export { bu as Align, cB as AnyAttribute, cP as AnyBuiltin, bU as AnyLooseData, bv as AnyVecInstance, bw as AnyWgslStruct, bx as Builtin, cQ as BuiltinClipDistances, cR as BuiltinFragDepth, cS as BuiltinFrontFacing, cT as BuiltinGlobalInvocationId, cU as BuiltinInstanceIndex, cV as BuiltinLocalInvocationId, cW as BuiltinLocalInvocationIndex, cX as BuiltinNumWorkgroups, cY as BuiltinPosition, cZ as BuiltinSampleIndex, c_ as BuiltinSampleMask, c$ as BuiltinVertexIndex, d0 as BuiltinWorkgroupId, by as Decorated, d2 as FormatToWGSLType, cC as HasCustomLocation, o as Infer, I as InferGPU, d1 as InferPartial, bz as Interpolate, cF as IsBuiltin, bA as Location, bV as LooseDecorated, bE as Mat2x2f, bF as Mat3x3f, bG as Mat4x4f, dM as PackedData, bH as Size, d3 as TgpuVertexFormatData, bt as Void, cx as WgslComparisonSampler, cb as WgslExternalTexture, cy as WgslSampler, cc as WgslStorageTexture, cd as WgslStorageTexture1d, ce as WgslStorageTexture2d, cf as WgslStorageTexture2dArray, cg as WgslStorageTexture3d, ch as WgslStorageTextureProps, ci as WgslTexture, cj as WgslTexture1d, ck as WgslTexture2d, cl as WgslTexture2dArray, cm as WgslTexture3d, cn as WgslTextureCube, co as WgslTextureCubeArray, cp as WgslTextureDepth2d, cq as WgslTextureDepth2dArray, cr as WgslTextureDepthCube, cs as WgslTextureDepthCubeArray, ct as WgslTextureDepthMultisampled2d, cu as WgslTextureMultisampled2d, cA as align, cO as builtin, cv as comparisonSampler, dv as float16, dw as float16x2, dx as float16x4, dy as float32, dz as float32x2, dA as float32x3, dB as float32x4, d4 as formatToWGSLType, cD as interpolate, cE as invariant, bi as isAlignAttrib, bj as isAtomic, cG as isBuiltin, bk as isBuiltinAttrib, cJ as isData, bl as isDecorated, cK as isDisarray, bm as isInterpolateAttrib, bn as isLocationAttrib, cL as isLooseData, cM as isLooseDecorated, dN as isPackedData, bo as isPtr, bp as isSizeAttrib, cN as isUnstruct, bq as isWgslArray, br as isWgslData, bs as isWgslStruct, cH as location, bB as m2x2f, bC as m3x3f, bD as m4x4f, d5 as packedFormats, cz as ref, cw as sampler, dl as sint16, dm as sint16x2, dn as sint16x4, dG as sint32, dH as sint32x2, dI as sint32x3, dJ as sint32x4, d9 as sint8, da as sint8x2, db as sint8x4, cI as size, ds as snorm16, dt as snorm16x2, du as snorm16x4, df as snorm8, dg as snorm8x2, dh as snorm8x4, bW as texture1d, bX as texture2d, bY as texture2dArray, bZ as texture3d, b_ as textureCube, b$ as textureCubeArray, c0 as textureDepth2d, c1 as textureDepth2dArray, c2 as textureDepthCube, c3 as textureDepthCubeArray, c4 as textureDepthMultisampled2d, c5 as textureExternal, c6 as textureMultisampled2d, c7 as textureStorage1d, c8 as textureStorage2d, c9 as textureStorage2dArray, ca as textureStorage3d, di as uint16, dj as uint16x2, dk as uint16x4, dC as uint32, dD as uint32x2, dE as uint32x3, dF as uint32x4, d6 as uint8, d7 as uint8x2, d8 as uint8x4, dK as unorm10_10_10_2, dp as unorm16, dq as unorm16x2, dr as unorm16x4, dc as unorm8, dd as unorm8x2, de as unorm8x4, dL as unorm8x4_bgra, bI as v2b, bJ as v2f, bK as v2i, bL as v2u, bM as v3b, bN as v3f, bO as v3i, bP as v3u, bQ as v4b, bR as v4f, bS as v4i, bT as v4u } from '../tgpuConstant-BOn7U_lv.js';
|
|
3
|
+
import { T as TgpuComptime } from '../comptime-DKpw1IVu.js';
|
|
4
|
+
export { m as mat2x2f, a as mat3x3f, b as mat4x4f, c as matToArray } from '../matrix-C4IFKU1R.js';
|
|
4
5
|
import 'tinyest';
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* A schema that represents a boolean value. (equivalent to `bool` in WGSL)
|
|
9
|
+
*
|
|
10
|
+
* Can also be called to cast a value to a bool in accordance with WGSL casting rules.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const value = bool(); // false
|
|
14
|
+
* @example
|
|
15
|
+
* const value = bool(0); // false
|
|
16
|
+
* @example
|
|
17
|
+
* const value = bool(-0); // false
|
|
18
|
+
* @example
|
|
19
|
+
* const value = bool(21.37); // true
|
|
20
|
+
*/
|
|
21
|
+
declare const bool: Bool;
|
|
22
|
+
/**
|
|
23
|
+
* A schema that represents an unsigned 32-bit integer value. (equivalent to `u32` in WGSL)
|
|
24
|
+
*
|
|
25
|
+
* Can also be called to cast a value to an u32 in accordance with WGSL casting rules.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const value = u32(); // 0
|
|
29
|
+
* @example
|
|
30
|
+
* const value = u32(7); // 7
|
|
31
|
+
* @example
|
|
32
|
+
* const value = u32(3.14); // 3
|
|
33
|
+
* @example
|
|
34
|
+
* const value = u32(-1); // 4294967295
|
|
35
|
+
* @example
|
|
36
|
+
* const value = u32(-3.1); // 0
|
|
37
|
+
*/
|
|
38
|
+
declare const u32: U32;
|
|
39
|
+
declare const u16: U16;
|
|
40
|
+
/**
|
|
41
|
+
* A schema that represents a signed 32-bit integer value. (equivalent to `i32` in WGSL)
|
|
42
|
+
*
|
|
43
|
+
* Can also be called to cast a value to an i32 in accordance with WGSL casting rules.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const value = i32(); // 0
|
|
47
|
+
* @example
|
|
48
|
+
* const value = i32(3.14); // 3
|
|
49
|
+
* @example
|
|
50
|
+
* const value = i32(-3.9); // -3
|
|
51
|
+
* @example
|
|
52
|
+
* const value = i32(10000000000) // 1410065408
|
|
53
|
+
*/
|
|
54
|
+
declare const i32: I32;
|
|
55
|
+
/**
|
|
56
|
+
* A schema that represents a 32-bit float value. (equivalent to `f32` in WGSL)
|
|
57
|
+
*
|
|
58
|
+
* Can also be called to cast a value to an f32.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* const value = f32(); // 0
|
|
62
|
+
* @example
|
|
63
|
+
* const value = f32(1.23); // 1.23
|
|
64
|
+
* @example
|
|
65
|
+
* const value = f32(true); // 1
|
|
66
|
+
*/
|
|
67
|
+
declare const f32: F32;
|
|
68
|
+
/**
|
|
69
|
+
* A schema that represents a 16-bit float value. (equivalent to `f16` in WGSL)
|
|
70
|
+
*
|
|
71
|
+
* Can also be called to cast a value to an f16.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* const value = f16(); // 0
|
|
75
|
+
* @example
|
|
76
|
+
* const value = f32(1.23); // 1.23
|
|
77
|
+
* @example
|
|
78
|
+
* const value = f16(true); // 1
|
|
79
|
+
* @example
|
|
80
|
+
* const value = f16(21877.5); // 21872
|
|
81
|
+
*/
|
|
82
|
+
declare const f16: F16;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a struct schema that can be used to construct GPU buffers.
|
|
86
|
+
* Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).
|
|
87
|
+
* The order of members matches the passed in properties object.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });
|
|
91
|
+
*
|
|
92
|
+
* @param props Record with `string` keys and `TgpuData` values,
|
|
93
|
+
* each entry describing one struct member.
|
|
94
|
+
*/
|
|
95
|
+
declare function struct<TProps extends Record<string, AnyWgslData>>(props: TProps): WgslStruct<TProps>;
|
|
96
|
+
|
|
97
|
+
interface WgslArrayConstructor {
|
|
98
|
+
<TElement extends AnyWgslData>(elementType: TElement): (elementCount: number) => WgslArray<TElement>;
|
|
99
|
+
<TElement extends AnyWgslData>(elementType: TElement, elementCount: number): WgslArray<TElement>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Creates an array schema that can be used to construct gpu buffers.
|
|
103
|
+
* Describes arrays with fixed-size length, storing elements of the same type.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* const LENGTH = 3;
|
|
107
|
+
* const array = d.arrayOf(d.u32, LENGTH);
|
|
108
|
+
*
|
|
109
|
+
* If `elementCount` is not specified, a partially applied function is returned.
|
|
110
|
+
* @example
|
|
111
|
+
* const array = d.arrayOf(d.vec3f);
|
|
112
|
+
* // ^? (n: number) => WgslArray<d.Vec3f>
|
|
113
|
+
*
|
|
114
|
+
* @param elementType The type of elements in the array.
|
|
115
|
+
* @param elementCount The number of elements in the array.
|
|
116
|
+
*/
|
|
117
|
+
declare const arrayOf: TgpuComptime<WgslArrayConstructor>;
|
|
118
|
+
|
|
119
|
+
declare function ptrFn<T extends StorableData>(inner: T): Ptr<'function', T, 'read-write'>;
|
|
120
|
+
declare function ptrPrivate<T extends StorableData>(inner: T): Ptr<'private', T, 'read-write'>;
|
|
121
|
+
declare function ptrWorkgroup<T extends StorableData>(inner: T): Ptr<'workgroup', T, 'read-write'>;
|
|
122
|
+
declare function ptrStorage<T extends StorableData, TAccess extends 'read' | 'read-write' = 'read'>(inner: T, access?: TAccess): Ptr<'storage', T, TAccess>;
|
|
123
|
+
declare function ptrUniform<T extends StorableData>(inner: T): Ptr<'uniform', T, 'read'>;
|
|
124
|
+
declare function ptrHandle<T extends StorableData>(inner: T): Ptr<'handle', T, 'read'>;
|
|
125
|
+
|
|
6
126
|
/**
|
|
7
127
|
* Schema representing vec2f - a vector with 2 elements of type f32.
|
|
8
128
|
* Also a constructor function for this vector value.
|
|
@@ -190,125 +310,6 @@ declare const vec4u: Vec4u;
|
|
|
190
310
|
*/
|
|
191
311
|
declare const vec4b: Vec4b;
|
|
192
312
|
|
|
193
|
-
/**
|
|
194
|
-
* A schema that represents a boolean value. (equivalent to `bool` in WGSL)
|
|
195
|
-
*
|
|
196
|
-
* Can also be called to cast a value to a bool in accordance with WGSL casting rules.
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* const value = bool(); // false
|
|
200
|
-
* @example
|
|
201
|
-
* const value = bool(0); // false
|
|
202
|
-
* @example
|
|
203
|
-
* const value = bool(-0); // false
|
|
204
|
-
* @example
|
|
205
|
-
* const value = bool(21.37); // true
|
|
206
|
-
*/
|
|
207
|
-
declare const bool: Bool;
|
|
208
|
-
/**
|
|
209
|
-
* A schema that represents an unsigned 32-bit integer value. (equivalent to `u32` in WGSL)
|
|
210
|
-
*
|
|
211
|
-
* Can also be called to cast a value to an u32 in accordance with WGSL casting rules.
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* const value = u32(); // 0
|
|
215
|
-
* @example
|
|
216
|
-
* const value = u32(7); // 7
|
|
217
|
-
* @example
|
|
218
|
-
* const value = u32(3.14); // 3
|
|
219
|
-
* @example
|
|
220
|
-
* const value = u32(-1); // 4294967295
|
|
221
|
-
* @example
|
|
222
|
-
* const value = u32(-3.1); // 0
|
|
223
|
-
*/
|
|
224
|
-
declare const u32: U32;
|
|
225
|
-
declare const u16: U16;
|
|
226
|
-
/**
|
|
227
|
-
* A schema that represents a signed 32-bit integer value. (equivalent to `i32` in WGSL)
|
|
228
|
-
*
|
|
229
|
-
* Can also be called to cast a value to an i32 in accordance with WGSL casting rules.
|
|
230
|
-
*
|
|
231
|
-
* @example
|
|
232
|
-
* const value = i32(); // 0
|
|
233
|
-
* @example
|
|
234
|
-
* const value = i32(3.14); // 3
|
|
235
|
-
* @example
|
|
236
|
-
* const value = i32(-3.9); // -3
|
|
237
|
-
* @example
|
|
238
|
-
* const value = i32(10000000000) // 1410065408
|
|
239
|
-
*/
|
|
240
|
-
declare const i32: I32;
|
|
241
|
-
/**
|
|
242
|
-
* A schema that represents a 32-bit float value. (equivalent to `f32` in WGSL)
|
|
243
|
-
*
|
|
244
|
-
* Can also be called to cast a value to an f32.
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* const value = f32(); // 0
|
|
248
|
-
* @example
|
|
249
|
-
* const value = f32(1.23); // 1.23
|
|
250
|
-
* @example
|
|
251
|
-
* const value = f32(true); // 1
|
|
252
|
-
*/
|
|
253
|
-
declare const f32: F32;
|
|
254
|
-
/**
|
|
255
|
-
* A schema that represents a 16-bit float value. (equivalent to `f16` in WGSL)
|
|
256
|
-
*
|
|
257
|
-
* Can also be called to cast a value to an f16.
|
|
258
|
-
*
|
|
259
|
-
* @example
|
|
260
|
-
* const value = f16(); // 0
|
|
261
|
-
* @example
|
|
262
|
-
* const value = f32(1.23); // 1.23
|
|
263
|
-
* @example
|
|
264
|
-
* const value = f16(true); // 1
|
|
265
|
-
* @example
|
|
266
|
-
* const value = f16(21877.5); // 21872
|
|
267
|
-
*/
|
|
268
|
-
declare const f16: F16;
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Creates a struct schema that can be used to construct GPU buffers.
|
|
272
|
-
* Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).
|
|
273
|
-
* The order of members matches the passed in properties object.
|
|
274
|
-
*
|
|
275
|
-
* @example
|
|
276
|
-
* const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });
|
|
277
|
-
*
|
|
278
|
-
* @param props Record with `string` keys and `TgpuData` values,
|
|
279
|
-
* each entry describing one struct member.
|
|
280
|
-
*/
|
|
281
|
-
declare function struct<TProps extends Record<string, AnyWgslData>>(props: TProps): WgslStruct<TProps>;
|
|
282
|
-
|
|
283
|
-
interface WgslArrayConstructor {
|
|
284
|
-
<TElement extends AnyWgslData>(elementType: TElement): (elementCount: number) => WgslArray<TElement>;
|
|
285
|
-
<TElement extends AnyWgslData>(elementType: TElement, elementCount: number): WgslArray<TElement>;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Creates an array schema that can be used to construct gpu buffers.
|
|
289
|
-
* Describes arrays with fixed-size length, storing elements of the same type.
|
|
290
|
-
*
|
|
291
|
-
* @example
|
|
292
|
-
* const LENGTH = 3;
|
|
293
|
-
* const array = d.arrayOf(d.u32, LENGTH);
|
|
294
|
-
*
|
|
295
|
-
* If `elementCount` is not specified, a partially applied function is returned.
|
|
296
|
-
* @example
|
|
297
|
-
* const array = d.arrayOf(d.vec3f);
|
|
298
|
-
* // ^? (n: number) => WgslArray<d.Vec3f>
|
|
299
|
-
*
|
|
300
|
-
* @param elementType The type of elements in the array.
|
|
301
|
-
* @param elementCount The number of elements in the array.
|
|
302
|
-
*/
|
|
303
|
-
declare const arrayOf: DualFn<WgslArrayConstructor>;
|
|
304
|
-
|
|
305
|
-
declare function ptrFn<T extends StorableData>(inner: T): Ptr<'function', T, 'read-write'>;
|
|
306
|
-
declare function ptrPrivate<T extends StorableData>(inner: T): Ptr<'private', T, 'read-write'>;
|
|
307
|
-
declare function ptrWorkgroup<T extends StorableData>(inner: T): Ptr<'workgroup', T, 'read-write'>;
|
|
308
|
-
declare function ptrStorage<T extends StorableData, TAccess extends 'read' | 'read-write' = 'read'>(inner: T, access?: TAccess): Ptr<'storage', T, TAccess>;
|
|
309
|
-
declare function ptrUniform<T extends StorableData>(inner: T): Ptr<'uniform', T, 'read'>;
|
|
310
|
-
declare function ptrHandle<T extends StorableData>(inner: T): Ptr<'handle', T, 'read'>;
|
|
311
|
-
|
|
312
313
|
interface DisarrayConstructor {
|
|
313
314
|
<TElement extends AnyData>(elementType: TElement): (elementCount: number) => Disarray<TElement>;
|
|
314
315
|
<TElement extends AnyData>(elementType: TElement, elementCount: number): Disarray<TElement>;
|
|
@@ -335,7 +336,7 @@ interface DisarrayConstructor {
|
|
|
335
336
|
* @param elementType The type of elements in the array.
|
|
336
337
|
* @param elementCount The number of elements in the array.
|
|
337
338
|
*/
|
|
338
|
-
declare const disarrayOf:
|
|
339
|
+
declare const disarrayOf: TgpuComptime<DisarrayConstructor>;
|
|
339
340
|
|
|
340
341
|
/**
|
|
341
342
|
* Creates a loose struct schema that can be used to construct vertex buffers.
|
package/data/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as B,c as vt,d as bt,g as _t}from"../chunk-LMPPDGRD.js";import{c as xt,f as dt,g as gt,h as Dt,i as At,j as Tt,k as ht,l as Wt,n as Nt,o as qt}from"../chunk-MBB2XFH6.js";import{A as St,B as Ot,C as Vt,D as Pt,E as Et,F as wt,G as Ct,H as kt,I as $t,J as Ut,K as Lt,L as Mt,M as jt,N as Ft,O as zt,P as Kt,a as A,j as yt,k as mt,l as ct,m as ft,z as Bt}from"../chunk-EHLRP4V2.js";import{$b as ce,Ab as ut,Ac as T,B as V,Bb as lt,Bc as It,C as y,D as m,E as c,F as f,G as P,H as E,Hb as b,I as w,J as C,K as k,Kb as Qt,L as x,Lb as Xt,Ma as L,Mb as Yt,Na as M,Nb as Zt,Oa as j,Ob as te,Pa as F,Pb as ee,Qa as z,Qb as re,Ra as K,Rb as ae,S as $,Sb as ne,T as d,Tb as se,U as g,Ua as N,Ub as oe,V as D,Vb as ie,Wb as pe,Xb as ue,Yb as le,Z as U,Zb as ye,_b as me,a as p,ac as fe,bc as xe,cc as de,dc as ge,ec as De,fc as Ae,gb as _,gc as Te,hb as q,hc as he,ib as G,ic as We,j as I,jb as H,jc as Ie,k as v,kb as R,kc as ve,lb as J,lc as be,mb as l,mc as Be,nb as Q,nc as Se,ob as X,oc as Oe,pb as Y,pc as Ve,q as O,qb as Z,qc as Pe,rb as tt,rc as Ee,sb as et,sc as we,tb as rt,tc as Ce,ub as at,uc as ke,vb as nt,vc as $e,wb as st,wc as Ue,xb as ot,xc as Le,yb as it,yc as Me,zb as pt,zc as je}from"../chunk-SHSILTWI.js";var Gt=b(((e,t)=>t===void 0?r=>S(e,r):S(e,t))).$name("disarrayOf");function S(e,t){let r=a=>{if(a&&a.length!==t)throw new Error(`Disarray schema of ${t} elements of type ${e.type} called with ${a.length} argument(s).`);return Array.from({length:t},(s,n)=>T(e,a?.[n]))};if(Object.setPrototypeOf(r,Ht),r.elementType=e,!Number.isInteger(t)||t<0)throw new Error(`Cannot create disarray schema with invalid element count: ${t}.`);return r.elementCount=t,r}var Ht={[p]:!0,type:"disarray",toString(){return`disarrayOf(${this.elementType}, ${this.elementCount})`}};function Rt(e){let t=r=>Object.fromEntries(Object.entries(e).map(([a,s])=>[a,T(s,r?.[a])]));return Object.setPrototypeOf(t,Jt),t.propTypes=e,t}var Jt={[p]:!0,type:"unstruct",$name(e){return v(this,e),this},toString(){return`unstruct:${I(this)??"<unnamed>"}`}};function u(e,t){if(e===t)return!0;if(e.type!==t.type)return!1;if(m(e)&&m(t)||g(e)&&g(t)){let r=e.propTypes,a=t.propTypes,s=Object.keys(r),n=Object.keys(a);if(s.length!==n.length)return!1;for(let o=0;o<s.length;o++){let h=s[o],W=n[o];if(h!==W||!h||!W||!u(r[h],a[W]))return!1}return!0}if(y(e)&&y(t)||d(e)&&d(t))return e.elementCount===t.elementCount&&u(e.elementType,t.elementType);if(c(e)&&c(t))return e.addressSpace===t.addressSpace&&e.access===t.access&&u(e.inner,t.inner);if(f(e)&&f(t))return u(e.inner,t.inner);if(x(e)&&x(t)||D(e)&&D(t)){if(!u(e.inner,t.inner)||e.attribs.length!==t.attribs.length)return!1;let r=n=>{let o=n;return`${o.type}(${(o.params??[]).join(",")})`},a=e.attribs.map(r),s=t.attribs.map(r);for(let n=0;n<a.length;n++)if(a[n]!==s[n])return!1}return!0}function i(e,t){let r=e.prototype,a=B[t][p].jsImpl;r[t]=function(s){return a(this,s)}}i(l,"add");i(l,"sub");i(l,"mul");i(l,"div");i(A,"add");i(A,"sub");i(A,"mul");export{O as Void,gt as align,xt as alignmentOf,Nt as arrayOf,_t as atomic,_ as bool,qt as builtin,bt as comparisonSampler,u as deepEqual,Gt as disarrayOf,J as f16,R as f32,We as float16,Ie as float16x2,ve as float16x4,be as float32,Be as float32x2,Se as float32x3,Oe as float32x4,Qt as formatToWGSLType,H as i32,Tt as interpolate,ht as invariant,P as isAlignAttrib,f as isAtomic,Wt as isBuiltin,k as isBuiltinAttrib,U as isData,x as isDecorated,d as isDisarray,C as isInterpolateAttrib,w as isLocationAttrib,$ as isLooseData,D as isLooseDecorated,je as isPackedData,c as isPtr,E as isSizeAttrib,g as isUnstruct,y as isWgslArray,V as isWgslData,m as isWgslStruct,At as location,yt as mat2x2f,mt as mat3x3f,ct as mat4x4f,ft as matToArray,Xt as packedFormats,L as ptrFn,K as ptrHandle,M as ptrPrivate,F as ptrStorage,z as ptrUniform,j as ptrWorkgroup,N as ref,vt as sampler,ce as sint16,fe as sint16x2,xe as sint16x4,Ce as sint32,ke as sint32x2,$e as sint32x3,Ue as sint32x4,ee as sint8,re as sint8x2,ae as sint8x4,Dt as size,dt as sizeOf,Ae as snorm16,Te as snorm16x2,he as snorm16x4,ie as snorm8,pe as snorm8x2,ue as snorm8x4,It as struct,Bt as texture1d,St as texture2d,Vt as texture2dArray,wt as texture3d,Pt as textureCube,Et as textureCubeArray,Lt as textureDepth2d,jt as textureDepth2dArray,Ft as textureDepthCube,zt as textureDepthCubeArray,Mt as textureDepthMultisampled2d,Kt as textureExternal,Ot as textureMultisampled2d,Ct as textureStorage1d,kt as textureStorage2d,$t as textureStorage2dArray,Ut as textureStorage3d,G as u16,q as u32,le as uint16,ye as uint16x2,me as uint16x4,Ve as uint32,Pe as uint32x2,Ee as uint32x3,we as uint32x4,Yt as uint8,Zt as uint8x2,te as uint8x4,Le as unorm10_10_10_2,de as unorm16,ge as unorm16x2,De as unorm16x4,ne as unorm8,se as unorm8x2,oe as unorm8x4,Me as unorm8x4_bgra,Rt as unstruct,tt as vec2b,Q as vec2f,X as vec2h,Y as vec2i,Z as vec2u,st as vec3b,et as vec3f,rt as vec3h,at as vec3i,nt as vec3u,lt as vec4b,ot as vec4f,it as vec4h,pt as vec4i,ut as vec4u};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/data/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/data/disarray.ts","../../src/data/unstruct.ts","../../src/data/deepEqual.ts","../../src/data/index.ts"],"sourcesContent":["import { comptime } from '../core/function/comptime.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { AnyData, Disarray } from './dataTypes.ts';\nimport { schemaCallWrapper } from './schemaCallWrapper.ts';\n\n// ----------\n// Public API\n// ----------\n\ninterface DisarrayConstructor {\n <TElement extends AnyData>(\n elementType: TElement,\n ): (elementCount: number) => Disarray<TElement>;\n\n <TElement extends AnyData>(\n elementType: TElement,\n elementCount: number,\n ): Disarray<TElement>;\n}\n\n/**\n * Creates an array schema that can be used to construct vertex buffers.\n * Describes arrays with fixed-size length, storing elements of the same type.\n *\n * Elements in the schema are not aligned in respect to their `byteAlignment`,\n * unless they are explicitly decorated with the custom align attribute\n * via `d.align` function.\n *\n * @example\n * const disarray = d.disarrayOf(d.vec3f, 3); // packed array of vec3f\n *\n * @example\n * const disarray = d.disarrayOf(d.align(16, d.vec3f), 3);\n *\n * If `elementCount` is not specified, a partially applied function is returned.\n * @example\n * const disarray = d.disarrayOf(d.vec3f);\n * // ^? (n: number) => Disarray<d.Vec3f>\n *\n * @param elementType The type of elements in the array.\n * @param elementCount The number of elements in the array.\n */\nexport const disarrayOf = comptime(\n ((elementType, elementCount) => {\n if (elementCount === undefined) {\n return (count: number) => cpu_disarrayOf(elementType, count);\n }\n return cpu_disarrayOf(elementType, elementCount);\n }) as DisarrayConstructor,\n).$name('disarrayOf');\n\nexport function cpu_disarrayOf<TElement extends AnyData>(\n elementType: TElement,\n elementCount: number,\n): Disarray<TElement> {\n // In the schema call, create and return a deep copy\n // by wrapping all the values in `elementType` schema calls.\n const disarraySchema = (elements?: TElement[]) => {\n if (elements && elements.length !== elementCount) {\n throw new Error(\n `Disarray schema of ${elementCount} elements of type ${elementType.type} called with ${elements.length} argument(s).`,\n );\n }\n\n return Array.from(\n { length: elementCount },\n (_, i) => schemaCallWrapper(elementType, elements?.[i]),\n );\n };\n Object.setPrototypeOf(disarraySchema, DisarrayImpl);\n\n disarraySchema.elementType = elementType;\n\n if (!Number.isInteger(elementCount) || elementCount < 0) {\n throw new Error(\n `Cannot create disarray schema with invalid element count: ${elementCount}.`,\n );\n }\n disarraySchema.elementCount = elementCount;\n\n return disarraySchema as unknown as Disarray<TElement>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst DisarrayImpl = {\n [$internal]: true,\n type: 'disarray',\n\n toString(this: Disarray): string {\n return `disarrayOf(${this.elementType}, ${this.elementCount})`;\n },\n};\n","import { getName, setName } from '../shared/meta.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { AnyData, Unstruct } from './dataTypes.ts';\nimport { schemaCallWrapper } from './schemaCallWrapper.ts';\nimport type { BaseData } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates a loose struct schema that can be used to construct vertex buffers.\n * Describes structs with members of both loose and non-loose types.\n *\n * The order of members matches the passed in properties object.\n * Members are not aligned in respect to their `byteAlignment`,\n * unless they are explicitly decorated with the custom align attribute\n * via `d.align` function.\n *\n * @example\n * const CircleStruct = d.unstruct({ radius: d.f32, pos: d.vec3f }); // packed struct with no padding\n *\n * @example\n * const CircleStruct = d.unstruct({ radius: d.f32, pos: d.align(16, d.vec3f) });\n *\n * @param properties Record with `string` keys and `TgpuData` or `TgpuLooseData` values,\n * each entry describing one struct member.\n */\nexport function unstruct<TProps extends Record<string, BaseData>>(\n properties: TProps,\n): Unstruct<TProps> {\n // In the schema call, create and return a deep copy\n // by wrapping all the values in corresponding schema calls.\n const unstructSchema = (instanceProps?: TProps) =>\n Object.fromEntries(\n Object.entries(properties).map(([key, schema]) => [\n key,\n schemaCallWrapper(schema as AnyData, instanceProps?.[key]),\n ]),\n );\n Object.setPrototypeOf(unstructSchema, UnstructImpl);\n unstructSchema.propTypes = properties;\n\n return unstructSchema as unknown as Unstruct<TProps>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst UnstructImpl = {\n [$internal]: true,\n type: 'unstruct',\n\n $name(label: string) {\n setName(this, label);\n return this;\n },\n\n toString(): string {\n return `unstruct:${getName(this) ?? '<unnamed>'}`;\n },\n};\n","import type { AnyAttribute } from './attributes.ts';\nimport { isDisarray, isLooseDecorated, isUnstruct } from './dataTypes.ts';\nimport type { AnyData } from './dataTypes.ts';\nimport {\n isAtomic,\n isDecorated,\n isPtr,\n isWgslArray,\n isWgslStruct,\n} from './wgslTypes.ts';\n\n/**\n * Performs a deep comparison of two TypeGPU data schemas.\n *\n * @param a The first data schema to compare.\n * @param b The second data schema to compare.\n * @returns `true` if the schemas are deeply equal, `false` otherwise.\n *\n * @example\n * ```ts\n * import { vec3f, struct, deepEqual } from 'typegpu/data';\n *\n * const schema1 = struct({ a: vec3f });\n * const schema2 = struct({ a: vec3f });\n * const schema3 = struct({ b: vec3f });\n *\n * console.log(deepEqual(schema1, schema2)); // true\n * console.log(deepEqual(schema1, schema3)); // false\n * ```\n */\nexport function deepEqual(a: AnyData, b: AnyData): boolean {\n if (a === b) {\n return true;\n }\n\n if (a.type !== b.type) {\n return false;\n }\n\n if (\n (isWgslStruct(a) && isWgslStruct(b)) ||\n (isUnstruct(a) && isUnstruct(b))\n ) {\n const aProps = a.propTypes;\n const bProps = b.propTypes;\n const aKeys = Object.keys(aProps);\n const bKeys = Object.keys(bProps);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n for (let i = 0; i < aKeys.length; i++) {\n const keyA = aKeys[i];\n const keyB = bKeys[i];\n if (\n keyA !== keyB || !keyA || !keyB ||\n !deepEqual(aProps[keyA], bProps[keyB])\n ) {\n return false;\n }\n }\n return true;\n }\n\n if ((isWgslArray(a) && isWgslArray(b)) || (isDisarray(a) && isDisarray(b))) {\n return (\n a.elementCount === b.elementCount &&\n deepEqual(a.elementType as AnyData, b.elementType as AnyData)\n );\n }\n\n if (isPtr(a) && isPtr(b)) {\n return (\n a.addressSpace === b.addressSpace &&\n a.access === b.access &&\n deepEqual(a.inner as AnyData, b.inner as AnyData)\n );\n }\n\n if (isAtomic(a) && isAtomic(b)) {\n return deepEqual(a.inner as AnyData, b.inner as AnyData);\n }\n\n if (\n (isDecorated(a) && isDecorated(b)) ||\n (isLooseDecorated(a) && isLooseDecorated(b))\n ) {\n if (!deepEqual(a.inner as AnyData, b.inner as AnyData)) {\n return false;\n }\n if (a.attribs.length !== b.attribs.length) {\n return false;\n }\n\n // Create comparable string representations for each attribute\n const getAttrKey = (attr: unknown): string => {\n const anyAttr = attr as AnyAttribute;\n return `${anyAttr.type}(${(anyAttr.params ?? []).join(',')})`;\n };\n\n const attrsA = a.attribs.map(getAttrKey);\n const attrsB = b.attribs.map(getAttrKey);\n\n for (let i = 0; i < attrsA.length; i++) {\n if (attrsA[i] !== attrsB[i]) {\n return false;\n }\n }\n }\n\n // All other types have been checked for equality at the start\n return true;\n}\n","/**\n * @module typegpu/data\n */\n\nimport { type InfixOperator, infixOperators } from '../tgsl/accessProp.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport { MatBase } from './matrix.ts';\nimport { VecBase } from './vectorImpl.ts';\n\nfunction assignInfixOperator<T extends typeof VecBase | typeof MatBase>(\n object: T,\n operator: InfixOperator,\n) {\n type Instance = InstanceType<T>;\n\n const proto = object.prototype as {\n [K in InfixOperator]?: (this: Instance, other: unknown) => unknown;\n };\n const opImpl = infixOperators[operator][$internal].jsImpl as (\n lhs: Instance,\n rhs: unknown,\n ) => unknown;\n\n proto[operator] = function (this: Instance, other: unknown): unknown {\n return opImpl(this, other);\n };\n}\n\nassignInfixOperator(VecBase, 'add');\nassignInfixOperator(VecBase, 'sub');\nassignInfixOperator(VecBase, 'mul');\nassignInfixOperator(VecBase, 'div');\nassignInfixOperator(MatBase, 'add');\nassignInfixOperator(MatBase, 'sub');\nassignInfixOperator(MatBase, 'mul');\n\nexport { bool, f16, f32, i32, u16, u32 } from './numeric.ts';\nexport {\n isAlignAttrib,\n isAtomic,\n isBuiltinAttrib,\n isDecorated,\n isInterpolateAttrib,\n isLocationAttrib,\n isPtr,\n isSizeAttrib,\n isWgslArray,\n isWgslData,\n isWgslStruct,\n Void,\n} from './wgslTypes.ts';\nexport type {\n Align,\n AnyVecInstance,\n AnyWgslData,\n AnyWgslStruct,\n Atomic,\n BaseData,\n BaseData as BaseWgslData,\n Bool,\n Builtin,\n Decorated,\n F16,\n F32,\n I32,\n Interpolate,\n Location,\n m2x2f,\n m3x3f,\n m4x4f,\n Mat2x2f,\n Mat3x3f,\n Mat4x4f,\n Ptr,\n Size,\n StorableData,\n U16,\n U32,\n v2b,\n v2f,\n v2i,\n v2u,\n v3b,\n v3f,\n v3i,\n v3u,\n v4b,\n v4f,\n v4i,\n v4u,\n Vec2b,\n Vec2f,\n Vec2h,\n Vec2i,\n Vec2u,\n Vec3b,\n Vec3f,\n Vec3h,\n Vec3i,\n Vec3u,\n Vec4b,\n Vec4f,\n Vec4h,\n Vec4i,\n Vec4u,\n WgslArray,\n WgslStruct,\n} from './wgslTypes.ts';\nexport { struct } from './struct.ts';\nexport { arrayOf } from './array.ts';\nexport {\n ptrFn,\n ptrHandle,\n ptrPrivate,\n ptrStorage,\n ptrUniform,\n ptrWorkgroup,\n} from './ptr.ts';\nexport type {\n AnyData,\n AnyLooseData,\n Disarray,\n LooseDecorated,\n Unstruct,\n} from './dataTypes.ts';\nexport {\n texture1d,\n texture2d,\n texture2dArray,\n texture3d,\n textureCube,\n textureCubeArray,\n textureDepth2d,\n textureDepth2dArray,\n textureDepthCube,\n textureDepthCubeArray,\n textureDepthMultisampled2d,\n textureExternal,\n textureMultisampled2d,\n textureStorage1d,\n textureStorage2d,\n textureStorage2dArray,\n textureStorage3d,\n type WgslExternalTexture,\n type WgslStorageTexture,\n type WgslStorageTexture1d,\n type WgslStorageTexture2d,\n type WgslStorageTexture2dArray,\n type WgslStorageTexture3d,\n type WgslStorageTextureProps,\n type WgslTexture,\n type WgslTexture1d,\n type WgslTexture2d,\n type WgslTexture2dArray,\n type WgslTexture3d,\n type WgslTextureCube,\n type WgslTextureCubeArray,\n type WgslTextureDepth2d,\n type WgslTextureDepth2dArray,\n type WgslTextureDepthCube,\n type WgslTextureDepthCubeArray,\n type WgslTextureDepthMultisampled2d,\n type WgslTextureMultisampled2d,\n} from './texture.ts';\nexport {\n comparisonSampler,\n sampler,\n type WgslComparisonSampler,\n type WgslSampler,\n} from './sampler.ts';\nexport {\n vec2b,\n vec2f,\n vec2h,\n vec2i,\n vec2u,\n vec3b,\n vec3f,\n vec3h,\n vec3i,\n vec3u,\n vec4b,\n vec4f,\n vec4h,\n vec4i,\n vec4u,\n} from './vector.ts';\nexport { disarrayOf } from './disarray.ts';\nexport { unstruct } from './unstruct.ts';\nexport { mat2x2f, mat3x3f, mat4x4f, matToArray } from './matrix.ts';\nexport * from './vertexFormatData.ts';\nexport { atomic } from './atomic.ts';\nexport { ref } from './ref.ts';\nexport {\n align,\n type AnyAttribute,\n type HasCustomLocation,\n interpolate,\n invariant,\n type IsBuiltin,\n isBuiltin,\n location,\n size,\n} from './attributes.ts';\nexport {\n isData,\n isDisarray,\n isLooseData,\n isLooseDecorated,\n isUnstruct,\n} from './dataTypes.ts';\nexport { PUBLIC_sizeOf as sizeOf } from './sizeOf.ts';\nexport { PUBLIC_alignmentOf as alignmentOf } from './alignmentOf.ts';\nexport { builtin } from '../builtin.ts';\nexport { deepEqual } from './deepEqual.ts';\nexport type {\n AnyBuiltin,\n BuiltinClipDistances,\n BuiltinFragDepth,\n BuiltinFrontFacing,\n BuiltinGlobalInvocationId,\n BuiltinInstanceIndex,\n BuiltinLocalInvocationId,\n BuiltinLocalInvocationIndex,\n BuiltinNumWorkgroups,\n BuiltinPosition,\n BuiltinSampleIndex,\n BuiltinSampleMask,\n BuiltinVertexIndex,\n BuiltinWorkgroupId,\n} from '../builtin.ts';\nexport type { Infer, InferGPU, InferPartial } from '../shared/repr.ts';\n"],"mappings":"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","names":["disarrayOf","comptime","elementType","elementCount","count","cpu_disarrayOf","disarraySchema","elements","_","i","schemaCallWrapper","DisarrayImpl","$internal","unstruct","properties","unstructSchema","instanceProps","key","schema","schemaCallWrapper","UnstructImpl","$internal","label","setName","getName","deepEqual","a","b","isWgslStruct","isUnstruct","aProps","bProps","aKeys","bKeys","i","keyA","keyB","isWgslArray","isDisarray","isPtr","isAtomic","isDecorated","isLooseDecorated","getAttrKey","attr","anyAttr","attrsA","attrsB","assignInfixOperator","object","operator","proto","opImpl","infixOperators","$internal","other","VecBase","MatBase"]}
|