typegpu 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/attributes-BQuRnaZ4.d.ts +151 -0
  2. package/attributes-Bt2NG-9a.d.cts +151 -0
  3. package/chunk-LF344PKG.cjs +4 -0
  4. package/chunk-LF344PKG.cjs.map +1 -0
  5. package/chunk-SDSDWWKW.js +2 -0
  6. package/chunk-SDSDWWKW.js.map +1 -0
  7. package/chunk-Y2M5GYRO.cjs +2 -0
  8. package/chunk-Y2M5GYRO.cjs.map +1 -0
  9. package/chunk-YLI4IK35.js +4 -0
  10. package/chunk-YLI4IK35.js.map +1 -0
  11. package/data/index.cjs +1 -192
  12. package/data/index.d.cts +209 -2
  13. package/data/index.d.ts +209 -2
  14. package/data/index.js +1 -192
  15. package/index.cjs +18 -4269
  16. package/index.cjs.map +1 -1
  17. package/index.d.cts +146 -133
  18. package/index.d.ts +146 -133
  19. package/index.js +18 -4269
  20. package/index.js.map +1 -1
  21. package/package.json +2 -2
  22. package/std/index.cjs +1 -490
  23. package/std/index.cjs.map +1 -1
  24. package/std/index.d.cts +10 -3
  25. package/std/index.d.ts +10 -3
  26. package/std/index.js +1 -490
  27. package/std/index.js.map +1 -1
  28. package/vector-CeDeofzh.d.ts +176 -0
  29. package/vector-UFYwud47.d.cts +176 -0
  30. package/{vector-CDD2FV2v.d.cts → wgslTypes-BNsjCP--.d.cts} +477 -260
  31. package/{vector-CDD2FV2v.d.ts → wgslTypes-BNsjCP--.d.ts} +477 -260
  32. package/chunk-2CMWQRQC.cjs +0 -2
  33. package/chunk-2CMWQRQC.cjs.map +0 -1
  34. package/chunk-2ZAQFPSX.js +0 -1266
  35. package/chunk-2ZAQFPSX.js.map +0 -1
  36. package/chunk-35UVS2JJ.cjs +0 -591
  37. package/chunk-35UVS2JJ.cjs.map +0 -1
  38. package/chunk-A2QB4MSZ.js +0 -4
  39. package/chunk-A2QB4MSZ.js.map +0 -1
  40. package/chunk-CMYXKKUP.cjs +0 -1266
  41. package/chunk-CMYXKKUP.cjs.map +0 -1
  42. package/chunk-DDEF2Y4S.js +0 -591
  43. package/chunk-DDEF2Y4S.js.map +0 -1
  44. package/chunk-KYBPSQX5.js +0 -2
  45. package/chunk-KYBPSQX5.js.map +0 -1
  46. package/chunk-VRYGOFCW.cjs +0 -4
  47. package/chunk-VRYGOFCW.cjs.map +0 -1
  48. package/index-CuzbyKXg.d.cts +0 -751
  49. package/index-FHKuURMs.d.ts +0 -751
