typegpu 0.5.4 → 0.5.5
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/attributes-BcDZsQCE.d.cts +159 -0
- package/attributes-DsIdcdq4.d.ts +159 -0
- package/chunk-A6AAWPBU.cjs +2 -0
- package/chunk-A6AAWPBU.cjs.map +1 -0
- package/chunk-HZAXWB4J.js +2 -0
- package/chunk-HZAXWB4J.js.map +1 -0
- package/chunk-T5Y2EQPZ.js +4 -0
- package/chunk-T5Y2EQPZ.js.map +1 -0
- package/chunk-VUYQ2ZIK.cjs +4 -0
- package/chunk-VUYQ2ZIK.cjs.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.d.cts +3 -4
- package/data/index.d.ts +3 -4
- package/data/index.js +1 -1
- package/{wgslTypes-Bh2dG5qv.d.cts → dataTypes-ts2Ccted.d.cts} +300 -6
- package/{wgslTypes-Bh2dG5qv.d.ts → dataTypes-ts2Ccted.d.ts} +300 -6
- package/index.cjs +19 -19
- package/index.cjs.map +1 -1
- package/index.d.cts +25 -397
- package/index.d.ts +25 -397
- package/index.js +19 -19
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/sampler-CPNwYXSH.d.ts +369 -0
- package/sampler-DeX4AnIZ.d.cts +369 -0
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +85 -50
- package/std/index.d.ts +85 -50
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/attributes-BdU8hyQq.d.cts +0 -435
- package/attributes-CAsvE5Z9.d.ts +0 -435
- package/chunk-5PJ3H5OR.js +0 -2
- package/chunk-5PJ3H5OR.js.map +0 -1
- package/chunk-7UUBX6MC.cjs +0 -4
- package/chunk-7UUBX6MC.cjs.map +0 -1
- package/chunk-AKBL6GDL.js +0 -4
- package/chunk-AKBL6GDL.js.map +0 -1
- package/chunk-URJCMUTT.cjs +0 -2
- package/chunk-URJCMUTT.cjs.map +0 -1
@@ -0,0 +1,159 @@
|
|
1
|
+
import { D as Decorated, l as Vec3u, ah as Builtin, U as U32, d as Vec4f, p as WgslArray, F as F32, B as BaseData, ag as Align, af as Size, L as Location, ai as Interpolate, bh as InterpolationType, w as WgslTypeLiteral, bi as LooseTypeLiteral, as as LooseDecorated, v as AnyData, bj as PerspectiveOrLinearInterpolationType, bk as PerspectiveOrLinearInterpolatableData, bl as FlatInterpolationType, bm as FlatInterpolatableData, A as AnyWgslData, at as AnyLooseData } from './dataTypes-ts2Ccted.cjs';
|
2
|
+
|
3
|
+
type BuiltinVertexIndex = Decorated<U32, [Builtin<'vertex_index'>]>;
|
4
|
+
type BuiltinInstanceIndex = Decorated<U32, [Builtin<'instance_index'>]>;
|
5
|
+
type BuiltinPosition = Decorated<Vec4f, [Builtin<'position'>]>;
|
6
|
+
type BuiltinClipDistances = Decorated<WgslArray<U32>, [
|
7
|
+
Builtin<'clip_distances'>
|
8
|
+
]>;
|
9
|
+
type BuiltinFrontFacing = Decorated<F32, [Builtin<'front_facing'>]>;
|
10
|
+
type BuiltinFragDepth = Decorated<F32, [Builtin<'frag_depth'>]>;
|
11
|
+
type BuiltinSampleIndex = Decorated<U32, [Builtin<'sample_index'>]>;
|
12
|
+
type BuiltinSampleMask = Decorated<U32, [Builtin<'sample_mask'>]>;
|
13
|
+
type BuiltinLocalInvocationId = Decorated<Vec3u, [
|
14
|
+
Builtin<'local_invocation_id'>
|
15
|
+
]>;
|
16
|
+
type BuiltinLocalInvocationIndex = Decorated<U32, [
|
17
|
+
Builtin<'local_invocation_index'>
|
18
|
+
]>;
|
19
|
+
type BuiltinGlobalInvocationId = Decorated<Vec3u, [
|
20
|
+
Builtin<'global_invocation_id'>
|
21
|
+
]>;
|
22
|
+
type BuiltinWorkgroupId = Decorated<Vec3u, [Builtin<'workgroup_id'>]>;
|
23
|
+
type BuiltinNumWorkgroups = Decorated<Vec3u, [
|
24
|
+
Builtin<'num_workgroups'>
|
25
|
+
]>;
|
26
|
+
type BuiltinSubgroupInvocationId = Decorated<U32, [
|
27
|
+
Builtin<'subgroup_invocation_id'>
|
28
|
+
]>;
|
29
|
+
type BuiltinSubgroupSize = Decorated<U32, [Builtin<'subgroup_size'>]>;
|
30
|
+
declare const builtin: {
|
31
|
+
readonly vertexIndex: BuiltinVertexIndex;
|
32
|
+
readonly instanceIndex: BuiltinInstanceIndex;
|
33
|
+
readonly position: BuiltinPosition;
|
34
|
+
readonly clipDistances: BuiltinClipDistances;
|
35
|
+
readonly frontFacing: BuiltinFrontFacing;
|
36
|
+
readonly fragDepth: BuiltinFragDepth;
|
37
|
+
readonly sampleIndex: BuiltinSampleIndex;
|
38
|
+
readonly sampleMask: BuiltinSampleMask;
|
39
|
+
readonly localInvocationId: BuiltinLocalInvocationId;
|
40
|
+
readonly localInvocationIndex: BuiltinLocalInvocationIndex;
|
41
|
+
readonly globalInvocationId: BuiltinGlobalInvocationId;
|
42
|
+
readonly workgroupId: BuiltinWorkgroupId;
|
43
|
+
readonly numWorkgroups: BuiltinNumWorkgroups;
|
44
|
+
readonly subgroupInvocationId: BuiltinSubgroupInvocationId;
|
45
|
+
readonly subgroupSize: BuiltinSubgroupSize;
|
46
|
+
};
|
47
|
+
type AnyBuiltin = (typeof builtin)[keyof typeof builtin];
|
48
|
+
type AnyComputeBuiltin = BuiltinLocalInvocationId | BuiltinLocalInvocationIndex | BuiltinGlobalInvocationId | BuiltinWorkgroupId | BuiltinNumWorkgroups | BuiltinSubgroupInvocationId | BuiltinSubgroupSize;
|
49
|
+
type AnyFragmentInputBuiltin = BuiltinPosition | BuiltinFrontFacing | BuiltinSampleIndex | BuiltinSampleMask | BuiltinSubgroupInvocationId | BuiltinSubgroupSize;
|
50
|
+
type AnyFragmentOutputBuiltin = BuiltinFragDepth | BuiltinSampleMask;
|
51
|
+
type OmitBuiltins<S> = S extends AnyBuiltin ? never : S extends BaseData ? S : {
|
52
|
+
[Key in keyof S as S[Key] extends AnyBuiltin ? never : Key]: S[Key];
|
53
|
+
};
|
54
|
+
|
55
|
+
declare const builtinNames: readonly ["vertex_index", "instance_index", "position", "clip_distances", "front_facing", "frag_depth", "sample_index", "sample_mask", "fragment", "local_invocation_id", "local_invocation_index", "global_invocation_id", "workgroup_id", "num_workgroups", "subgroup_invocation_id", "subgroup_size"];
|
56
|
+
type BuiltinName = (typeof builtinNames)[number];
|
57
|
+
type AnyAttribute<AllowedBuiltins extends Builtin<BuiltinName> = Builtin<BuiltinName>> = Align<number> | Size<number> | Location<number> | Interpolate<InterpolationType> | AllowedBuiltins;
|
58
|
+
type ExtractAttributes<T> = T extends {
|
59
|
+
readonly attribs: unknown[];
|
60
|
+
} ? T['attribs'] : [];
|
61
|
+
type Undecorate<T> = T extends {
|
62
|
+
readonly inner: infer TInner;
|
63
|
+
} ? TInner : T;
|
64
|
+
/**
|
65
|
+
* Decorates a data-type `TData` with an attribute `TAttrib`.
|
66
|
+
*
|
67
|
+
* - if `TData` is loose
|
68
|
+
* - if `TData` is already `LooseDecorated`
|
69
|
+
* - Prepend `TAttrib` to the existing attribute tuple.
|
70
|
+
* - else
|
71
|
+
* - Wrap `TData` with `LooseDecorated` and a single attribute `[TAttrib]`
|
72
|
+
* - else
|
73
|
+
* - if `TData` is already `Decorated`
|
74
|
+
* - Prepend `TAttrib` to the existing attribute tuple.
|
75
|
+
* - else
|
76
|
+
* - Wrap `TData` with `Decorated` and a single attribute `[TAttrib]`
|
77
|
+
*/
|
78
|
+
type Decorate<TData extends BaseData, TAttrib extends AnyAttribute> = TData['type'] extends WgslTypeLiteral ? Decorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]> : TData['type'] extends LooseTypeLiteral ? LooseDecorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]> : never;
|
79
|
+
type IsBuiltin<T> = ExtractAttributes<T>[number] extends [] ? false : ExtractAttributes<T>[number] extends Builtin<BuiltinName> ? true : false;
|
80
|
+
type HasCustomLocation<T> = ExtractAttributes<T>[number] extends [] ? false : ExtractAttributes<T>[number] extends Location<number> ? true : false;
|
81
|
+
/**
|
82
|
+
* Gives the wrapped data-type a custom byte alignment. Useful in order to
|
83
|
+
* fulfill uniform alignment requirements.
|
84
|
+
*
|
85
|
+
* @example
|
86
|
+
* const Data = d.struct({
|
87
|
+
* a: u32, // takes up 4 bytes
|
88
|
+
* // 12 bytes of padding, because `b` is custom aligned to multiples of 16 bytes
|
89
|
+
* b: d.align(16, u32),
|
90
|
+
* });
|
91
|
+
*
|
92
|
+
* @param alignment The multiple of bytes this data should align itself to.
|
93
|
+
* @param data The data-type to align.
|
94
|
+
*/
|
95
|
+
declare function align<TAlign extends number, TData extends AnyData>(alignment: TAlign, data: TData): Decorate<TData, Align<TAlign>>;
|
96
|
+
/**
|
97
|
+
* Adds padding bytes after the wrapped data-type, until the whole value takes up `size` bytes.
|
98
|
+
*
|
99
|
+
* @example
|
100
|
+
* const Data = d.struct({
|
101
|
+
* a: d.size(16, u32), // takes up 16 bytes, instead of 4
|
102
|
+
* b: u32, // starts at byte 16, because `a` has a custom size
|
103
|
+
* });
|
104
|
+
*
|
105
|
+
* @param size The amount of bytes that should be reserved for this data-type.
|
106
|
+
* @param data The data-type to wrap.
|
107
|
+
*/
|
108
|
+
declare function size<TSize extends number, TData extends AnyData>(size: TSize, data: TData): Decorate<TData, Size<TSize>>;
|
109
|
+
/**
|
110
|
+
* Assigns an explicit numeric location to a struct member or a parameter that has this type.
|
111
|
+
*
|
112
|
+
* @example
|
113
|
+
* const VertexOutput = {
|
114
|
+
* a: d.u32, // has implicit location 0
|
115
|
+
* b: d.location(5, d.u32),
|
116
|
+
* c: d.u32, // has implicit location 6
|
117
|
+
* };
|
118
|
+
*
|
119
|
+
* @param location The explicit numeric location.
|
120
|
+
* @param data The data-type to wrap.
|
121
|
+
*/
|
122
|
+
declare function location<TLocation extends number, TData extends AnyData>(location: TLocation, data: TData): Decorate<TData, Location<TLocation>>;
|
123
|
+
/**
|
124
|
+
* Specifies how user-defined vertex shader output (fragment shader input)
|
125
|
+
* must be interpolated.
|
126
|
+
*
|
127
|
+
* Tip: Integer outputs cannot be interpolated.
|
128
|
+
*
|
129
|
+
* @example
|
130
|
+
* const VertexOutput = {
|
131
|
+
* a: d.f32, // has implicit 'perspective, center' interpolation
|
132
|
+
* b: d.interpolate('linear, sample', d.f32),
|
133
|
+
* };
|
134
|
+
*
|
135
|
+
* @param interpolationType How data should be interpolated.
|
136
|
+
* @param data The data-type to wrap.
|
137
|
+
*/
|
138
|
+
declare function interpolate<TInterpolation extends PerspectiveOrLinearInterpolationType, TData extends PerspectiveOrLinearInterpolatableData>(interpolationType: TInterpolation, data: TData): Decorate<TData, Interpolate<TInterpolation>>;
|
139
|
+
/**
|
140
|
+
* Specifies how user-defined vertex shader output (fragment shader input)
|
141
|
+
* must be interpolated.
|
142
|
+
*
|
143
|
+
* Tip: Default sampling method of `flat` is `first`. Unless you specifically
|
144
|
+
* need deterministic behavior provided by `'flat, first'`, prefer explicit
|
145
|
+
* `'flat, either'` as it could be slightly faster in hardware.
|
146
|
+
*
|
147
|
+
* @example
|
148
|
+
* const VertexOutput = {
|
149
|
+
* a: d.f32, // has implicit 'perspective, center' interpolation
|
150
|
+
* b: d.interpolate('flat, either', d.u32), // integer outputs cannot interpolate
|
151
|
+
* };
|
152
|
+
*
|
153
|
+
* @param interpolationType How data should be interpolated.
|
154
|
+
* @param data The data-type to wrap.
|
155
|
+
*/
|
156
|
+
declare function interpolate<TInterpolation extends FlatInterpolationType, TData extends FlatInterpolatableData>(interpolationType: TInterpolation, data: TData): Decorate<TData, Interpolate<TInterpolation>>;
|
157
|
+
declare function isBuiltin<T extends Decorated<AnyWgslData, AnyAttribute[]> | LooseDecorated<AnyLooseData, AnyAttribute[]>>(value: T | unknown): value is T;
|
158
|
+
|
159
|
+
export { type AnyAttribute as A, type BuiltinVertexIndex as B, type Decorate as D, type HasCustomLocation as H, type IsBuiltin as I, type OmitBuiltins as O, type AnyComputeBuiltin as a, type AnyFragmentInputBuiltin as b, type AnyFragmentOutputBuiltin as c, align as d, isBuiltin as e, builtin as f, type BuiltinInstanceIndex as g, type BuiltinPosition as h, interpolate as i, type BuiltinClipDistances as j, type BuiltinFrontFacing as k, location as l, type BuiltinFragDepth as m, type BuiltinSampleIndex as n, type BuiltinSampleMask as o, type BuiltinLocalInvocationId as p, type BuiltinLocalInvocationIndex as q, type BuiltinGlobalInvocationId as r, size as s, type BuiltinWorkgroupId as t, type BuiltinNumWorkgroups as u, type AnyBuiltin as v };
|
@@ -0,0 +1,159 @@
|
|
1
|
+
import { D as Decorated, l as Vec3u, ah as Builtin, U as U32, d as Vec4f, p as WgslArray, F as F32, B as BaseData, ag as Align, af as Size, L as Location, ai as Interpolate, bh as InterpolationType, w as WgslTypeLiteral, bi as LooseTypeLiteral, as as LooseDecorated, v as AnyData, bj as PerspectiveOrLinearInterpolationType, bk as PerspectiveOrLinearInterpolatableData, bl as FlatInterpolationType, bm as FlatInterpolatableData, A as AnyWgslData, at as AnyLooseData } from './dataTypes-ts2Ccted.js';
|
2
|
+
|
3
|
+
type BuiltinVertexIndex = Decorated<U32, [Builtin<'vertex_index'>]>;
|
4
|
+
type BuiltinInstanceIndex = Decorated<U32, [Builtin<'instance_index'>]>;
|
5
|
+
type BuiltinPosition = Decorated<Vec4f, [Builtin<'position'>]>;
|
6
|
+
type BuiltinClipDistances = Decorated<WgslArray<U32>, [
|
7
|
+
Builtin<'clip_distances'>
|
8
|
+
]>;
|
9
|
+
type BuiltinFrontFacing = Decorated<F32, [Builtin<'front_facing'>]>;
|
10
|
+
type BuiltinFragDepth = Decorated<F32, [Builtin<'frag_depth'>]>;
|
11
|
+
type BuiltinSampleIndex = Decorated<U32, [Builtin<'sample_index'>]>;
|
12
|
+
type BuiltinSampleMask = Decorated<U32, [Builtin<'sample_mask'>]>;
|
13
|
+
type BuiltinLocalInvocationId = Decorated<Vec3u, [
|
14
|
+
Builtin<'local_invocation_id'>
|
15
|
+
]>;
|
16
|
+
type BuiltinLocalInvocationIndex = Decorated<U32, [
|
17
|
+
Builtin<'local_invocation_index'>
|
18
|
+
]>;
|
19
|
+
type BuiltinGlobalInvocationId = Decorated<Vec3u, [
|
20
|
+
Builtin<'global_invocation_id'>
|
21
|
+
]>;
|
22
|
+
type BuiltinWorkgroupId = Decorated<Vec3u, [Builtin<'workgroup_id'>]>;
|
23
|
+
type BuiltinNumWorkgroups = Decorated<Vec3u, [
|
24
|
+
Builtin<'num_workgroups'>
|
25
|
+
]>;
|
26
|
+
type BuiltinSubgroupInvocationId = Decorated<U32, [
|
27
|
+
Builtin<'subgroup_invocation_id'>
|
28
|
+
]>;
|
29
|
+
type BuiltinSubgroupSize = Decorated<U32, [Builtin<'subgroup_size'>]>;
|
30
|
+
declare const builtin: {
|
31
|
+
readonly vertexIndex: BuiltinVertexIndex;
|
32
|
+
readonly instanceIndex: BuiltinInstanceIndex;
|
33
|
+
readonly position: BuiltinPosition;
|
34
|
+
readonly clipDistances: BuiltinClipDistances;
|
35
|
+
readonly frontFacing: BuiltinFrontFacing;
|
36
|
+
readonly fragDepth: BuiltinFragDepth;
|
37
|
+
readonly sampleIndex: BuiltinSampleIndex;
|
38
|
+
readonly sampleMask: BuiltinSampleMask;
|
39
|
+
readonly localInvocationId: BuiltinLocalInvocationId;
|
40
|
+
readonly localInvocationIndex: BuiltinLocalInvocationIndex;
|
41
|
+
readonly globalInvocationId: BuiltinGlobalInvocationId;
|
42
|
+
readonly workgroupId: BuiltinWorkgroupId;
|
43
|
+
readonly numWorkgroups: BuiltinNumWorkgroups;
|
44
|
+
readonly subgroupInvocationId: BuiltinSubgroupInvocationId;
|
45
|
+
readonly subgroupSize: BuiltinSubgroupSize;
|
46
|
+
};
|
47
|
+
type AnyBuiltin = (typeof builtin)[keyof typeof builtin];
|
48
|
+
type AnyComputeBuiltin = BuiltinLocalInvocationId | BuiltinLocalInvocationIndex | BuiltinGlobalInvocationId | BuiltinWorkgroupId | BuiltinNumWorkgroups | BuiltinSubgroupInvocationId | BuiltinSubgroupSize;
|
49
|
+
type AnyFragmentInputBuiltin = BuiltinPosition | BuiltinFrontFacing | BuiltinSampleIndex | BuiltinSampleMask | BuiltinSubgroupInvocationId | BuiltinSubgroupSize;
|
50
|
+
type AnyFragmentOutputBuiltin = BuiltinFragDepth | BuiltinSampleMask;
|
51
|
+
type OmitBuiltins<S> = S extends AnyBuiltin ? never : S extends BaseData ? S : {
|
52
|
+
[Key in keyof S as S[Key] extends AnyBuiltin ? never : Key]: S[Key];
|
53
|
+
};
|
54
|
+
|
55
|
+
declare const builtinNames: readonly ["vertex_index", "instance_index", "position", "clip_distances", "front_facing", "frag_depth", "sample_index", "sample_mask", "fragment", "local_invocation_id", "local_invocation_index", "global_invocation_id", "workgroup_id", "num_workgroups", "subgroup_invocation_id", "subgroup_size"];
|
56
|
+
type BuiltinName = (typeof builtinNames)[number];
|
57
|
+
type AnyAttribute<AllowedBuiltins extends Builtin<BuiltinName> = Builtin<BuiltinName>> = Align<number> | Size<number> | Location<number> | Interpolate<InterpolationType> | AllowedBuiltins;
|
58
|
+
type ExtractAttributes<T> = T extends {
|
59
|
+
readonly attribs: unknown[];
|
60
|
+
} ? T['attribs'] : [];
|
61
|
+
type Undecorate<T> = T extends {
|
62
|
+
readonly inner: infer TInner;
|
63
|
+
} ? TInner : T;
|
64
|
+
/**
|
65
|
+
* Decorates a data-type `TData` with an attribute `TAttrib`.
|
66
|
+
*
|
67
|
+
* - if `TData` is loose
|
68
|
+
* - if `TData` is already `LooseDecorated`
|
69
|
+
* - Prepend `TAttrib` to the existing attribute tuple.
|
70
|
+
* - else
|
71
|
+
* - Wrap `TData` with `LooseDecorated` and a single attribute `[TAttrib]`
|
72
|
+
* - else
|
73
|
+
* - if `TData` is already `Decorated`
|
74
|
+
* - Prepend `TAttrib` to the existing attribute tuple.
|
75
|
+
* - else
|
76
|
+
* - Wrap `TData` with `Decorated` and a single attribute `[TAttrib]`
|
77
|
+
*/
|
78
|
+
type Decorate<TData extends BaseData, TAttrib extends AnyAttribute> = TData['type'] extends WgslTypeLiteral ? Decorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]> : TData['type'] extends LooseTypeLiteral ? LooseDecorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]> : never;
|
79
|
+
type IsBuiltin<T> = ExtractAttributes<T>[number] extends [] ? false : ExtractAttributes<T>[number] extends Builtin<BuiltinName> ? true : false;
|
80
|
+
type HasCustomLocation<T> = ExtractAttributes<T>[number] extends [] ? false : ExtractAttributes<T>[number] extends Location<number> ? true : false;
|
81
|
+
/**
|
82
|
+
* Gives the wrapped data-type a custom byte alignment. Useful in order to
|
83
|
+
* fulfill uniform alignment requirements.
|
84
|
+
*
|
85
|
+
* @example
|
86
|
+
* const Data = d.struct({
|
87
|
+
* a: u32, // takes up 4 bytes
|
88
|
+
* // 12 bytes of padding, because `b` is custom aligned to multiples of 16 bytes
|
89
|
+
* b: d.align(16, u32),
|
90
|
+
* });
|
91
|
+
*
|
92
|
+
* @param alignment The multiple of bytes this data should align itself to.
|
93
|
+
* @param data The data-type to align.
|
94
|
+
*/
|
95
|
+
declare function align<TAlign extends number, TData extends AnyData>(alignment: TAlign, data: TData): Decorate<TData, Align<TAlign>>;
|
96
|
+
/**
|
97
|
+
* Adds padding bytes after the wrapped data-type, until the whole value takes up `size` bytes.
|
98
|
+
*
|
99
|
+
* @example
|
100
|
+
* const Data = d.struct({
|
101
|
+
* a: d.size(16, u32), // takes up 16 bytes, instead of 4
|
102
|
+
* b: u32, // starts at byte 16, because `a` has a custom size
|
103
|
+
* });
|
104
|
+
*
|
105
|
+
* @param size The amount of bytes that should be reserved for this data-type.
|
106
|
+
* @param data The data-type to wrap.
|
107
|
+
*/
|
108
|
+
declare function size<TSize extends number, TData extends AnyData>(size: TSize, data: TData): Decorate<TData, Size<TSize>>;
|
109
|
+
/**
|
110
|
+
* Assigns an explicit numeric location to a struct member or a parameter that has this type.
|
111
|
+
*
|
112
|
+
* @example
|
113
|
+
* const VertexOutput = {
|
114
|
+
* a: d.u32, // has implicit location 0
|
115
|
+
* b: d.location(5, d.u32),
|
116
|
+
* c: d.u32, // has implicit location 6
|
117
|
+
* };
|
118
|
+
*
|
119
|
+
* @param location The explicit numeric location.
|
120
|
+
* @param data The data-type to wrap.
|
121
|
+
*/
|
122
|
+
declare function location<TLocation extends number, TData extends AnyData>(location: TLocation, data: TData): Decorate<TData, Location<TLocation>>;
|
123
|
+
/**
|
124
|
+
* Specifies how user-defined vertex shader output (fragment shader input)
|
125
|
+
* must be interpolated.
|
126
|
+
*
|
127
|
+
* Tip: Integer outputs cannot be interpolated.
|
128
|
+
*
|
129
|
+
* @example
|
130
|
+
* const VertexOutput = {
|
131
|
+
* a: d.f32, // has implicit 'perspective, center' interpolation
|
132
|
+
* b: d.interpolate('linear, sample', d.f32),
|
133
|
+
* };
|
134
|
+
*
|
135
|
+
* @param interpolationType How data should be interpolated.
|
136
|
+
* @param data The data-type to wrap.
|
137
|
+
*/
|
138
|
+
declare function interpolate<TInterpolation extends PerspectiveOrLinearInterpolationType, TData extends PerspectiveOrLinearInterpolatableData>(interpolationType: TInterpolation, data: TData): Decorate<TData, Interpolate<TInterpolation>>;
|
139
|
+
/**
|
140
|
+
* Specifies how user-defined vertex shader output (fragment shader input)
|
141
|
+
* must be interpolated.
|
142
|
+
*
|
143
|
+
* Tip: Default sampling method of `flat` is `first`. Unless you specifically
|
144
|
+
* need deterministic behavior provided by `'flat, first'`, prefer explicit
|
145
|
+
* `'flat, either'` as it could be slightly faster in hardware.
|
146
|
+
*
|
147
|
+
* @example
|
148
|
+
* const VertexOutput = {
|
149
|
+
* a: d.f32, // has implicit 'perspective, center' interpolation
|
150
|
+
* b: d.interpolate('flat, either', d.u32), // integer outputs cannot interpolate
|
151
|
+
* };
|
152
|
+
*
|
153
|
+
* @param interpolationType How data should be interpolated.
|
154
|
+
* @param data The data-type to wrap.
|
155
|
+
*/
|
156
|
+
declare function interpolate<TInterpolation extends FlatInterpolationType, TData extends FlatInterpolatableData>(interpolationType: TInterpolation, data: TData): Decorate<TData, Interpolate<TInterpolation>>;
|
157
|
+
declare function isBuiltin<T extends Decorated<AnyWgslData, AnyAttribute[]> | LooseDecorated<AnyLooseData, AnyAttribute[]>>(value: T | unknown): value is T;
|
158
|
+
|
159
|
+
export { type AnyAttribute as A, type BuiltinVertexIndex as B, type Decorate as D, type HasCustomLocation as H, type IsBuiltin as I, type OmitBuiltins as O, type AnyComputeBuiltin as a, type AnyFragmentInputBuiltin as b, type AnyFragmentOutputBuiltin as c, align as d, isBuiltin as e, builtin as f, type BuiltinInstanceIndex as g, type BuiltinPosition as h, interpolate as i, type BuiltinClipDistances as j, type BuiltinFrontFacing as k, location as l, type BuiltinFragDepth as m, type BuiltinSampleIndex as n, type BuiltinSampleMask as o, type BuiltinLocalInvocationId as p, type BuiltinLocalInvocationIndex as q, type BuiltinGlobalInvocationId as r, size as s, type BuiltinWorkgroupId as t, type BuiltinNumWorkgroups as u, type AnyBuiltin as v };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5;var _chunkVUYQ2ZIKcjs = require('./chunk-VUYQ2ZIK.cjs');function Q(t){let e=n=>n;return Object.setPrototypeOf(e,X),e.propTypes=t,e}var X={type:"struct",[_chunkVUYQ2ZIKcjs.S]:!0,_label:void 0,get label(){return this._label},$name(t){return this._label=t,this},toString(){return`struct:${_nullishCoalesce(this.label, () => ("<unnamed>"))}`}};var d=(t,e)=>{let n=e-1,i=~n;return(t&n)===0?t:(t&i)+e};var G=["uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],Pt= exports.b ={f32:"float32",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",f16:"float16",vec2h:"float16x2",vec4h:"float16x4",u32:"uint32",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",i32:"sint32",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4"};var Y=["unstruct","disarray","loose-decorated",...G];function _(t){return Y.includes(_optionalChain([t, 'optionalAccess', _2 => _2.type]))}function T(t){return _optionalChain([t, 'optionalAccess', _3 => _3.type])==="disarray"}function g(t){return _optionalChain([t, 'optionalAccess', _4 => _4.type])==="unstruct"}function l(t){return _optionalChain([t, 'optionalAccess', _5 => _5.type])==="loose-decorated"}function b(t){return _optionalChain([t, 'access', _6 => _6.attribs, 'optionalAccess', _7 => _7.find, 'call', _8 => _8(_chunkVUYQ2ZIKcjs.ca), 'optionalAccess', _9 => _9.value])}function j(t){return _optionalChain([t, 'access', _10 => _10.attribs, 'optionalAccess', _11 => _11.find, 'call', _12 => _12(_chunkVUYQ2ZIKcjs.da), 'optionalAccess', _13 => _13.value])}function kt(t){return _optionalChain([t, 'access', _14 => _14.attribs, 'optionalAccess', _15 => _15.find, 'call', _16 => _16(_chunkVUYQ2ZIKcjs.ea), 'optionalAccess', _17 => _17.value])}function Z(t){return _chunkVUYQ2ZIKcjs.Z.call(void 0, t)||_(t)}var r=class{constructor(e){this.type=e}},tt= exports.i ={uint8:_chunkVUYQ2ZIKcjs.N,uint8x2:_chunkVUYQ2ZIKcjs.u,uint8x4:_chunkVUYQ2ZIKcjs.E,sint8:_chunkVUYQ2ZIKcjs.O,sint8x2:_chunkVUYQ2ZIKcjs.t,sint8x4:_chunkVUYQ2ZIKcjs.D,unorm8:_chunkVUYQ2ZIKcjs.P,unorm8x2:_chunkVUYQ2ZIKcjs.r,unorm8x4:_chunkVUYQ2ZIKcjs.B,snorm8:_chunkVUYQ2ZIKcjs.P,snorm8x2:_chunkVUYQ2ZIKcjs.r,snorm8x4:_chunkVUYQ2ZIKcjs.B,uint16:_chunkVUYQ2ZIKcjs.N,uint16x2:_chunkVUYQ2ZIKcjs.u,uint16x4:_chunkVUYQ2ZIKcjs.E,sint16:_chunkVUYQ2ZIKcjs.O,sint16x2:_chunkVUYQ2ZIKcjs.t,sint16x4:_chunkVUYQ2ZIKcjs.D,unorm16:_chunkVUYQ2ZIKcjs.P,unorm16x2:_chunkVUYQ2ZIKcjs.r,unorm16x4:_chunkVUYQ2ZIKcjs.B,snorm16:_chunkVUYQ2ZIKcjs.P,snorm16x2:_chunkVUYQ2ZIKcjs.r,snorm16x4:_chunkVUYQ2ZIKcjs.B,float16:_chunkVUYQ2ZIKcjs.P,float16x2:_chunkVUYQ2ZIKcjs.r,float16x4:_chunkVUYQ2ZIKcjs.B,float32:_chunkVUYQ2ZIKcjs.P,float32x2:_chunkVUYQ2ZIKcjs.r,float32x3:_chunkVUYQ2ZIKcjs.w,float32x4:_chunkVUYQ2ZIKcjs.B,uint32:_chunkVUYQ2ZIKcjs.N,uint32x2:_chunkVUYQ2ZIKcjs.u,uint32x3:_chunkVUYQ2ZIKcjs.z,uint32x4:_chunkVUYQ2ZIKcjs.E,sint32:_chunkVUYQ2ZIKcjs.O,sint32x2:_chunkVUYQ2ZIKcjs.t,sint32x3:_chunkVUYQ2ZIKcjs.y,sint32x4:_chunkVUYQ2ZIKcjs.D,"unorm10-10-10-2":_chunkVUYQ2ZIKcjs.B,"unorm8x4-bgra":_chunkVUYQ2ZIKcjs.B},K= exports.j =Object.keys(tt),zt= exports.k =new r("uint8"),Et= exports.l =new r("uint8x2"),Ot= exports.m =new r("uint8x4"),$t= exports.n =new r("sint8"),Mt= exports.o =new r("sint8x2"),Nt= exports.p =new r("sint8x4"),Rt= exports.q =new r("unorm8"),Gt= exports.r =new r("unorm8x2"),jt= exports.s =new r("unorm8x4"),Kt= exports.t =new r("snorm8"),Ht= exports.u =new r("snorm8x2"),Jt= exports.v =new r("snorm8x4"),qt= exports.w =new r("uint16"),Qt= exports.x =new r("uint16x2"),Xt= exports.y =new r("uint16x4"),Yt= exports.z =new r("sint16"),Zt= exports.A =new r("sint16x2"),te= exports.B =new r("sint16x4"),ee= exports.C =new r("unorm16"),re= exports.D =new r("unorm16x2"),ne= exports.E =new r("unorm16x4"),oe= exports.F =new r("snorm16"),ie= exports.G =new r("snorm16x2"),ae= exports.H =new r("snorm16x4"),se= exports.I =new r("float16"),ue= exports.J =new r("float16x2"),pe= exports.K =new r("float16x4"),xe= exports.L =new r("float32"),le= exports.M =new r("float32x2"),me= exports.N =new r("float32x3"),ce= exports.O =new r("float32x4"),ye= exports.P =new r("uint32"),fe= exports.Q =new r("uint32x2"),de= exports.R =new r("uint32x3"),Te= exports.S =new r("uint32x4"),ge= exports.T =new r("sint32"),be= exports.U =new r("sint32x2"),De= exports.V =new r("sint32x3"),Ae= exports.W =new r("sint32x4"),Ie= exports.X =new r("unorm10-10-10-2"),ve= exports.Y =new r("unorm8x4-bgra");var et={f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:16,vec3h:8,vec3i:16,vec3u:16,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:8,mat3x3f:16,mat4x4f:16,atomic:4};function rt(t){let e=_optionalChain([t, 'optionalAccess', _18 => _18.type]),n=et[e];if(n!==void 0)return n;if(_chunkVUYQ2ZIKcjs.$.call(void 0, t))return Object.values(t.propTypes).map(p).reduce((i,c)=>i>c?i:c);if(_chunkVUYQ2ZIKcjs._.call(void 0, t))return p(t.elementType);if(g(t)){let i=Object.values(t.propTypes)[0];return i?_nullishCoalesce(b(i), () => (1)):1}if(T(t))return _nullishCoalesce(b(t.elementType), () => (1));if(_chunkVUYQ2ZIKcjs.ha.call(void 0, t)||l(t))return _nullishCoalesce(b(t), () => (p(t.inner)));if(K.includes(e))return 1;throw new Error(`Cannot determine alignment of data: ${JSON.stringify(t)}`)}function nt(t){if(g(t)){let e=Object.values(t.propTypes)[0];return e?D(e):1}return T(t)?D(t.elementType):l(t)?_nullishCoalesce(b(t), () => (D(t.inner))):_nullishCoalesce(b(t), () => (1))}var H=new WeakMap,J=new WeakMap;function p(t){let e=H.get(t);return e===void 0&&(e=rt(t),H.set(t,e)),e}function D(t){let e=J.get(t);return e===void 0&&(e=nt(t),J.set(t,e)),e}function ot(t){return p(t)}var it={f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:12,vec3h:6,vec3i:12,vec3u:12,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:16,mat3x3f:48,mat4x4f:64,uint8:1,uint8x2:2,uint8x4:4,sint8:1,sint8x2:2,sint8x4:4,unorm8:1,unorm8x2:2,unorm8x4:4,snorm8:1,snorm8x2:2,snorm8x4:4,uint16:2,uint16x2:4,uint16x4:8,sint16:2,sint16x2:4,sint16x4:8,unorm16:2,unorm16x2:4,unorm16x4:8,snorm16:2,snorm16x2:4,snorm16x4:8,float16:2,float16x2:4,float16x4:8,float32:4,float32x2:8,float32x3:12,float32x4:16,uint32:4,uint32x2:8,uint32x3:12,uint32x4:16,sint32:4,sint32x2:8,sint32x3:12,sint32x4:16,"unorm10-10-10-2":4,"unorm8x4-bgra":4,atomic:4};function at(t){let e=0;for(let n of Object.values(t.propTypes)){if(Number.isNaN(e))throw new Error("Only the last property of a struct can be unbounded");if(e=d(e,p(n)),e+=x(n),Number.isNaN(e)&&n.type!=="array")throw new Error("Cannot nest unbounded struct within another struct")}return d(e,p(t))}function st(t){let e=0;for(let n of Object.values(t.propTypes)){let i=D(n);e=d(e,i),e+=x(n)}return e}function ut(t){let e=it[_optionalChain([t, 'optionalAccess', _19 => _19.type])];if(e!==void 0)return e;if(_chunkVUYQ2ZIKcjs.$.call(void 0, t))return at(t);if(g(t))return st(t);if(_chunkVUYQ2ZIKcjs._.call(void 0, t)){if(t.elementCount===0)return Number.NaN;let n=p(t.elementType);return d(x(t.elementType),n)*t.elementCount}if(T(t)){let n=D(t.elementType);return d(x(t.elementType),n)*t.elementCount}if(_chunkVUYQ2ZIKcjs.ha.call(void 0, t)||l(t))return _nullishCoalesce(j(t), () => (x(t.inner)));throw new Error(`Cannot determine size of data: ${t}`)}var q=new WeakMap;function x(t){let e=q.get(t);return e===void 0&&(e=ut(t),q.set(t,e)),e}function pt(t){return x(t)}function $(t,e){return new O(t,e)}var O= (_class =class{constructor(e,n){;_class.prototype.__init.call(this);this.elementType=e;this.elementCount=n;if(Number.isNaN(x(e)))throw new Error("Cannot nest runtime sized arrays.");if(!Number.isInteger(n)||n<0)throw new Error(`Cannot create array schema with invalid element count: ${n}.`)}__init() {this.type="array"}toString(){return`arrayOf(${this.elementType})`}}, _class);function xt(t){return{type:"ptr",inner:t,addressSpace:"function",access:"read-write"}}function lt(t){return{type:"ptr",inner:t,addressSpace:"private",access:"read-write"}}function mt(t){return{type:"ptr",inner:t,addressSpace:"workgroup",access:"read-write"}}function ct(t,e="read"){return{type:"ptr",inner:t,addressSpace:"storage",access:e}}function yt(t){return{type:"ptr",inner:t,addressSpace:"uniform",access:"read"}}function ft(t){return{type:"ptr",inner:t,addressSpace:"handle",access:"read"}}function dt(t,e){return new M(t,e)}var M= (_class2 =class{constructor(e,n){;_class2.prototype.__init2.call(this);this.elementType=e;this.elementCount=n;if(!Number.isInteger(n)||n<0)throw new Error(`Cannot create disarray schema with invalid element count: ${n}.`)}__init2() {this.type="disarray"}}, _class2);function Tt(t){let e=n=>n;return Object.setPrototypeOf(e,gt),e.propTypes=t,e}var gt={type:"unstruct",_label:void 0,get label(){return this._label},$name(t){return this._label=t,this},toString(){return`unstruct:${_nullishCoalesce(this.label, () => ("<unnamed>"))}`}};function bt(t){return new N(t)}var N= (_class3 =class{constructor(e){;_class3.prototype.__init3.call(this);this.inner=e}__init3() {this.type="atomic"}}, _class3);function o(t,e){return _chunkVUYQ2ZIKcjs.ha.call(void 0, t)?new k(t.inner,[e,...t.attribs]):l(t)?new U(t.inner,[e,...t.attribs]):_(t)?new U(t,[e]):new k(t,[e])}function Dt(t,e){return o(e,{type:"@align",value:t})}function At(t,e){return o(e,{type:"@size",value:t})}function It(t,e){return o(e,{type:"@location",value:t})}function vt(t,e){return o(e,{type:"@interpolate",value:t})}function wt(t){return(_chunkVUYQ2ZIKcjs.ha.call(void 0, t)||l(t))&&t.attribs.find(_chunkVUYQ2ZIKcjs.ga)!==void 0}function Ge(t){return!_chunkVUYQ2ZIKcjs.ha.call(void 0, t)&&!l(t)?"":t.attribs.map(e=>`${e.type}(${e.value}) `).join("")}var L=class{constructor(e,n){this.inner=e;this.attribs=n;let i=_optionalChain([n, 'access', _20 => _20.find, 'call', _21 => _21(_chunkVUYQ2ZIKcjs.ca), 'optionalAccess', _22 => _22.value]),c=_optionalChain([n, 'access', _23 => _23.find, 'call', _24 => _24(_chunkVUYQ2ZIKcjs.da), 'optionalAccess', _25 => _25.value]);if(i!==void 0){if(i<=0)throw new Error(`Custom data alignment must be a positive number, got: ${i}.`);if(Math.log2(i)%1!==0)throw new Error(`Alignment has to be a power of 2, got: ${i}.`);if(_chunkVUYQ2ZIKcjs.Z.call(void 0, this.inner)&&i%p(this.inner)!==0)throw new Error(`Custom alignment has to be a multiple of the standard data alignment. Got: ${i}, expected multiple of: ${p(this.inner)}.`)}if(c!==void 0){if(c<x(this.inner))throw new Error(`Custom data size cannot be smaller then the standard data size. Got: ${c}, expected at least: ${x(this.inner)}.`);if(c<=0)throw new Error(`Custom data size must be a positive number. Got: ${c}.`)}}},k= (_class4 =class extends L{constructor(...args) { super(...args); _class4.prototype.__init4.call(this); }__init4() {this.type="decorated"}}, _class4),U= (_class5 =class extends L{constructor(...args2) { super(...args2); _class5.prototype.__init5.call(this); }__init5() {this.type="loose-decorated"}}, _class5);var Bt={vertexIndex:o(_chunkVUYQ2ZIKcjs.N,{type:"@builtin",value:"vertex_index"}),instanceIndex:o(_chunkVUYQ2ZIKcjs.N,{type:"@builtin",value:"instance_index"}),position:o(_chunkVUYQ2ZIKcjs.B,{type:"@builtin",value:"position"}),clipDistances:o($(_chunkVUYQ2ZIKcjs.N,8),{type:"@builtin",value:"clip_distances"}),frontFacing:o(_chunkVUYQ2ZIKcjs.P,{type:"@builtin",value:"front_facing"}),fragDepth:o(_chunkVUYQ2ZIKcjs.P,{type:"@builtin",value:"frag_depth"}),sampleIndex:o(_chunkVUYQ2ZIKcjs.N,{type:"@builtin",value:"sample_index"}),sampleMask:o(_chunkVUYQ2ZIKcjs.N,{type:"@builtin",value:"sample_mask"}),localInvocationId:o(_chunkVUYQ2ZIKcjs.z,{type:"@builtin",value:"local_invocation_id"}),localInvocationIndex:o(_chunkVUYQ2ZIKcjs.N,{type:"@builtin",value:"local_invocation_index"}),globalInvocationId:o(_chunkVUYQ2ZIKcjs.z,{type:"@builtin",value:"global_invocation_id"}),workgroupId:o(_chunkVUYQ2ZIKcjs.z,{type:"@builtin",value:"workgroup_id"}),numWorkgroups:o(_chunkVUYQ2ZIKcjs.z,{type:"@builtin",value:"num_workgroups"}),subgroupInvocationId:o(_chunkVUYQ2ZIKcjs.N,{type:"@builtin",value:"subgroup_invocation_id"}),subgroupSize:o(_chunkVUYQ2ZIKcjs.N,{type:"@builtin",value:"subgroup_size"})};exports.a = G; exports.b = Pt; exports.c = _; exports.d = T; exports.e = g; exports.f = l; exports.g = kt; exports.h = Z; exports.i = tt; exports.j = K; exports.k = zt; exports.l = Et; exports.m = Ot; exports.n = $t; exports.o = Mt; exports.p = Nt; exports.q = Rt; exports.r = Gt; exports.s = jt; exports.t = Kt; exports.u = Ht; exports.v = Jt; exports.w = qt; exports.x = Qt; exports.y = Xt; exports.z = Yt; exports.A = Zt; exports.B = te; exports.C = ee; exports.D = re; exports.E = ne; exports.F = oe; exports.G = ie; exports.H = ae; exports.I = se; exports.J = ue; exports.K = pe; exports.L = xe; exports.M = le; exports.N = me; exports.O = ce; exports.P = ye; exports.Q = fe; exports.R = de; exports.S = Te; exports.T = ge; exports.U = be; exports.V = De; exports.W = Ae; exports.X = Ie; exports.Y = ve; exports.Z = p; exports._ = D; exports.$ = ot; exports.aa = d; exports.ba = x; exports.ca = pt; exports.da = o; exports.ea = Dt; exports.fa = At; exports.ga = It; exports.ha = vt; exports.ia = wt; exports.ja = Ge; exports.ka = Q; exports.la = $; exports.ma = xt; exports.na = lt; exports.oa = mt; exports.pa = ct; exports.qa = yt; exports.ra = ft; exports.sa = dt; exports.ta = Tt; exports.ua = bt; exports.va = Bt;
|
2
|
+
//# sourceMappingURL=chunk-A6AAWPBU.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/chunk-A6AAWPBU.cjs","../src/data/struct.ts"],"names":["struct","props","WgslStructImpl","$structTag","label"],"mappings":"AAAA,yyBAAyL,SCiBzKA,CAAAA,CACdC,CAAAA,CACoB,CACpB,IAAMD,CAAAA,CAAaC,CAAAA,EAAaA,CAAAA,CAChC,OAAA,MAAA,CAAO,cAAA,CAAeD,CAAAA,CAAQE,CAAc,CAAA,CAC5CF,CAAAA,CAAO,SAAA,CAAYC,CAAAA,CAEZD,CACT,CAMA,IAAME,CAAAA,CAAiB,CACrB,IAAA,CAAM,QAAA,CACN,CAACC,mBAAU,CAAA,CAAG,CAAA,CAAA,CACd,MAAA,CAAQ,KAAA,CAAA,CAER,IAAI,KAAA,CAAA,CAA4B,CAC9B,OAAO,IAAA,CAAK,MACd,CAAA,CAEA,KAAA,CAAMC,CAAAA,CAAe,CACnB,OAAA,IAAA,CAAK,MAAA,CAASA,CAAAA,CACP,IACT,CAAA,CAEA,QAAA,CAAA,CAAmB,CACjB,MAAO,CAAA,OAAA,mBAAU,IAAA,CAAK,KAAA,SAAS,aAAW,CAAA,CAAA","file":"/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/chunk-A6AAWPBU.cjs","sourcesContent":[null,"import { $structTag, type AnyWgslData, type WgslStruct } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates a struct schema that can be used to construct GPU buffers.\n * Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).\n * The order of members matches the passed in properties object.\n *\n * @example\n * const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });\n *\n * @param props Record with `string` keys and `TgpuData` values,\n * each entry describing one struct member.\n */\nexport function struct<TProps extends Record<string, AnyWgslData>>(\n props: TProps,\n): WgslStruct<TProps> {\n const struct = <T>(props: T) => props;\n Object.setPrototypeOf(struct, WgslStructImpl);\n struct.propTypes = props;\n\n return struct as WgslStruct<TProps>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst WgslStructImpl = {\n type: 'struct',\n [$structTag]: true,\n _label: undefined as string | undefined,\n\n get label(): string | undefined {\n return this._label;\n },\n\n $name(label: string) {\n this._label = label;\n return this;\n },\n\n toString(): string {\n return `struct:${this.label ?? '<unnamed>'}`;\n },\n};\n"]}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{$ as h,B as s,D as v,E as w,N as a,O as B,P as u,S as R,Z as F,_ as V,ca as P,da as S,ea as z,ga as E,ha as m,r as y,t as A,u as I,w as W,y as C,z as f}from"./chunk-T5Y2EQPZ.js";function Q(t){let e=n=>n;return Object.setPrototypeOf(e,X),e.propTypes=t,e}var X={type:"struct",[R]:!0,_label:void 0,get label(){return this._label},$name(t){return this._label=t,this},toString(){return`struct:${this.label??"<unnamed>"}`}};var d=(t,e)=>{let n=e-1,i=~n;return(t&n)===0?t:(t&i)+e};var G=["uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],Pt={f32:"float32",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",f16:"float16",vec2h:"float16x2",vec4h:"float16x4",u32:"uint32",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",i32:"sint32",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4"};var Y=["unstruct","disarray","loose-decorated",...G];function _(t){return Y.includes(t?.type)}function T(t){return t?.type==="disarray"}function g(t){return t?.type==="unstruct"}function l(t){return t?.type==="loose-decorated"}function b(t){return t.attribs?.find(P)?.value}function j(t){return t.attribs?.find(S)?.value}function kt(t){return t.attribs?.find(z)?.value}function Z(t){return F(t)||_(t)}var r=class{constructor(e){this.type=e}},tt={uint8:a,uint8x2:I,uint8x4:w,sint8:B,sint8x2:A,sint8x4:v,unorm8:u,unorm8x2:y,unorm8x4:s,snorm8:u,snorm8x2:y,snorm8x4:s,uint16:a,uint16x2:I,uint16x4:w,sint16:B,sint16x2:A,sint16x4:v,unorm16:u,unorm16x2:y,unorm16x4:s,snorm16:u,snorm16x2:y,snorm16x4:s,float16:u,float16x2:y,float16x4:s,float32:u,float32x2:y,float32x3:W,float32x4:s,uint32:a,uint32x2:I,uint32x3:f,uint32x4:w,sint32:B,sint32x2:A,sint32x3:C,sint32x4:v,"unorm10-10-10-2":s,"unorm8x4-bgra":s},K=Object.keys(tt),zt=new r("uint8"),Et=new r("uint8x2"),Ot=new r("uint8x4"),$t=new r("sint8"),Mt=new r("sint8x2"),Nt=new r("sint8x4"),Rt=new r("unorm8"),Gt=new r("unorm8x2"),jt=new r("unorm8x4"),Kt=new r("snorm8"),Ht=new r("snorm8x2"),Jt=new r("snorm8x4"),qt=new r("uint16"),Qt=new r("uint16x2"),Xt=new r("uint16x4"),Yt=new r("sint16"),Zt=new r("sint16x2"),te=new r("sint16x4"),ee=new r("unorm16"),re=new r("unorm16x2"),ne=new r("unorm16x4"),oe=new r("snorm16"),ie=new r("snorm16x2"),ae=new r("snorm16x4"),se=new r("float16"),ue=new r("float16x2"),pe=new r("float16x4"),xe=new r("float32"),le=new r("float32x2"),me=new r("float32x3"),ce=new r("float32x4"),ye=new r("uint32"),fe=new r("uint32x2"),de=new r("uint32x3"),Te=new r("uint32x4"),ge=new r("sint32"),be=new r("sint32x2"),De=new r("sint32x3"),Ae=new r("sint32x4"),Ie=new r("unorm10-10-10-2"),ve=new r("unorm8x4-bgra");var et={f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:16,vec3h:8,vec3i:16,vec3u:16,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:8,mat3x3f:16,mat4x4f:16,atomic:4};function rt(t){let e=t?.type,n=et[e];if(n!==void 0)return n;if(h(t))return Object.values(t.propTypes).map(p).reduce((i,c)=>i>c?i:c);if(V(t))return p(t.elementType);if(g(t)){let i=Object.values(t.propTypes)[0];return i?b(i)??1:1}if(T(t))return b(t.elementType)??1;if(m(t)||l(t))return b(t)??p(t.inner);if(K.includes(e))return 1;throw new Error(`Cannot determine alignment of data: ${JSON.stringify(t)}`)}function nt(t){if(g(t)){let e=Object.values(t.propTypes)[0];return e?D(e):1}return T(t)?D(t.elementType):l(t)?b(t)??D(t.inner):b(t)??1}var H=new WeakMap,J=new WeakMap;function p(t){let e=H.get(t);return e===void 0&&(e=rt(t),H.set(t,e)),e}function D(t){let e=J.get(t);return e===void 0&&(e=nt(t),J.set(t,e)),e}function ot(t){return p(t)}var it={f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:12,vec3h:6,vec3i:12,vec3u:12,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:16,mat3x3f:48,mat4x4f:64,uint8:1,uint8x2:2,uint8x4:4,sint8:1,sint8x2:2,sint8x4:4,unorm8:1,unorm8x2:2,unorm8x4:4,snorm8:1,snorm8x2:2,snorm8x4:4,uint16:2,uint16x2:4,uint16x4:8,sint16:2,sint16x2:4,sint16x4:8,unorm16:2,unorm16x2:4,unorm16x4:8,snorm16:2,snorm16x2:4,snorm16x4:8,float16:2,float16x2:4,float16x4:8,float32:4,float32x2:8,float32x3:12,float32x4:16,uint32:4,uint32x2:8,uint32x3:12,uint32x4:16,sint32:4,sint32x2:8,sint32x3:12,sint32x4:16,"unorm10-10-10-2":4,"unorm8x4-bgra":4,atomic:4};function at(t){let e=0;for(let n of Object.values(t.propTypes)){if(Number.isNaN(e))throw new Error("Only the last property of a struct can be unbounded");if(e=d(e,p(n)),e+=x(n),Number.isNaN(e)&&n.type!=="array")throw new Error("Cannot nest unbounded struct within another struct")}return d(e,p(t))}function st(t){let e=0;for(let n of Object.values(t.propTypes)){let i=D(n);e=d(e,i),e+=x(n)}return e}function ut(t){let e=it[t?.type];if(e!==void 0)return e;if(h(t))return at(t);if(g(t))return st(t);if(V(t)){if(t.elementCount===0)return Number.NaN;let n=p(t.elementType);return d(x(t.elementType),n)*t.elementCount}if(T(t)){let n=D(t.elementType);return d(x(t.elementType),n)*t.elementCount}if(m(t)||l(t))return j(t)??x(t.inner);throw new Error(`Cannot determine size of data: ${t}`)}var q=new WeakMap;function x(t){let e=q.get(t);return e===void 0&&(e=ut(t),q.set(t,e)),e}function pt(t){return x(t)}function $(t,e){return new O(t,e)}var O=class{constructor(e,n){this.elementType=e;this.elementCount=n;if(Number.isNaN(x(e)))throw new Error("Cannot nest runtime sized arrays.");if(!Number.isInteger(n)||n<0)throw new Error(`Cannot create array schema with invalid element count: ${n}.`)}type="array";"~gpuRepr";"~reprPartial";"~memIdent";toString(){return`arrayOf(${this.elementType})`}};function xt(t){return{type:"ptr",inner:t,addressSpace:"function",access:"read-write"}}function lt(t){return{type:"ptr",inner:t,addressSpace:"private",access:"read-write"}}function mt(t){return{type:"ptr",inner:t,addressSpace:"workgroup",access:"read-write"}}function ct(t,e="read"){return{type:"ptr",inner:t,addressSpace:"storage",access:e}}function yt(t){return{type:"ptr",inner:t,addressSpace:"uniform",access:"read"}}function ft(t){return{type:"ptr",inner:t,addressSpace:"handle",access:"read"}}function dt(t,e){return new M(t,e)}var M=class{constructor(e,n){this.elementType=e;this.elementCount=n;if(!Number.isInteger(n)||n<0)throw new Error(`Cannot create disarray schema with invalid element count: ${n}.`)}type="disarray";"~reprPartial"};function Tt(t){let e=n=>n;return Object.setPrototypeOf(e,gt),e.propTypes=t,e}var gt={type:"unstruct",_label:void 0,get label(){return this._label},$name(t){return this._label=t,this},toString(){return`unstruct:${this.label??"<unnamed>"}`}};function bt(t){return new N(t)}var N=class{constructor(e){this.inner=e}type="atomic";"~memIdent";"~gpuRepr"};function o(t,e){return m(t)?new k(t.inner,[e,...t.attribs]):l(t)?new U(t.inner,[e,...t.attribs]):_(t)?new U(t,[e]):new k(t,[e])}function Dt(t,e){return o(e,{type:"@align",value:t})}function At(t,e){return o(e,{type:"@size",value:t})}function It(t,e){return o(e,{type:"@location",value:t})}function vt(t,e){return o(e,{type:"@interpolate",value:t})}function wt(t){return(m(t)||l(t))&&t.attribs.find(E)!==void 0}function Ge(t){return!m(t)&&!l(t)?"":t.attribs.map(e=>`${e.type}(${e.value}) `).join("")}var L=class{constructor(e,n){this.inner=e;this.attribs=n;let i=n.find(P)?.value,c=n.find(S)?.value;if(i!==void 0){if(i<=0)throw new Error(`Custom data alignment must be a positive number, got: ${i}.`);if(Math.log2(i)%1!==0)throw new Error(`Alignment has to be a power of 2, got: ${i}.`);if(F(this.inner)&&i%p(this.inner)!==0)throw new Error(`Custom alignment has to be a multiple of the standard data alignment. Got: ${i}, expected multiple of: ${p(this.inner)}.`)}if(c!==void 0){if(c<x(this.inner))throw new Error(`Custom data size cannot be smaller then the standard data size. Got: ${c}, expected at least: ${x(this.inner)}.`);if(c<=0)throw new Error(`Custom data size must be a positive number. Got: ${c}.`)}}},k=class extends L{type="decorated";"~gpuRepr";"~reprPartial";"~memIdent"},U=class extends L{type="loose-decorated"};var Bt={vertexIndex:o(a,{type:"@builtin",value:"vertex_index"}),instanceIndex:o(a,{type:"@builtin",value:"instance_index"}),position:o(s,{type:"@builtin",value:"position"}),clipDistances:o($(a,8),{type:"@builtin",value:"clip_distances"}),frontFacing:o(u,{type:"@builtin",value:"front_facing"}),fragDepth:o(u,{type:"@builtin",value:"frag_depth"}),sampleIndex:o(a,{type:"@builtin",value:"sample_index"}),sampleMask:o(a,{type:"@builtin",value:"sample_mask"}),localInvocationId:o(f,{type:"@builtin",value:"local_invocation_id"}),localInvocationIndex:o(a,{type:"@builtin",value:"local_invocation_index"}),globalInvocationId:o(f,{type:"@builtin",value:"global_invocation_id"}),workgroupId:o(f,{type:"@builtin",value:"workgroup_id"}),numWorkgroups:o(f,{type:"@builtin",value:"num_workgroups"}),subgroupInvocationId:o(a,{type:"@builtin",value:"subgroup_invocation_id"}),subgroupSize:o(a,{type:"@builtin",value:"subgroup_size"})};export{G as a,Pt as b,_ as c,T as d,g as e,l as f,kt as g,Z as h,tt as i,K as j,zt as k,Et as l,Ot as m,$t as n,Mt as o,Nt as p,Rt as q,Gt as r,jt as s,Kt as t,Ht as u,Jt as v,qt as w,Qt as x,Xt as y,Yt as z,Zt as A,te as B,ee as C,re as D,ne as E,oe as F,ie as G,ae as H,se as I,ue as J,pe as K,xe as L,le as M,me as N,ce as O,ye as P,fe as Q,de as R,Te as S,ge as T,be as U,De as V,Ae as W,Ie as X,ve as Y,p as Z,D as _,ot as $,d as aa,x as ba,pt as ca,o as da,Dt as ea,At as fa,It as ga,vt as ha,wt as ia,Ge as ja,Q as ka,$ as la,xt as ma,lt as na,mt as oa,ct as pa,yt as qa,ft as ra,dt as sa,Tt as ta,bt as ua,Bt as va};
|
2
|
+
//# sourceMappingURL=chunk-HZAXWB4J.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/data/struct.ts","../src/mathUtils.ts","../src/shared/vertexFormat.ts","../src/data/dataTypes.ts","../src/data/vertexFormatData.ts","../src/data/alignmentOf.ts","../src/data/sizeOf.ts","../src/data/array.ts","../src/data/ptr.ts","../src/data/disarray.ts","../src/data/unstruct.ts","../src/data/atomic.ts","../src/data/attributes.ts","../src/builtin.ts"],"sourcesContent":["import { $structTag, type AnyWgslData, type WgslStruct } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates a struct schema that can be used to construct GPU buffers.\n * Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).\n * The order of members matches the passed in properties object.\n *\n * @example\n * const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });\n *\n * @param props Record with `string` keys and `TgpuData` values,\n * each entry describing one struct member.\n */\nexport function struct<TProps extends Record<string, AnyWgslData>>(\n props: TProps,\n): WgslStruct<TProps> {\n const struct = <T>(props: T) => props;\n Object.setPrototypeOf(struct, WgslStructImpl);\n struct.propTypes = props;\n\n return struct as WgslStruct<TProps>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst WgslStructImpl = {\n type: 'struct',\n [$structTag]: true,\n _label: undefined as string | undefined,\n\n get label(): string | undefined {\n return this._label;\n },\n\n $name(label: string) {\n this._label = label;\n return this;\n },\n\n toString(): string {\n return `struct:${this.label ?? '<unnamed>'}`;\n },\n};\n","/**\n * @param value\n * @param modulo has to be power of 2\n */\nexport const roundUp = (value: number, modulo: number) => {\n const bitMask = modulo - 1;\n const invBitMask = ~bitMask;\n return (value & bitMask) === 0 ? value : (value & invBitMask) + modulo;\n};\n","export const vertexFormats = [\n 'uint8',\n 'uint8x2',\n 'uint8x4',\n 'sint8',\n 'sint8x2',\n 'sint8x4',\n 'unorm8',\n 'unorm8x2',\n 'unorm8x4',\n 'snorm8',\n 'snorm8x2',\n 'snorm8x4',\n 'uint16',\n 'uint16x2',\n 'uint16x4',\n 'sint16',\n 'sint16x2',\n 'sint16x4',\n 'unorm16',\n 'unorm16x2',\n 'unorm16x4',\n 'snorm16',\n 'snorm16x2',\n 'snorm16x4',\n 'float16',\n 'float16x2',\n 'float16x4',\n 'float32',\n 'float32x2',\n 'float32x3',\n 'float32x4',\n 'uint32',\n 'uint32x2',\n 'uint32x3',\n 'uint32x4',\n 'sint32',\n 'sint32x2',\n 'sint32x3',\n 'sint32x4',\n 'unorm10-10-10-2',\n 'unorm8x4-bgra',\n] as const;\n\nexport type VertexFormat = (typeof vertexFormats)[number];\n\nexport const kindToDefaultFormatMap = {\n f32: 'float32',\n vec2f: 'float32x2',\n vec3f: 'float32x3',\n vec4f: 'float32x4',\n f16: 'float16',\n vec2h: 'float16x2',\n // vec3h has no direct equivalent in the spec\n vec4h: 'float16x4',\n u32: 'uint32',\n vec2u: 'uint32x2',\n vec3u: 'uint32x3',\n vec4u: 'uint32x4',\n i32: 'sint32',\n vec2i: 'sint32x2',\n vec3i: 'sint32x3',\n vec4i: 'sint32x4',\n} as const;\n\nexport type KindToDefaultFormatMap = typeof kindToDefaultFormatMap;\n\nexport interface TgpuVertexAttrib<TFormat extends VertexFormat = VertexFormat> {\n readonly format: TFormat;\n readonly offset: number;\n}\n\nexport type AnyVertexAttribs =\n | Record<string, TgpuVertexAttrib>\n | TgpuVertexAttrib;\n\n/**\n * All vertex attribute formats that can be interpreted as\n * an single or multi component u32 in a shader.\n * https://www.w3.org/TR/webgpu/#vertex-formats\n */\ntype U32CompatibleFormats =\n | TgpuVertexAttrib<'uint8'>\n | TgpuVertexAttrib<'uint8x2'>\n | TgpuVertexAttrib<'uint8x4'>\n | TgpuVertexAttrib<'uint16'>\n | TgpuVertexAttrib<'uint16x2'>\n | TgpuVertexAttrib<'uint16x4'>\n | TgpuVertexAttrib<'uint32'>\n | TgpuVertexAttrib<'uint32x2'>\n | TgpuVertexAttrib<'uint32x3'>\n | TgpuVertexAttrib<'uint32x4'>;\n\n/**\n * All vertex attribute formats that can be interpreted as\n * an single or multi component i32 in a shader.\n * https://www.w3.org/TR/webgpu/#vertex-formats\n */\ntype I32CompatibleFormats =\n | TgpuVertexAttrib<'sint8'>\n | TgpuVertexAttrib<'sint8x2'>\n | TgpuVertexAttrib<'sint8x4'>\n | TgpuVertexAttrib<'sint16'>\n | TgpuVertexAttrib<'sint16x2'>\n | TgpuVertexAttrib<'sint16x4'>\n | TgpuVertexAttrib<'sint32'>\n | TgpuVertexAttrib<'sint32x2'>\n | TgpuVertexAttrib<'sint32x3'>\n | TgpuVertexAttrib<'sint32x4'>;\n\n/**\n * All vertex attribute formats that can be interpreted as\n * an single or multi component f32 in a shader.\n * https://www.w3.org/TR/webgpu/#vertex-formats\n */\ntype F32CompatibleFormats =\n | TgpuVertexAttrib<'unorm8'>\n | TgpuVertexAttrib<'unorm8x2'>\n | TgpuVertexAttrib<'unorm8x4'>\n | TgpuVertexAttrib<'snorm8'>\n | TgpuVertexAttrib<'snorm8x2'>\n | TgpuVertexAttrib<'snorm8x4'>\n | TgpuVertexAttrib<'unorm16'>\n | TgpuVertexAttrib<'unorm16x2'>\n | TgpuVertexAttrib<'unorm16x4'>\n | TgpuVertexAttrib<'snorm16'>\n | TgpuVertexAttrib<'snorm16x2'>\n | TgpuVertexAttrib<'snorm16x4'>\n | TgpuVertexAttrib<'float16'>\n | TgpuVertexAttrib<'float16x2'>\n | TgpuVertexAttrib<'float16x4'>\n | TgpuVertexAttrib<'float32'>\n | TgpuVertexAttrib<'float32x2'>\n | TgpuVertexAttrib<'float32x3'>\n | TgpuVertexAttrib<'float32x4'>\n | TgpuVertexAttrib<'unorm10-10-10-2'>\n | TgpuVertexAttrib<'unorm8x4-bgra'>;\n\n/**\n * All vertex attribute formats that can be interpreted as\n * a single or multi component f16 in a shader. (same as f32 on the shader side)\n * https://www.w3.org/TR/webgpu/#vertex-formats\n */\ntype F16CompatibleFormats = F32CompatibleFormats;\n\nexport type KindToAcceptedAttribMap = {\n u32: U32CompatibleFormats;\n vec2u: U32CompatibleFormats;\n vec3u: U32CompatibleFormats;\n vec4u: U32CompatibleFormats;\n\n i32: I32CompatibleFormats;\n vec2i: I32CompatibleFormats;\n vec3i: I32CompatibleFormats;\n vec4i: I32CompatibleFormats;\n\n f16: F16CompatibleFormats;\n vec2h: F16CompatibleFormats;\n vec3h: F16CompatibleFormats;\n vec4h: F16CompatibleFormats;\n\n f32: F32CompatibleFormats;\n vec2f: F32CompatibleFormats;\n vec3f: F32CompatibleFormats;\n vec4f: F32CompatibleFormats;\n};\n","import type { TgpuNamable } from '../namable.ts';\nimport type {\n $repr,\n Infer,\n InferGPURecord,\n InferPartial,\n InferPartialRecord,\n InferRecord,\n MemIdentityRecord,\n} from '../shared/repr.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { Prettify } from '../shared/utilityTypes.ts';\nimport { vertexFormats } from '../shared/vertexFormat.ts';\nimport type { PackedData } from './vertexFormatData.ts';\nimport * as wgsl from './wgslTypes.ts';\n\nexport type TgpuDualFn<TImpl extends (...args: unknown[]) => unknown> =\n TImpl & {\n [$internal]: {\n implementation: TImpl | string;\n };\n };\n\n/**\n * Array schema constructed via `d.disarrayOf` function.\n *\n * Useful for defining vertex buffers.\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 */\nexport interface Disarray<TElement extends wgsl.BaseData = wgsl.BaseData> {\n readonly type: 'disarray';\n readonly elementCount: number;\n readonly elementType: TElement;\n readonly [$repr]: Infer<TElement>[];\n readonly '~reprPartial': { idx: number; value: InferPartial<TElement> }[];\n}\n\n/**\n * Struct schema constructed via `d.unstruct` function.\n *\n * Useful for defining vertex buffers, as the standard layout restrictions do not apply.\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 */\nexport interface Unstruct<\n TProps extends Record<string, wgsl.BaseData> = Record<string, wgsl.BaseData>,\n> extends TgpuNamable {\n (props: Prettify<InferRecord<TProps>>): Prettify<InferRecord<TProps>>;\n readonly label?: string | undefined;\n readonly type: 'unstruct';\n readonly propTypes: TProps;\n readonly [$repr]: Prettify<InferRecord<TProps>>;\n readonly '~gpuRepr': Prettify<InferGPURecord<TProps>>;\n readonly '~memIdent': Unstruct<Prettify<MemIdentityRecord<TProps>>>;\n readonly '~reprPartial': Prettify<Partial<InferPartialRecord<TProps>>>;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <we need the type to be broader than Unstruct<Record<string, BaseData>>\nexport type AnyUnstruct = Unstruct<any>;\n\nexport interface LooseDecorated<\n TInner extends wgsl.BaseData = wgsl.BaseData,\n TAttribs extends unknown[] = unknown[],\n> {\n readonly type: 'loose-decorated';\n readonly inner: TInner;\n readonly attribs: TAttribs;\n readonly [$repr]: Infer<TInner>;\n}\n\nconst looseTypeLiterals = [\n 'unstruct',\n 'disarray',\n 'loose-decorated',\n ...vertexFormats,\n] as const;\n\nexport type LooseTypeLiteral = (typeof looseTypeLiterals)[number];\n\nexport type AnyLooseData = Disarray | AnyUnstruct | LooseDecorated | PackedData;\n\nexport function isLooseData(data: unknown): data is AnyLooseData {\n return looseTypeLiterals.includes((data as AnyLooseData)?.type);\n}\n\n/**\n * Checks whether the passed in value is a disarray schema,\n * as opposed to, e.g., a regular array schema.\n *\n * Array schemas can be used to describe uniform and storage buffers,\n * whereas disarray schemas cannot. Disarrays are useful for\n * defining vertex buffers instead.\n *\n * @example\n * isDisarray(d.arrayOf(d.u32, 4)) // false\n * isDisarray(d.disarrayOf(d.u32, 4)) // true\n * isDisarray(d.vec3f) // false\n */\nexport function isDisarray<T extends Disarray>(\n schema: T | unknown,\n): schema is T {\n return (schema as Disarray)?.type === 'disarray';\n}\n\n/**\n * Checks whether passed in value is a unstruct schema,\n * as opposed to, e.g., a struct schema.\n *\n * Struct schemas can be used to describe uniform and storage buffers,\n * whereas unstruct schemas cannot. Unstructs are useful for\n * defining vertex buffers instead.\n *\n * @example\n * isUnstruct(d.struct({ a: d.u32 })) // false\n * isUnstruct(d.unstruct({ a: d.u32 })) // true\n * isUnstruct(d.vec3f) // false\n */\nexport function isUnstruct<T extends Unstruct>(\n schema: T | unknown,\n): schema is T {\n return (schema as T)?.type === 'unstruct';\n}\n\nexport function isLooseDecorated<T extends LooseDecorated>(\n value: T | unknown,\n): value is T {\n return (value as T)?.type === 'loose-decorated';\n}\n\nexport function getCustomAlignment(data: wgsl.BaseData): number | undefined {\n return (data as unknown as wgsl.Decorated | LooseDecorated).attribs?.find(\n wgsl.isAlignAttrib,\n )?.value;\n}\n\nexport function getCustomSize(data: wgsl.BaseData): number | undefined {\n return (data as unknown as wgsl.Decorated | LooseDecorated).attribs?.find(\n wgsl.isSizeAttrib,\n )?.value;\n}\n\nexport function getCustomLocation(data: wgsl.BaseData): number | undefined {\n return (data as unknown as wgsl.Decorated | LooseDecorated).attribs?.find(\n wgsl.isLocationAttrib,\n )?.value;\n}\n\nexport function isData(value: unknown): value is AnyData {\n return wgsl.isWgslData(value) || isLooseData(value);\n}\n\nexport type AnyData = wgsl.AnyWgslData | AnyLooseData;\nexport type AnyConcreteData = Exclude<\n AnyData,\n wgsl.AbstractInt | wgsl.AbstractFloat | wgsl.Void\n>;\n","import { $repr, type Infer } from '../shared/repr.ts';\nimport type { VertexFormat } from '../shared/vertexFormat.ts';\nimport { f32, i32, u32 } from './numeric.ts';\nimport {\n vec2f,\n vec2i,\n vec2u,\n vec3f,\n vec3i,\n vec3u,\n vec4f,\n vec4i,\n vec4u,\n} from './vector.ts';\n\nexport type FormatToWGSLType<T extends VertexFormat> =\n (typeof formatToWGSLType)[T];\n\nexport interface TgpuVertexFormatData<T extends VertexFormat> {\n readonly type: T;\n /** Type-token, not available at runtime */\n readonly [$repr]: Infer<FormatToWGSLType<T>>;\n}\n\nclass TgpuVertexFormatDataImpl<T extends VertexFormat>\n implements TgpuVertexFormatData<T>\n{\n /** Used as a type-token for the `Infer<T>` functionality. */\n public declare readonly [$repr]: Infer<FormatToWGSLType<T>>;\n\n constructor(public readonly type: T) {}\n}\n\nexport const formatToWGSLType = {\n uint8: u32,\n uint8x2: vec2u,\n uint8x4: vec4u,\n sint8: i32,\n sint8x2: vec2i,\n sint8x4: vec4i,\n unorm8: f32,\n unorm8x2: vec2f,\n unorm8x4: vec4f,\n snorm8: f32,\n snorm8x2: vec2f,\n snorm8x4: vec4f,\n uint16: u32,\n uint16x2: vec2u,\n uint16x4: vec4u,\n sint16: i32,\n sint16x2: vec2i,\n sint16x4: vec4i,\n unorm16: f32,\n unorm16x2: vec2f,\n unorm16x4: vec4f,\n snorm16: f32,\n snorm16x2: vec2f,\n snorm16x4: vec4f,\n float16: f32,\n float16x2: vec2f,\n float16x4: vec4f,\n float32: f32,\n float32x2: vec2f,\n float32x3: vec3f,\n float32x4: vec4f,\n uint32: u32,\n uint32x2: vec2u,\n uint32x3: vec3u,\n uint32x4: vec4u,\n sint32: i32,\n sint32x2: vec2i,\n sint32x3: vec3i,\n sint32x4: vec4i,\n 'unorm10-10-10-2': vec4f,\n 'unorm8x4-bgra': vec4f,\n} as const;\n\nexport const packedFormats = Object.keys(formatToWGSLType);\n\nexport type uint8 = TgpuVertexFormatData<'uint8'>;\nexport const uint8 = new TgpuVertexFormatDataImpl('uint8') as uint8;\n\nexport type uint8x2 = TgpuVertexFormatData<'uint8x2'>;\nexport const uint8x2 = new TgpuVertexFormatDataImpl('uint8x2') as uint8x2;\n\nexport type uint8x4 = TgpuVertexFormatData<'uint8x4'>;\nexport const uint8x4 = new TgpuVertexFormatDataImpl('uint8x4') as uint8x4;\n\nexport type sint8 = TgpuVertexFormatData<'sint8'>;\nexport const sint8 = new TgpuVertexFormatDataImpl('sint8') as sint8;\n\nexport type sint8x2 = TgpuVertexFormatData<'sint8x2'>;\nexport const sint8x2 = new TgpuVertexFormatDataImpl('sint8x2') as sint8x2;\n\nexport type sint8x4 = TgpuVertexFormatData<'sint8x4'>;\nexport const sint8x4 = new TgpuVertexFormatDataImpl('sint8x4') as sint8x4;\n\nexport type unorm8 = TgpuVertexFormatData<'unorm8'>;\nexport const unorm8 = new TgpuVertexFormatDataImpl('unorm8') as unorm8;\n\nexport type unorm8x2 = TgpuVertexFormatData<'unorm8x2'>;\nexport const unorm8x2 = new TgpuVertexFormatDataImpl('unorm8x2') as unorm8x2;\n\nexport type unorm8x4 = TgpuVertexFormatData<'unorm8x4'>;\nexport const unorm8x4 = new TgpuVertexFormatDataImpl('unorm8x4') as unorm8x4;\n\nexport type snorm8 = TgpuVertexFormatData<'snorm8'>;\nexport const snorm8 = new TgpuVertexFormatDataImpl('snorm8') as snorm8;\n\nexport type snorm8x2 = TgpuVertexFormatData<'snorm8x2'>;\nexport const snorm8x2 = new TgpuVertexFormatDataImpl('snorm8x2') as snorm8x2;\n\nexport type snorm8x4 = TgpuVertexFormatData<'snorm8x4'>;\nexport const snorm8x4 = new TgpuVertexFormatDataImpl('snorm8x4') as snorm8x4;\n\nexport type uint16 = TgpuVertexFormatData<'uint16'>;\nexport const uint16 = new TgpuVertexFormatDataImpl('uint16') as uint16;\n\nexport type uint16x2 = TgpuVertexFormatData<'uint16x2'>;\nexport const uint16x2 = new TgpuVertexFormatDataImpl('uint16x2') as uint16x2;\n\nexport type uint16x4 = TgpuVertexFormatData<'uint16x4'>;\nexport const uint16x4 = new TgpuVertexFormatDataImpl('uint16x4') as uint16x4;\n\nexport type sint16 = TgpuVertexFormatData<'sint16'>;\nexport const sint16 = new TgpuVertexFormatDataImpl('sint16') as sint16;\n\nexport type sint16x2 = TgpuVertexFormatData<'sint16x2'>;\nexport const sint16x2 = new TgpuVertexFormatDataImpl('sint16x2') as sint16x2;\n\nexport type sint16x4 = TgpuVertexFormatData<'sint16x4'>;\nexport const sint16x4 = new TgpuVertexFormatDataImpl('sint16x4') as sint16x4;\n\nexport type unorm16 = TgpuVertexFormatData<'unorm16'>;\nexport const unorm16 = new TgpuVertexFormatDataImpl('unorm16') as unorm16;\n\nexport type unorm16x2 = TgpuVertexFormatData<'unorm16x2'>;\nexport const unorm16x2 = new TgpuVertexFormatDataImpl('unorm16x2') as unorm16x2;\n\nexport type unorm16x4 = TgpuVertexFormatData<'unorm16x4'>;\nexport const unorm16x4 = new TgpuVertexFormatDataImpl('unorm16x4') as unorm16x4;\n\nexport type snorm16 = TgpuVertexFormatData<'snorm16'>;\nexport const snorm16 = new TgpuVertexFormatDataImpl('snorm16') as snorm16;\n\nexport type snorm16x2 = TgpuVertexFormatData<'snorm16x2'>;\nexport const snorm16x2 = new TgpuVertexFormatDataImpl('snorm16x2') as snorm16x2;\n\nexport type snorm16x4 = TgpuVertexFormatData<'snorm16x4'>;\nexport const snorm16x4 = new TgpuVertexFormatDataImpl('snorm16x4') as snorm16x4;\n\nexport type float16 = TgpuVertexFormatData<'float16'>;\nexport const float16 = new TgpuVertexFormatDataImpl('float16') as float16;\n\nexport type float16x2 = TgpuVertexFormatData<'float16x2'>;\nexport const float16x2 = new TgpuVertexFormatDataImpl('float16x2') as float16x2;\n\nexport type float16x4 = TgpuVertexFormatData<'float16x4'>;\nexport const float16x4 = new TgpuVertexFormatDataImpl('float16x4') as float16x4;\n\nexport type float32 = TgpuVertexFormatData<'float32'>;\nexport const float32 = new TgpuVertexFormatDataImpl('float32') as float32;\n\nexport type float32x2 = TgpuVertexFormatData<'float32x2'>;\nexport const float32x2 = new TgpuVertexFormatDataImpl('float32x2') as float32x2;\n\nexport type float32x3 = TgpuVertexFormatData<'float32x3'>;\nexport const float32x3 = new TgpuVertexFormatDataImpl('float32x3') as float32x3;\n\nexport type float32x4 = TgpuVertexFormatData<'float32x4'>;\nexport const float32x4 = new TgpuVertexFormatDataImpl('float32x4') as float32x4;\n\nexport type uint32 = TgpuVertexFormatData<'uint32'>;\nexport const uint32 = new TgpuVertexFormatDataImpl('uint32') as uint32;\n\nexport type uint32x2 = TgpuVertexFormatData<'uint32x2'>;\nexport const uint32x2 = new TgpuVertexFormatDataImpl('uint32x2') as uint32x2;\n\nexport type uint32x3 = TgpuVertexFormatData<'uint32x3'>;\nexport const uint32x3 = new TgpuVertexFormatDataImpl('uint32x3') as uint32x3;\n\nexport type uint32x4 = TgpuVertexFormatData<'uint32x4'>;\nexport const uint32x4 = new TgpuVertexFormatDataImpl('uint32x4') as uint32x4;\n\nexport type sint32 = TgpuVertexFormatData<'sint32'>;\nexport const sint32 = new TgpuVertexFormatDataImpl('sint32') as sint32;\n\nexport type sint32x2 = TgpuVertexFormatData<'sint32x2'>;\nexport const sint32x2 = new TgpuVertexFormatDataImpl('sint32x2') as sint32x2;\n\nexport type sint32x3 = TgpuVertexFormatData<'sint32x3'>;\nexport const sint32x3 = new TgpuVertexFormatDataImpl('sint32x3') as sint32x3;\n\nexport type sint32x4 = TgpuVertexFormatData<'sint32x4'>;\nexport const sint32x4 = new TgpuVertexFormatDataImpl('sint32x4') as sint32x4;\n\nexport type unorm10_10_10_2 = TgpuVertexFormatData<'unorm10-10-10-2'>;\nexport const unorm10_10_10_2 = new TgpuVertexFormatDataImpl(\n 'unorm10-10-10-2',\n) as unorm10_10_10_2;\n\nexport type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;\nexport const unorm8x4_bgra = new TgpuVertexFormatDataImpl(\n 'unorm8x4-bgra',\n) as unorm8x4_bgra;\n\nexport type PackedData =\n | uint8\n | uint8x2\n | uint8x4\n | sint8\n | sint8x2\n | sint8x4\n | unorm8\n | unorm8x2\n | unorm8x4\n | snorm8\n | snorm8x2\n | snorm8x4\n | uint16\n | uint16x2\n | uint16x4\n | sint16\n | sint16x2\n | sint16x4\n | unorm16\n | unorm16x2\n | unorm16x4\n | snorm16\n | snorm16x2\n | snorm16x4\n | float16\n | float16x2\n | float16x4\n | float32\n | float32x2\n | float32x3\n | float32x4\n | uint32\n | uint32x2\n | uint32x3\n | uint32x4\n | sint32\n | sint32x2\n | sint32x3\n | sint32x4\n | unorm10_10_10_2\n | unorm8x4_bgra;\n","import {\n type AnyData,\n getCustomAlignment,\n isDisarray,\n isLooseDecorated,\n isUnstruct,\n} from './dataTypes.ts';\nimport { packedFormats } from './vertexFormatData.ts';\nimport {\n type BaseData,\n isDecorated,\n isWgslArray,\n isWgslStruct,\n} from './wgslTypes.ts';\n\nconst knownAlignmentMap: Record<string, number> = {\n f32: 4,\n f16: 2,\n i32: 4,\n u32: 4,\n vec2f: 8,\n vec2h: 4,\n vec2i: 8,\n vec2u: 8,\n vec3f: 16,\n vec3h: 8,\n vec3i: 16,\n vec3u: 16,\n vec4f: 16,\n vec4h: 8,\n vec4i: 16,\n vec4u: 16,\n mat2x2f: 8,\n mat3x3f: 16,\n mat4x4f: 16,\n atomic: 4,\n};\n\nfunction computeAlignment(data: object): number {\n const dataType = (data as BaseData)?.type;\n const knownAlignment = knownAlignmentMap[dataType];\n if (knownAlignment !== undefined) {\n return knownAlignment;\n }\n\n if (isWgslStruct(data)) {\n return Object.values(data.propTypes)\n .map(alignmentOf)\n .reduce((a, b) => (a > b ? a : b));\n }\n\n if (isWgslArray(data)) {\n return alignmentOf(data.elementType);\n }\n\n if (isUnstruct(data)) {\n // A loose struct is aligned to its first property.\n const firstProp = Object.values(data.propTypes)[0];\n return firstProp ? (getCustomAlignment(firstProp) ?? 1) : 1;\n }\n\n if (isDisarray(data)) {\n return getCustomAlignment(data.elementType) ?? 1;\n }\n\n if (isDecorated(data) || isLooseDecorated(data)) {\n return getCustomAlignment(data) ?? alignmentOf(data.inner);\n }\n\n if (packedFormats.includes(dataType)) {\n return 1;\n }\n\n throw new Error(\n `Cannot determine alignment of data: ${JSON.stringify(data)}`,\n );\n}\n\nfunction computeCustomAlignment(data: BaseData): number {\n if (isUnstruct(data)) {\n // A loose struct is aligned to its first property.\n const firstProp = Object.values(data.propTypes)[0];\n return firstProp ? customAlignmentOf(firstProp) : 1;\n }\n\n if (isDisarray(data)) {\n return customAlignmentOf(data.elementType);\n }\n\n if (isLooseDecorated(data)) {\n return getCustomAlignment(data) ?? customAlignmentOf(data.inner);\n }\n\n return getCustomAlignment(data) ?? 1;\n}\n\n/**\n * Since alignments can be inferred from data types, they are not stored on them.\n * Instead, this weak map acts as an extended property of those data types.\n */\nconst cachedAlignments = new WeakMap<object, number>();\n\nconst cachedCustomAlignments = new WeakMap<object, number>();\n\nexport function alignmentOf(data: BaseData): number {\n let alignment = cachedAlignments.get(data);\n if (alignment === undefined) {\n alignment = computeAlignment(data);\n cachedAlignments.set(data, alignment);\n }\n\n return alignment;\n}\n\nexport function customAlignmentOf(data: BaseData): number {\n let alignment = cachedCustomAlignments.get(data);\n if (alignment === undefined) {\n alignment = computeCustomAlignment(data);\n cachedCustomAlignments.set(data, alignment);\n }\n\n return alignment;\n}\n\n/**\n * Returns the alignment (in bytes) of data represented by the `schema`.\n */\nexport function PUBLIC_alignmentOf(schema: AnyData): number {\n return alignmentOf(schema);\n}\n","import { roundUp } from '../mathUtils.ts';\nimport { alignmentOf, customAlignmentOf } from './alignmentOf.ts';\nimport type { AnyData, LooseTypeLiteral, Unstruct } from './dataTypes.ts';\nimport {\n getCustomSize,\n isDisarray,\n isLooseDecorated,\n isUnstruct,\n} from './dataTypes.ts';\nimport type { BaseData, WgslStruct, WgslTypeLiteral } from './wgslTypes.ts';\nimport { isDecorated, isWgslArray, isWgslStruct } from './wgslTypes.ts';\n\nconst knownSizesMap: Record<string, number> = {\n f32: 4,\n f16: 2,\n i32: 4,\n u32: 4,\n vec2f: 8,\n vec2h: 4,\n vec2i: 8,\n vec2u: 8,\n vec3f: 12,\n vec3h: 6,\n vec3i: 12,\n vec3u: 12,\n vec4f: 16,\n vec4h: 8,\n vec4i: 16,\n vec4u: 16,\n mat2x2f: 16,\n mat3x3f: 48,\n mat4x4f: 64,\n uint8: 1,\n uint8x2: 2,\n uint8x4: 4,\n sint8: 1,\n sint8x2: 2,\n sint8x4: 4,\n unorm8: 1,\n unorm8x2: 2,\n unorm8x4: 4,\n snorm8: 1,\n snorm8x2: 2,\n snorm8x4: 4,\n uint16: 2,\n uint16x2: 4,\n uint16x4: 8,\n sint16: 2,\n sint16x2: 4,\n sint16x4: 8,\n unorm16: 2,\n unorm16x2: 4,\n unorm16x4: 8,\n snorm16: 2,\n snorm16x2: 4,\n snorm16x4: 8,\n float16: 2,\n float16x2: 4,\n float16x4: 8,\n float32: 4,\n float32x2: 8,\n float32x3: 12,\n float32x4: 16,\n uint32: 4,\n uint32x2: 8,\n uint32x3: 12,\n uint32x4: 16,\n sint32: 4,\n sint32x2: 8,\n sint32x3: 12,\n sint32x4: 16,\n 'unorm10-10-10-2': 4,\n 'unorm8x4-bgra': 4,\n atomic: 4,\n} satisfies Partial<Record<WgslTypeLiteral | LooseTypeLiteral, number>>;\n\nfunction sizeOfStruct(struct: WgslStruct) {\n let size = 0;\n for (const property of Object.values(struct.propTypes)) {\n if (Number.isNaN(size)) {\n throw new Error('Only the last property of a struct can be unbounded');\n }\n\n size = roundUp(size, alignmentOf(property));\n size += sizeOf(property);\n\n if (Number.isNaN(size) && property.type !== 'array') {\n throw new Error('Cannot nest unbounded struct within another struct');\n }\n }\n\n return roundUp(size, alignmentOf(struct));\n}\n\nfunction sizeOfUnstruct(data: Unstruct) {\n let size = 0;\n\n for (const property of Object.values(data.propTypes)) {\n const alignment = customAlignmentOf(property);\n size = roundUp(size, alignment);\n size += sizeOf(property);\n }\n\n return size;\n}\n\nfunction computeSize(data: object): number {\n const knownSize = knownSizesMap[(data as BaseData)?.type];\n\n if (knownSize !== undefined) {\n return knownSize;\n }\n\n if (isWgslStruct(data)) {\n return sizeOfStruct(data);\n }\n\n if (isUnstruct(data)) {\n return sizeOfUnstruct(data);\n }\n\n if (isWgslArray(data)) {\n if (data.elementCount === 0) {\n return Number.NaN;\n }\n\n const alignment = alignmentOf(data.elementType);\n const stride = roundUp(sizeOf(data.elementType), alignment);\n return stride * data.elementCount;\n }\n\n if (isDisarray(data)) {\n const alignment = customAlignmentOf(data.elementType);\n const stride = roundUp(sizeOf(data.elementType), alignment);\n return stride * data.elementCount;\n }\n\n if (isDecorated(data) || isLooseDecorated(data)) {\n return getCustomSize(data) ?? sizeOf(data.inner);\n }\n\n throw new Error(`Cannot determine size of data: ${data}`);\n}\n\n/**\n * Since sizes can be inferred from data types, they are not stored on them.\n * Instead, this weak map acts as an extended property of those data types.\n */\nconst cachedSizes = new WeakMap<BaseData, number>();\n\nexport function sizeOf(schema: BaseData): number {\n let size = cachedSizes.get(schema);\n\n if (size === undefined) {\n size = computeSize(schema);\n cachedSizes.set(schema, size);\n }\n\n return size;\n}\n\n/**\n * Returns the size (in bytes) of data represented by the `schema`.\n */\nexport function PUBLIC_sizeOf(schema: AnyData): number {\n return sizeOf(schema);\n}\n","import type {\n $repr,\n Infer,\n InferGPU,\n InferPartial,\n MemIdentity,\n} from '../shared/repr.ts';\nimport { sizeOf } from './sizeOf.ts';\nimport type { AnyWgslData, BaseData, WgslArray } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates an array schema that can be used to construct gpu buffers.\n * Describes arrays with fixed-size length, storing elements of the same type.\n *\n * @example\n * const LENGTH = 3;\n * const array = d.arrayOf(d.u32, LENGTH);\n *\n * @param elementType The type of elements in the array.\n * @param elementCount The number of elements in the array.\n */\nexport function arrayOf<TElement extends AnyWgslData>(\n elementType: TElement,\n elementCount: number,\n): WgslArray<TElement> {\n return new WgslArrayImpl(elementType, elementCount);\n}\n\n// --------------\n// Implementation\n// --------------\n\nclass WgslArrayImpl<TElement extends BaseData> implements WgslArray<TElement> {\n public readonly type = 'array';\n /** Type-token, not available at runtime */\n public declare readonly [$repr]: Infer<TElement>[];\n /** Type-token, not available at runtime */\n public readonly '~gpuRepr'!: InferGPU<TElement>[];\n /** Type-token, not available at runtime */\n public readonly '~reprPartial'!: {\n idx: number;\n value: InferPartial<TElement>;\n }[];\n /** Type-token, not available at runtime */\n public readonly '~memIdent'!: WgslArray<MemIdentity<TElement>>;\n\n constructor(\n public readonly elementType: TElement,\n public readonly elementCount: number,\n ) {\n if (Number.isNaN(sizeOf(elementType))) {\n throw new Error('Cannot nest runtime sized arrays.');\n }\n\n if (!Number.isInteger(elementCount) || elementCount < 0) {\n throw new Error(\n `Cannot create array schema with invalid element count: ${elementCount}.`,\n );\n }\n }\n\n toString() {\n return `arrayOf(${this.elementType})`;\n }\n}\n","import type { AnyData } from './dataTypes.ts';\nimport type { Ptr } from './wgslTypes.ts';\n\nexport function ptrFn<T extends AnyData>(\n inner: T,\n): Ptr<'function', T, 'read-write'> {\n return {\n type: 'ptr',\n inner,\n addressSpace: 'function',\n access: 'read-write',\n } as Ptr<'function', T, 'read-write'>;\n}\n\nexport function ptrPrivate<T extends AnyData>(\n inner: T,\n): Ptr<'private', T, 'read-write'> {\n return {\n type: 'ptr',\n inner,\n addressSpace: 'private',\n access: 'read-write',\n } as Ptr<'private', T, 'read-write'>;\n}\n\nexport function ptrWorkgroup<T extends AnyData>(\n inner: T,\n): Ptr<'workgroup', T, 'read-write'> {\n return {\n type: 'ptr',\n inner,\n addressSpace: 'workgroup',\n access: 'read-write',\n } as Ptr<'workgroup', T, 'read-write'>;\n}\n\nexport function ptrStorage<\n T extends AnyData,\n TAccess extends 'read' | 'read-write' = 'read',\n>(inner: T, access: TAccess = 'read' as TAccess): Ptr<'storage', T, TAccess> {\n return {\n type: 'ptr',\n inner,\n addressSpace: 'storage',\n access,\n } as Ptr<'storage', T, TAccess>;\n}\n\nexport function ptrUniform<T extends AnyData>(\n inner: T,\n): Ptr<'uniform', T, 'read'> {\n return {\n type: 'ptr',\n inner,\n addressSpace: 'uniform',\n access: 'read',\n } as Ptr<'uniform', T, 'read'>;\n}\n\nexport function ptrHandle<T extends AnyData>(\n inner: T,\n): Ptr<'handle', T, 'read'> {\n return {\n type: 'ptr',\n inner,\n addressSpace: 'handle',\n access: 'read',\n } as Ptr<'handle', T, 'read'>;\n}\n","import type { $repr, Infer, InferPartial } from '../shared/repr.ts';\nimport type { AnyData, Disarray } from './dataTypes.ts';\n\n// ----------\n// Public API\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 * @param elementType The type of elements in the array.\n * @param count The number of elements in the array.\n */\nexport function disarrayOf<TElement extends AnyData>(\n elementType: TElement,\n count: number,\n): Disarray<TElement> {\n return new DisarrayImpl(elementType, count);\n}\n\n// --------------\n// Implementation\n// --------------\n\nclass DisarrayImpl<TElement extends AnyData> implements Disarray<TElement> {\n public readonly type = 'disarray';\n /** Type-token, not available at runtime */\n public declare readonly [$repr]: Infer<TElement>[];\n /** Type-token, not available at runtime */\n public readonly '~reprPartial'!: {\n idx: number;\n value: InferPartial<TElement>;\n }[];\n\n constructor(\n public readonly elementType: TElement,\n public readonly elementCount: number,\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 }\n}\n","import type { Unstruct } from './dataTypes.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 const unstruct = <T>(props: T) => props;\n Object.setPrototypeOf(unstruct, UnstructImpl);\n unstruct.propTypes = properties;\n\n return unstruct as unknown as Unstruct<TProps>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst UnstructImpl = {\n type: 'unstruct',\n _label: undefined as string | undefined,\n\n get label(): string | undefined {\n return this._label;\n },\n\n $name(label: string) {\n this._label = label;\n return this;\n },\n\n toString(): string {\n return `unstruct:${this.label ?? '<unnamed>'}`;\n },\n};\n","import type { $repr, Infer, MemIdentity } from '../shared/repr.ts';\nimport type { Atomic, I32, U32, atomicI32, atomicU32 } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Marks a concrete integer scalar type schema (u32 or i32) as a WGSL atomic.\n *\n * @example\n * const atomicU32 = d.atomic(d.u32);\n * const atomicI32 = d.atomic(d.i32);\n *\n * @param data Underlying type schema.\n */\nexport function atomic<TSchema extends U32 | I32>(\n data: TSchema,\n): Atomic<TSchema> {\n return new AtomicImpl(data);\n}\n\n// --------------\n// Implementation\n// --------------\n\nclass AtomicImpl<TSchema extends U32 | I32> implements Atomic<TSchema> {\n public readonly type = 'atomic';\n /** Type-token, not available at runtime */\n public declare readonly [$repr]: Infer<TSchema>;\n /** Type-token, not available at runtime */\n public readonly '~memIdent'!: MemIdentity<TSchema>;\n /** Type-token, not available at runtime */\n public readonly '~gpuRepr': TSchema extends U32 ? atomicU32 : atomicI32;\n\n constructor(public readonly inner: TSchema) {}\n}\n","import type {\n $repr,\n Infer,\n InferGPU,\n InferPartial,\n MemIdentity,\n} from '../shared/repr.ts';\nimport { alignmentOf } from './alignmentOf.ts';\nimport {\n type AnyData,\n type AnyLooseData,\n type LooseDecorated,\n type LooseTypeLiteral,\n isLooseData,\n isLooseDecorated,\n} from './dataTypes.ts';\nimport { sizeOf } from './sizeOf.ts';\nimport {\n type Align,\n type AnyWgslData,\n type BaseData,\n type Builtin,\n type Decorated,\n type FlatInterpolatableData,\n type FlatInterpolationType,\n type Interpolate,\n type InterpolationType,\n type Location,\n type PerspectiveOrLinearInterpolatableData,\n type PerspectiveOrLinearInterpolationType,\n type Size,\n type WgslTypeLiteral,\n isAlignAttrib,\n isBuiltinAttrib,\n isDecorated,\n isSizeAttrib,\n isWgslData,\n} from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\nexport const builtinNames = [\n 'vertex_index',\n 'instance_index',\n 'position',\n 'clip_distances',\n 'front_facing',\n 'frag_depth',\n 'sample_index',\n 'sample_mask',\n 'fragment',\n 'local_invocation_id',\n 'local_invocation_index',\n 'global_invocation_id',\n 'workgroup_id',\n 'num_workgroups',\n 'subgroup_invocation_id',\n 'subgroup_size',\n] as const;\n\nexport type BuiltinName = (typeof builtinNames)[number];\n\nexport type AnyAttribute<\n AllowedBuiltins extends Builtin<BuiltinName> = Builtin<BuiltinName>,\n> =\n | Align<number>\n | Size<number>\n | Location<number>\n | Interpolate<InterpolationType>\n | AllowedBuiltins;\n\nexport type ExtractAttributes<T> = T extends {\n readonly attribs: unknown[];\n}\n ? T['attribs']\n : [];\n\ntype Undecorate<T> = T extends { readonly inner: infer TInner } ? TInner : T;\n\n/**\n * Decorates a data-type `TData` with an attribute `TAttrib`.\n *\n * - if `TData` is loose\n * - if `TData` is already `LooseDecorated`\n * - Prepend `TAttrib` to the existing attribute tuple.\n * - else\n * - Wrap `TData` with `LooseDecorated` and a single attribute `[TAttrib]`\n * - else\n * - if `TData` is already `Decorated`\n * - Prepend `TAttrib` to the existing attribute tuple.\n * - else\n * - Wrap `TData` with `Decorated` and a single attribute `[TAttrib]`\n */\nexport type Decorate<\n TData extends BaseData,\n TAttrib extends AnyAttribute,\n> = TData['type'] extends WgslTypeLiteral\n ? Decorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]>\n : TData['type'] extends LooseTypeLiteral\n ? LooseDecorated<Undecorate<TData>, [TAttrib, ...ExtractAttributes<TData>]>\n : never;\n\nexport type IsBuiltin<T> = ExtractAttributes<T>[number] extends []\n ? false\n : ExtractAttributes<T>[number] extends Builtin<BuiltinName>\n ? true\n : false;\n\nexport type HasCustomLocation<T> = ExtractAttributes<T>[number] extends []\n ? false\n : ExtractAttributes<T>[number] extends Location<number>\n ? true\n : false;\n\nexport function attribute<TData extends BaseData, TAttrib extends AnyAttribute>(\n data: TData,\n attrib: TAttrib,\n): Decorated | LooseDecorated {\n if (isDecorated(data)) {\n return new DecoratedImpl(data.inner, [\n attrib,\n ...data.attribs,\n ]) as Decorated;\n }\n\n if (isLooseDecorated(data)) {\n return new LooseDecoratedImpl(data.inner, [\n attrib,\n ...data.attribs,\n ]) as LooseDecorated;\n }\n\n if (isLooseData(data)) {\n return new LooseDecoratedImpl(data, [attrib]) as unknown as LooseDecorated;\n }\n\n return new DecoratedImpl(data, [attrib]) as unknown as Decorated;\n}\n\n/**\n * Gives the wrapped data-type a custom byte alignment. Useful in order to\n * fulfill uniform alignment requirements.\n *\n * @example\n * const Data = d.struct({\n * a: u32, // takes up 4 bytes\n * // 12 bytes of padding, because `b` is custom aligned to multiples of 16 bytes\n * b: d.align(16, u32),\n * });\n *\n * @param alignment The multiple of bytes this data should align itself to.\n * @param data The data-type to align.\n */\nexport function align<TAlign extends number, TData extends AnyData>(\n alignment: TAlign,\n data: TData,\n): Decorate<TData, Align<TAlign>> {\n // biome-ignore lint/suspicious/noExplicitAny: <tired of lying to types>\n return attribute(data, { type: '@align', value: alignment }) as any;\n}\n\n/**\n * Adds padding bytes after the wrapped data-type, until the whole value takes up `size` bytes.\n *\n * @example\n * const Data = d.struct({\n * a: d.size(16, u32), // takes up 16 bytes, instead of 4\n * b: u32, // starts at byte 16, because `a` has a custom size\n * });\n *\n * @param size The amount of bytes that should be reserved for this data-type.\n * @param data The data-type to wrap.\n */\nexport function size<TSize extends number, TData extends AnyData>(\n size: TSize,\n data: TData,\n): Decorate<TData, Size<TSize>> {\n // biome-ignore lint/suspicious/noExplicitAny: <tired of lying to types>\n return attribute(data, { type: '@size', value: size }) as any;\n}\n\n/**\n * Assigns an explicit numeric location to a struct member or a parameter that has this type.\n *\n * @example\n * const VertexOutput = {\n * a: d.u32, // has implicit location 0\n * b: d.location(5, d.u32),\n * c: d.u32, // has implicit location 6\n * };\n *\n * @param location The explicit numeric location.\n * @param data The data-type to wrap.\n */\nexport function location<TLocation extends number, TData extends AnyData>(\n location: TLocation,\n data: TData,\n): Decorate<TData, Location<TLocation>> {\n // biome-ignore lint/suspicious/noExplicitAny: <tired of lying to types>\n return attribute(data, { type: '@location', value: location }) as any;\n}\n\n/**\n * Specifies how user-defined vertex shader output (fragment shader input)\n * must be interpolated.\n *\n * Tip: Integer outputs cannot be interpolated.\n *\n * @example\n * const VertexOutput = {\n * a: d.f32, // has implicit 'perspective, center' interpolation\n * b: d.interpolate('linear, sample', d.f32),\n * };\n *\n * @param interpolationType How data should be interpolated.\n * @param data The data-type to wrap.\n */\nexport function interpolate<\n TInterpolation extends PerspectiveOrLinearInterpolationType,\n TData extends PerspectiveOrLinearInterpolatableData,\n>(\n interpolationType: TInterpolation,\n data: TData,\n): Decorate<TData, Interpolate<TInterpolation>>;\n\n/**\n * Specifies how user-defined vertex shader output (fragment shader input)\n * must be interpolated.\n *\n * Tip: Default sampling method of `flat` is `first`. Unless you specifically\n * need deterministic behavior provided by `'flat, first'`, prefer explicit\n * `'flat, either'` as it could be slightly faster in hardware.\n *\n * @example\n * const VertexOutput = {\n * a: d.f32, // has implicit 'perspective, center' interpolation\n * b: d.interpolate('flat, either', d.u32), // integer outputs cannot interpolate\n * };\n *\n * @param interpolationType How data should be interpolated.\n * @param data The data-type to wrap.\n */\nexport function interpolate<\n TInterpolation extends FlatInterpolationType,\n TData extends FlatInterpolatableData,\n>(\n interpolationType: TInterpolation,\n data: TData,\n): Decorate<TData, Interpolate<TInterpolation>>;\n\nexport function interpolate<\n TInterpolation extends InterpolationType,\n TData extends AnyData,\n>(\n interpolationType: TInterpolation,\n data: TData,\n): Decorate<TData, Interpolate<TInterpolation>> {\n return attribute(data, {\n type: '@interpolate',\n value: interpolationType,\n // biome-ignore lint/suspicious/noExplicitAny: <tired of lying to types>\n }) as any;\n}\n\nexport function isBuiltin<\n T extends\n | Decorated<AnyWgslData, AnyAttribute[]>\n | LooseDecorated<AnyLooseData, AnyAttribute[]>,\n>(value: T | unknown): value is T {\n return (\n (isDecorated(value) || isLooseDecorated(value)) &&\n value.attribs.find(isBuiltinAttrib) !== undefined\n );\n}\n\nexport function getAttributesString<T extends BaseData>(field: T): string {\n if (!isDecorated(field) && !isLooseDecorated(field)) {\n return '';\n }\n\n return (field.attribs as AnyAttribute[])\n .map((attrib) => `${attrib.type}(${attrib.value}) `)\n .join('');\n}\n\n// --------------\n// Implementation\n// --------------\n\nclass BaseDecoratedImpl<TInner extends BaseData, TAttribs extends unknown[]> {\n // Type-token, not available at runtime\n public declare readonly [$repr]: Infer<TInner>;\n\n constructor(\n public readonly inner: TInner,\n public readonly attribs: TAttribs,\n ) {\n const alignAttrib = attribs.find(isAlignAttrib)?.value;\n const sizeAttrib = attribs.find(isSizeAttrib)?.value;\n\n if (alignAttrib !== undefined) {\n if (alignAttrib <= 0) {\n throw new Error(\n `Custom data alignment must be a positive number, got: ${alignAttrib}.`,\n );\n }\n\n if (Math.log2(alignAttrib) % 1 !== 0) {\n throw new Error(\n `Alignment has to be a power of 2, got: ${alignAttrib}.`,\n );\n }\n\n if (isWgslData(this.inner)) {\n if (alignAttrib % alignmentOf(this.inner) !== 0) {\n throw new Error(\n `Custom alignment has to be a multiple of the standard data alignment. Got: ${alignAttrib}, expected multiple of: ${alignmentOf(this.inner)}.`,\n );\n }\n }\n }\n\n if (sizeAttrib !== undefined) {\n if (sizeAttrib < sizeOf(this.inner)) {\n throw new Error(\n `Custom data size cannot be smaller then the standard data size. Got: ${sizeAttrib}, expected at least: ${sizeOf(this.inner)}.`,\n );\n }\n\n if (sizeAttrib <= 0) {\n throw new Error(\n `Custom data size must be a positive number. Got: ${sizeAttrib}.`,\n );\n }\n }\n }\n}\n\nclass DecoratedImpl<TInner extends BaseData, TAttribs extends unknown[]>\n extends BaseDecoratedImpl<TInner, TAttribs>\n implements Decorated<TInner, TAttribs>\n{\n public readonly type = 'decorated';\n readonly '~gpuRepr': InferGPU<TInner>;\n readonly '~reprPartial': InferPartial<TInner>;\n public readonly '~memIdent'!: TAttribs extends Location<number>[]\n ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs>\n : Decorated<MemIdentity<TInner>, TAttribs>;\n}\n\nclass LooseDecoratedImpl<TInner extends BaseData, TAttribs extends unknown[]>\n extends BaseDecoratedImpl<TInner, TAttribs>\n implements LooseDecorated<TInner, TAttribs>\n{\n public readonly type = 'loose-decorated';\n}\n","import { arrayOf } from './data/array.ts';\nimport { attribute } from './data/attributes.ts';\nimport { f32, u32 } from './data/numeric.ts';\nimport { vec3u, vec4f } from './data/vector.ts';\nimport type {\n BaseData,\n Builtin,\n Decorated,\n F32,\n U32,\n Vec3u,\n Vec4f,\n WgslArray,\n} from './data/wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\nexport type BuiltinVertexIndex = Decorated<U32, [Builtin<'vertex_index'>]>;\nexport type BuiltinInstanceIndex = Decorated<U32, [Builtin<'instance_index'>]>;\nexport type BuiltinPosition = Decorated<Vec4f, [Builtin<'position'>]>;\nexport type BuiltinClipDistances = Decorated<\n WgslArray<U32>,\n [Builtin<'clip_distances'>]\n>;\nexport type BuiltinFrontFacing = Decorated<F32, [Builtin<'front_facing'>]>;\nexport type BuiltinFragDepth = Decorated<F32, [Builtin<'frag_depth'>]>;\nexport type BuiltinSampleIndex = Decorated<U32, [Builtin<'sample_index'>]>;\nexport type BuiltinSampleMask = Decorated<U32, [Builtin<'sample_mask'>]>;\nexport type BuiltinLocalInvocationId = Decorated<\n Vec3u,\n [Builtin<'local_invocation_id'>]\n>;\nexport type BuiltinLocalInvocationIndex = Decorated<\n U32,\n [Builtin<'local_invocation_index'>]\n>;\nexport type BuiltinGlobalInvocationId = Decorated<\n Vec3u,\n [Builtin<'global_invocation_id'>]\n>;\nexport type BuiltinWorkgroupId = Decorated<Vec3u, [Builtin<'workgroup_id'>]>;\nexport type BuiltinNumWorkgroups = Decorated<\n Vec3u,\n [Builtin<'num_workgroups'>]\n>;\nexport type BuiltinSubgroupInvocationId = Decorated<\n U32,\n [Builtin<'subgroup_invocation_id'>]\n>;\nexport type BuiltinSubgroupSize = Decorated<U32, [Builtin<'subgroup_size'>]>;\n\nexport const builtin = {\n vertexIndex: attribute(u32, {\n type: '@builtin',\n value: 'vertex_index',\n }) as BuiltinVertexIndex,\n instanceIndex: attribute(u32, {\n type: '@builtin',\n value: 'instance_index',\n }) as BuiltinInstanceIndex,\n position: attribute(vec4f, {\n type: '@builtin',\n value: 'position',\n }) as BuiltinPosition,\n clipDistances: attribute(arrayOf(u32, 8), {\n type: '@builtin',\n value: 'clip_distances',\n }) as BuiltinClipDistances,\n frontFacing: attribute(f32, {\n type: '@builtin',\n value: 'front_facing',\n }) as BuiltinFrontFacing,\n fragDepth: attribute(f32, {\n type: '@builtin',\n value: 'frag_depth',\n }) as BuiltinFragDepth,\n sampleIndex: attribute(u32, {\n type: '@builtin',\n value: 'sample_index',\n }) as BuiltinSampleIndex,\n sampleMask: attribute(u32, {\n type: '@builtin',\n value: 'sample_mask',\n }) as BuiltinSampleMask,\n localInvocationId: attribute(vec3u, {\n type: '@builtin',\n value: 'local_invocation_id',\n }) as BuiltinLocalInvocationId,\n localInvocationIndex: attribute(u32, {\n type: '@builtin',\n value: 'local_invocation_index',\n }) as BuiltinLocalInvocationIndex,\n globalInvocationId: attribute(vec3u, {\n type: '@builtin',\n value: 'global_invocation_id',\n }) as BuiltinGlobalInvocationId,\n workgroupId: attribute(vec3u, {\n type: '@builtin',\n value: 'workgroup_id',\n }) as BuiltinWorkgroupId,\n numWorkgroups: attribute(vec3u, {\n type: '@builtin',\n value: 'num_workgroups',\n }) as BuiltinNumWorkgroups,\n subgroupInvocationId: attribute(u32, {\n type: '@builtin',\n value: 'subgroup_invocation_id',\n }) as BuiltinSubgroupInvocationId,\n subgroupSize: attribute(u32, {\n type: '@builtin',\n value: 'subgroup_size',\n }) as BuiltinSubgroupSize,\n} as const;\n\nexport type AnyBuiltin = (typeof builtin)[keyof typeof builtin];\nexport type AnyComputeBuiltin =\n | BuiltinLocalInvocationId\n | BuiltinLocalInvocationIndex\n | BuiltinGlobalInvocationId\n | BuiltinWorkgroupId\n | BuiltinNumWorkgroups\n | BuiltinSubgroupInvocationId\n | BuiltinSubgroupSize;\nexport type AnyVertexInputBuiltin = BuiltinVertexIndex | BuiltinInstanceIndex;\nexport type AnyVertexOutputBuiltin = BuiltinClipDistances | BuiltinPosition;\nexport type AnyFragmentInputBuiltin =\n | BuiltinPosition\n | BuiltinFrontFacing\n | BuiltinSampleIndex\n | BuiltinSampleMask\n | BuiltinSubgroupInvocationId\n | BuiltinSubgroupSize;\nexport type AnyFragmentOutputBuiltin = BuiltinFragDepth | BuiltinSampleMask;\n\nexport type OmitBuiltins<S> = S extends AnyBuiltin\n ? never\n : S extends BaseData\n ? S\n : {\n [Key in keyof S as S[Key] extends AnyBuiltin ? never : Key]: S[Key];\n };\n"],"mappings":"yLAiBO,SAASA,EACdC,EACoB,CACpB,IAAMD,EAAaC,GAAaA,EAChC,cAAO,eAAeD,EAAQE,CAAc,EAC5CF,EAAO,UAAYC,EAEZD,CACT,CAMA,IAAME,EAAiB,CACrB,KAAM,SACN,CAACC,CAAU,EAAG,GACd,OAAQ,OAER,IAAI,OAA4B,CAC9B,OAAO,KAAK,MACd,EAEA,MAAMC,EAAe,CACnB,YAAK,OAASA,EACP,IACT,EAEA,UAAmB,CACjB,MAAO,UAAU,KAAK,OAAS,WAAW,EAC5C,CACF,EC5CO,IAAMC,EAAU,CAACC,EAAeC,IAAmB,CACxD,IAAMC,EAAUD,EAAS,EACnBE,EAAa,CAACD,EACpB,OAAQF,EAAQE,KAAa,EAAIF,GAASA,EAAQG,GAAcF,CAClE,ECRO,IAAMG,EAAgB,CAC3B,QACA,UACA,UACA,QACA,UACA,UACA,SACA,WACA,WACA,SACA,WACA,WACA,SACA,WACA,WACA,SACA,WACA,WACA,UACA,YACA,YACA,UACA,YACA,YACA,UACA,YACA,YACA,UACA,YACA,YACA,YACA,SACA,WACA,WACA,WACA,SACA,WACA,WACA,WACA,kBACA,eACF,EAIaC,GAAyB,CACpC,IAAK,UACL,MAAO,YACP,MAAO,YACP,MAAO,YACP,IAAK,UACL,MAAO,YAEP,MAAO,YACP,IAAK,SACL,MAAO,WACP,MAAO,WACP,MAAO,WACP,IAAK,SACL,MAAO,WACP,MAAO,WACP,MAAO,UACT,ECUA,IAAMC,EAAoB,CACxB,WACA,WACA,kBACA,GAAGC,CACL,EAMO,SAASC,EAAYC,EAAqC,CAC/D,OAAOH,EAAkB,SAAUG,GAAuB,IAAI,CAChE,CAeO,SAASC,EACdC,EACa,CACb,OAAQA,GAAqB,OAAS,UACxC,CAeO,SAASC,EACdD,EACa,CACb,OAAQA,GAAc,OAAS,UACjC,CAEO,SAASE,EACdC,EACY,CACZ,OAAQA,GAAa,OAAS,iBAChC,CAEO,SAASC,EAAmBN,EAAyC,CAC1E,OAAQA,EAAoD,SAAS,KAC9DO,CACP,GAAG,KACL,CAEO,SAASC,EAAcR,EAAyC,CACrE,OAAQA,EAAoD,SAAS,KAC9DS,CACP,GAAG,KACL,CAEO,SAASC,GAAkBV,EAAyC,CACzE,OAAQA,EAAoD,SAAS,KAC9DW,CACP,GAAG,KACL,CAEO,SAASC,EAAOP,EAAkC,CACvD,OAAYQ,EAAWR,CAAK,GAAKN,EAAYM,CAAK,CACpD,CChIA,IAAMS,EAAN,KAEA,CAIE,YAA4BC,EAAS,CAAT,UAAAA,CAAU,CACxC,EAEaC,GAAmB,CAC9B,MAAOC,EACP,QAASC,EACT,QAASC,EACT,MAAOC,EACP,QAASC,EACT,QAASC,EACT,OAAQC,EACR,SAAUC,EACV,SAAUC,EACV,OAAQF,EACR,SAAUC,EACV,SAAUC,EACV,OAAQR,EACR,SAAUC,EACV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AAQF,EAAK,CAAC,EAAG,CACxC,KAAM,WACN,MAAO,gBACT,CAAC,EACD,YAAaD,EAAUI,EAAK,CAC1B,KAAM,WACN,MAAO,cACT,CAAC,EACD,UAAWJ,EAAUI,EAAK,CACxB,KAAM,WACN,MAAO,YACT,CAAC,EACD,YAAaJ,EAAUC,EAAK,CAC1B,KAAM,WACN,MAAO,cACT,CAAC,EACD,WAAYD,EAAUC,EAAK,CACzB,KAAM,WACN,MAAO,aACT,CAAC,EACD,kBAAmBD,EAAUK,EAAO,CAClC,KAAM,WACN,MAAO,qBACT,CAAC,EACD,qBAAsBL,EAAUC,EAAK,CACnC,KAAM,WACN,MAAO,wBACT,CAAC,EACD,mBAAoBD,EAAUK,EAAO,CACnC,KAAM,WACN,MAAO,sBACT,CAAC,EACD,YAAaL,EAAUK,EAAO,CAC5B,KAAM,WACN,MAAO,cACT,CAAC,EACD,cAAeL,EAAUK,EAAO,CAC9B,KAAM,WACN,MAAO,gBACT,CAAC,EACD,qBAAsBL,EAAUC,EAAK,CACnC,KAAM,WACN,MAAO,wBACT,CAAC,EACD,aAAcD,EAAUC,EAAK,CAC3B,KAAM,WACN,MAAO,eACT,CAAC,CACH","names":["struct","props","WgslStructImpl","$structTag","label","roundUp","value","modulo","bitMask","invBitMask","vertexFormats","kindToDefaultFormatMap","looseTypeLiterals","vertexFormats","isLooseData","data","isDisarray","schema","isUnstruct","isLooseDecorated","value","getCustomAlignment","isAlignAttrib","getCustomSize","isSizeAttrib","getCustomLocation","isLocationAttrib","isData","isWgslData","TgpuVertexFormatDataImpl","type","formatToWGSLType","u32","vec2u","vec4u","i32","vec2i","vec4i","f32","vec2f","vec4f","vec3f","vec3u","vec3i","packedFormats","uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10_10_10_2","unorm8x4_bgra","knownAlignmentMap","computeAlignment","data","dataType","knownAlignment","isWgslStruct","alignmentOf","a","b","isWgslArray","isUnstruct","firstProp","getCustomAlignment","isDisarray","isDecorated","isLooseDecorated","packedFormats","computeCustomAlignment","customAlignmentOf","cachedAlignments","cachedCustomAlignments","alignment","PUBLIC_alignmentOf","schema","knownSizesMap","sizeOfStruct","struct","size","property","roundUp","alignmentOf","sizeOf","sizeOfUnstruct","data","alignment","customAlignmentOf","computeSize","knownSize","isWgslStruct","isUnstruct","isWgslArray","isDisarray","isDecorated","isLooseDecorated","getCustomSize","cachedSizes","schema","PUBLIC_sizeOf","arrayOf","elementType","elementCount","WgslArrayImpl","sizeOf","ptrFn","inner","ptrPrivate","ptrWorkgroup","ptrStorage","access","ptrUniform","ptrHandle","disarrayOf","elementType","count","DisarrayImpl","elementCount","unstruct","properties","props","UnstructImpl","label","atomic","data","AtomicImpl","inner","attribute","data","attrib","isDecorated","DecoratedImpl","isLooseDecorated","LooseDecoratedImpl","isLooseData","align","alignment","size","location","interpolate","interpolationType","isBuiltin","value","isBuiltinAttrib","getAttributesString","field","BaseDecoratedImpl","inner","attribs","alignAttrib","isAlignAttrib","sizeAttrib","isSizeAttrib","isWgslData","alignmentOf","sizeOf","builtin","attribute","u32","vec4f","arrayOf","f32","vec3u"]}
|