typegpu 0.3.2 → 0.3.4

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.
@@ -1,3 +1,592 @@
1
+ /**
2
+ * Type encompassing all available kinds of vector.
3
+ */
4
+ type VecKind = 'vec2f' | 'vec2i' | 'vec2u' | 'vec2h' | 'vec3f' | 'vec3i' | 'vec3u' | 'vec3h' | 'vec4f' | 'vec4i' | 'vec4u' | 'vec4h';
5
+ /**
6
+ * Type of the `d.vec2f` object/function: vector data type schema/constructor
7
+ */
8
+ type NativeVec2f = Vec2f & {
9
+ '~exotic': Vec2f;
10
+ } & ((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f);
11
+ /**
12
+ *
13
+ * Schema representing vec2f - a vector with 2 elements of type f32.
14
+ * Also a constructor function for this vector value.
15
+ *
16
+ * @example
17
+ * const vector = d.vec2f(); // (0.0, 0.0)
18
+ * const vector = d.vec2f(1); // (1.0, 1.0)
19
+ * const vector = d.vec2f(0.5, 0.1); // (0.5, 0.1)
20
+ *
21
+ * @example
22
+ * const buffer = root.createBuffer(d.vec2f, d.vec2f(0, 1)); // buffer holding a d.vec2f value, with an initial value of vec2f(0, 1);
23
+ */
24
+ declare const vec2f: NativeVec2f;
25
+ /**
26
+ * Type of the `d.vec2h` object/function: vector data type schema/constructor
27
+ */
28
+ type NativeVec2h = Vec2h & {
29
+ '~exotic': Vec2h;
30
+ } & ((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h);
31
+ /**
32
+ *
33
+ * Schema representing vec2h - a vector with 2 elements of type f16.
34
+ * Also a constructor function for this vector value.
35
+ *
36
+ * @example
37
+ * const vector = d.vec2h(); // (0.0, 0.0)
38
+ * const vector = d.vec2h(1); // (1.0, 1.0)
39
+ * const vector = d.vec2h(0.5, 0.1); // (0.5, 0.1)
40
+ *
41
+ * @example
42
+ * const buffer = root.createBuffer(d.vec2h, d.vec2h(0, 1)); // buffer holding a d.vec2h value, with an initial value of vec2h(0, 1);
43
+ */
44
+ declare const vec2h: NativeVec2h;
45
+ /**
46
+ * Type of the `d.vec2i` object/function: vector data type schema/constructor
47
+ */
48
+ type NativeVec2i = Vec2i & {
49
+ '~exotic': Vec2i;
50
+ } & ((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i);
51
+ /**
52
+ *
53
+ * Schema representing vec2i - a vector with 2 elements of type i32.
54
+ * Also a constructor function for this vector value.
55
+ *
56
+ * @example
57
+ * const vector = d.vec2i(); // (0, 0)
58
+ * const vector = d.vec2i(1); // (1, 1)
59
+ * const vector = d.vec2i(-1, 1); // (-1, 1)
60
+ *
61
+ * @example
62
+ * const buffer = root.createBuffer(d.vec2i, d.vec2i(0, 1)); // buffer holding a d.vec2i value, with an initial value of vec2i(0, 1);
63
+ */
64
+ declare const vec2i: NativeVec2i;
65
+ /**
66
+ * Type of the `d.vec2u` object/function: vector data type schema/constructor
67
+ */
68
+ type NativeVec2u = Vec2u & {
69
+ '~exotic': Vec2u;
70
+ } & ((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u);
71
+ /**
72
+ *
73
+ * Schema representing vec2u - a vector with 2 elements of type u32.
74
+ * Also a constructor function for this vector value.
75
+ *
76
+ * @example
77
+ * const vector = d.vec2u(); // (0, 0)
78
+ * const vector = d.vec2u(1); // (1, 1)
79
+ * const vector = d.vec2u(1, 2); // (1, 2)
80
+ *
81
+ * @example
82
+ * const buffer = root.createBuffer(d.vec2u, d.vec2u(0, 1)); // buffer holding a d.vec2u value, with an initial value of vec2u(0, 1);
83
+ */
84
+ declare const vec2u: NativeVec2u;
85
+ /**
86
+ * Type of the `d.vec3f` object/function: vector data type schema/constructor
87
+ */
88
+ type NativeVec3f = Vec3f & {
89
+ '~exotic': Vec3f;
90
+ } & ((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f);
91
+ /**
92
+ *
93
+ * Schema representing vec3f - a vector with 3 elements of type f32.
94
+ * Also a constructor function for this vector value.
95
+ *
96
+ * @example
97
+ * const vector = d.vec3f(); // (0.0, 0.0, 0.0)
98
+ * const vector = d.vec3f(1); // (1.0, 1.0, 1.0)
99
+ * const vector = d.vec3f(1, 2, 3.5); // (1.0, 2.0, 3.5)
100
+ *
101
+ * @example
102
+ * 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);
103
+ */
104
+ declare const vec3f: NativeVec3f;
105
+ /**
106
+ * Type of the `d.vec3h` object/function: vector data type schema/constructor
107
+ */
108
+ type NativeVec3h = Vec3h & {
109
+ '~exotic': Vec3h;
110
+ } & ((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h);
111
+ /**
112
+ *
113
+ * Schema representing vec3h - a vector with 3 elements of type f16.
114
+ * Also a constructor function for this vector value.
115
+ *
116
+ * @example
117
+ * const vector = d.vec3h(); // (0.0, 0.0, 0.0)
118
+ * const vector = d.vec3h(1); // (1.0, 1.0, 1.0)
119
+ * const vector = d.vec3h(1, 2, 3.5); // (1.0, 2.0, 3.5)
120
+ *
121
+ * @example
122
+ * 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);
123
+ */
124
+ declare const vec3h: NativeVec3h;
125
+ /**
126
+ * Type of the `d.vec3i` object/function: vector data type schema/constructor
127
+ */
128
+ type NativeVec3i = Vec3i & {
129
+ '~exotic': Vec3i;
130
+ } & ((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i);
131
+ /**
132
+ *
133
+ * Schema representing vec3i - a vector with 3 elements of type i32.
134
+ * Also a constructor function for this vector value.
135
+ *
136
+ * @example
137
+ * const vector = d.vec3i(); // (0, 0, 0)
138
+ * const vector = d.vec3i(1); // (1, 1, 1)
139
+ * const vector = d.vec3i(1, 2, -3); // (1, 2, -3)
140
+ *
141
+ * @example
142
+ * 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);
143
+ */
144
+ declare const vec3i: NativeVec3i;
145
+ /**
146
+ * Type of the `d.vec3u` object/function: vector data type schema/constructor
147
+ */
148
+ type NativeVec3u = Vec3u & {
149
+ '~exotic': Vec3u;
150
+ } & ((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u);
151
+ /**
152
+ *
153
+ * Schema representing vec3u - a vector with 3 elements of type u32.
154
+ * Also a constructor function for this vector value.
155
+ *
156
+ * @example
157
+ * const vector = d.vec3u(); // (0, 0, 0)
158
+ * const vector = d.vec3u(1); // (1, 1, 1)
159
+ * const vector = d.vec3u(1, 2, 3); // (1, 2, 3)
160
+ *
161
+ * @example
162
+ * 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);
163
+ */
164
+ declare const vec3u: NativeVec3u;
165
+ /**
166
+ * Type of the `d.vec4f` object/function: vector data type schema/constructor
167
+ */
168
+ type NativeVec4f = Vec4f & {
169
+ '~exotic': Vec4f;
170
+ } & ((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f);
171
+ /**
172
+ *
173
+ * Schema representing vec4f - a vector with 4 elements of type f32.
174
+ * Also a constructor function for this vector value.
175
+ *
176
+ * @example
177
+ * const vector = d.vec4f(); // (0.0, 0.0, 0.0, 0.0)
178
+ * const vector = d.vec4f(1); // (1.0, 1.0, 1.0, 1.0)
179
+ * const vector = d.vec4f(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
180
+ *
181
+ * @example
182
+ * 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);
183
+ */
184
+ declare const vec4f: NativeVec4f;
185
+ /**
186
+ * Type of the `d.vec4h` object/function: vector data type schema/constructor
187
+ */
188
+ type NativeVec4h = Vec4h & {
189
+ '~exotic': Vec4h;
190
+ } & ((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h);
191
+ /**
192
+ *
193
+ * Schema representing vec4h - a vector with 4 elements of type f16.
194
+ * Also a constructor function for this vector value.
195
+ *
196
+ * @example
197
+ * const vector = d.vec4h(); // (0.0, 0.0, 0.0, 0.0)
198
+ * const vector = d.vec4h(1); // (1.0, 1.0, 1.0, 1.0)
199
+ * const vector = d.vec4h(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
200
+ *
201
+ * @example
202
+ * 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);
203
+ */
204
+ declare const vec4h: NativeVec4h;
205
+ /**
206
+ * Type of the `d.vec4i` object/function: vector data type schema/constructor
207
+ */
208
+ type NativeVec4i = Vec4i & {
209
+ '~exotic': Vec4i;
210
+ } & ((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i);
211
+ /**
212
+ *
213
+ * Schema representing vec4i - a vector with 4 elements of type i32.
214
+ * Also a constructor function for this vector value.
215
+ *
216
+ * @example
217
+ * const vector = d.vec4i(); // (0, 0, 0, 0)
218
+ * const vector = d.vec4i(1); // (1, 1, 1, 1)
219
+ * const vector = d.vec4i(1, 2, 3, -4); // (1, 2, 3, -4)
220
+ *
221
+ * @example
222
+ * 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);
223
+ */
224
+ declare const vec4i: NativeVec4i;
225
+ /**
226
+ * Type of the `d.vec4u` object/function: vector data type schema/constructor
227
+ */
228
+ type NativeVec4u = Vec4u & {
229
+ '~exotic': Vec4u;
230
+ } & ((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u);
231
+ /**
232
+ *
233
+ * Schema representing vec4u - a vector with 4 elements of type u32.
234
+ * Also a constructor function for this vector value.
235
+ *
236
+ * @example
237
+ * const vector = d.vec4u(); // (0, 0, 0, 0)
238
+ * const vector = d.vec4u(1); // (1, 1, 1, 1)
239
+ * const vector = d.vec4u(1, 2, 3, 4); // (1, 2, 3, 4)
240
+ *
241
+ * @example
242
+ * 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);
243
+ */
244
+ declare const vec4u: NativeVec4u;
245
+
246
+ /**
247
+ * A schema that represents a boolean value. (equivalent to `bool` in WGSL)
248
+ */
249
+ declare const bool: Bool;
250
+ /**
251
+ * Unsigned 32-bit integer schema representing a single WGSL u32 value.
252
+ */
253
+ type NativeU32 = U32 & {
254
+ '~exotic': U32;
255
+ } & ((v: number | boolean) => number);
256
+ /**
257
+ * A schema that represents an unsigned 32-bit integer value. (equivalent to `u32` in WGSL)
258
+ *
259
+ * Can also be called to cast a value to an u32 in accordance with WGSL casting rules.
260
+ *
261
+ * @example
262
+ * const value = u32(3.14); // 3
263
+ * @example
264
+ * const value = u32(-1); // 4294967295
265
+ * @example
266
+ * const value = u32(-3.1); // 0
267
+ */
268
+ declare const u32: NativeU32;
269
+ /**
270
+ * Signed 32-bit integer schema representing a single WGSL i32 value.
271
+ */
272
+ type NativeI32 = I32 & {
273
+ '~exotic': I32;
274
+ } & ((v: number | boolean) => number);
275
+ /**
276
+ * A schema that represents a signed 32-bit integer value. (equivalent to `i32` in WGSL)
277
+ *
278
+ * Can also be called to cast a value to an i32 in accordance with WGSL casting rules.
279
+ *
280
+ * @example
281
+ * const value = i32(3.14); // 3
282
+ * @example
283
+ * const value = i32(-3.9); // -3
284
+ * @example
285
+ * const value = i32(10000000000) // 1410065408
286
+ */
287
+ declare const i32: NativeI32;
288
+ /**
289
+ * 32-bit float schema representing a single WGSL f32 value.
290
+ */
291
+ type NativeF32 = F32 & {
292
+ '~exotic': F32;
293
+ } & ((v: number | boolean) => number);
294
+ /**
295
+ * A schema that represents a 32-bit float value. (equivalent to `f32` in WGSL)
296
+ *
297
+ * Can also be called to cast a value to an f32.
298
+ *
299
+ * @example
300
+ * const value = f32(true); // 1
301
+ */
302
+ declare const f32: NativeF32;
303
+ /**
304
+ * 16-bit float schema representing a single WGSL f16 value.
305
+ */
306
+ type NativeF16 = F16 & {
307
+ '~exotic': F16;
308
+ } & ((v: number | boolean) => number);
309
+ /**
310
+ * A schema that represents a 16-bit float value. (equivalent to `f16` in WGSL)
311
+ *
312
+ * Can also be called to cast a value to an f16.
313
+ *
314
+ * @example
315
+ * const value = f16(true); // 1
316
+ * @example
317
+ * const value = f16(21877.5); // 21872
318
+ */
319
+ declare const f16: NativeF16;
320
+
321
+ 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"];
322
+ type VertexFormat = (typeof vertexFormats)[number];
323
+ declare const kindToDefaultFormatMap: {
324
+ readonly f32: "float32";
325
+ readonly vec2f: "float32x2";
326
+ readonly vec3f: "float32x3";
327
+ readonly vec4f: "float32x4";
328
+ readonly f16: "float16";
329
+ readonly vec2h: "float16x2";
330
+ readonly vec4h: "float16x4";
331
+ readonly u32: "uint32";
332
+ readonly vec2u: "uint32x2";
333
+ readonly vec3u: "uint32x3";
334
+ readonly vec4u: "uint32x4";
335
+ readonly i32: "sint32";
336
+ readonly vec2i: "sint32x2";
337
+ readonly vec3i: "sint32x3";
338
+ readonly vec4i: "sint32x4";
339
+ };
340
+ type KindToDefaultFormatMap = typeof kindToDefaultFormatMap;
341
+ interface TgpuVertexAttrib<TFormat extends VertexFormat = VertexFormat> {
342
+ readonly format: TFormat;
343
+ readonly offset: number;
344
+ }
345
+ /**
346
+ * All vertex attribute formats that can be interpreted as
347
+ * an single or multi component u32 in a shader.
348
+ * https://www.w3.org/TR/webgpu/#vertex-formats
349
+ */
350
+ type U32CompatibleFormats = TgpuVertexAttrib<'uint8'> | TgpuVertexAttrib<'uint8x2'> | TgpuVertexAttrib<'uint8x4'> | TgpuVertexAttrib<'uint16'> | TgpuVertexAttrib<'uint16x2'> | TgpuVertexAttrib<'uint16x4'> | TgpuVertexAttrib<'uint32'> | TgpuVertexAttrib<'uint32x2'> | TgpuVertexAttrib<'uint32x3'> | TgpuVertexAttrib<'uint32x4'>;
351
+ /**
352
+ * All vertex attribute formats that can be interpreted as
353
+ * an single or multi component i32 in a shader.
354
+ * https://www.w3.org/TR/webgpu/#vertex-formats
355
+ */
356
+ type I32CompatibleFormats = TgpuVertexAttrib<'sint8'> | TgpuVertexAttrib<'sint8x2'> | TgpuVertexAttrib<'sint8x4'> | TgpuVertexAttrib<'sint16'> | TgpuVertexAttrib<'sint16x2'> | TgpuVertexAttrib<'sint16x4'> | TgpuVertexAttrib<'sint32'> | TgpuVertexAttrib<'sint32x2'> | TgpuVertexAttrib<'sint32x3'> | TgpuVertexAttrib<'sint32x4'>;
357
+ /**
358
+ * All vertex attribute formats that can be interpreted as
359
+ * an single or multi component f32 in a shader.
360
+ * https://www.w3.org/TR/webgpu/#vertex-formats
361
+ */
362
+ 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'>;
363
+ /**
364
+ * All vertex attribute formats that can be interpreted as
365
+ * a single or multi component f16 in a shader. (same as f32 on the shader side)
366
+ * https://www.w3.org/TR/webgpu/#vertex-formats
367
+ */
368
+ type F16CompatibleFormats = F32CompatibleFormats;
369
+ type KindToAcceptedAttribMap = {
370
+ u32: U32CompatibleFormats;
371
+ vec2u: U32CompatibleFormats;
372
+ vec3u: U32CompatibleFormats;
373
+ vec4u: U32CompatibleFormats;
374
+ i32: I32CompatibleFormats;
375
+ vec2i: I32CompatibleFormats;
376
+ vec3i: I32CompatibleFormats;
377
+ vec4i: I32CompatibleFormats;
378
+ f16: F16CompatibleFormats;
379
+ vec2h: F16CompatibleFormats;
380
+ vec3h: F16CompatibleFormats;
381
+ vec4h: F16CompatibleFormats;
382
+ f32: F32CompatibleFormats;
383
+ vec2f: F32CompatibleFormats;
384
+ vec3f: F32CompatibleFormats;
385
+ vec4f: F32CompatibleFormats;
386
+ };
387
+
388
+ type FormatToWGSLType<T extends VertexFormat> = (typeof formatToWGSLType)[T];
389
+ interface TgpuVertexFormatData<T extends VertexFormat> {
390
+ readonly '~repr': Infer<FormatToWGSLType<T>>;
391
+ readonly type: T;
392
+ }
393
+ declare const formatToWGSLType: {
394
+ readonly uint8: NativeU32;
395
+ readonly uint8x2: NativeVec2u;
396
+ readonly uint8x4: NativeVec4u;
397
+ readonly sint8: NativeI32;
398
+ readonly sint8x2: NativeVec2i;
399
+ readonly sint8x4: NativeVec4i;
400
+ readonly unorm8: NativeF32;
401
+ readonly unorm8x2: NativeVec2f;
402
+ readonly unorm8x4: NativeVec4f;
403
+ readonly snorm8: NativeF32;
404
+ readonly snorm8x2: NativeVec2f;
405
+ readonly snorm8x4: NativeVec4f;
406
+ readonly uint16: NativeU32;
407
+ readonly uint16x2: NativeVec2u;
408
+ readonly uint16x4: NativeVec4u;
409
+ readonly sint16: NativeI32;
410
+ readonly sint16x2: NativeVec2i;
411
+ readonly sint16x4: NativeVec4i;
412
+ readonly unorm16: NativeF32;
413
+ readonly unorm16x2: NativeVec2f;
414
+ readonly unorm16x4: NativeVec4f;
415
+ readonly snorm16: NativeF32;
416
+ readonly snorm16x2: NativeVec2f;
417
+ readonly snorm16x4: NativeVec4f;
418
+ readonly float16: NativeF32;
419
+ readonly float16x2: NativeVec2f;
420
+ readonly float16x4: NativeVec4f;
421
+ readonly float32: NativeF32;
422
+ readonly float32x2: NativeVec2f;
423
+ readonly float32x3: NativeVec3f;
424
+ readonly float32x4: NativeVec4f;
425
+ readonly uint32: NativeU32;
426
+ readonly uint32x2: NativeVec2u;
427
+ readonly uint32x3: NativeVec3u;
428
+ readonly uint32x4: NativeVec4u;
429
+ readonly sint32: NativeI32;
430
+ readonly sint32x2: NativeVec2i;
431
+ readonly sint32x3: NativeVec3i;
432
+ readonly sint32x4: NativeVec4i;
433
+ readonly 'unorm10-10-10-2': NativeVec4f;
434
+ readonly 'unorm8x4-bgra': NativeVec4f;
435
+ };
436
+ declare const packedFormats: string[];
437
+ type uint8 = TgpuVertexFormatData<'uint8'>;
438
+ declare const uint8: uint8;
439
+ type uint8x2 = TgpuVertexFormatData<'uint8x2'>;
440
+ declare const uint8x2: uint8x2;
441
+ type uint8x4 = TgpuVertexFormatData<'uint8x4'>;
442
+ declare const uint8x4: uint8x4;
443
+ type sint8 = TgpuVertexFormatData<'sint8'>;
444
+ declare const sint8: sint8;
445
+ type sint8x2 = TgpuVertexFormatData<'sint8x2'>;
446
+ declare const sint8x2: sint8x2;
447
+ type sint8x4 = TgpuVertexFormatData<'sint8x4'>;
448
+ declare const sint8x4: sint8x4;
449
+ type unorm8 = TgpuVertexFormatData<'unorm8'>;
450
+ declare const unorm8: unorm8;
451
+ type unorm8x2 = TgpuVertexFormatData<'unorm8x2'>;
452
+ declare const unorm8x2: unorm8x2;
453
+ type unorm8x4 = TgpuVertexFormatData<'unorm8x4'>;
454
+ declare const unorm8x4: unorm8x4;
455
+ type snorm8 = TgpuVertexFormatData<'snorm8'>;
456
+ declare const snorm8: snorm8;
457
+ type snorm8x2 = TgpuVertexFormatData<'snorm8x2'>;
458
+ declare const snorm8x2: snorm8x2;
459
+ type snorm8x4 = TgpuVertexFormatData<'snorm8x4'>;
460
+ declare const snorm8x4: snorm8x4;
461
+ type uint16 = TgpuVertexFormatData<'uint16'>;
462
+ declare const uint16: uint16;
463
+ type uint16x2 = TgpuVertexFormatData<'uint16x2'>;
464
+ declare const uint16x2: uint16x2;
465
+ type uint16x4 = TgpuVertexFormatData<'uint16x4'>;
466
+ declare const uint16x4: uint16x4;
467
+ type sint16 = TgpuVertexFormatData<'sint16'>;
468
+ declare const sint16: sint16;
469
+ type sint16x2 = TgpuVertexFormatData<'sint16x2'>;
470
+ declare const sint16x2: sint16x2;
471
+ type sint16x4 = TgpuVertexFormatData<'sint16x4'>;
472
+ declare const sint16x4: sint16x4;
473
+ type unorm16 = TgpuVertexFormatData<'unorm16'>;
474
+ declare const unorm16: unorm16;
475
+ type unorm16x2 = TgpuVertexFormatData<'unorm16x2'>;
476
+ declare const unorm16x2: unorm16x2;
477
+ type unorm16x4 = TgpuVertexFormatData<'unorm16x4'>;
478
+ declare const unorm16x4: unorm16x4;
479
+ type snorm16 = TgpuVertexFormatData<'snorm16'>;
480
+ declare const snorm16: snorm16;
481
+ type snorm16x2 = TgpuVertexFormatData<'snorm16x2'>;
482
+ declare const snorm16x2: snorm16x2;
483
+ type snorm16x4 = TgpuVertexFormatData<'snorm16x4'>;
484
+ declare const snorm16x4: snorm16x4;
485
+ type float16 = TgpuVertexFormatData<'float16'>;
486
+ declare const float16: float16;
487
+ type float16x2 = TgpuVertexFormatData<'float16x2'>;
488
+ declare const float16x2: float16x2;
489
+ type float16x4 = TgpuVertexFormatData<'float16x4'>;
490
+ declare const float16x4: float16x4;
491
+ type float32 = TgpuVertexFormatData<'float32'>;
492
+ declare const float32: float32;
493
+ type float32x2 = TgpuVertexFormatData<'float32x2'>;
494
+ declare const float32x2: float32x2;
495
+ type float32x3 = TgpuVertexFormatData<'float32x3'>;
496
+ declare const float32x3: float32x3;
497
+ type float32x4 = TgpuVertexFormatData<'float32x4'>;
498
+ declare const float32x4: float32x4;
499
+ type uint32 = TgpuVertexFormatData<'uint32'>;
500
+ declare const uint32: uint32;
501
+ type uint32x2 = TgpuVertexFormatData<'uint32x2'>;
502
+ declare const uint32x2: uint32x2;
503
+ type uint32x3 = TgpuVertexFormatData<'uint32x3'>;
504
+ declare const uint32x3: uint32x3;
505
+ type uint32x4 = TgpuVertexFormatData<'uint32x4'>;
506
+ declare const uint32x4: uint32x4;
507
+ type sint32 = TgpuVertexFormatData<'sint32'>;
508
+ declare const sint32: sint32;
509
+ type sint32x2 = TgpuVertexFormatData<'sint32x2'>;
510
+ declare const sint32x2: sint32x2;
511
+ type sint32x3 = TgpuVertexFormatData<'sint32x3'>;
512
+ declare const sint32x3: sint32x3;
513
+ type sint32x4 = TgpuVertexFormatData<'sint32x4'>;
514
+ declare const sint32x4: sint32x4;
515
+ type unorm10_10_10_2 = TgpuVertexFormatData<'unorm10-10-10-2'>;
516
+ declare const unorm10_10_10_2: unorm10_10_10_2;
517
+ type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;
518
+ declare const unorm8x4_bgra: unorm8x4_bgra;
519
+ 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;
520
+
521
+ /**
522
+ * Array schema constructed via `d.disarrayOf` function.
523
+ *
524
+ * Useful for defining vertex buffers.
525
+ * Elements in the schema are not aligned in respect to their `byteAlignment`,
526
+ * unless they are explicitly decorated with the custom align attribute
527
+ * via `d.align` function.
528
+ */
529
+ interface Disarray<TElement extends BaseWgslData = BaseWgslData> {
530
+ readonly type: 'disarray';
531
+ readonly elementCount: number;
532
+ readonly elementType: TElement;
533
+ readonly '~repr': Infer<TElement>[];
534
+ }
535
+ /**
536
+ * Struct schema constructed via `d.unstruct` function.
537
+ *
538
+ * Useful for defining vertex buffers, as the standard layout restrictions do not apply.
539
+ * Members are not aligned in respect to their `byteAlignment`,
540
+ * unless they are explicitly decorated with the custom align attribute
541
+ * via `d.align` function.
542
+ */
543
+ interface Unstruct<TProps extends Record<string, BaseWgslData> = Record<string, BaseWgslData>> {
544
+ readonly type: 'unstruct';
545
+ readonly propTypes: TProps;
546
+ readonly '~repr': InferRecord<TProps>;
547
+ }
548
+ interface LooseDecorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends unknown[] = unknown[]> {
549
+ readonly type: 'loose-decorated';
550
+ readonly inner: TInner;
551
+ readonly attribs: TAttribs;
552
+ readonly '~repr': Infer<TInner>;
553
+ }
554
+ 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"];
555
+ type LooseTypeLiteral = (typeof looseTypeLiterals)[number];
556
+ type AnyLooseData = Disarray | Unstruct | LooseDecorated | PackedData;
557
+ declare function isLooseData(data: unknown): data is AnyLooseData;
558
+ /**
559
+ * Checks whether the passed in value is a disarray schema,
560
+ * as opposed to, e.g., a regular array schema.
561
+ *
562
+ * Array schemas can be used to describe uniform and storage buffers,
563
+ * whereas disarray schemas cannot. Disarrays are useful for
564
+ * defining vertex buffers instead.
565
+ *
566
+ * @example
567
+ * isDisarray(d.arrayOf(d.u32, 4)) // false
568
+ * isDisarray(d.disarrayOf(d.u32, 4)) // true
569
+ * isDisarray(d.vec3f) // false
570
+ */
571
+ declare function isDisarray<T extends Disarray>(schema: T | unknown): schema is T;
572
+ /**
573
+ * Checks whether passed in value is a unstruct schema,
574
+ * as opposed to, e.g., a struct schema.
575
+ *
576
+ * Struct schemas can be used to describe uniform and storage buffers,
577
+ * whereas unstruct schemas cannot. Unstructs are useful for
578
+ * defining vertex buffers instead.
579
+ *
580
+ * @example
581
+ * isUnstruct(d.struct({ a: d.u32 })) // false
582
+ * isUnstruct(d.unstruct({ a: d.u32 })) // true
583
+ * isUnstruct(d.vec3f) // false
584
+ */
585
+ declare function isUnstruct<T extends Unstruct>(schema: T | unknown): schema is T;
586
+ declare function isLooseDecorated<T extends LooseDecorated>(value: T | unknown): value is T;
587
+ declare function isData(value: unknown): value is AnyData;
588
+ type AnyData = AnyWgslData | AnyLooseData;
589
+
1
590
  /**
2
591
  * Extracts the inferred representation of a resource.
3
592
  * @example
@@ -10,7 +599,14 @@ type Infer<T> = T extends {
10
599
  type InferRecord<T extends Record<string | number | symbol, unknown>> = {
11
600
  [Key in keyof T]: Infer<T[Key]>;
12
601
  };
602
+ type MemIdentity<T> = T extends {
603
+ readonly '~memIdent': infer TMemIdent extends AnyData;
604
+ } ? TMemIdent : T;
605
+ type MemIdentityRecord<T extends Record<string | number | symbol, unknown>> = {
606
+ [Key in keyof T]: MemIdentity<T[Key]>;
607
+ };
13
608
 
609
+ type DecoratedLocation<T extends BaseWgslData> = Decorated<T, Location<number>[]>;
14
610
  interface NumberArrayView {
15
611
  readonly length: number;
16
612
  [n: number]: number;
@@ -532,11 +1128,13 @@ interface I32 {
532
1128
  readonly type: 'i32';
533
1129
  /** Type-token, not available at runtime */
534
1130
  readonly '~repr': number;
1131
+ readonly '~memIdent': I32 | Atomic<I32> | DecoratedLocation<I32>;
535
1132
  }
536
1133
  interface U32 {
537
1134
  readonly type: 'u32';
538
1135
  /** Type-token, not available at runtime */
539
1136
  readonly '~repr': number;
1137
+ readonly '~memIdent': U32 | Atomic<U32> | DecoratedLocation<U32>;
540
1138
  }
541
1139
  interface Vec2f {
542
1140
  readonly type: 'vec2f';
@@ -614,18 +1212,28 @@ interface Mat4x4f {
614
1212
  readonly '~repr': m4x4f;
615
1213
  }
616
1214
  interface WgslStruct<TProps extends Record<string, BaseWgslData> = Record<string, BaseWgslData>> {
1215
+ (props: InferRecord<TProps>): InferRecord<TProps>;
617
1216
  readonly type: 'struct';
618
1217
  readonly label?: string | undefined;
619
1218
  readonly propTypes: TProps;
620
1219
  /** Type-token, not available at runtime */
621
1220
  readonly '~repr': InferRecord<TProps>;
1221
+ readonly '~memIdent': WgslStruct<MemIdentityRecord<TProps>>;
622
1222
  }
1223
+ type AnyWgslStruct = WgslStruct<any>;
623
1224
  interface WgslArray<TElement = BaseWgslData> {
624
1225
  readonly type: 'array';
625
1226
  readonly elementCount: number;
626
1227
  readonly elementType: TElement;
627
1228
  /** Type-token, not available at runtime */
628
1229
  readonly '~repr': Infer<TElement>[];
1230
+ readonly '~memIdent': WgslArray<MemIdentity<TElement>>;
1231
+ }
1232
+ interface PtrFn<TInner = BaseWgslData> {
1233
+ readonly type: 'ptrFn';
1234
+ readonly inner: TInner;
1235
+ /** Type-token, not available at runtime */
1236
+ readonly '~repr': Infer<TInner>;
629
1237
  }
630
1238
  /**
631
1239
  * Schema representing the `atomic<...>` WGSL data type.
@@ -635,6 +1243,7 @@ interface Atomic<TInner extends U32 | I32 = U32 | I32> {
635
1243
  readonly inner: TInner;
636
1244
  /** Type-token, not available at runtime */
637
1245
  readonly '~repr': Infer<TInner>;
1246
+ readonly '~memIdent': MemIdentity<TInner>;
638
1247
  }
639
1248
  interface Align<T extends number> {
640
1249
  readonly type: '@align';
@@ -665,12 +1274,13 @@ interface Decorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends
665
1274
  readonly attribs: TAttribs;
666
1275
  /** Type-token, not available at runtime */
667
1276
  readonly '~repr': Infer<TInner>;
1277
+ readonly '~memIdent': TAttribs extends Location<number>[] ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs> : Decorated<MemIdentity<TInner>, TAttribs>;
668
1278
  }
669
- 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", "atomic", "decorated"];
1279
+ 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"];
670
1280
  type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
671
1281
  type PerspectiveOrLinearInterpolatableData = F32 | F16 | Vec2f | Vec2h | Vec3f | Vec3h | Vec4f | Vec4h;
672
1282
  type FlatInterpolatableData = PerspectiveOrLinearInterpolatableData | I32 | U32 | Vec2i | Vec2u | Vec3i | Vec3u | Vec4i | Vec4u;
673
- type AnyWgslData = Bool | F32 | F16 | I32 | U32 | Vec2f | Vec2h | Vec2i | Vec2u | Vec3f | Vec3h | Vec3i | Vec3u | Vec4f | Vec4h | Vec4i | Vec4u | Mat2x2f | Mat3x3f | Mat4x4f | WgslStruct | WgslArray | Atomic | Decorated;
1283
+ type AnyWgslData = Bool | F32 | F16 | I32 | U32 | Vec2f | Vec2h | Vec2i | Vec2u | Vec3f | Vec3h | Vec3i | Vec3u | Vec4f | Vec4h | Vec4i | Vec4u | Mat2x2f | Mat3x3f | Mat4x4f | AnyWgslStruct | WgslArray | PtrFn | Atomic | Decorated;
674
1284
  declare function isWgslData(value: unknown): value is AnyWgslData;
675
1285
  /**
676
1286
  * Checks whether passed in value is an array schema,
@@ -698,6 +1308,14 @@ declare function isWgslArray<T extends WgslArray>(schema: T | unknown): schema i
698
1308
  * isWgslStruct(d.vec3f) // false
699
1309
  */
700
1310
  declare function isWgslStruct<T extends WgslStruct>(schema: T | unknown): schema is T;
1311
+ /**
1312
+ * Checks whether passed in value is a pointer ('function' scope) schema.
1313
+ *
1314
+ * @example
1315
+ * isPtrFn(d.ptrFn(d.f32)) // true
1316
+ * isPtrFn(d.f32) // false
1317
+ */
1318
+ declare function isPtrFn<T extends PtrFn>(schema: T | unknown): schema is T;
701
1319
  /**
702
1320
  * Checks whether the passed in value is an atomic schema.
703
1321
  *
@@ -713,249 +1331,4 @@ declare function isInterpolateAttrib<T extends Interpolate<InterpolationType>>(v
713
1331
  declare function isBuiltinAttrib<T extends Builtin<string>>(value: unknown | T): value is T;
714
1332
  declare function isDecorated<T extends Decorated>(value: unknown | T): value is T;
715
1333
 
716
- /**
717
- * Type encompassing all available kinds of vector.
718
- */
719
- type VecKind = 'vec2f' | 'vec2i' | 'vec2u' | 'vec2h' | 'vec3f' | 'vec3i' | 'vec3u' | 'vec3h' | 'vec4f' | 'vec4i' | 'vec4u' | 'vec4h';
720
- /**
721
- * Type of the `d.vec2f` object/function: vector data type schema/constructor
722
- */
723
- type NativeVec2f = Vec2f & {
724
- '~exotic': Vec2f;
725
- } & ((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f);
726
- /**
727
- *
728
- * Schema representing vec2f - a vector with 2 elements of type f32.
729
- * Also a constructor function for this vector value.
730
- *
731
- * @example
732
- * const vector = d.vec2f(); // (0.0, 0.0)
733
- * const vector = d.vec2f(1); // (1.0, 1.0)
734
- * const vector = d.vec2f(0.5, 0.1); // (0.5, 0.1)
735
- *
736
- * @example
737
- * const buffer = root.createBuffer(d.vec2f, d.vec2f(0, 1)); // buffer holding a d.vec2f value, with an initial value of vec2f(0, 1);
738
- */
739
- declare const vec2f: NativeVec2f;
740
- /**
741
- * Type of the `d.vec2h` object/function: vector data type schema/constructor
742
- */
743
- type NativeVec2h = Vec2h & {
744
- '~exotic': Vec2h;
745
- } & ((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h);
746
- /**
747
- *
748
- * Schema representing vec2h - a vector with 2 elements of type f16.
749
- * Also a constructor function for this vector value.
750
- *
751
- * @example
752
- * const vector = d.vec2h(); // (0.0, 0.0)
753
- * const vector = d.vec2h(1); // (1.0, 1.0)
754
- * const vector = d.vec2h(0.5, 0.1); // (0.5, 0.1)
755
- *
756
- * @example
757
- * const buffer = root.createBuffer(d.vec2h, d.vec2h(0, 1)); // buffer holding a d.vec2h value, with an initial value of vec2h(0, 1);
758
- */
759
- declare const vec2h: NativeVec2h;
760
- /**
761
- * Type of the `d.vec2i` object/function: vector data type schema/constructor
762
- */
763
- type NativeVec2i = Vec2i & {
764
- '~exotic': Vec2i;
765
- } & ((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i);
766
- /**
767
- *
768
- * Schema representing vec2i - a vector with 2 elements of type i32.
769
- * Also a constructor function for this vector value.
770
- *
771
- * @example
772
- * const vector = d.vec2i(); // (0, 0)
773
- * const vector = d.vec2i(1); // (1, 1)
774
- * const vector = d.vec2i(-1, 1); // (-1, 1)
775
- *
776
- * @example
777
- * const buffer = root.createBuffer(d.vec2i, d.vec2i(0, 1)); // buffer holding a d.vec2i value, with an initial value of vec2i(0, 1);
778
- */
779
- declare const vec2i: NativeVec2i;
780
- /**
781
- * Type of the `d.vec2u` object/function: vector data type schema/constructor
782
- */
783
- type NativeVec2u = Vec2u & {
784
- '~exotic': Vec2u;
785
- } & ((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u);
786
- /**
787
- *
788
- * Schema representing vec2u - a vector with 2 elements of type u32.
789
- * Also a constructor function for this vector value.
790
- *
791
- * @example
792
- * const vector = d.vec2u(); // (0, 0)
793
- * const vector = d.vec2u(1); // (1, 1)
794
- * const vector = d.vec2u(1, 2); // (1, 2)
795
- *
796
- * @example
797
- * const buffer = root.createBuffer(d.vec2u, d.vec2u(0, 1)); // buffer holding a d.vec2u value, with an initial value of vec2u(0, 1);
798
- */
799
- declare const vec2u: NativeVec2u;
800
- /**
801
- * Type of the `d.vec3f` object/function: vector data type schema/constructor
802
- */
803
- type NativeVec3f = Vec3f & {
804
- '~exotic': Vec3f;
805
- } & ((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f);
806
- /**
807
- *
808
- * Schema representing vec3f - a vector with 3 elements of type f32.
809
- * Also a constructor function for this vector value.
810
- *
811
- * @example
812
- * const vector = d.vec3f(); // (0.0, 0.0, 0.0)
813
- * const vector = d.vec3f(1); // (1.0, 1.0, 1.0)
814
- * const vector = d.vec3f(1, 2, 3.5); // (1.0, 2.0, 3.5)
815
- *
816
- * @example
817
- * 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);
818
- */
819
- declare const vec3f: NativeVec3f;
820
- /**
821
- * Type of the `d.vec3h` object/function: vector data type schema/constructor
822
- */
823
- type NativeVec3h = Vec3h & {
824
- '~exotic': Vec3h;
825
- } & ((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h);
826
- /**
827
- *
828
- * Schema representing vec3h - a vector with 3 elements of type f16.
829
- * Also a constructor function for this vector value.
830
- *
831
- * @example
832
- * const vector = d.vec3h(); // (0.0, 0.0, 0.0)
833
- * const vector = d.vec3h(1); // (1.0, 1.0, 1.0)
834
- * const vector = d.vec3h(1, 2, 3.5); // (1.0, 2.0, 3.5)
835
- *
836
- * @example
837
- * 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);
838
- */
839
- declare const vec3h: NativeVec3h;
840
- /**
841
- * Type of the `d.vec3i` object/function: vector data type schema/constructor
842
- */
843
- type NativeVec3i = Vec3i & {
844
- '~exotic': Vec3i;
845
- } & ((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i);
846
- /**
847
- *
848
- * Schema representing vec3i - a vector with 3 elements of type i32.
849
- * Also a constructor function for this vector value.
850
- *
851
- * @example
852
- * const vector = d.vec3i(); // (0, 0, 0)
853
- * const vector = d.vec3i(1); // (1, 1, 1)
854
- * const vector = d.vec3i(1, 2, -3); // (1, 2, -3)
855
- *
856
- * @example
857
- * 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);
858
- */
859
- declare const vec3i: NativeVec3i;
860
- /**
861
- * Type of the `d.vec3u` object/function: vector data type schema/constructor
862
- */
863
- type NativeVec3u = Vec3u & {
864
- '~exotic': Vec3u;
865
- } & ((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u);
866
- /**
867
- *
868
- * Schema representing vec3u - a vector with 3 elements of type u32.
869
- * Also a constructor function for this vector value.
870
- *
871
- * @example
872
- * const vector = d.vec3u(); // (0, 0, 0)
873
- * const vector = d.vec3u(1); // (1, 1, 1)
874
- * const vector = d.vec3u(1, 2, 3); // (1, 2, 3)
875
- *
876
- * @example
877
- * 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);
878
- */
879
- declare const vec3u: NativeVec3u;
880
- /**
881
- * Type of the `d.vec4f` object/function: vector data type schema/constructor
882
- */
883
- type NativeVec4f = Vec4f & {
884
- '~exotic': Vec4f;
885
- } & ((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f);
886
- /**
887
- *
888
- * Schema representing vec4f - a vector with 4 elements of type f32.
889
- * Also a constructor function for this vector value.
890
- *
891
- * @example
892
- * const vector = d.vec4f(); // (0.0, 0.0, 0.0, 0.0)
893
- * const vector = d.vec4f(1); // (1.0, 1.0, 1.0, 1.0)
894
- * const vector = d.vec4f(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
895
- *
896
- * @example
897
- * 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);
898
- */
899
- declare const vec4f: NativeVec4f;
900
- /**
901
- * Type of the `d.vec4h` object/function: vector data type schema/constructor
902
- */
903
- type NativeVec4h = Vec4h & {
904
- '~exotic': Vec4h;
905
- } & ((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h);
906
- /**
907
- *
908
- * Schema representing vec4h - a vector with 4 elements of type f16.
909
- * Also a constructor function for this vector value.
910
- *
911
- * @example
912
- * const vector = d.vec4h(); // (0.0, 0.0, 0.0, 0.0)
913
- * const vector = d.vec4h(1); // (1.0, 1.0, 1.0, 1.0)
914
- * const vector = d.vec4h(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
915
- *
916
- * @example
917
- * 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);
918
- */
919
- declare const vec4h: NativeVec4h;
920
- /**
921
- * Type of the `d.vec4i` object/function: vector data type schema/constructor
922
- */
923
- type NativeVec4i = Vec4i & {
924
- '~exotic': Vec4i;
925
- } & ((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i);
926
- /**
927
- *
928
- * Schema representing vec4i - a vector with 4 elements of type i32.
929
- * Also a constructor function for this vector value.
930
- *
931
- * @example
932
- * const vector = d.vec4i(); // (0, 0, 0, 0)
933
- * const vector = d.vec4i(1); // (1, 1, 1, 1)
934
- * const vector = d.vec4i(1, 2, 3, -4); // (1, 2, 3, -4)
935
- *
936
- * @example
937
- * 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);
938
- */
939
- declare const vec4i: NativeVec4i;
940
- /**
941
- * Type of the `d.vec4u` object/function: vector data type schema/constructor
942
- */
943
- type NativeVec4u = Vec4u & {
944
- '~exotic': Vec4u;
945
- } & ((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u);
946
- /**
947
- *
948
- * Schema representing vec4u - a vector with 4 elements of type u32.
949
- * Also a constructor function for this vector value.
950
- *
951
- * @example
952
- * const vector = d.vec4u(); // (0, 0, 0, 0)
953
- * const vector = d.vec4u(1); // (1, 1, 1, 1)
954
- * const vector = d.vec4u(1, 2, 3, 4); // (1, 2, 3, 4)
955
- *
956
- * @example
957
- * 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);
958
- */
959
- declare const vec4u: NativeVec4u;
960
-
961
- export { type PerspectiveOrLinearInterpolatableData as $, type AnyWgslData as A, type BaseWgslData as B, type NativeVec3i as C, type Decorated as D, type InferRecord as E, type F32 as F, type m2x2f as G, type m3x3f as H, type Infer as I, type m4x4f as J, type v2f as K, type Location as L, type Mat2x2f as M, type NativeVec2u as N, type Mat3x3f as O, type v3f as P, type Mat4x4f as Q, type v4f as R, type Atomic as S, type Align as T, type U32 as U, type Vec2f as V, type WgslArray as W, type Size as X, type Interpolate as Y, type InterpolationType as Z, type PerspectiveOrLinearInterpolationType as _, type F16 as a, type FlatInterpolationType as a0, type FlatInterpolatableData as a1, isWgslData as a2, isWgslArray as a3, isWgslStruct as a4, isAtomic as a5, isDecorated as a6, isAlignAttrib as a7, isBuiltinAttrib as a8, isLocationAttrib as a9, isInterpolateAttrib as aa, isSizeAttrib as ab, type v2i as ac, type v2u as ad, type v3i as ae, type v3u as af, type v4i as ag, type v4u as ah, vec2f as ai, vec2h as aj, vec2i as ak, vec2u as al, vec3f as am, vec3h as an, vec3i as ao, vec3u as ap, vec4f as aq, vec4h as ar, vec4i as as, vec4u as at, type VecKind as au, 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 WgslStruct as n, type WgslTypeLiteral as o, type AnyVecInstance as p, type AnyMatInstance as q, type Builtin as r, type Bool as s, type NativeVec4u as t, type NativeVec2i as u, type NativeVec4i as v, type NativeVec2f as w, type NativeVec4f as x, type NativeVec3f as y, type NativeVec3u as z };
1334
+ export { type Mat3x3f as $, type AnyWgslData as A, type BaseWgslData as B, type PerspectiveOrLinearInterpolatableData as C, type Decorated as D, type FlatInterpolationType as E, type F32 as F, type FlatInterpolatableData as G, type LooseDecorated as H, type Infer as I, type AnyLooseData as J, type KindToAcceptedAttribMap as K, type Location as L, type MemIdentity as M, type LooseTypeLiteral as N, type WgslStruct as O, type PerspectiveOrLinearInterpolationType as P, type PtrFn as Q, type m2x2f as R, type Size as S, type TgpuVertexAttrib as T, type U32 as U, type Vec2f as V, type WgslArray as W, type m3x3f as X, type m4x4f as Y, type Mat2x2f as Z, type v2f as _, type F16 as a, sint16x2 as a$, type v3f as a0, type Mat4x4f as a1, type v4f as a2, type Atomic as a3, bool as a4, f32 as a5, f16 as a6, i32 as a7, u32 as a8, isWgslData as a9, vec4h as aA, vec4i as aB, vec4u as aC, isDisarray as aD, isUnstruct as aE, isLooseDecorated as aF, isData as aG, isLooseData as aH, type FormatToWGSLType as aI, type TgpuVertexFormatData as aJ, packedFormats as aK, uint8 as aL, uint8x2 as aM, uint8x4 as aN, sint8 as aO, sint8x2 as aP, sint8x4 as aQ, unorm8 as aR, unorm8x2 as aS, unorm8x4 as aT, snorm8 as aU, snorm8x2 as aV, snorm8x4 as aW, uint16 as aX, uint16x2 as aY, uint16x4 as aZ, sint16 as a_, isWgslArray as aa, isWgslStruct as ab, isPtrFn as ac, isAtomic as ad, isDecorated as ae, isAlignAttrib as af, isBuiltinAttrib as ag, isLocationAttrib as ah, isInterpolateAttrib as ai, isSizeAttrib as aj, type Bool as ak, type v2i as al, type v2u as am, type v3i as an, type v3u as ao, type v4i as ap, type v4u as aq, vec2f as ar, vec2h as as, vec2i as at, vec2u as au, vec3f as av, vec3h as aw, vec3i as ax, vec3u as ay, vec4f as az, type I32 as b, sint16x4 as b0, unorm16 as b1, unorm16x2 as b2, unorm16x4 as b3, snorm16 as b4, snorm16x2 as b5, snorm16x4 as b6, float16 as b7, float16x2 as b8, float16x4 as b9, float32 as ba, float32x2 as bb, float32x3 as bc, float32x4 as bd, uint32 as be, uint32x2 as bf, uint32x3 as bg, uint32x4 as bh, sint32 as bi, sint32x2 as bj, sint32x3 as bk, sint32x4 as bl, unorm10_10_10_2 as bm, unorm8x4_bgra as bn, type PackedData as bo, type VecKind as bp, 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 AnyData as o, type Disarray as p, type Unstruct as q, type VertexFormat as r, type KindToDefaultFormatMap as s, type WgslTypeLiteral as t, type AnyVecInstance as u, type AnyMatInstance as v, type Builtin as w, type Align as x, type Interpolate as y, type InterpolationType as z };