@@ -1,21 +1,370 @@
1
+ /**
2
+ * Can be assigned a name. Not to be confused with
3
+ * being able to HAVE a name.
4
+ */
5
+ interface TgpuNamable {
6
+ $name(label?: string | undefined): this;
7
+ }
8
+
9
+ declare const vertexFormats: readonly ["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"];
10
+ type VertexFormat = (typeof vertexFormats)[number];
11
+ declare const kindToDefaultFormatMap: {
12
+ readonly f32: "float32";
13
+ readonly vec2f: "float32x2";
14
+ readonly vec3f: "float32x3";
15
+ readonly vec4f: "float32x4";
16
+ readonly f16: "float16";
17
+ readonly vec2h: "float16x2";
18
+ readonly vec4h: "float16x4";
19
+ readonly u32: "uint32";
20
+ readonly vec2u: "uint32x2";
21
+ readonly vec3u: "uint32x3";
22
+ readonly vec4u: "uint32x4";
23
+ readonly i32: "sint32";
24
+ readonly vec2i: "sint32x2";
25
+ readonly vec3i: "sint32x3";
26
+ readonly vec4i: "sint32x4";
27
+ };
28
+ type KindToDefaultFormatMap = typeof kindToDefaultFormatMap;
29
+ interface TgpuVertexAttrib<TFormat extends VertexFormat = VertexFormat> {
30
+ readonly format: TFormat;
31
+ readonly offset: number;
32
+ }
33
+ /**
34
+ * All vertex attribute formats that can be interpreted as
35
+ * an single or multi component u32 in a shader.
36
+ * https://www.w3.org/TR/webgpu/#vertex-formats
37
+ */
38
+ type U32CompatibleFormats = TgpuVertexAttrib<'uint8'> | TgpuVertexAttrib<'uint8x2'> | TgpuVertexAttrib<'uint8x4'> | TgpuVertexAttrib<'uint16'> | TgpuVertexAttrib<'uint16x2'> | TgpuVertexAttrib<'uint16x4'> | TgpuVertexAttrib<'uint32'> | TgpuVertexAttrib<'uint32x2'> | TgpuVertexAttrib<'uint32x3'> | TgpuVertexAttrib<'uint32x4'>;
39
+ /**
40
+ * All vertex attribute formats that can be interpreted as
41
+ * an single or multi component i32 in a shader.
42
+ * https://www.w3.org/TR/webgpu/#vertex-formats
43
+ */
44
+ type I32CompatibleFormats = TgpuVertexAttrib<'sint8'> | TgpuVertexAttrib<'sint8x2'> | TgpuVertexAttrib<'sint8x4'> | TgpuVertexAttrib<'sint16'> | TgpuVertexAttrib<'sint16x2'> | TgpuVertexAttrib<'sint16x4'> | TgpuVertexAttrib<'sint32'> | TgpuVertexAttrib<'sint32x2'> | TgpuVertexAttrib<'sint32x3'> | TgpuVertexAttrib<'sint32x4'>;
45
+ /**
46
+ * All vertex attribute formats that can be interpreted as
47
+ * an single or multi component f32 in a shader.
48
+ * https://www.w3.org/TR/webgpu/#vertex-formats
49
+ */
50
+ type F32CompatibleFormats = TgpuVertexAttrib<'unorm8'> | TgpuVertexAttrib<'unorm8x2'> | TgpuVertexAttrib<'unorm8x4'> | TgpuVertexAttrib<'snorm8'> | TgpuVertexAttrib<'snorm8x2'> | TgpuVertexAttrib<'snorm8x4'> | TgpuVertexAttrib<'unorm16'> | TgpuVertexAttrib<'unorm16x2'> | TgpuVertexAttrib<'unorm16x4'> | TgpuVertexAttrib<'snorm16'> | TgpuVertexAttrib<'snorm16x2'> | TgpuVertexAttrib<'snorm16x4'> | TgpuVertexAttrib<'float16'> | TgpuVertexAttrib<'float16x2'> | TgpuVertexAttrib<'float16x4'> | TgpuVertexAttrib<'float32'> | TgpuVertexAttrib<'float32x2'> | TgpuVertexAttrib<'float32x3'> | TgpuVertexAttrib<'float32x4'> | TgpuVertexAttrib<'unorm10-10-10-2'> | TgpuVertexAttrib<'unorm8x4-bgra'>;
51
+ /**
52
+ * All vertex attribute formats that can be interpreted as
53
+ * a single or multi component f16 in a shader. (same as f32 on the shader side)
54
+ * https://www.w3.org/TR/webgpu/#vertex-formats
55
+ */
56
+ type F16CompatibleFormats = F32CompatibleFormats;
57
+ type KindToAcceptedAttribMap = {
58
+ u32: U32CompatibleFormats;
59
+ vec2u: U32CompatibleFormats;
60
+ vec3u: U32CompatibleFormats;
61
+ vec4u: U32CompatibleFormats;
62
+ i32: I32CompatibleFormats;
63
+ vec2i: I32CompatibleFormats;
64
+ vec3i: I32CompatibleFormats;
65
+ vec4i: I32CompatibleFormats;
66
+ f16: F16CompatibleFormats;
67
+ vec2h: F16CompatibleFormats;
68
+ vec3h: F16CompatibleFormats;
69
+ vec4h: F16CompatibleFormats;
70
+ f32: F32CompatibleFormats;
71
+ vec2f: F32CompatibleFormats;
72
+ vec3f: F32CompatibleFormats;
73
+ vec4f: F32CompatibleFormats;
74
+ };
75
+
76
+ type FormatToWGSLType<T extends VertexFormat> = (typeof formatToWGSLType)[T];
77
+ interface TgpuVertexFormatData<T extends VertexFormat> {
78
+ readonly '~repr': Infer<FormatToWGSLType<T>>;
79
+ readonly type: T;
80
+ }
81
+ declare const formatToWGSLType: {
82
+ readonly uint8: U32;
83
+ readonly uint8x2: Vec2u;
84
+ readonly uint8x4: Vec4u;
85
+ readonly sint8: I32;
86
+ readonly sint8x2: Vec2i;
87
+ readonly sint8x4: Vec4i;
88
+ readonly unorm8: F32;
89
+ readonly unorm8x2: Vec2f;
90
+ readonly unorm8x4: Vec4f;
91
+ readonly snorm8: F32;
92
+ readonly snorm8x2: Vec2f;
93
+ readonly snorm8x4: Vec4f;
94
+ readonly uint16: U32;
95
+ readonly uint16x2: Vec2u;
96
+ readonly uint16x4: Vec4u;
97
+ readonly sint16: I32;
98
+ readonly sint16x2: Vec2i;
99
+ readonly sint16x4: Vec4i;
100
+ readonly unorm16: F32;
101
+ readonly unorm16x2: Vec2f;
102
+ readonly unorm16x4: Vec4f;
103
+ readonly snorm16: F32;
104
+ readonly snorm16x2: Vec2f;
105
+ readonly snorm16x4: Vec4f;
106
+ readonly float16: F32;
107
+ readonly float16x2: Vec2f;
108
+ readonly float16x4: Vec4f;
109
+ readonly float32: F32;
110
+ readonly float32x2: Vec2f;
111
+ readonly float32x3: Vec3f;
112
+ readonly float32x4: Vec4f;
113
+ readonly uint32: U32;
114
+ readonly uint32x2: Vec2u;
115
+ readonly uint32x3: Vec3u;
116
+ readonly uint32x4: Vec4u;
117
+ readonly sint32: I32;
118
+ readonly sint32x2: Vec2i;
119
+ readonly sint32x3: Vec3i;
120
+ readonly sint32x4: Vec4i;
121
+ readonly 'unorm10-10-10-2': Vec4f;
122
+ readonly 'unorm8x4-bgra': Vec4f;
123
+ };
124
+ declare const packedFormats: string[];
125
+ type uint8 = TgpuVertexFormatData<'uint8'>;
126
+ declare const uint8: uint8;
127
+ type uint8x2 = TgpuVertexFormatData<'uint8x2'>;
128
+ declare const uint8x2: uint8x2;
129
+ type uint8x4 = TgpuVertexFormatData<'uint8x4'>;
130
+ declare const uint8x4: uint8x4;
131
+ type sint8 = TgpuVertexFormatData<'sint8'>;
132
+ declare const sint8: sint8;
133
+ type sint8x2 = TgpuVertexFormatData<'sint8x2'>;
134
+ declare const sint8x2: sint8x2;
135
+ type sint8x4 = TgpuVertexFormatData<'sint8x4'>;
136
+ declare const sint8x4: sint8x4;
137
+ type unorm8 = TgpuVertexFormatData<'unorm8'>;
138
+ declare const unorm8: unorm8;
139
+ type unorm8x2 = TgpuVertexFormatData<'unorm8x2'>;
140
+ declare const unorm8x2: unorm8x2;
141
+ type unorm8x4 = TgpuVertexFormatData<'unorm8x4'>;
142
+ declare const unorm8x4: unorm8x4;
143
+ type snorm8 = TgpuVertexFormatData<'snorm8'>;
144
+ declare const snorm8: snorm8;
145
+ type snorm8x2 = TgpuVertexFormatData<'snorm8x2'>;
146
+ declare const snorm8x2: snorm8x2;
147
+ type snorm8x4 = TgpuVertexFormatData<'snorm8x4'>;
148
+ declare const snorm8x4: snorm8x4;
149
+ type uint16 = TgpuVertexFormatData<'uint16'>;
150
+ declare const uint16: uint16;
151
+ type uint16x2 = TgpuVertexFormatData<'uint16x2'>;
152
+ declare const uint16x2: uint16x2;
153
+ type uint16x4 = TgpuVertexFormatData<'uint16x4'>;
154
+ declare const uint16x4: uint16x4;
155
+ type sint16 = TgpuVertexFormatData<'sint16'>;
156
+ declare const sint16: sint16;
157
+ type sint16x2 = TgpuVertexFormatData<'sint16x2'>;
158
+ declare const sint16x2: sint16x2;
159
+ type sint16x4 = TgpuVertexFormatData<'sint16x4'>;
160
+ declare const sint16x4: sint16x4;
161
+ type unorm16 = TgpuVertexFormatData<'unorm16'>;
162
+ declare const unorm16: unorm16;
163
+ type unorm16x2 = TgpuVertexFormatData<'unorm16x2'>;
164
+ declare const unorm16x2: unorm16x2;
165
+ type unorm16x4 = TgpuVertexFormatData<'unorm16x4'>;
166
+ declare const unorm16x4: unorm16x4;
167
+ type snorm16 = TgpuVertexFormatData<'snorm16'>;
168
+ declare const snorm16: snorm16;
169
+ type snorm16x2 = TgpuVertexFormatData<'snorm16x2'>;
170
+ declare const snorm16x2: snorm16x2;
171
+ type snorm16x4 = TgpuVertexFormatData<'snorm16x4'>;
172
+ declare const snorm16x4: snorm16x4;
173
+ type float16 = TgpuVertexFormatData<'float16'>;
174
+ declare const float16: float16;
175
+ type float16x2 = TgpuVertexFormatData<'float16x2'>;
176
+ declare const float16x2: float16x2;
177
+ type float16x4 = TgpuVertexFormatData<'float16x4'>;
178
+ declare const float16x4: float16x4;
179
+ type float32 = TgpuVertexFormatData<'float32'>;
180
+ declare const float32: float32;
181
+ type float32x2 = TgpuVertexFormatData<'float32x2'>;
182
+ declare const float32x2: float32x2;
183
+ type float32x3 = TgpuVertexFormatData<'float32x3'>;
184
+ declare const float32x3: float32x3;
185
+ type float32x4 = TgpuVertexFormatData<'float32x4'>;
186
+ declare const float32x4: float32x4;
187
+ type uint32 = TgpuVertexFormatData<'uint32'>;
188
+ declare const uint32: uint32;
189
+ type uint32x2 = TgpuVertexFormatData<'uint32x2'>;
190
+ declare const uint32x2: uint32x2;
191
+ type uint32x3 = TgpuVertexFormatData<'uint32x3'>;
192
+ declare const uint32x3: uint32x3;
193
+ type uint32x4 = TgpuVertexFormatData<'uint32x4'>;
194
+ declare const uint32x4: uint32x4;
195
+ type sint32 = TgpuVertexFormatData<'sint32'>;
196
+ declare const sint32: sint32;
197
+ type sint32x2 = TgpuVertexFormatData<'sint32x2'>;
198
+ declare const sint32x2: sint32x2;
199
+ type sint32x3 = TgpuVertexFormatData<'sint32x3'>;
200
+ declare const sint32x3: sint32x3;
201
+ type sint32x4 = TgpuVertexFormatData<'sint32x4'>;
202
+ declare const sint32x4: sint32x4;
203
+ type unorm10_10_10_2 = TgpuVertexFormatData<'unorm10-10-10-2'>;
204
+ declare const unorm10_10_10_2: unorm10_10_10_2;
205
+ type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;
206
+ declare const unorm8x4_bgra: unorm8x4_bgra;
207
+ type PackedData = 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;
208
+
209
+ /**
210
+ * Array schema constructed via `d.disarrayOf` function.
211
+ *
212
+ * Useful for defining vertex buffers.
213
+ * Elements in the schema are not aligned in respect to their `byteAlignment`,
214
+ * unless they are explicitly decorated with the custom align attribute
215
+ * via `d.align` function.
216
+ */
217
+ interface Disarray<TElement extends BaseData = BaseData> {
218
+ readonly type: 'disarray';
219
+ readonly elementCount: number;
220
+ readonly elementType: TElement;
221
+ readonly '~repr': Infer<TElement>[];
222
+ readonly '~reprPartial': {
223
+ idx: number;
224
+ value: InferPartial<TElement>;
225
+ }[];
226
+ }
227
+ /**
228
+ * Struct schema constructed via `d.unstruct` function.
229
+ *
230
+ * Useful for defining vertex buffers, as the standard layout restrictions do not apply.
231
+ * Members are not aligned in respect to their `byteAlignment`,
232
+ * unless they are explicitly decorated with the custom align attribute
233
+ * via `d.align` function.
234
+ */
235
+ interface Unstruct<TProps extends Record<string, BaseData> = Record<string, BaseData>> extends TgpuNamable {
236
+ readonly label?: string | undefined;
237
+ readonly type: 'unstruct';
238
+ readonly propTypes: TProps;
239
+ readonly '~repr': InferRecord<TProps>;
240
+ readonly '~reprPartial': Partial<InferPartialRecord<TProps>>;
241
+ }
242
+ interface LooseDecorated<TInner extends BaseData = BaseData, TAttribs extends unknown[] = unknown[]> {
243
+ readonly type: 'loose-decorated';
244
+ readonly inner: TInner;
245
+ readonly attribs: TAttribs;
246
+ readonly '~repr': Infer<TInner>;
247
+ }
248
+ declare const looseTypeLiterals: readonly ["unstruct", "disarray", "loose-decorated", "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"];
249
+ type LooseTypeLiteral = (typeof looseTypeLiterals)[number];
250
+ type AnyLooseData = Disarray | Unstruct | LooseDecorated | PackedData;
251
+ declare function isLooseData(data: unknown): data is AnyLooseData;
252
+ /**
253
+ * Checks whether the passed in value is a disarray schema,
254
+ * as opposed to, e.g., a regular array schema.
255
+ *
256
+ * Array schemas can be used to describe uniform and storage buffers,
257
+ * whereas disarray schemas cannot. Disarrays are useful for
258
+ * defining vertex buffers instead.
259
+ *
260
+ * @example
261
+ * isDisarray(d.arrayOf(d.u32, 4)) // false
262
+ * isDisarray(d.disarrayOf(d.u32, 4)) // true
263
+ * isDisarray(d.vec3f) // false
264
+ */
265
+ declare function isDisarray<T extends Disarray>(schema: T | unknown): schema is T;
266
+ /**
267
+ * Checks whether passed in value is a unstruct schema,
268
+ * as opposed to, e.g., a struct schema.
269
+ *
270
+ * Struct schemas can be used to describe uniform and storage buffers,
271
+ * whereas unstruct schemas cannot. Unstructs are useful for
272
+ * defining vertex buffers instead.
273
+ *
274
+ * @example
275
+ * isUnstruct(d.struct({ a: d.u32 })) // false
276
+ * isUnstruct(d.unstruct({ a: d.u32 })) // true
277
+ * isUnstruct(d.vec3f) // false
278
+ */
279
+ declare function isUnstruct<T extends Unstruct>(schema: T | unknown): schema is T;
280
+ declare function isLooseDecorated<T extends LooseDecorated>(value: T | unknown): value is T;
281
+ declare function isData(value: unknown): value is AnyData;
282
+ type AnyData = AnyWgslData | AnyLooseData;
283
+
1
284
  /**
2
285
  * Extracts the inferred representation of a resource.
3
286
  * @example
4
287
  * type A = Infer<F32> // => number
5
- * type B = Infer<TgpuArray<F32>> // => number[]
288
+ * type B = Infer<WgslArray<F32>> // => number[]
6
289
  */
7
290
  type Infer<T> = T extends {
8
291
  readonly '~repr': infer TRepr;
9
292
  } ? TRepr : T;
293
+ type InferPartial<T> = T extends {
294
+ readonly '~reprPartial': infer TRepr;
295
+ } ? TRepr : T extends {
296
+ readonly '~repr': infer TRepr;
297
+ } ? TRepr | undefined : T extends Record<string | number | symbol, unknown> ? InferPartialRecord<T> : T;
10
298
  type InferRecord<T extends Record<string | number | symbol, unknown>> = {
11
299
  [Key in keyof T]: Infer<T[Key]>;
12
300
  };
301
+ type InferPartialRecord<T extends Record<string | number | symbol, unknown>> = {
302
+ [Key in keyof T]: InferPartial<T[Key]>;
303
+ };
304
+ type MemIdentity<T> = T extends {
305
+ readonly '~memIdent': infer TMemIdent extends AnyData;
306
+ } ? TMemIdent : T;
307
+ type MemIdentityRecord<T extends Record<string | number | symbol, unknown>> = {
308
+ [Key in keyof T]: MemIdentity<T[Key]>;
309
+ };
310
+
311
+ type Default<T, TDefault> = unknown extends T ? TDefault : T extends undefined ? TDefault : T;
312
+ type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
313
+ type Prettify<T> = {
314
+ [K in keyof T]: T[K];
315
+ } & {};
316
+ /**
317
+ * Removes properties from record type that extend `Prop`
318
+ */
319
+ type OmitProps<T extends Record<string, unknown>, Prop> = Pick<T, {
320
+ [Key in keyof T]: T[Key] extends Prop ? never : Key;
321
+ }[keyof T]>;
322
+ /**
323
+ * The opposite of Readonly<T>
324
+ */
325
+ type Mutable<T> = {
326
+ -readonly [P in keyof T]: T[P];
327
+ };
13
328
 
329
+ /**
330
+ * Struct schema constructed via `d.struct` function.
331
+ *
332
+ * Responsible for handling reading and writing struct values
333
+ * between binary and JS representation. Takes into account
334
+ * the `byteAlignment` requirement of its members.
335
+ */
336
+ interface WgslStruct<TProps extends Record<string, BaseData> = Record<string, BaseData>> extends TgpuNamable {
337
+ (props: InferRecord<TProps>): InferRecord<TProps>;
338
+ readonly type: 'struct';
339
+ readonly label?: string | undefined;
340
+ readonly propTypes: TProps;
341
+ /** Type-token, not available at runtime */
342
+ readonly '~repr': InferRecord<TProps>;
343
+ /** Type-token, not available at runtime */
344
+ readonly '~memIdent': WgslStruct<MemIdentityRecord<TProps>>;
345
+ /** Type-token, not available at runtime */
346
+ readonly '~reprPartial': Partial<InferPartialRecord<TProps>>;
347
+ }
348
+ type AnyWgslStruct = WgslStruct<any>;
349
+ /**
350
+ * Creates a struct schema that can be used to construct GPU buffers.
351
+ * Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).
352
+ * The order of members matches the passed in properties object.
353
+ *
354
+ * @example
355
+ * const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });
356
+ *
357
+ * @param props Record with `string` keys and `TgpuData` values,
358
+ * each entry describing one struct member.
359
+ */
360
+ declare function struct<TProps extends Record<string, AnyWgslData>>(props: TProps): WgslStruct<Prettify<TProps>>;
361
+
362
+ type DecoratedLocation<T extends BaseData> = Decorated<T, Location<number>[]>;
14
363
  interface NumberArrayView {
15
364
  readonly length: number;
16
365
  [n: number]: number;
17
366
  }
18
- interface BaseWgslData {
367
+ interface BaseData {
19
368
  type: string;
20
369
  /** Type-token, not available at runtime */
21
370
  readonly '~repr': unknown;
@@ -518,118 +867,229 @@ interface Bool {
518
867
  readonly type: 'bool';
519
868
  readonly '~repr': boolean;
520
869
  }
870
+ /**
871
+ * 32-bit float schema representing a single WGSL f32 value.
872
+ */
521
873
  interface F32 {
522
874
  readonly type: 'f32';
523
875
  /** Type-token, not available at runtime */
524
876
  readonly '~repr': number;
877
+ (v: number | boolean): number;
525
878
  }
879
+ /**
880
+ * 16-bit float schema representing a single WGSL f16 value.
881
+ */
526
882
  interface F16 {
527
883
  readonly type: 'f16';
528
884
  /** Type-token, not available at runtime */
529
885
  readonly '~repr': number;
886
+ (v: number | boolean): number;
530
887
  }
888
+ /**
889
+ * Signed 32-bit integer schema representing a single WGSL i32 value.
890
+ */
531
891
  interface I32 {
532
892
  readonly type: 'i32';
533
893
  /** Type-token, not available at runtime */
534
894
  readonly '~repr': number;
895
+ readonly '~memIdent': I32 | Atomic<I32> | DecoratedLocation<I32>;
896
+ (v: number | boolean): number;
535
897
  }
898
+ /**
899
+ * Unsigned 32-bit integer schema representing a single WGSL u32 value.
900
+ */
536
901
  interface U32 {
537
902
  readonly type: 'u32';
538
903
  /** Type-token, not available at runtime */
539
904
  readonly '~repr': number;
905
+ readonly '~memIdent': U32 | Atomic<U32> | DecoratedLocation<U32>;
906
+ (v: number | boolean): number;
540
907
  }
908
+ /**
909
+ * Type of the `d.vec2f` object/function: vector data type schema/constructor
910
+ */
541
911
  interface Vec2f {
542
912
  readonly type: 'vec2f';
543
913
  /** Type-token, not available at runtime */
544
914
  readonly '~repr': v2f;
915
+ (x: number, y: number): v2f;
916
+ (xy: number): v2f;
917
+ (): v2f;
545
918
  }
919
+ /**
920
+ * Type of the `d.vec2h` object/function: vector data type schema/constructor
921
+ */
546
922
  interface Vec2h {
547
923
  readonly type: 'vec2h';
548
924
  /** Type-token, not available at runtime */
549
925
  readonly '~repr': v2h;
926
+ (x: number, y: number): v2h;
927
+ (xy: number): v2h;
928
+ (): v2h;
550
929
  }
930
+ /**
931
+ * Type of the `d.vec2i` object/function: vector data type schema/constructor
932
+ */
551
933
  interface Vec2i {
552
934
  readonly type: 'vec2i';
553
935
  /** Type-token, not available at runtime */
554
936
  readonly '~repr': v2i;
937
+ (x: number, y: number): v2i;
938
+ (xy: number): v2i;
939
+ (): v2i;
555
940
  }
941
+ /**
942
+ * Type of the `d.vec2u` object/function: vector data type schema/constructor
943
+ */
556
944
  interface Vec2u {
557
945
  readonly type: 'vec2u';
558
946
  /** Type-token, not available at runtime */
559
947
  readonly '~repr': v2u;
948
+ (x: number, y: number): v2u;
949
+ (xy: number): v2u;
950
+ (): v2u;
560
951
  }
952
+ /**
953
+ * Type of the `d.vec3f` object/function: vector data type schema/constructor
954
+ */
561
955
  interface Vec3f {
562
956
  readonly type: 'vec3f';
563
957
  /** Type-token, not available at runtime */
564
958
  readonly '~repr': v3f;
959
+ (x: number, y: number, z: number): v3f;
960
+ (xyz: number): v3f;
961
+ (): v3f;
565
962
  }
963
+ /**
964
+ * Type of the `d.vec3h` object/function: vector data type schema/constructor
965
+ */
566
966
  interface Vec3h {
567
967
  readonly type: 'vec3h';
568
968
  /** Type-token, not available at runtime */
569
969
  readonly '~repr': v3h;
970
+ (x: number, y: number, z: number): v3h;
971
+ (xyz: number): v3h;
972
+ (): v3h;
570
973
  }
974
+ /**
975
+ * Type of the `d.vec3i` object/function: vector data type schema/constructor
976
+ */
571
977
  interface Vec3i {
572
978
  readonly type: 'vec3i';
573
979
  /** Type-token, not available at runtime */
574
980
  readonly '~repr': v3i;
981
+ (x: number, y: number, z: number): v3i;
982
+ (xyz: number): v3i;
983
+ (): v3i;
575
984
  }
985
+ /**
986
+ * Type of the `d.vec3u` object/function: vector data type schema/constructor
987
+ */
576
988
  interface Vec3u {
577
989
  readonly type: 'vec3u';
578
990
  /** Type-token, not available at runtime */
579
991
  readonly '~repr': v3u;
992
+ (x: number, y: number, z: number): v3u;
993
+ (xyz: number): v3u;
994
+ (): v3u;
580
995
  }
996
+ /**
997
+ * Type of the `d.vec4f` object/function: vector data type schema/constructor
998
+ */
581
999
  interface Vec4f {
582
1000
  readonly type: 'vec4f';
583
1001
  /** Type-token, not available at runtime */
584
1002
  readonly '~repr': v4f;
1003
+ (x: number, y: number, z: number, w: number): v4f;
1004
+ (xyzw: number): v4f;
1005
+ (): v4f;
585
1006
  }
1007
+ /**
1008
+ * Type of the `d.vec4h` object/function: vector data type schema/constructor
1009
+ */
586
1010
  interface Vec4h {
587
1011
  readonly type: 'vec4h';
588
1012
  /** Type-token, not available at runtime */
589
1013
  readonly '~repr': v4h;
1014
+ (x: number, y: number, z: number, w: number): v4h;
1015
+ (xyzw: number): v4h;
1016
+ (): v4h;
590
1017
  }
1018
+ /**
1019
+ * Type of the `d.vec4i` object/function: vector data type schema/constructor
1020
+ */
591
1021
  interface Vec4i {
592
1022
  readonly type: 'vec4i';
593
1023
  /** Type-token, not available at runtime */
594
1024
  readonly '~repr': v4i;
1025
+ (x: number, y: number, z: number, w: number): v4i;
1026
+ (xyzw: number): v4i;
1027
+ (): v4i;
595
1028
  }
1029
+ /**
1030
+ * Type of the `d.vec4u` object/function: vector data type schema/constructor
1031
+ */
596
1032
  interface Vec4u {
597
1033
  readonly type: 'vec4u';
598
1034
  /** Type-token, not available at runtime */
599
1035
  readonly '~repr': v4u;
1036
+ (x: number, y: number, z: number, w: number): v4u;
1037
+ (xyzw: number): v4u;
1038
+ (): v4u;
600
1039
  }
1040
+ /**
1041
+ * Type of the `d.mat2x2f` object/function: matrix data type schema/constructor
1042
+ */
601
1043
  interface Mat2x2f {
602
1044
  readonly type: 'mat2x2f';
603
1045
  /** Type-token, not available at runtime */
604
1046
  readonly '~repr': m2x2f;
1047
+ (...elements: number[]): m2x2f;
1048
+ (...columns: v2f[]): m2x2f;
1049
+ (): m2x2f;
605
1050
  }
1051
+ /**
1052
+ * Type of the `d.mat3x3f` object/function: matrix data type schema/constructor
1053
+ */
606
1054
  interface Mat3x3f {
607
1055
  readonly type: 'mat3x3f';
608
1056
  /** Type-token, not available at runtime */
609
1057
  readonly '~repr': m3x3f;
1058
+ (...elements: number[]): m3x3f;
1059
+ (...columns: v3f[]): m3x3f;
1060
+ (): m3x3f;
610
1061
  }
1062
+ /**
1063
+ * Type of the `d.mat4x4f` object/function: matrix data type schema/constructor
1064
+ */
611
1065
  interface Mat4x4f {
612
1066
  readonly type: 'mat4x4f';
613
1067
  /** Type-token, not available at runtime */
614
1068
  readonly '~repr': m4x4f;
1069
+ (...elements: number[]): m4x4f;
1070
+ (...columns: v4f[]): m4x4f;
1071
+ (): m4x4f;
615
1072
  }
616
- interface WgslStruct<TProps extends Record<string, BaseWgslData> = Record<string, BaseWgslData>> {
617
- (props: InferRecord<TProps>): InferRecord<TProps>;
618
- readonly type: 'struct';
619
- readonly label?: string | undefined;
620
- readonly propTypes: TProps;
621
- /** Type-token, not available at runtime */
622
- readonly '~repr': InferRecord<TProps>;
623
- }
624
- type AnyWgslStruct = WgslStruct<any>;
625
- interface WgslArray<TElement = BaseWgslData> {
1073
+ /**
1074
+ * Array schema constructed via `d.arrayOf` function.
1075
+ *
1076
+ * Responsible for handling reading and writing array values
1077
+ * between binary and JS representation. Takes into account
1078
+ * the `byteAlignment` requirement of its elementType.
1079
+ */
1080
+ interface WgslArray<TElement extends BaseData = BaseData> {
626
1081
  readonly type: 'array';
627
1082
  readonly elementCount: number;
628
1083
  readonly elementType: TElement;
629
1084
  /** Type-token, not available at runtime */
630
1085
  readonly '~repr': Infer<TElement>[];
1086
+ readonly '~reprPartial': {
1087
+ idx: number;
1088
+ value: InferPartial<TElement>;
1089
+ }[];
1090
+ readonly '~memIdent': WgslArray<MemIdentity<TElement>>;
631
1091
  }
632
- interface PtrFn<TInner = BaseWgslData> {
1092
+ interface PtrFn<TInner = BaseData> {
633
1093
  readonly type: 'ptrFn';
634
1094
  readonly inner: TInner;
635
1095
  /** Type-token, not available at runtime */
@@ -643,6 +1103,7 @@ interface Atomic<TInner extends U32 | I32 = U32 | I32> {
643
1103
  readonly inner: TInner;
644
1104
  /** Type-token, not available at runtime */
645
1105
  readonly '~repr': Infer<TInner>;
1106
+ readonly '~memIdent': MemIdentity<TInner>;
646
1107
  }
647
1108
  interface Align<T extends number> {
648
1109
  readonly type: '@align';
@@ -667,12 +1128,13 @@ interface Builtin<T extends string> {
667
1128
  readonly type: '@builtin';
668
1129
  readonly value: T;
669
1130
  }
670
- interface Decorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends unknown[] = unknown[]> {
1131
+ interface Decorated<TInner extends BaseData = BaseData, TAttribs extends unknown[] = unknown[]> {
671
1132
  readonly type: 'decorated';
672
1133
  readonly inner: TInner;
673
1134
  readonly attribs: TAttribs;
674
1135
  /** Type-token, not available at runtime */
675
1136
  readonly '~repr': Infer<TInner>;
1137
+ readonly '~memIdent': TAttribs extends Location<number>[] ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs> : Decorated<MemIdentity<TInner>, TAttribs>;
676
1138
  }
677
1139
  declare const wgslTypeLiterals: readonly ["bool", "f32", "f16", "i32", "u32", "vec2f", "vec2h", "vec2i", "vec2u", "vec3f", "vec3h", "vec3i", "vec3u", "vec4f", "vec4h", "vec4i", "vec4u", "mat2x2f", "mat3x3f", "mat4x4f", "struct", "array", "ptrFn", "atomic", "decorated"];
678
1140
  type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
@@ -729,249 +1191,4 @@ declare function isInterpolateAttrib<T extends Interpolate<InterpolationType>>(v
729
1191
  declare function isBuiltinAttrib<T extends Builtin<string>>(value: unknown | T): value is T;
730
1192
  declare function isDecorated<T extends Decorated>(value: unknown | T): value is T;
731
1193
 
732
- /**
733
- * Type encompassing all available kinds of vector.
734
- */
735
- type VecKind = 'vec2f' | 'vec2i' | 'vec2u' | 'vec2h' | 'vec3f' | 'vec3i' | 'vec3u' | 'vec3h' | 'vec4f' | 'vec4i' | 'vec4u' | 'vec4h';
736
- /**
737
- * Type of the `d.vec2f` object/function: vector data type schema/constructor
738
- */
739
- type NativeVec2f = Vec2f & {
740
- '~exotic': Vec2f;
741
- } & ((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f);
742
- /**
743
- *
744
- * Schema representing vec2f - a vector with 2 elements of type f32.
745
- * Also a constructor function for this vector value.
746
- *
747
- * @example
748
- * const vector = d.vec2f(); // (0.0, 0.0)
749
- * const vector = d.vec2f(1); // (1.0, 1.0)
750
- * const vector = d.vec2f(0.5, 0.1); // (0.5, 0.1)
751
- *
752
- * @example
753
- * const buffer = root.createBuffer(d.vec2f, d.vec2f(0, 1)); // buffer holding a d.vec2f value, with an initial value of vec2f(0, 1);
754
- */
755
- declare const vec2f: NativeVec2f;
756
- /**
757
- * Type of the `d.vec2h` object/function: vector data type schema/constructor
758
- */
759
- type NativeVec2h = Vec2h & {
760
- '~exotic': Vec2h;
761
- } & ((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h);
762
- /**
763
- *
764
- * Schema representing vec2h - a vector with 2 elements of type f16.
765
- * Also a constructor function for this vector value.
766
- *
767
- * @example
768
- * const vector = d.vec2h(); // (0.0, 0.0)
769
- * const vector = d.vec2h(1); // (1.0, 1.0)
770
- * const vector = d.vec2h(0.5, 0.1); // (0.5, 0.1)
771
- *
772
- * @example
773
- * const buffer = root.createBuffer(d.vec2h, d.vec2h(0, 1)); // buffer holding a d.vec2h value, with an initial value of vec2h(0, 1);
774
- */
775
- declare const vec2h: NativeVec2h;
776
- /**
777
- * Type of the `d.vec2i` object/function: vector data type schema/constructor
778
- */
779
- type NativeVec2i = Vec2i & {
780
- '~exotic': Vec2i;
781
- } & ((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i);
782
- /**
783
- *
784
- * Schema representing vec2i - a vector with 2 elements of type i32.
785
- * Also a constructor function for this vector value.
786
- *
787
- * @example
788
- * const vector = d.vec2i(); // (0, 0)
789
- * const vector = d.vec2i(1); // (1, 1)
790
- * const vector = d.vec2i(-1, 1); // (-1, 1)
791
- *
792
- * @example
793
- * const buffer = root.createBuffer(d.vec2i, d.vec2i(0, 1)); // buffer holding a d.vec2i value, with an initial value of vec2i(0, 1);
794
- */
795
- declare const vec2i: NativeVec2i;
796
- /**
797
- * Type of the `d.vec2u` object/function: vector data type schema/constructor
798
- */
799
- type NativeVec2u = Vec2u & {
800
- '~exotic': Vec2u;
801
- } & ((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u);
802
- /**
803
- *
804
- * Schema representing vec2u - a vector with 2 elements of type u32.
805
- * Also a constructor function for this vector value.
806
- *
807
- * @example
808
- * const vector = d.vec2u(); // (0, 0)
809
- * const vector = d.vec2u(1); // (1, 1)
810
- * const vector = d.vec2u(1, 2); // (1, 2)
811
- *
812
- * @example
813
- * const buffer = root.createBuffer(d.vec2u, d.vec2u(0, 1)); // buffer holding a d.vec2u value, with an initial value of vec2u(0, 1);
814
- */
815
- declare const vec2u: NativeVec2u;
816
- /**
817
- * Type of the `d.vec3f` object/function: vector data type schema/constructor
818
- */
819
- type NativeVec3f = Vec3f & {
820
- '~exotic': Vec3f;
821
- } & ((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f);
822
- /**
823
- *
824
- * Schema representing vec3f - a vector with 3 elements of type f32.
825
- * Also a constructor function for this vector value.
826
- *
827
- * @example
828
- * const vector = d.vec3f(); // (0.0, 0.0, 0.0)
829
- * const vector = d.vec3f(1); // (1.0, 1.0, 1.0)
830
- * const vector = d.vec3f(1, 2, 3.5); // (1.0, 2.0, 3.5)
831
- *
832
- * @example
833
- * const buffer = root.createBuffer(d.vec3f, d.vec3f(0, 1, 2)); // buffer holding a d.vec3f value, with an initial value of vec3f(0, 1, 2);
834
- */
835
- declare const vec3f: NativeVec3f;
836
- /**
837
- * Type of the `d.vec3h` object/function: vector data type schema/constructor
838
- */
839
- type NativeVec3h = Vec3h & {
840
- '~exotic': Vec3h;
841
- } & ((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h);
842
- /**
843
- *
844
- * Schema representing vec3h - a vector with 3 elements of type f16.
845
- * Also a constructor function for this vector value.
846
- *
847
- * @example
848
- * const vector = d.vec3h(); // (0.0, 0.0, 0.0)
849
- * const vector = d.vec3h(1); // (1.0, 1.0, 1.0)
850
- * const vector = d.vec3h(1, 2, 3.5); // (1.0, 2.0, 3.5)
851
- *
852
- * @example
853
- * const buffer = root.createBuffer(d.vec3h, d.vec3h(0, 1, 2)); // buffer holding a d.vec3h value, with an initial value of vec3h(0, 1, 2);
854
- */
855
- declare const vec3h: NativeVec3h;
856
- /**
857
- * Type of the `d.vec3i` object/function: vector data type schema/constructor
858
- */
859
- type NativeVec3i = Vec3i & {
860
- '~exotic': Vec3i;
861
- } & ((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i);
862
- /**
863
- *
864
- * Schema representing vec3i - a vector with 3 elements of type i32.
865
- * Also a constructor function for this vector value.
866
- *
867
- * @example
868
- * const vector = d.vec3i(); // (0, 0, 0)
869
- * const vector = d.vec3i(1); // (1, 1, 1)
870
- * const vector = d.vec3i(1, 2, -3); // (1, 2, -3)
871
- *
872
- * @example
873
- * const buffer = root.createBuffer(d.vec3i, d.vec3i(0, 1, 2)); // buffer holding a d.vec3i value, with an initial value of vec3i(0, 1, 2);
874
- */
875
- declare const vec3i: NativeVec3i;
876
- /**
877
- * Type of the `d.vec3u` object/function: vector data type schema/constructor
878
- */
879
- type NativeVec3u = Vec3u & {
880
- '~exotic': Vec3u;
881
- } & ((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u);
882
- /**
883
- *
884
- * Schema representing vec3u - a vector with 3 elements of type u32.
885
- * Also a constructor function for this vector value.
886
- *
887
- * @example
888
- * const vector = d.vec3u(); // (0, 0, 0)
889
- * const vector = d.vec3u(1); // (1, 1, 1)
890
- * const vector = d.vec3u(1, 2, 3); // (1, 2, 3)
891
- *
892
- * @example
893
- * const buffer = root.createBuffer(d.vec3u, d.vec3u(0, 1, 2)); // buffer holding a d.vec3u value, with an initial value of vec3u(0, 1, 2);
894
- */
895
- declare const vec3u: NativeVec3u;
896
- /**
897
- * Type of the `d.vec4f` object/function: vector data type schema/constructor
898
- */
899
- type NativeVec4f = Vec4f & {
900
- '~exotic': Vec4f;
901
- } & ((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f);
902
- /**
903
- *
904
- * Schema representing vec4f - a vector with 4 elements of type f32.
905
- * Also a constructor function for this vector value.
906
- *
907
- * @example
908
- * const vector = d.vec4f(); // (0.0, 0.0, 0.0, 0.0)
909
- * const vector = d.vec4f(1); // (1.0, 1.0, 1.0, 1.0)
910
- * const vector = d.vec4f(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
911
- *
912
- * @example
913
- * const buffer = root.createBuffer(d.vec4f, d.vec4f(0, 1, 2, 3)); // buffer holding a d.vec4f value, with an initial value of vec4f(0, 1, 2, 3);
914
- */
915
- declare const vec4f: NativeVec4f;
916
- /**
917
- * Type of the `d.vec4h` object/function: vector data type schema/constructor
918
- */
919
- type NativeVec4h = Vec4h & {
920
- '~exotic': Vec4h;
921
- } & ((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h);
922
- /**
923
- *
924
- * Schema representing vec4h - a vector with 4 elements of type f16.
925
- * Also a constructor function for this vector value.
926
- *
927
- * @example
928
- * const vector = d.vec4h(); // (0.0, 0.0, 0.0, 0.0)
929
- * const vector = d.vec4h(1); // (1.0, 1.0, 1.0, 1.0)
930
- * const vector = d.vec4h(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
931
- *
932
- * @example
933
- * const buffer = root.createBuffer(d.vec4h, d.vec4h(0, 1, 2, 3)); // buffer holding a d.vec4h value, with an initial value of vec4h(0, 1, 2, 3);
934
- */
935
- declare const vec4h: NativeVec4h;
936
- /**
937
- * Type of the `d.vec4i` object/function: vector data type schema/constructor
938
- */
939
- type NativeVec4i = Vec4i & {
940
- '~exotic': Vec4i;
941
- } & ((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i);
942
- /**
943
- *
944
- * Schema representing vec4i - a vector with 4 elements of type i32.
945
- * Also a constructor function for this vector value.
946
- *
947
- * @example
948
- * const vector = d.vec4i(); // (0, 0, 0, 0)
949
- * const vector = d.vec4i(1); // (1, 1, 1, 1)
950
- * const vector = d.vec4i(1, 2, 3, -4); // (1, 2, 3, -4)
951
- *
952
- * @example
953
- * const buffer = root.createBuffer(d.vec4i, d.vec4i(0, 1, 2, 3)); // buffer holding a d.vec4i value, with an initial value of vec4i(0, 1, 2, 3);
954
- */
955
- declare const vec4i: NativeVec4i;
956
- /**
957
- * Type of the `d.vec4u` object/function: vector data type schema/constructor
958
- */
959
- type NativeVec4u = Vec4u & {
960
- '~exotic': Vec4u;
961
- } & ((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u);
962
- /**
963
- *
964
- * Schema representing vec4u - a vector with 4 elements of type u32.
965
- * Also a constructor function for this vector value.
966
- *
967
- * @example
968
- * const vector = d.vec4u(); // (0, 0, 0, 0)
969
- * const vector = d.vec4u(1); // (1, 1, 1, 1)
970
- * const vector = d.vec4u(1, 2, 3, 4); // (1, 2, 3, 4)
971
- *
972
- * @example
973
- * const buffer = root.createBuffer(d.vec4u, d.vec4u(0, 1, 2, 3)); // buffer holding a d.vec4u value, with an initial value of vec4u(0, 1, 2, 3);
974
- */
975
- declare const vec4u: NativeVec4u;
976
-
977
- export { type InterpolationType as $, type AnyWgslData as A, type BaseWgslData as B, type NativeVec3u as C, type Decorated as D, type NativeVec3i as E, type F32 as F, type InferRecord as G, type m2x2f as H, type Infer as I, type m3x3f as J, type m4x4f as K, type Location as L, type Mat2x2f as M, type NativeVec2u as N, type v2f as O, type PtrFn as P, type Mat3x3f as Q, type v3f as R, type Mat4x4f as S, type v4f as T, type U32 as U, type Vec2f as V, type WgslArray as W, type Atomic as X, type Align as Y, type Size as Z, type Interpolate as _, type F16 as a, type PerspectiveOrLinearInterpolationType as a0, type PerspectiveOrLinearInterpolatableData as a1, type FlatInterpolationType as a2, type FlatInterpolatableData as a3, isWgslData as a4, isWgslArray as a5, isWgslStruct as a6, isPtrFn as a7, isAtomic as a8, isDecorated as a9, isAlignAttrib as aa, isBuiltinAttrib as ab, isLocationAttrib as ac, isInterpolateAttrib as ad, isSizeAttrib as ae, type v2i as af, type v2u as ag, type v3i as ah, type v3u as ai, type v4i as aj, type v4u as ak, vec2f as al, vec2h as am, vec2i as an, vec2u as ao, vec3f as ap, vec3h as aq, vec3i as ar, vec3u as as, vec4f as at, vec4h as au, vec4i as av, vec4u as aw, type VecKind as ax, type I32 as b, type Vec3f as c, type Vec4f as d, type Vec2h as e, type Vec3h as f, type Vec4h as g, type Vec2i as h, type Vec3i as i, type Vec4i as j, type Vec2u as k, type Vec3u as l, type Vec4u as m, type AnyWgslStruct as n, type WgslTypeLiteral as o, type AnyVecInstance as p, type AnyMatInstance as q, type Builtin as r, type Bool as s, type WgslStruct as t, type NativeVec4u as u, type NativeVec2i as v, type NativeVec4i as w, type NativeVec2f as x, type NativeVec4f as y, type NativeVec3f as z };
1194
+ export { isWgslStruct as $, type AnyWgslData as A, type BaseData as B, type AnyVecInstance as C, type Decorated as D, type AnyMatInstance as E, type F32 as F, type Bool as G, type PtrFn as H, type Infer as I, type Mat2x2f as J, type KindToAcceptedAttribMap as K, type Location as L, type Mutable as M, type Mat3x3f as N, type OmitProps as O, type Prettify as P, type Mat4x4f as Q, type m2x2f as R, type m3x3f as S, type TgpuNamable as T, type U32 as U, type Vec2f as V, type WgslArray as W, type m4x4f as X, type Atomic as Y, isWgslData as Z, isWgslArray as _, type F16 as a, float32x4 as a$, isPtrFn as a0, isAtomic as a1, isDecorated as a2, isAlignAttrib as a3, isBuiltinAttrib as a4, isLocationAttrib as a5, isInterpolateAttrib as a6, isSizeAttrib as a7, type Size as a8, type Align as a9, sint8 as aA, sint8x2 as aB, sint8x4 as aC, unorm8 as aD, unorm8x2 as aE, unorm8x4 as aF, snorm8 as aG, snorm8x2 as aH, snorm8x4 as aI, uint16 as aJ, uint16x2 as aK, uint16x4 as aL, sint16 as aM, sint16x2 as aN, sint16x4 as aO, unorm16 as aP, unorm16x2 as aQ, unorm16x4 as aR, snorm16 as aS, snorm16x2 as aT, snorm16x4 as aU, float16 as aV, float16x2 as aW, float16x4 as aX, float32 as aY, float32x2 as aZ, float32x3 as a_, type Builtin as aa, type Interpolate as ab, type v2f as ac, type v2i as ad, type v2u as ae, type v3f as af, type v3i as ag, type v3u as ah, type v4f as ai, type v4i as aj, type v4u as ak, struct as al, type LooseDecorated as am, type AnyLooseData as an, isDisarray as ao, isUnstruct as ap, isLooseDecorated as aq, isData as ar, isLooseData as as, type FormatToWGSLType as at, type TgpuVertexFormatData as au, formatToWGSLType as av, packedFormats as aw, uint8 as ax, uint8x2 as ay, uint8x4 as az, type I32 as b, uint32 as b0, uint32x2 as b1, uint32x3 as b2, uint32x4 as b3, sint32 as b4, sint32x2 as b5, sint32x3 as b6, sint32x4 as b7, unorm10_10_10_2 as b8, unorm8x4_bgra as b9, type PackedData as ba, type InterpolationType as bb, type PerspectiveOrLinearInterpolationType as bc, type PerspectiveOrLinearInterpolatableData as bd, type FlatInterpolationType as be, type FlatInterpolatableData as bf, type LooseTypeLiteral as bg, type v2h as bh, type v3h as bi, type v4h as bj, type Vec3f as c, type Vec4f as d, type Vec2h as e, type Vec3h as f, type Vec4h as g, type Vec2i as h, type Vec3i as i, type Vec4i as j, type Vec2u as k, type Vec3u as l, type Vec4u as m, type AnyWgslStruct as n, type Default as o, type UnionToIntersection as p, type Disarray as q, type Unstruct as r, type VertexFormat as s, type TgpuVertexAttrib as t, type KindToDefaultFormatMap as u, type AnyData as v, type WgslStruct as w, type InferPartial as x, type MemIdentity as y, type WgslTypeLiteral as z };