typegpu 0.3.0-alpha.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ import { Block } from 'tinyest';
2
+
1
3
  /**
2
4
  * Extracts the inferred representation of a resource.
3
5
  * @example
@@ -11,1250 +13,1802 @@ type InferRecord<T extends Record<string | number | symbol, unknown>> = {
11
13
  [Key in keyof T]: Infer<T[Key]>;
12
14
  };
13
15
 
14
- interface NumberArrayView {
15
- readonly length: number;
16
- [n: number]: number;
17
- }
18
- interface BaseWgslData {
19
- type: string;
20
- /** Type-token, not available at runtime */
21
- readonly '~repr': unknown;
22
- }
23
- interface Swizzle2<T2, T3, T4> {
24
- readonly xx: T2;
25
- readonly xy: T2;
26
- readonly yx: T2;
27
- readonly yy: T2;
28
- readonly xxx: T3;
29
- readonly xxy: T3;
30
- readonly xyx: T3;
31
- readonly xyy: T3;
32
- readonly yxx: T3;
33
- readonly yxy: T3;
34
- readonly yyx: T3;
35
- readonly yyy: T3;
36
- readonly xxxx: T4;
37
- readonly xxxy: T4;
38
- readonly xxyx: T4;
39
- readonly xxyy: T4;
40
- readonly xyxx: T4;
41
- readonly xyxy: T4;
42
- readonly xyyx: T4;
43
- readonly xyyy: T4;
44
- readonly yxxx: T4;
45
- readonly yxxy: T4;
46
- readonly yxyx: T4;
47
- readonly yxyy: T4;
48
- readonly yyxx: T4;
49
- readonly yyxy: T4;
50
- readonly yyyx: T4;
51
- readonly yyyy: T4;
52
- }
53
- interface Swizzle3<T2, T3, T4> extends Swizzle2<T2, T3, T4> {
54
- readonly xz: T2;
55
- readonly yz: T2;
56
- readonly zx: T2;
57
- readonly zy: T2;
58
- readonly zz: T2;
59
- readonly xxz: T3;
60
- readonly xyz: T3;
61
- readonly xzx: T3;
62
- readonly xzy: T3;
63
- readonly xzz: T3;
64
- readonly yxz: T3;
65
- readonly yyz: T3;
66
- readonly yzx: T3;
67
- readonly yzy: T3;
68
- readonly yzz: T3;
69
- readonly zxx: T3;
70
- readonly zxy: T3;
71
- readonly zxz: T3;
72
- readonly zyx: T3;
73
- readonly zyy: T3;
74
- readonly zyz: T3;
75
- readonly zzx: T3;
76
- readonly zzy: T3;
77
- readonly zzz: T3;
78
- readonly xxxz: T4;
79
- readonly xxyz: T4;
80
- readonly xxzx: T4;
81
- readonly xxzy: T4;
82
- readonly xxzz: T4;
83
- readonly xyxz: T4;
84
- readonly xyyz: T4;
85
- readonly xyzx: T4;
86
- readonly xyzy: T4;
87
- readonly xyzz: T4;
88
- readonly xzxx: T4;
89
- readonly xzxy: T4;
90
- readonly xzxz: T4;
91
- readonly xzyx: T4;
92
- readonly xzyy: T4;
93
- readonly xzyz: T4;
94
- readonly xzzx: T4;
95
- readonly xzzy: T4;
96
- readonly xzzz: T4;
97
- readonly yxxz: T4;
98
- readonly yxyz: T4;
99
- readonly yxzx: T4;
100
- readonly yxzy: T4;
101
- readonly yxzz: T4;
102
- readonly yyxz: T4;
103
- readonly yyyz: T4;
104
- readonly yyzx: T4;
105
- readonly yyzy: T4;
106
- readonly yyzz: T4;
107
- readonly yzxx: T4;
108
- readonly yzxy: T4;
109
- readonly yzxz: T4;
110
- readonly yzyx: T4;
111
- readonly yzyy: T4;
112
- readonly yzyz: T4;
113
- readonly yzzx: T4;
114
- readonly yzzy: T4;
115
- readonly yzzz: T4;
116
- readonly zxxx: T4;
117
- readonly zxxy: T4;
118
- readonly zxxz: T4;
119
- readonly zxyx: T4;
120
- readonly zxyy: T4;
121
- readonly zxyz: T4;
122
- readonly zxzx: T4;
123
- readonly zxzy: T4;
124
- readonly zxzz: T4;
125
- readonly zyxx: T4;
126
- readonly zyxy: T4;
127
- readonly zyxz: T4;
128
- readonly zyyx: T4;
129
- readonly zyyy: T4;
130
- readonly zyyz: T4;
131
- readonly zyzx: T4;
132
- readonly zyzy: T4;
133
- readonly zyzz: T4;
134
- readonly zzxx: T4;
135
- readonly zzxy: T4;
136
- readonly zzxz: T4;
137
- readonly zzyx: T4;
138
- readonly zzyy: T4;
139
- readonly zzyz: T4;
140
- readonly zzzx: T4;
141
- readonly zzzy: T4;
142
- readonly zzzz: T4;
143
- }
144
- interface Swizzle4<T2, T3, T4> extends Swizzle3<T2, T3, T4> {
145
- readonly yw: T2;
146
- readonly zw: T2;
147
- readonly wx: T2;
148
- readonly wy: T2;
149
- readonly wz: T2;
150
- readonly ww: T2;
151
- readonly xxw: T3;
152
- readonly xyw: T3;
153
- readonly xzw: T3;
154
- readonly xwx: T3;
155
- readonly xwy: T3;
156
- readonly xwz: T3;
157
- readonly xww: T3;
158
- readonly yxw: T3;
159
- readonly yyw: T3;
160
- readonly yzw: T3;
161
- readonly ywx: T3;
162
- readonly ywy: T3;
163
- readonly ywz: T3;
164
- readonly yww: T3;
165
- readonly zxw: T3;
166
- readonly zyw: T3;
167
- readonly zzw: T3;
168
- readonly zwx: T3;
169
- readonly zwy: T3;
170
- readonly zwz: T3;
171
- readonly zww: T3;
172
- readonly wxx: T3;
173
- readonly wxz: T3;
174
- readonly wxy: T3;
175
- readonly wyy: T3;
176
- readonly wyz: T3;
177
- readonly wzz: T3;
178
- readonly wwx: T3;
179
- readonly wwy: T3;
180
- readonly wwz: T3;
181
- readonly www: T3;
182
- readonly xxxw: T4;
183
- readonly xxyw: T4;
184
- readonly xxzw: T4;
185
- readonly xxwx: T4;
186
- readonly xxwy: T4;
187
- readonly xxwz: T4;
188
- readonly xxww: T4;
189
- readonly xyxw: T4;
190
- readonly xyyw: T4;
191
- readonly xyzw: T4;
192
- readonly xywx: T4;
193
- readonly xywy: T4;
194
- readonly xywz: T4;
195
- readonly xyww: T4;
196
- readonly xzxw: T4;
197
- readonly xzyw: T4;
198
- readonly xzzw: T4;
199
- readonly xzwx: T4;
200
- readonly xzwy: T4;
201
- readonly xzwz: T4;
202
- readonly xzww: T4;
203
- readonly xwxx: T4;
204
- readonly xwxy: T4;
205
- readonly xwxz: T4;
206
- readonly xwyy: T4;
207
- readonly xwyz: T4;
208
- readonly xwzz: T4;
209
- readonly xwwx: T4;
210
- readonly xwwy: T4;
211
- readonly xwwz: T4;
212
- readonly xwww: T4;
213
- readonly yxxw: T4;
214
- readonly yxyw: T4;
215
- readonly yxzw: T4;
216
- readonly yxwx: T4;
217
- readonly yxwy: T4;
218
- readonly yxwz: T4;
219
- readonly yxww: T4;
220
- readonly yyxw: T4;
221
- readonly yyyw: T4;
222
- readonly yyzw: T4;
223
- readonly yywx: T4;
224
- readonly yywy: T4;
225
- readonly yywz: T4;
226
- readonly yyww: T4;
227
- readonly yzxw: T4;
228
- readonly yzyw: T4;
229
- readonly yzzw: T4;
230
- readonly yzwx: T4;
231
- readonly yzwy: T4;
232
- readonly yzwz: T4;
233
- readonly yzww: T4;
234
- readonly ywxx: T4;
235
- readonly ywxy: T4;
236
- readonly ywxz: T4;
237
- readonly ywxw: T4;
238
- readonly ywyy: T4;
239
- readonly ywyz: T4;
240
- readonly ywzz: T4;
241
- readonly ywwx: T4;
242
- readonly ywwy: T4;
243
- readonly ywwz: T4;
244
- readonly ywww: T4;
245
- readonly zxxw: T4;
246
- readonly zxyw: T4;
247
- readonly zxzw: T4;
248
- readonly zxwx: T4;
249
- readonly zxwy: T4;
250
- readonly zxwz: T4;
251
- readonly zxww: T4;
252
- readonly zyxw: T4;
253
- readonly zyyw: T4;
254
- readonly zyzw: T4;
255
- readonly zywx: T4;
256
- readonly zywy: T4;
257
- readonly zywz: T4;
258
- readonly zyww: T4;
259
- readonly zzxw: T4;
260
- readonly zzyw: T4;
261
- readonly zzzw: T4;
262
- readonly zzwx: T4;
263
- readonly zzwy: T4;
264
- readonly zzwz: T4;
265
- readonly zzww: T4;
266
- readonly zwxx: T4;
267
- readonly zwxy: T4;
268
- readonly zwxz: T4;
269
- readonly zwxw: T4;
270
- readonly zwyy: T4;
271
- readonly zwyz: T4;
272
- readonly zwzz: T4;
273
- readonly zwwx: T4;
274
- readonly zwwy: T4;
275
- readonly zwwz: T4;
276
- readonly zwww: T4;
277
- readonly wxxx: T4;
278
- readonly wxxy: T4;
279
- readonly wxxz: T4;
280
- readonly wxxw: T4;
281
- readonly wxyx: T4;
282
- readonly wxyy: T4;
283
- readonly wxyz: T4;
284
- readonly wxyw: T4;
285
- readonly wxzx: T4;
286
- readonly wxzy: T4;
287
- readonly wxzz: T4;
288
- readonly wxzw: T4;
289
- readonly wxwx: T4;
290
- readonly wxwy: T4;
291
- readonly wxwz: T4;
292
- readonly wxww: T4;
293
- readonly wyxx: T4;
294
- readonly wyxy: T4;
295
- readonly wyxz: T4;
296
- readonly wyxw: T4;
297
- readonly wyyy: T4;
298
- readonly wyyz: T4;
299
- readonly wyzw: T4;
300
- readonly wywx: T4;
301
- readonly wywy: T4;
302
- readonly wywz: T4;
303
- readonly wyww: T4;
304
- readonly wzxx: T4;
305
- readonly wzxy: T4;
306
- readonly wzxz: T4;
307
- readonly wzxw: T4;
308
- readonly wzyy: T4;
309
- readonly wzyz: T4;
310
- readonly wzzy: T4;
311
- readonly wzzw: T4;
312
- readonly wzwx: T4;
313
- readonly wzwy: T4;
314
- readonly wzwz: T4;
315
- readonly wzww: T4;
316
- readonly wwxx: T4;
317
- readonly wwxy: T4;
318
- readonly wwxz: T4;
319
- readonly wwxw: T4;
320
- readonly wwyy: T4;
321
- readonly wwyz: T4;
322
- readonly wwzz: T4;
323
- readonly wwwx: T4;
324
- readonly wwwy: T4;
325
- readonly wwwz: T4;
326
- readonly wwww: T4;
16
+ /**
17
+ * A schema that represents a boolean value. (equivalent to `bool` in WGSL)
18
+ */
19
+ declare const bool: Bool;
20
+ /**
21
+ * Unsigned 32-bit integer schema representing a single WGSL u32 value.
22
+ */
23
+ type NativeU32 = U32 & {
24
+ '~exotic': U32;
25
+ } & ((v: number | boolean) => number);
26
+ /**
27
+ * A schema that represents an unsigned 32-bit integer value. (equivalent to `u32` in WGSL)
28
+ *
29
+ * Can also be called to cast a value to an u32 in accordance with WGSL casting rules.
30
+ *
31
+ * @example
32
+ * const value = u32(3.14); // 3
33
+ * @example
34
+ * const value = u32(-1); // 4294967295
35
+ * @example
36
+ * const value = u32(-3.1); // 0
37
+ */
38
+ declare const u32: NativeU32;
39
+ /**
40
+ * Signed 32-bit integer schema representing a single WGSL i32 value.
41
+ */
42
+ type NativeI32 = I32 & {
43
+ '~exotic': I32;
44
+ } & ((v: number | boolean) => number);
45
+ /**
46
+ * A schema that represents a signed 32-bit integer value. (equivalent to `i32` in WGSL)
47
+ *
48
+ * Can also be called to cast a value to an i32 in accordance with WGSL casting rules.
49
+ *
50
+ * @example
51
+ * const value = i32(3.14); // 3
52
+ * @example
53
+ * const value = i32(-3.9); // -3
54
+ * @example
55
+ * const value = i32(10000000000) // 1410065408
56
+ */
57
+ declare const i32: NativeI32;
58
+ /**
59
+ * 32-bit float schema representing a single WGSL f32 value.
60
+ */
61
+ type NativeF32 = F32 & {
62
+ '~exotic': F32;
63
+ } & ((v: number | boolean) => number);
64
+ /**
65
+ * A schema that represents a 32-bit float value. (equivalent to `f32` in WGSL)
66
+ *
67
+ * Can also be called to cast a value to an f32.
68
+ *
69
+ * @example
70
+ * const value = f32(true); // 1
71
+ */
72
+ declare const f32: NativeF32;
73
+ /**
74
+ * 16-bit float schema representing a single WGSL f16 value.
75
+ */
76
+ type NativeF16 = F16 & {
77
+ '~exotic': F16;
78
+ } & ((v: number | boolean) => number);
79
+ /**
80
+ * A schema that represents a 16-bit float value. (equivalent to `f16` in WGSL)
81
+ *
82
+ * Can also be called to cast a value to an f16.
83
+ *
84
+ * @example
85
+ * const value = f16(true); // 1
86
+ * @example
87
+ * const value = f16(21877.5); // 21872
88
+ */
89
+ declare const f16: NativeF16;
90
+
91
+ /**
92
+ * Can be assigned a name. Not to be confused with
93
+ * being able to HAVE a name.
94
+ */
95
+ interface TgpuNamable {
96
+ $name(label?: string | undefined): this;
327
97
  }
98
+
99
+ type Default<T, TDefault> = unknown extends T ? TDefault : T extends undefined ? TDefault : T;
100
+ type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
101
+ type Prettify<T> = {
102
+ [K in keyof T]: T[K];
103
+ } & {};
328
104
  /**
329
- * Interface representing its WGSL vector type counterpart: vec2f or vec2<f32>.
330
- * A vector with 2 elements of type f32
105
+ * Removes properties from record type that extend `Prop`
331
106
  */
332
- interface v2f extends NumberArrayView, Swizzle2<v2f, v3f, v4f> {
333
- /** use to distinguish between vectors of the same size on the type level */
334
- readonly kind: 'vec2f';
335
- x: number;
336
- y: number;
337
- }
107
+ type OmitProps<T extends Record<string, unknown>, Prop> = Pick<T, {
108
+ [Key in keyof T]: T[Key] extends Prop ? never : Key;
109
+ }[keyof T]>;
110
+
338
111
  /**
339
- * Interface representing its WGSL vector type counterpart: vec2h or vec2<f16>.
340
- * A vector with 2 elements of type f16
112
+ * Strips schema types down to their most basic forms. (native -> exotic)
113
+ * This is used by schema constructors to be able to ingest native schemas (created by TypeGPU), and
114
+ * spit out a type that matches non-native schemas as well.
341
115
  */
342
- interface v2h extends NumberArrayView, Swizzle2<v2h, v3h, v4h> {
343
- /** use to distinguish between vectors of the same size on the type level */
344
- readonly kind: 'vec2h';
345
- x: number;
346
- y: number;
347
- }
116
+ type Exotic<T> = T extends {
117
+ readonly '~exotic': infer TExotic;
118
+ } ? TExotic : T;
119
+ type ExoticRecord<T> = T extends Record<string | number | symbol, unknown> ? {
120
+ [Key in keyof T]: Exotic<T[Key]>;
121
+ } : T;
122
+
348
123
  /**
349
- * Interface representing its WGSL vector type counterpart: vec2i or vec2<i32>.
350
- * A vector with 2 elements of type i32
124
+ * Type of the `d.vec2f` object/function: vector data type schema/constructor
351
125
  */
352
- interface v2i extends NumberArrayView, Swizzle2<v2i, v3i, v4i> {
353
- /** use to distinguish between vectors of the same size on the type level */
354
- readonly kind: 'vec2i';
355
- x: number;
356
- y: number;
357
- }
126
+ type NativeVec2f = Vec2f & {
127
+ '~exotic': Vec2f;
128
+ } & ((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f);
358
129
  /**
359
- * Interface representing its WGSL vector type counterpart: vec2u or vec2<u32>.
360
- * A vector with 2 elements of type u32
130
+ *
131
+ * Schema representing vec2f - a vector with 2 elements of type f32.
132
+ * Also a constructor function for this vector value.
133
+ *
134
+ * @example
135
+ * const vector = d.vec2f(); // (0.0, 0.0)
136
+ * const vector = d.vec2f(1); // (1.0, 1.0)
137
+ * const vector = d.vec2f(0.5, 0.1); // (0.5, 0.1)
138
+ *
139
+ * @example
140
+ * const buffer = root.createBuffer(d.vec2f, d.vec2f(0, 1)); // buffer holding a d.vec2f value, with an initial value of vec2f(0, 1);
361
141
  */
362
- interface v2u extends NumberArrayView, Swizzle2<v2u, v3u, v4u> {
363
- /** use to distinguish between vectors of the same size on the type level */
364
- readonly kind: 'vec2u';
365
- x: number;
366
- y: number;
367
- }
142
+ declare const vec2f: NativeVec2f;
368
143
  /**
369
- * Interface representing its WGSL vector type counterpart: vec3f or vec3<f32>.
370
- * A vector with 3 elements of type f32
144
+ * Type of the `d.vec2h` object/function: vector data type schema/constructor
371
145
  */
372
- interface v3f extends NumberArrayView, Swizzle3<v2f, v3f, v4f> {
373
- /** use to distinguish between vectors of the same size on the type level */
374
- readonly kind: 'vec3f';
375
- x: number;
376
- y: number;
377
- z: number;
378
- }
146
+ type NativeVec2h = Vec2h & {
147
+ '~exotic': Vec2h;
148
+ } & ((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h);
379
149
  /**
380
- * Interface representing its WGSL vector type counterpart: vec3h or vec3<f16>.
381
- * A vector with 3 elements of type f16
150
+ *
151
+ * Schema representing vec2h - a vector with 2 elements of type f16.
152
+ * Also a constructor function for this vector value.
153
+ *
154
+ * @example
155
+ * const vector = d.vec2h(); // (0.0, 0.0)
156
+ * const vector = d.vec2h(1); // (1.0, 1.0)
157
+ * const vector = d.vec2h(0.5, 0.1); // (0.5, 0.1)
158
+ *
159
+ * @example
160
+ * const buffer = root.createBuffer(d.vec2h, d.vec2h(0, 1)); // buffer holding a d.vec2h value, with an initial value of vec2h(0, 1);
382
161
  */
383
- interface v3h extends NumberArrayView, Swizzle3<v2h, v3h, v4h> {
384
- /** use to distinguish between vectors of the same size on the type level */
385
- readonly kind: 'vec3h';
386
- x: number;
387
- y: number;
388
- z: number;
389
- }
162
+ declare const vec2h: NativeVec2h;
390
163
  /**
391
- * Interface representing its WGSL vector type counterpart: vec3i or vec3<i32>.
392
- * A vector with 3 elements of type i32
164
+ * Type of the `d.vec2i` object/function: vector data type schema/constructor
393
165
  */
394
- interface v3i extends NumberArrayView, Swizzle3<v2i, v3i, v4i> {
395
- /** use to distinguish between vectors of the same size on the type level */
396
- readonly kind: 'vec3i';
397
- x: number;
398
- y: number;
399
- z: number;
400
- }
166
+ type NativeVec2i = Vec2i & {
167
+ '~exotic': Vec2i;
168
+ } & ((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i);
401
169
  /**
402
- * Interface representing its WGSL vector type counterpart: vec3u or vec3<u32>.
403
- * A vector with 3 elements of type u32
404
- */
405
- interface v3u extends NumberArrayView, Swizzle3<v2u, v3u, v4u> {
406
- /** use to distinguish between vectors of the same size on the type level */
407
- readonly kind: 'vec3u';
408
- x: number;
409
- y: number;
410
- z: number;
411
- }
170
+ *
171
+ * Schema representing vec2i - a vector with 2 elements of type i32.
172
+ * Also a constructor function for this vector value.
173
+ *
174
+ * @example
175
+ * const vector = d.vec2i(); // (0, 0)
176
+ * const vector = d.vec2i(1); // (1, 1)
177
+ * const vector = d.vec2i(-1, 1); // (-1, 1)
178
+ *
179
+ * @example
180
+ * const buffer = root.createBuffer(d.vec2i, d.vec2i(0, 1)); // buffer holding a d.vec2i value, with an initial value of vec2i(0, 1);
181
+ */
182
+ declare const vec2i: NativeVec2i;
412
183
  /**
413
- * Interface representing its WGSL vector type counterpart: vec4f or vec4<f32>.
414
- * A vector with 4 elements of type f32
184
+ * Type of the `d.vec2u` object/function: vector data type schema/constructor
415
185
  */
416
- interface v4f extends NumberArrayView, Swizzle4<v2f, v3f, v4f> {
417
- /** use to distinguish between vectors of the same size on the type level */
418
- readonly kind: 'vec4f';
419
- x: number;
420
- y: number;
421
- z: number;
422
- w: number;
423
- }
186
+ type NativeVec2u = Vec2u & {
187
+ '~exotic': Vec2u;
188
+ } & ((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u);
424
189
  /**
425
- * Interface representing its WGSL vector type counterpart: vec4h or vec4<f16>.
426
- * A vector with 4 elements of type f16
190
+ *
191
+ * Schema representing vec2u - a vector with 2 elements of type u32.
192
+ * Also a constructor function for this vector value.
193
+ *
194
+ * @example
195
+ * const vector = d.vec2u(); // (0, 0)
196
+ * const vector = d.vec2u(1); // (1, 1)
197
+ * const vector = d.vec2u(1, 2); // (1, 2)
198
+ *
199
+ * @example
200
+ * const buffer = root.createBuffer(d.vec2u, d.vec2u(0, 1)); // buffer holding a d.vec2u value, with an initial value of vec2u(0, 1);
427
201
  */
428
- interface v4h extends NumberArrayView, Swizzle4<v2h, v3h, v4h> {
429
- /** use to distinguish between vectors of the same size on the type level */
430
- readonly kind: 'vec4h';
431
- x: number;
432
- y: number;
433
- z: number;
434
- w: number;
435
- }
202
+ declare const vec2u: NativeVec2u;
436
203
  /**
437
- * Interface representing its WGSL vector type counterpart: vec4i or vec4<i32>.
438
- * A vector with 4 elements of type i32
204
+ * Type of the `d.vec3f` object/function: vector data type schema/constructor
439
205
  */
440
- interface v4i extends NumberArrayView, Swizzle4<v2i, v3i, v4i> {
441
- /** use to distinguish between vectors of the same size on the type level */
442
- readonly kind: 'vec4i';
443
- x: number;
444
- y: number;
445
- z: number;
446
- w: number;
447
- }
206
+ type NativeVec3f = Vec3f & {
207
+ '~exotic': Vec3f;
208
+ } & ((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f);
448
209
  /**
449
- * Interface representing its WGSL vector type counterpart: vec4u or vec4<u32>.
450
- * A vector with 4 elements of type u32
210
+ *
211
+ * Schema representing vec3f - a vector with 3 elements of type f32.
212
+ * Also a constructor function for this vector value.
213
+ *
214
+ * @example
215
+ * const vector = d.vec3f(); // (0.0, 0.0, 0.0)
216
+ * const vector = d.vec3f(1); // (1.0, 1.0, 1.0)
217
+ * const vector = d.vec3f(1, 2, 3.5); // (1.0, 2.0, 3.5)
218
+ *
219
+ * @example
220
+ * 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);
451
221
  */
452
- interface v4u extends NumberArrayView, Swizzle4<v2u, v3u, v4u> {
453
- /** use to distinguish between vectors of the same size on the type level */
454
- readonly kind: 'vec4u';
455
- x: number;
456
- y: number;
457
- z: number;
458
- w: number;
459
- }
460
- interface matBase<TColumn> extends NumberArrayView {
461
- readonly columns: readonly TColumn[];
462
- }
222
+ declare const vec3f: NativeVec3f;
463
223
  /**
464
- * Interface representing its WGSL matrix type counterpart: mat2x2
465
- * A matrix with 2 rows and 2 columns, with elements of type `TColumn`
224
+ * Type of the `d.vec3h` object/function: vector data type schema/constructor
466
225
  */
467
- interface mat2x2<TColumn> extends matBase<TColumn> {
468
- readonly length: 4;
469
- [n: number]: number;
470
- }
226
+ type NativeVec3h = Vec3h & {
227
+ '~exotic': Vec3h;
228
+ } & ((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h);
471
229
  /**
472
- * Interface representing its WGSL matrix type counterpart: mat2x2f or mat2x2<f32>
473
- * A matrix with 2 rows and 2 columns, with elements of type d.f32
230
+ *
231
+ * Schema representing vec3h - a vector with 3 elements of type f16.
232
+ * Also a constructor function for this vector value.
233
+ *
234
+ * @example
235
+ * const vector = d.vec3h(); // (0.0, 0.0, 0.0)
236
+ * const vector = d.vec3h(1); // (1.0, 1.0, 1.0)
237
+ * const vector = d.vec3h(1, 2, 3.5); // (1.0, 2.0, 3.5)
238
+ *
239
+ * @example
240
+ * 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);
474
241
  */
475
- interface m2x2f extends mat2x2<v2f> {
476
- readonly kind: 'mat2x2f';
477
- }
242
+ declare const vec3h: NativeVec3h;
478
243
  /**
479
- * Interface representing its WGSL matrix type counterpart: mat3x3
480
- * A matrix with 3 rows and 3 columns, with elements of type `TColumn`
244
+ * Type of the `d.vec3i` object/function: vector data type schema/constructor
481
245
  */
482
- interface mat3x3<TColumn> extends matBase<TColumn> {
483
- readonly length: 12;
484
- [n: number]: number;
485
- }
246
+ type NativeVec3i = Vec3i & {
247
+ '~exotic': Vec3i;
248
+ } & ((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i);
486
249
  /**
487
- * Interface representing its WGSL matrix type counterpart: mat3x3f or mat3x3<f32>
488
- * A matrix with 3 rows and 3 columns, with elements of type d.f32
250
+ *
251
+ * Schema representing vec3i - a vector with 3 elements of type i32.
252
+ * Also a constructor function for this vector value.
253
+ *
254
+ * @example
255
+ * const vector = d.vec3i(); // (0, 0, 0)
256
+ * const vector = d.vec3i(1); // (1, 1, 1)
257
+ * const vector = d.vec3i(1, 2, -3); // (1, 2, -3)
258
+ *
259
+ * @example
260
+ * 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);
489
261
  */
490
- interface m3x3f extends mat3x3<v3f> {
491
- readonly kind: 'mat3x3f';
492
- }
262
+ declare const vec3i: NativeVec3i;
493
263
  /**
494
- * Interface representing its WGSL matrix type counterpart: mat4x4
495
- * A matrix with 4 rows and 4 columns, with elements of type `TColumn`
264
+ * Type of the `d.vec3u` object/function: vector data type schema/constructor
496
265
  */
497
- interface mat4x4<TColumn> extends matBase<TColumn> {
498
- readonly length: 16;
499
- [n: number]: number;
500
- }
266
+ type NativeVec3u = Vec3u & {
267
+ '~exotic': Vec3u;
268
+ } & ((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u);
501
269
  /**
502
- * Interface representing its WGSL matrix type counterpart: mat4x4f or mat4x4<f32>
503
- * A matrix with 4 rows and 4 columns, with elements of type d.f32
270
+ *
271
+ * Schema representing vec3u - a vector with 3 elements of type u32.
272
+ * Also a constructor function for this vector value.
273
+ *
274
+ * @example
275
+ * const vector = d.vec3u(); // (0, 0, 0)
276
+ * const vector = d.vec3u(1); // (1, 1, 1)
277
+ * const vector = d.vec3u(1, 2, 3); // (1, 2, 3)
278
+ *
279
+ * @example
280
+ * 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);
504
281
  */
505
- interface m4x4f extends mat4x4<v4f> {
506
- readonly kind: 'mat4x4f';
507
- }
282
+ declare const vec3u: NativeVec3u;
508
283
  /**
509
- * Boolean schema representing a single WGSL bool value.
510
- * Cannot be used inside buffers as it is not host-shareable.
284
+ * Type of the `d.vec4f` object/function: vector data type schema/constructor
511
285
  */
512
- interface Bool {
513
- readonly type: 'bool';
514
- readonly '~repr': boolean;
515
- }
516
- interface F32 {
517
- readonly type: 'f32';
518
- /** Type-token, not available at runtime */
519
- readonly '~repr': number;
520
- }
521
- interface F16 {
522
- readonly type: 'f16';
523
- /** Type-token, not available at runtime */
524
- readonly '~repr': number;
525
- }
526
- interface I32 {
527
- readonly type: 'i32';
528
- /** Type-token, not available at runtime */
529
- readonly '~repr': number;
530
- }
531
- interface U32 {
532
- readonly type: 'u32';
533
- /** Type-token, not available at runtime */
534
- readonly '~repr': number;
535
- }
536
- interface Vec2f {
537
- readonly type: 'vec2f';
538
- /** Type-token, not available at runtime */
539
- readonly '~repr': v2f;
540
- }
541
- interface Vec2h {
542
- readonly type: 'vec2h';
543
- /** Type-token, not available at runtime */
544
- readonly '~repr': v2h;
545
- }
546
- interface Vec2i {
547
- readonly type: 'vec2i';
548
- /** Type-token, not available at runtime */
549
- readonly '~repr': v2i;
550
- }
551
- interface Vec2u {
552
- readonly type: 'vec2u';
553
- /** Type-token, not available at runtime */
554
- readonly '~repr': v2u;
555
- }
556
- interface Vec3f {
557
- readonly type: 'vec3f';
558
- /** Type-token, not available at runtime */
559
- readonly '~repr': v3f;
560
- }
561
- interface Vec3h {
562
- readonly type: 'vec3h';
563
- /** Type-token, not available at runtime */
564
- readonly '~repr': v3h;
565
- }
566
- interface Vec3i {
567
- readonly type: 'vec3i';
568
- /** Type-token, not available at runtime */
569
- readonly '~repr': v3i;
570
- }
571
- interface Vec3u {
572
- readonly type: 'vec3u';
573
- /** Type-token, not available at runtime */
574
- readonly '~repr': v3u;
575
- }
576
- interface Vec4f {
577
- readonly type: 'vec4f';
578
- /** Type-token, not available at runtime */
579
- readonly '~repr': v4f;
580
- }
581
- interface Vec4h {
582
- readonly type: 'vec4h';
583
- /** Type-token, not available at runtime */
584
- readonly '~repr': v4h;
585
- }
586
- interface Vec4i {
587
- readonly type: 'vec4i';
588
- /** Type-token, not available at runtime */
589
- readonly '~repr': v4i;
590
- }
591
- interface Vec4u {
592
- readonly type: 'vec4u';
593
- /** Type-token, not available at runtime */
594
- readonly '~repr': v4u;
595
- }
596
- interface Mat2x2f {
597
- readonly type: 'mat2x2f';
598
- /** Type-token, not available at runtime */
599
- readonly '~repr': m2x2f;
600
- }
601
- interface Mat3x3f {
602
- readonly type: 'mat3x3f';
603
- /** Type-token, not available at runtime */
604
- readonly '~repr': m3x3f;
605
- }
606
- interface Mat4x4f {
607
- readonly type: 'mat4x4f';
608
- /** Type-token, not available at runtime */
609
- readonly '~repr': m4x4f;
610
- }
611
- interface WgslStruct<TProps extends Record<string, BaseWgslData> = Record<string, BaseWgslData>> {
612
- readonly type: 'struct';
613
- readonly label?: string | undefined;
614
- readonly propTypes: TProps;
615
- /** Type-token, not available at runtime */
616
- readonly '~repr': InferRecord<TProps>;
617
- }
618
- interface WgslArray<TElement = BaseWgslData> {
619
- readonly type: 'array';
620
- readonly elementCount: number;
621
- readonly elementType: TElement;
622
- /** Type-token, not available at runtime */
623
- readonly '~repr': Infer<TElement>[];
624
- }
625
- /**
626
- * Schema representing the `atomic<...>` WGSL data type.
627
- */
628
- interface Atomic<TInner extends U32 | I32 = U32 | I32> {
629
- readonly type: 'atomic';
630
- readonly inner: TInner;
631
- /** Type-token, not available at runtime */
632
- readonly '~repr': Infer<TInner>;
633
- }
634
- interface Align<T extends number> {
635
- readonly type: '@align';
636
- readonly value: T;
637
- }
638
- interface Size<T extends number> {
639
- readonly type: '@size';
640
- readonly value: T;
641
- }
642
- interface Location<T extends number> {
643
- readonly type: '@location';
644
- readonly value: T;
645
- }
646
- interface Builtin<T extends string> {
647
- readonly type: '@builtin';
648
- readonly value: T;
649
- }
650
- interface Decorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends unknown[] = unknown[]> {
651
- readonly type: 'decorated';
652
- readonly inner: TInner;
653
- readonly attribs: TAttribs;
654
- /** Type-token, not available at runtime */
655
- readonly '~repr': Infer<TInner>;
656
- }
657
- 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"];
658
- type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
659
- 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;
660
- declare function isWgslData(value: unknown): value is AnyWgslData;
661
- /**
662
- * Checks whether passed in value is an array schema,
663
- * as opposed to, e.g., a looseArray schema.
664
- *
665
- * Array schemas can be used to describe uniform and storage buffers,
666
- * whereas looseArray schemas cannot.
667
- *
668
- * @example
669
- * isWgslArray(d.arrayOf(d.u32, 4)) // true
670
- * isWgslArray(d.looseArrayOf(d.u32, 4)) // false
671
- * isWgslArray(d.vec3f) // false
672
- */
673
- declare function isWgslArray<T extends WgslArray>(schema: T | unknown): schema is T;
674
- /**
675
- * Checks whether passed in value is a struct schema,
676
- * as opposed to, e.g., a looseStruct schema.
677
- *
678
- * Struct schemas can be used to describe uniform and storage buffers,
679
- * whereas looseStruct schemas cannot.
680
- *
681
- * @example
682
- * isWgslStruct(d.struct({ a: d.u32 })) // true
683
- * isWgslStruct(d.looseStruct({ a: d.u32 })) // false
684
- * isWgslStruct(d.vec3f) // false
685
- */
686
- declare function isWgslStruct<T extends WgslStruct>(schema: T | unknown): schema is T;
687
- /**
688
- * Checks whether the passed in value is an atomic schema.
689
- *
690
- * @example
691
- * isAtomic(d.atomic(d.u32)) // true
692
- * isAtomic(d.u32) // false
693
- */
694
- declare function isAtomic<T extends Atomic<U32 | I32>>(schema: T | unknown): schema is T;
695
- declare function isAlignAttrib<T extends Align<number>>(value: unknown | T): value is T;
696
- declare function isSizeAttrib<T extends Size<number>>(value: unknown | T): value is T;
697
- declare function isLocationAttrib<T extends Location<number>>(value: unknown | T): value is T;
698
- declare function isBuiltinAttrib<T extends Builtin<string>>(value: unknown | T): value is T;
699
- declare function isDecorated<T extends Decorated>(value: unknown | T): value is T;
700
-
701
- /**
702
- * Type of the `d.vec2f` object/function: vector data type schema/constructor
703
- */
704
- type NativeVec2f = Vec2f & {
705
- '~exotic': Vec2f;
706
- } & ((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f);
707
- /**
708
- *
709
- * Schema representing vec2f - a vector with 2 elements of type f32.
710
- * Also a constructor function for this vector value.
711
- *
712
- * @example
713
- * const vector = d.vec2f(); // (0.0, 0.0)
714
- * const vector = d.vec2f(1); // (1.0, 1.0)
715
- * const vector = d.vec2f(0.5, 0.1); // (0.5, 0.1)
716
- *
717
- * @example
718
- * const buffer = root.createBuffer(d.vec2f, d.vec2f(0, 1)); // buffer holding a d.vec2f value, with an initial value of vec2f(0, 1);
719
- */
720
- declare const vec2f: NativeVec2f;
721
- /**
722
- * Type of the `d.vec2h` object/function: vector data type schema/constructor
723
- */
724
- type NativeVec2h = Vec2h & {
725
- '~exotic': Vec2h;
726
- } & ((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h);
727
- /**
728
- *
729
- * Schema representing vec2h - a vector with 2 elements of type f16.
730
- * Also a constructor function for this vector value.
731
- *
732
- * @example
733
- * const vector = d.vec2h(); // (0.0, 0.0)
734
- * const vector = d.vec2h(1); // (1.0, 1.0)
735
- * const vector = d.vec2h(0.5, 0.1); // (0.5, 0.1)
736
- *
737
- * @example
738
- * const buffer = root.createBuffer(d.vec2h, d.vec2h(0, 1)); // buffer holding a d.vec2h value, with an initial value of vec2h(0, 1);
739
- */
740
- declare const vec2h: NativeVec2h;
741
- /**
742
- * Type of the `d.vec2i` object/function: vector data type schema/constructor
743
- */
744
- type NativeVec2i = Vec2i & {
745
- '~exotic': Vec2i;
746
- } & ((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i);
747
- /**
748
- *
749
- * Schema representing vec2i - a vector with 2 elements of type i32.
750
- * Also a constructor function for this vector value.
751
- *
752
- * @example
753
- * const vector = d.vec2i(); // (0, 0)
754
- * const vector = d.vec2i(1); // (1, 1)
755
- * const vector = d.vec2i(-1, 1); // (-1, 1)
756
- *
757
- * @example
758
- * const buffer = root.createBuffer(d.vec2i, d.vec2i(0, 1)); // buffer holding a d.vec2i value, with an initial value of vec2i(0, 1);
759
- */
760
- declare const vec2i: NativeVec2i;
761
- /**
762
- * Type of the `d.vec2u` object/function: vector data type schema/constructor
763
- */
764
- type NativeVec2u = Vec2u & {
765
- '~exotic': Vec2u;
766
- } & ((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u);
767
- /**
768
- *
769
- * Schema representing vec2u - a vector with 2 elements of type u32.
770
- * Also a constructor function for this vector value.
771
- *
772
- * @example
773
- * const vector = d.vec2u(); // (0, 0)
774
- * const vector = d.vec2u(1); // (1, 1)
775
- * const vector = d.vec2u(1, 2); // (1, 2)
776
- *
777
- * @example
778
- * const buffer = root.createBuffer(d.vec2u, d.vec2u(0, 1)); // buffer holding a d.vec2u value, with an initial value of vec2u(0, 1);
779
- */
780
- declare const vec2u: NativeVec2u;
781
- /**
782
- * Type of the `d.vec3f` object/function: vector data type schema/constructor
783
- */
784
- type NativeVec3f = Vec3f & {
785
- '~exotic': Vec3f;
786
- } & ((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f);
286
+ type NativeVec4f = Vec4f & {
287
+ '~exotic': Vec4f;
288
+ } & ((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f);
787
289
  /**
788
290
  *
789
- * Schema representing vec3f - a vector with 3 elements of type f32.
291
+ * Schema representing vec4f - a vector with 4 elements of type f32.
790
292
  * Also a constructor function for this vector value.
791
293
  *
792
294
  * @example
793
- * const vector = d.vec3f(); // (0.0, 0.0, 0.0)
794
- * const vector = d.vec3f(1); // (1.0, 1.0, 1.0)
795
- * const vector = d.vec3f(1, 2, 3.5); // (1.0, 2.0, 3.5)
295
+ * const vector = d.vec4f(); // (0.0, 0.0, 0.0, 0.0)
296
+ * const vector = d.vec4f(1); // (1.0, 1.0, 1.0, 1.0)
297
+ * const vector = d.vec4f(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
796
298
  *
797
299
  * @example
798
- * 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);
300
+ * 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);
799
301
  */
800
- declare const vec3f: NativeVec3f;
302
+ declare const vec4f: NativeVec4f;
801
303
  /**
802
- * Type of the `d.vec3h` object/function: vector data type schema/constructor
304
+ * Type of the `d.vec4h` object/function: vector data type schema/constructor
803
305
  */
804
- type NativeVec3h = Vec3h & {
805
- '~exotic': Vec3h;
806
- } & ((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h);
306
+ type NativeVec4h = Vec4h & {
307
+ '~exotic': Vec4h;
308
+ } & ((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h);
807
309
  /**
808
310
  *
809
- * Schema representing vec3h - a vector with 3 elements of type f16.
311
+ * Schema representing vec4h - a vector with 4 elements of type f16.
810
312
  * Also a constructor function for this vector value.
811
313
  *
812
314
  * @example
813
- * const vector = d.vec3h(); // (0.0, 0.0, 0.0)
814
- * const vector = d.vec3h(1); // (1.0, 1.0, 1.0)
815
- * const vector = d.vec3h(1, 2, 3.5); // (1.0, 2.0, 3.5)
315
+ * const vector = d.vec4h(); // (0.0, 0.0, 0.0, 0.0)
316
+ * const vector = d.vec4h(1); // (1.0, 1.0, 1.0, 1.0)
317
+ * const vector = d.vec4h(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
816
318
  *
817
319
  * @example
818
- * 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);
320
+ * 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);
819
321
  */
820
- declare const vec3h: NativeVec3h;
322
+ declare const vec4h: NativeVec4h;
821
323
  /**
822
- * Type of the `d.vec3i` object/function: vector data type schema/constructor
324
+ * Type of the `d.vec4i` object/function: vector data type schema/constructor
823
325
  */
824
- type NativeVec3i = Vec3i & {
825
- '~exotic': Vec3i;
826
- } & ((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i);
326
+ type NativeVec4i = Vec4i & {
327
+ '~exotic': Vec4i;
328
+ } & ((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i);
827
329
  /**
828
330
  *
829
- * Schema representing vec3i - a vector with 3 elements of type i32.
331
+ * Schema representing vec4i - a vector with 4 elements of type i32.
830
332
  * Also a constructor function for this vector value.
831
333
  *
832
334
  * @example
833
- * const vector = d.vec3i(); // (0, 0, 0)
834
- * const vector = d.vec3i(1); // (1, 1, 1)
835
- * const vector = d.vec3i(1, 2, -3); // (1, 2, -3)
335
+ * const vector = d.vec4i(); // (0, 0, 0, 0)
336
+ * const vector = d.vec4i(1); // (1, 1, 1, 1)
337
+ * const vector = d.vec4i(1, 2, 3, -4); // (1, 2, 3, -4)
836
338
  *
837
339
  * @example
838
- * 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);
340
+ * 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);
839
341
  */
840
- declare const vec3i: NativeVec3i;
342
+ declare const vec4i: NativeVec4i;
841
343
  /**
842
- * Type of the `d.vec3u` object/function: vector data type schema/constructor
344
+ * Type of the `d.vec4u` object/function: vector data type schema/constructor
843
345
  */
844
- type NativeVec3u = Vec3u & {
845
- '~exotic': Vec3u;
846
- } & ((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u);
346
+ type NativeVec4u = Vec4u & {
347
+ '~exotic': Vec4u;
348
+ } & ((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u);
847
349
  /**
848
350
  *
849
- * Schema representing vec3u - a vector with 3 elements of type u32.
351
+ * Schema representing vec4u - a vector with 4 elements of type u32.
850
352
  * Also a constructor function for this vector value.
851
353
  *
852
354
  * @example
853
- * const vector = d.vec3u(); // (0, 0, 0)
854
- * const vector = d.vec3u(1); // (1, 1, 1)
855
- * const vector = d.vec3u(1, 2, 3); // (1, 2, 3)
355
+ * const vector = d.vec4u(); // (0, 0, 0, 0)
356
+ * const vector = d.vec4u(1); // (1, 1, 1, 1)
357
+ * const vector = d.vec4u(1, 2, 3, 4); // (1, 2, 3, 4)
856
358
  *
857
359
  * @example
858
- * 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);
360
+ * 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);
859
361
  */
860
- declare const vec3u: NativeVec3u;
861
- /**
862
- * Type of the `d.vec4f` object/function: vector data type schema/constructor
863
- */
864
- type NativeVec4f = Vec4f & {
865
- '~exotic': Vec4f;
866
- } & ((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f);
362
+ declare const vec4u: NativeVec4u;
363
+
364
+ 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"];
365
+ type VertexFormat = (typeof vertexFormats)[number];
366
+
367
+ type FormatToWGSLType<T extends VertexFormat> = (typeof formatToWGSLType)[T];
368
+ interface TgpuVertexFormatData<T extends VertexFormat> {
369
+ readonly '~repr': Infer<FormatToWGSLType<T>>;
370
+ readonly type: T;
371
+ }
372
+ declare const formatToWGSLType: {
373
+ readonly uint8: NativeU32;
374
+ readonly uint8x2: NativeVec2u;
375
+ readonly uint8x4: NativeVec4u;
376
+ readonly sint8: NativeI32;
377
+ readonly sint8x2: NativeVec2i;
378
+ readonly sint8x4: NativeVec4i;
379
+ readonly unorm8: NativeF32;
380
+ readonly unorm8x2: NativeVec2f;
381
+ readonly unorm8x4: NativeVec4f;
382
+ readonly snorm8: NativeF32;
383
+ readonly snorm8x2: NativeVec2f;
384
+ readonly snorm8x4: NativeVec4f;
385
+ readonly uint16: NativeU32;
386
+ readonly uint16x2: NativeVec2u;
387
+ readonly uint16x4: NativeVec4u;
388
+ readonly sint16: NativeI32;
389
+ readonly sint16x2: NativeVec2i;
390
+ readonly sint16x4: NativeVec4i;
391
+ readonly unorm16: NativeF32;
392
+ readonly unorm16x2: NativeVec2f;
393
+ readonly unorm16x4: NativeVec4f;
394
+ readonly snorm16: NativeF32;
395
+ readonly snorm16x2: NativeVec2f;
396
+ readonly snorm16x4: NativeVec4f;
397
+ readonly float16: NativeF32;
398
+ readonly float16x2: NativeVec2f;
399
+ readonly float16x4: NativeVec4f;
400
+ readonly float32: NativeF32;
401
+ readonly float32x2: NativeVec2f;
402
+ readonly float32x3: NativeVec3f;
403
+ readonly float32x4: NativeVec4f;
404
+ readonly uint32: NativeU32;
405
+ readonly uint32x2: NativeVec2u;
406
+ readonly uint32x3: NativeVec3u;
407
+ readonly uint32x4: NativeVec4u;
408
+ readonly sint32: NativeI32;
409
+ readonly sint32x2: NativeVec2i;
410
+ readonly sint32x3: NativeVec3i;
411
+ readonly sint32x4: NativeVec4i;
412
+ readonly 'unorm10-10-10-2': NativeVec4f;
413
+ readonly 'unorm8x4-bgra': NativeVec4f;
414
+ };
415
+ declare const packedFormats: string[];
416
+ type uint8 = TgpuVertexFormatData<'uint8'>;
417
+ declare const uint8: uint8;
418
+ type uint8x2 = TgpuVertexFormatData<'uint8x2'>;
419
+ declare const uint8x2: uint8x2;
420
+ type uint8x4 = TgpuVertexFormatData<'uint8x4'>;
421
+ declare const uint8x4: uint8x4;
422
+ type sint8 = TgpuVertexFormatData<'sint8'>;
423
+ declare const sint8: sint8;
424
+ type sint8x2 = TgpuVertexFormatData<'sint8x2'>;
425
+ declare const sint8x2: sint8x2;
426
+ type sint8x4 = TgpuVertexFormatData<'sint8x4'>;
427
+ declare const sint8x4: sint8x4;
428
+ type unorm8 = TgpuVertexFormatData<'unorm8'>;
429
+ declare const unorm8: unorm8;
430
+ type unorm8x2 = TgpuVertexFormatData<'unorm8x2'>;
431
+ declare const unorm8x2: unorm8x2;
432
+ type unorm8x4 = TgpuVertexFormatData<'unorm8x4'>;
433
+ declare const unorm8x4: unorm8x4;
434
+ type snorm8 = TgpuVertexFormatData<'snorm8'>;
435
+ declare const snorm8: snorm8;
436
+ type snorm8x2 = TgpuVertexFormatData<'snorm8x2'>;
437
+ declare const snorm8x2: snorm8x2;
438
+ type snorm8x4 = TgpuVertexFormatData<'snorm8x4'>;
439
+ declare const snorm8x4: snorm8x4;
440
+ type uint16 = TgpuVertexFormatData<'uint16'>;
441
+ declare const uint16: uint16;
442
+ type uint16x2 = TgpuVertexFormatData<'uint16x2'>;
443
+ declare const uint16x2: uint16x2;
444
+ type uint16x4 = TgpuVertexFormatData<'uint16x4'>;
445
+ declare const uint16x4: uint16x4;
446
+ type sint16 = TgpuVertexFormatData<'sint16'>;
447
+ declare const sint16: sint16;
448
+ type sint16x2 = TgpuVertexFormatData<'sint16x2'>;
449
+ declare const sint16x2: sint16x2;
450
+ type sint16x4 = TgpuVertexFormatData<'sint16x4'>;
451
+ declare const sint16x4: sint16x4;
452
+ type unorm16 = TgpuVertexFormatData<'unorm16'>;
453
+ declare const unorm16: unorm16;
454
+ type unorm16x2 = TgpuVertexFormatData<'unorm16x2'>;
455
+ declare const unorm16x2: unorm16x2;
456
+ type unorm16x4 = TgpuVertexFormatData<'unorm16x4'>;
457
+ declare const unorm16x4: unorm16x4;
458
+ type snorm16 = TgpuVertexFormatData<'snorm16'>;
459
+ declare const snorm16: snorm16;
460
+ type snorm16x2 = TgpuVertexFormatData<'snorm16x2'>;
461
+ declare const snorm16x2: snorm16x2;
462
+ type snorm16x4 = TgpuVertexFormatData<'snorm16x4'>;
463
+ declare const snorm16x4: snorm16x4;
464
+ type float16 = TgpuVertexFormatData<'float16'>;
465
+ declare const float16: float16;
466
+ type float16x2 = TgpuVertexFormatData<'float16x2'>;
467
+ declare const float16x2: float16x2;
468
+ type float16x4 = TgpuVertexFormatData<'float16x4'>;
469
+ declare const float16x4: float16x4;
470
+ type float32 = TgpuVertexFormatData<'float32'>;
471
+ declare const float32: float32;
472
+ type float32x2 = TgpuVertexFormatData<'float32x2'>;
473
+ declare const float32x2: float32x2;
474
+ type float32x3 = TgpuVertexFormatData<'float32x3'>;
475
+ declare const float32x3: float32x3;
476
+ type float32x4 = TgpuVertexFormatData<'float32x4'>;
477
+ declare const float32x4: float32x4;
478
+ type uint32 = TgpuVertexFormatData<'uint32'>;
479
+ declare const uint32: uint32;
480
+ type uint32x2 = TgpuVertexFormatData<'uint32x2'>;
481
+ declare const uint32x2: uint32x2;
482
+ type uint32x3 = TgpuVertexFormatData<'uint32x3'>;
483
+ declare const uint32x3: uint32x3;
484
+ type uint32x4 = TgpuVertexFormatData<'uint32x4'>;
485
+ declare const uint32x4: uint32x4;
486
+ type sint32 = TgpuVertexFormatData<'sint32'>;
487
+ declare const sint32: sint32;
488
+ type sint32x2 = TgpuVertexFormatData<'sint32x2'>;
489
+ declare const sint32x2: sint32x2;
490
+ type sint32x3 = TgpuVertexFormatData<'sint32x3'>;
491
+ declare const sint32x3: sint32x3;
492
+ type sint32x4 = TgpuVertexFormatData<'sint32x4'>;
493
+ declare const sint32x4: sint32x4;
494
+ type unorm10_10_10_2 = TgpuVertexFormatData<'unorm10-10-10-2'>;
495
+ declare const unorm10_10_10_2: unorm10_10_10_2;
496
+ type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;
497
+ declare const unorm8x4_bgra: unorm8x4_bgra;
498
+ 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;
499
+
867
500
  /**
501
+ * Array schema constructed via `d.disarrayOf` function.
868
502
  *
869
- * Schema representing vec4f - a vector with 4 elements of type f32.
870
- * Also a constructor function for this vector value.
871
- *
872
- * @example
873
- * const vector = d.vec4f(); // (0.0, 0.0, 0.0, 0.0)
874
- * const vector = d.vec4f(1); // (1.0, 1.0, 1.0, 1.0)
875
- * const vector = d.vec4f(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
876
- *
877
- * @example
878
- * 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);
503
+ * Useful for defining vertex buffers.
504
+ * Elements in the schema are not aligned in respect to their `byteAlignment`,
505
+ * unless they are explicitly decorated with the custom align attribute
506
+ * via `d.align` function.
879
507
  */
880
- declare const vec4f: NativeVec4f;
508
+ interface Disarray<TElement extends BaseWgslData = BaseWgslData> {
509
+ readonly type: 'disarray';
510
+ readonly elementCount: number;
511
+ readonly elementType: TElement;
512
+ readonly '~repr': Infer<TElement>[];
513
+ }
881
514
  /**
882
- * Type of the `d.vec4h` object/function: vector data type schema/constructor
515
+ * Struct schema constructed via `d.unstruct` function.
516
+ *
517
+ * Useful for defining vertex buffers, as the standard layout restrictions do not apply.
518
+ * Members are not aligned in respect to their `byteAlignment`,
519
+ * unless they are explicitly decorated with the custom align attribute
520
+ * via `d.align` function.
883
521
  */
884
- type NativeVec4h = Vec4h & {
885
- '~exotic': Vec4h;
886
- } & ((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h);
522
+ interface Unstruct<TProps extends Record<string, BaseWgslData> = Record<string, BaseWgslData>> {
523
+ readonly type: 'unstruct';
524
+ readonly propTypes: TProps;
525
+ readonly '~repr': InferRecord<TProps>;
526
+ }
527
+ interface LooseDecorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends unknown[] = unknown[]> {
528
+ readonly type: 'loose-decorated';
529
+ readonly inner: TInner;
530
+ readonly attribs: TAttribs;
531
+ readonly '~repr': Infer<TInner>;
532
+ }
533
+ 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"];
534
+ type LooseTypeLiteral = (typeof looseTypeLiterals)[number];
535
+ type AnyLooseData = Disarray | Unstruct | LooseDecorated | PackedData;
536
+ declare function isLooseData(data: unknown): data is AnyLooseData;
887
537
  /**
538
+ * Checks whether the passed in value is a disarray schema,
539
+ * as opposed to, e.g., a regular array schema.
888
540
  *
889
- * Schema representing vec4h - a vector with 4 elements of type f16.
890
- * Also a constructor function for this vector value.
891
- *
892
- * @example
893
- * const vector = d.vec4h(); // (0.0, 0.0, 0.0, 0.0)
894
- * const vector = d.vec4h(1); // (1.0, 1.0, 1.0, 1.0)
895
- * const vector = d.vec4h(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
541
+ * Array schemas can be used to describe uniform and storage buffers,
542
+ * whereas disarray schemas cannot. Disarrays are useful for
543
+ * defining vertex buffers instead.
896
544
  *
897
545
  * @example
898
- * 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);
899
- */
900
- declare const vec4h: NativeVec4h;
901
- /**
902
- * Type of the `d.vec4i` object/function: vector data type schema/constructor
546
+ * isDisarray(d.arrayOf(d.u32, 4)) // false
547
+ * isDisarray(d.disarrayOf(d.u32, 4)) // true
548
+ * isDisarray(d.vec3f) // false
903
549
  */
904
- type NativeVec4i = Vec4i & {
905
- '~exotic': Vec4i;
906
- } & ((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i);
550
+ declare function isDisarray<T extends Disarray>(schema: T | unknown): schema is T;
907
551
  /**
552
+ * Checks whether passed in value is a unstruct schema,
553
+ * as opposed to, e.g., a struct schema.
908
554
  *
909
- * Schema representing vec4i - a vector with 4 elements of type i32.
910
- * Also a constructor function for this vector value.
911
- *
912
- * @example
913
- * const vector = d.vec4i(); // (0, 0, 0, 0)
914
- * const vector = d.vec4i(1); // (1, 1, 1, 1)
915
- * const vector = d.vec4i(1, 2, 3, -4); // (1, 2, 3, -4)
555
+ * Struct schemas can be used to describe uniform and storage buffers,
556
+ * whereas unstruct schemas cannot. Unstructs are useful for
557
+ * defining vertex buffers instead.
916
558
  *
917
559
  * @example
918
- * 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);
560
+ * isUnstruct(d.struct({ a: d.u32 })) // false
561
+ * isUnstruct(d.unstruct({ a: d.u32 })) // true
562
+ * isUnstruct(d.vec3f) // false
919
563
  */
920
- declare const vec4i: NativeVec4i;
564
+ declare function isUnstruct<T extends Unstruct>(schema: T | unknown): schema is T;
565
+ declare function isLooseDecorated<T extends LooseDecorated>(value: T | unknown): value is T;
566
+ declare function isData(value: unknown): value is AnyData;
567
+ type AnyData = AnyWgslData | AnyLooseData;
568
+
569
+ interface Storage {
570
+ usableAsStorage: true;
571
+ }
572
+ declare const Storage: Storage;
573
+ declare function isUsableAsStorage<T>(value: T): value is T & Storage;
574
+
575
+ interface NameRegistry {
576
+ /**
577
+ * Creates a valid WGSL identifier, each guaranteed to be unique
578
+ * in the lifetime of a single resolution process.
579
+ * @param primer Used in the generation process, makes the identifier more recognizable.
580
+ */
581
+ makeUnique(primer?: string): string;
582
+ }
583
+
584
+ interface TgpuComputePipeline extends TgpuNamable {
585
+ readonly resourceType: 'compute-pipeline';
586
+ readonly label: string | undefined;
587
+ with(bindGroupLayout: TgpuBindGroupLayout, bindGroup: TgpuBindGroup): TgpuComputePipeline;
588
+ dispatchWorkgroups(x: number, y?: number | undefined, z?: number | undefined): void;
589
+ }
590
+
591
+ type TextureProps = {
592
+ size: readonly number[];
593
+ format: GPUTextureFormat;
594
+ viewFormats?: GPUTextureFormat[] | undefined;
595
+ dimension?: GPUTextureDimension | undefined;
596
+ mipLevelCount?: number | undefined;
597
+ sampleCount?: number | undefined;
598
+ };
599
+
600
+ declare const texelFormatToChannelType: {
601
+ r8unorm: F32;
602
+ r8snorm: F32;
603
+ r8uint: U32;
604
+ r8sint: I32;
605
+ r16uint: U32;
606
+ r16sint: I32;
607
+ r16float: F32;
608
+ rg8unorm: F32;
609
+ rg8snorm: F32;
610
+ rg8uint: U32;
611
+ rg8sint: I32;
612
+ r32uint: U32;
613
+ r32sint: I32;
614
+ r32float: F32;
615
+ rg16uint: U32;
616
+ rg16sint: I32;
617
+ rg16float: F32;
618
+ rgba8unorm: F32;
619
+ 'rgba8unorm-srgb': F32;
620
+ rgba8snorm: F32;
621
+ rgba8uint: U32;
622
+ rgba8sint: I32;
623
+ bgra8unorm: F32;
624
+ 'bgra8unorm-srgb': F32;
625
+ rgb9e5ufloat: F32;
626
+ rgb10a2uint: U32;
627
+ rgb10a2unorm: F32;
628
+ rg11b10ufloat: F32;
629
+ rg32uint: U32;
630
+ rg32sint: I32;
631
+ rg32float: F32;
632
+ rgba16uint: U32;
633
+ rgba16sint: I32;
634
+ rgba16float: F32;
635
+ rgba32uint: U32;
636
+ rgba32sint: I32;
637
+ rgba32float: F32;
638
+ stencil8: F32;
639
+ depth16unorm: F32;
640
+ depth24plus: F32;
641
+ 'depth24plus-stencil8': F32;
642
+ depth32float: F32;
643
+ 'depth32float-stencil8': F32;
644
+ 'bc1-rgba-unorm': F32;
645
+ 'bc1-rgba-unorm-srgb': F32;
646
+ 'bc2-rgba-unorm': F32;
647
+ 'bc2-rgba-unorm-srgb': F32;
648
+ 'bc3-rgba-unorm': F32;
649
+ 'bc3-rgba-unorm-srgb': F32;
650
+ 'bc4-r-unorm': F32;
651
+ 'bc4-r-snorm': F32;
652
+ 'bc5-rg-unorm': F32;
653
+ 'bc5-rg-snorm': F32;
654
+ 'bc6h-rgb-ufloat': F32;
655
+ 'bc6h-rgb-float': F32;
656
+ 'bc7-rgba-unorm': F32;
657
+ 'bc7-rgba-unorm-srgb': F32;
658
+ 'etc2-rgb8unorm': F32;
659
+ 'etc2-rgb8unorm-srgb': F32;
660
+ 'etc2-rgb8a1unorm': F32;
661
+ 'etc2-rgb8a1unorm-srgb': F32;
662
+ 'etc2-rgba8unorm': F32;
663
+ 'etc2-rgba8unorm-srgb': F32;
664
+ 'eac-r11unorm': F32;
665
+ 'eac-r11snorm': F32;
666
+ 'eac-rg11unorm': F32;
667
+ 'eac-rg11snorm': F32;
668
+ 'astc-4x4-unorm': F32;
669
+ 'astc-4x4-unorm-srgb': F32;
670
+ 'astc-5x4-unorm': F32;
671
+ 'astc-5x4-unorm-srgb': F32;
672
+ 'astc-5x5-unorm': F32;
673
+ 'astc-5x5-unorm-srgb': F32;
674
+ 'astc-6x5-unorm': F32;
675
+ 'astc-6x5-unorm-srgb': F32;
676
+ 'astc-6x6-unorm': F32;
677
+ 'astc-6x6-unorm-srgb': F32;
678
+ 'astc-8x5-unorm': F32;
679
+ 'astc-8x5-unorm-srgb': F32;
680
+ 'astc-8x6-unorm': F32;
681
+ 'astc-8x6-unorm-srgb': F32;
682
+ 'astc-8x8-unorm': F32;
683
+ 'astc-8x8-unorm-srgb': F32;
684
+ 'astc-10x5-unorm': F32;
685
+ 'astc-10x5-unorm-srgb': F32;
686
+ 'astc-10x6-unorm': F32;
687
+ 'astc-10x6-unorm-srgb': F32;
688
+ 'astc-10x8-unorm': F32;
689
+ 'astc-10x8-unorm-srgb': F32;
690
+ 'astc-10x10-unorm': F32;
691
+ 'astc-10x10-unorm-srgb': F32;
692
+ 'astc-12x10-unorm': F32;
693
+ 'astc-12x10-unorm-srgb': F32;
694
+ 'astc-12x12-unorm': F32;
695
+ 'astc-12x12-unorm-srgb': F32;
696
+ };
697
+ type TexelFormatToChannelType = typeof texelFormatToChannelType;
698
+ type TexelFormatToStringChannels = {
699
+ [Key in keyof TexelFormatToChannelType]: TexelFormatToChannelType[Key]['type'];
700
+ };
701
+ type KeysWithValue<T extends Record<string, unknown>, TValue> = keyof {
702
+ [Key in keyof T as T[Key] extends TValue ? Key : never]: Key;
703
+ };
704
+ type ChannelTypeToLegalFormats = {
705
+ [Key in TexelFormatToChannelType[keyof TexelFormatToChannelType]['type']]: KeysWithValue<TexelFormatToStringChannels, Key>;
706
+ };
707
+ type SampleTypeToStringChannelType = {
708
+ float: 'f32';
709
+ 'unfilterable-float': 'f32';
710
+ depth: 'f32';
711
+ sint: 'i32';
712
+ uint: 'u32';
713
+ };
714
+ type ViewDimensionToDimension = {
715
+ '1d': '1d';
716
+ '2d': '2d';
717
+ '2d-array': '2d';
718
+ '3d': '3d';
719
+ cube: '2d';
720
+ 'cube-array': '2d';
721
+ };
921
722
  /**
922
- * Type of the `d.vec4u` object/function: vector data type schema/constructor
923
- */
924
- type NativeVec4u = Vec4u & {
925
- '~exotic': Vec4u;
926
- } & ((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u);
723
+ * https://www.w3.org/TR/WGSL/#storage-texel-formats
724
+ */
725
+ type StorageTextureTexelFormat = 'rgba8unorm' | 'rgba8snorm' | 'rgba8uint' | 'rgba8sint' | 'rgba16uint' | 'rgba16sint' | 'rgba16float' | 'r32uint' | 'r32sint' | 'r32float' | 'rg32uint' | 'rg32sint' | 'rg32float' | 'rgba32uint' | 'rgba32sint' | 'rgba32float' | 'bgra8unorm';
726
+ declare const texelFormatToDataType: {
727
+ readonly rgba8unorm: Vec4f;
728
+ readonly rgba8snorm: Vec4f;
729
+ readonly rgba8uint: Vec4u;
730
+ readonly rgba8sint: Vec4i;
731
+ readonly rgba16uint: Vec4u;
732
+ readonly rgba16sint: Vec4i;
733
+ readonly rgba16float: Vec4f;
734
+ readonly r32uint: Vec4u;
735
+ readonly r32sint: Vec4i;
736
+ readonly r32float: Vec4f;
737
+ readonly rg32uint: Vec4u;
738
+ readonly rg32sint: Vec4i;
739
+ readonly rg32float: Vec4f;
740
+ readonly rgba32uint: Vec4u;
741
+ readonly rgba32sint: Vec4i;
742
+ readonly rgba32float: Vec4f;
743
+ readonly bgra8unorm: Vec4f;
744
+ };
745
+ declare const channelFormatToSchema: {
746
+ float: F32;
747
+ 'unfilterable-float': F32;
748
+ uint: U32;
749
+ sint: I32;
750
+ depth: F32;
751
+ };
752
+ type ChannelFormatToSchema = typeof channelFormatToSchema;
753
+ type TexelFormatToDataType = typeof texelFormatToDataType;
754
+ type TexelFormatToDataTypeOrNever<T> = T extends keyof TexelFormatToDataType ? TexelFormatToDataType[T] : never;
927
755
  /**
928
- *
929
- * Schema representing vec4u - a vector with 4 elements of type u32.
930
- * Also a constructor function for this vector value.
931
- *
932
- * @example
933
- * const vector = d.vec4u(); // (0, 0, 0, 0)
934
- * const vector = d.vec4u(1); // (1, 1, 1, 1)
935
- * const vector = d.vec4u(1, 2, 3, 4); // (1, 2, 3, 4)
936
- *
937
- * @example
938
- * 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);
756
+ * Represents what formats a storage view can choose from based on its owner texture's props.
939
757
  */
940
- declare const vec4u: NativeVec4u;
941
-
758
+ type StorageFormatOptions<TProps extends TextureProps> = Extract<TProps['format'] | Default<TProps['viewFormats'], []>[number], StorageTextureTexelFormat>;
942
759
  /**
943
- * A schema that represents a boolean value. (equivalent to `bool` in WGSL)
760
+ * Represents what formats a sampled view can choose from based on its owner texture's props.
944
761
  */
945
- declare const bool: Bool;
762
+ type SampledFormatOptions<TProps extends TextureProps> = TProps['format'] | Default<TProps['viewFormats'], []>[number];
763
+
764
+ interface Sampled {
765
+ usableAsSampled: true;
766
+ }
767
+ interface Render {
768
+ usableAsRender: true;
769
+ }
770
+ type LiteralToExtensionMap = {
771
+ storage: Storage;
772
+ sampled: Sampled;
773
+ render: Render;
774
+ };
775
+ type AllowedUsages<TProps extends TextureProps> = 'sampled' | 'render' | (TProps['format'] extends StorageTextureTexelFormat ? 'storage' : never);
776
+
777
+ type ResolveStorageDimension<TDimension extends GPUTextureViewDimension, TProps extends TextureProps> = StorageTextureDimension extends TDimension ? Default<TProps['dimension'], '2d'> : TDimension extends StorageTextureDimension ? TDimension : '2d';
778
+ type ViewUsages<TProps extends TextureProps, TTexture extends TgpuTexture<TProps>> = boolean extends TTexture['usableAsSampled'] ? boolean extends TTexture['usableAsStorage'] ? never : 'readonly' | 'writeonly' | 'mutable' : boolean extends TTexture['usableAsStorage'] ? 'sampled' : 'readonly' | 'writeonly' | 'mutable' | 'sampled';
779
+ type ChannelData = U32 | I32 | F32;
780
+ type TexelData = Vec4u | Vec4i | Vec4f;
781
+ /**
782
+ * @param TProps all properties that distinguish this texture apart from other textures on the type level.
783
+ */
784
+ interface TgpuTexture<TProps extends TextureProps = TextureProps> extends TgpuNamable {
785
+ readonly resourceType: 'texture';
786
+ readonly props: TProps;
787
+ readonly label: string | undefined;
788
+ readonly usableAsStorage: boolean;
789
+ readonly usableAsSampled: boolean;
790
+ readonly usableAsRender: boolean;
791
+ $usage<T extends AllowedUsages<TProps>[]>(...usages: T): this & UnionToIntersection<LiteralToExtensionMap[T[number]]>;
792
+ createView<TUsage extends ViewUsages<TProps, this>, TDimension extends 'sampled' extends TUsage ? GPUTextureViewDimension : StorageTextureDimension, TFormat extends 'sampled' extends TUsage ? SampledFormatOptions<TProps> : StorageFormatOptions<TProps>>(access: TUsage, params?: TextureViewParams<TDimension, TFormat>): {
793
+ mutable: TgpuMutableTexture<ResolveStorageDimension<TDimension, TProps>, TexelFormatToDataTypeOrNever<StorageFormatOptions<TProps> extends TFormat ? TProps['format'] : TFormat>>;
794
+ readonly: TgpuReadonlyTexture<ResolveStorageDimension<TDimension, TProps>, TexelFormatToDataTypeOrNever<StorageFormatOptions<TProps> extends TFormat ? TProps['format'] : TFormat>>;
795
+ writeonly: TgpuWriteonlyTexture<ResolveStorageDimension<TDimension, TProps>, TexelFormatToDataTypeOrNever<StorageFormatOptions<TProps> extends TFormat ? TProps['format'] : TFormat>>;
796
+ sampled: TgpuSampledTexture<GPUTextureViewDimension extends TDimension ? Default<TProps['dimension'], '2d'> : TDimension, TexelFormatToChannelType[SampledFormatOptions<TProps> extends TFormat ? TProps['format'] : TFormat]>;
797
+ }[TUsage];
798
+ destroy(): void;
799
+ }
800
+ type StorageTextureAccess = 'readonly' | 'writeonly' | 'mutable';
801
+ /**
802
+ * Based on @see GPUTextureViewDimension
803
+ * https://www.w3.org/TR/WGSL/#texture-depth
804
+ */
805
+ type StorageTextureDimension = '1d' | '2d' | '2d-array' | '3d';
806
+ type TextureViewParams<TDimension extends GPUTextureViewDimension | undefined, TFormat extends GPUTextureFormat | undefined> = {
807
+ format?: TFormat;
808
+ dimension?: TDimension;
809
+ aspect?: GPUTextureAspect;
810
+ baseMipLevel?: number;
811
+ mipLevelCount?: number;
812
+ baseArrayLayout?: number;
813
+ arrayLayerCount?: number;
814
+ };
815
+ interface TgpuStorageTexture<TDimension extends StorageTextureDimension = StorageTextureDimension, TData extends TexelData = TexelData> {
816
+ readonly resourceType: 'texture-storage-view';
817
+ readonly dimension: TDimension;
818
+ readonly texelDataType: TData;
819
+ readonly access: StorageTextureAccess;
820
+ }
821
+ /**
822
+ * A texture accessed as "readonly" storage on the GPU.
823
+ */
824
+ interface TgpuReadonlyTexture<TDimension extends StorageTextureDimension = StorageTextureDimension, TData extends TexelData = TexelData> extends TgpuStorageTexture<TDimension, TData>, TgpuResolvable {
825
+ readonly access: 'readonly';
826
+ }
827
+ /**
828
+ * A texture accessed as "writeonly" storage on the GPU.
829
+ */
830
+ interface TgpuWriteonlyTexture<TDimension extends StorageTextureDimension = StorageTextureDimension, TData extends TexelData = TexelData> extends TgpuStorageTexture<TDimension, TData>, TgpuResolvable {
831
+ readonly access: 'writeonly';
832
+ }
833
+ /**
834
+ * A texture accessed as "mutable" (or read_write) storage on the GPU.
835
+ */
836
+ interface TgpuMutableTexture<TDimension extends StorageTextureDimension = StorageTextureDimension, TData extends TexelData = TexelData> extends TgpuStorageTexture<TDimension, TData>, TgpuResolvable {
837
+ readonly access: 'mutable';
838
+ }
839
+ /**
840
+ * A texture accessed as sampled on the GPU.
841
+ */
842
+ interface TgpuSampledTexture<TDimension extends GPUTextureViewDimension = GPUTextureViewDimension, TData extends ChannelData = ChannelData> extends TgpuResolvable {
843
+ readonly resourceType: 'texture-sampled-view';
844
+ readonly dimension: TDimension;
845
+ readonly channelDataType: TData;
846
+ }
847
+ declare function isStorageTextureView<T extends TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture>(value: unknown | T): value is T;
848
+ declare function isSampledTextureView<T extends TgpuSampledTexture>(value: unknown | T): value is T;
849
+ type TgpuAnyTextureView = TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture | TgpuSampledTexture;
850
+
851
+ interface Unwrapper {
852
+ readonly device: GPUDevice;
853
+ unwrap(resource: TgpuComputePipeline): GPUComputePipeline;
854
+ unwrap(resource: TgpuBindGroupLayout): GPUBindGroupLayout;
855
+ unwrap(resource: TgpuBindGroup): GPUBindGroup;
856
+ unwrap(resource: TgpuBuffer<AnyData>): GPUBuffer;
857
+ unwrap(resource: TgpuTexture): GPUTexture;
858
+ unwrap(resource: TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture | TgpuSampledTexture): GPUTextureView;
859
+ }
860
+
861
+ interface Uniform {
862
+ usableAsUniform: true;
863
+ }
864
+ declare const Uniform: Uniform;
865
+ interface Vertex {
866
+ usableAsVertex: true;
867
+ }
868
+ declare const Vertex: Vertex;
869
+ type LiteralToUsageType<T extends 'uniform' | 'storage' | 'vertex'> = T extends 'uniform' ? Uniform : T extends 'storage' ? Storage : T extends 'vertex' ? Vertex : never;
870
+ interface TgpuBuffer<TData extends AnyData> extends TgpuNamable {
871
+ readonly resourceType: 'buffer';
872
+ readonly dataType: TData;
873
+ readonly initial?: Infer<TData> | undefined;
874
+ readonly label: string | undefined;
875
+ readonly buffer: GPUBuffer;
876
+ readonly destroyed: boolean;
877
+ $usage<T extends RestrictVertexUsages<TData>>(...usages: T): this & UnionToIntersection<LiteralToUsageType<T[number]>>;
878
+ $addFlags(flags: GPUBufferUsageFlags): this;
879
+ write(data: Infer<TData>): void;
880
+ copyFrom(srcBuffer: TgpuBuffer<TData>): void;
881
+ read(): Promise<Infer<TData>>;
882
+ destroy(): void;
883
+ }
884
+ declare function isBuffer<T extends TgpuBuffer<AnyData>>(value: T | unknown): value is T;
885
+ declare function isUsableAsUniform<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T & Uniform;
886
+ declare function isUsableAsVertex<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T & Vertex;
887
+ type RestrictVertexUsages<TData extends AnyData> = TData extends {
888
+ readonly type: WgslTypeLiteral;
889
+ } ? ('uniform' | 'storage' | 'vertex')[] : 'vertex'[];
890
+
891
+ interface TgpuSampler extends TgpuResolvable {
892
+ readonly resourceType: 'sampler';
893
+ }
894
+ interface TgpuComparisonSampler {
895
+ readonly resourceType: 'sampler-comparison';
896
+ }
897
+ declare function isSampler(resource: unknown): resource is TgpuSampler;
898
+ declare function isComparisonSampler(resource: unknown): resource is TgpuComparisonSampler;
899
+
900
+ type TgpuLayoutEntryBase = {
901
+ /**
902
+ * Limits this resource's visibility to specific shader stages.
903
+ *
904
+ * By default, each resource is visible to all shader stage types, but
905
+ * depending on the underlying implementation, this may have performance implications.
906
+ *
907
+ * @default ['compute'] for mutable resources
908
+ * @default ['compute','vertex','fragment'] for everything else
909
+ */
910
+ visibility?: TgpuShaderStage[];
911
+ };
912
+ type TgpuLayoutUniform = TgpuLayoutEntryBase & {
913
+ uniform: AnyWgslData;
914
+ };
915
+ type TgpuLayoutStorage = TgpuLayoutEntryBase & {
916
+ storage: AnyWgslData | ((arrayLength: number) => AnyWgslData);
917
+ /** @default 'readonly' */
918
+ access?: 'mutable' | 'readonly';
919
+ };
920
+ type TgpuLayoutSampler = TgpuLayoutEntryBase & {
921
+ sampler: GPUSamplerBindingType;
922
+ };
923
+ type TgpuLayoutTexture<TSampleType extends GPUTextureSampleType = GPUTextureSampleType> = TgpuLayoutEntryBase & {
924
+ /**
925
+ * - 'float' - f32
926
+ * - 'unfilterable-float' - f32, cannot be used with filtering samplers
927
+ * - 'depth' - f32
928
+ * - 'sint' - i32
929
+ * - 'uint' - u32
930
+ */
931
+ texture: TSampleType;
932
+ /**
933
+ * @default '2d'
934
+ */
935
+ viewDimension?: GPUTextureViewDimension;
936
+ /**
937
+ * @default false
938
+ */
939
+ multisampled?: boolean;
940
+ };
941
+ type TgpuLayoutStorageTexture<TFormat extends StorageTextureTexelFormat = StorageTextureTexelFormat> = TgpuLayoutEntryBase & {
942
+ storageTexture: TFormat;
943
+ /** @default 'writeonly' */
944
+ access?: 'readonly' | 'writeonly' | 'mutable';
945
+ /** @default '2d' */
946
+ viewDimension?: StorageTextureDimension;
947
+ };
948
+ type TgpuLayoutExternalTexture = TgpuLayoutEntryBase & {
949
+ externalTexture: Record<string, never>;
950
+ };
951
+ type TgpuLayoutEntry = TgpuLayoutUniform | TgpuLayoutStorage | TgpuLayoutSampler | TgpuLayoutTexture | TgpuLayoutStorageTexture | TgpuLayoutExternalTexture;
952
+ type UnwrapRuntimeConstructorInner<T extends BaseWgslData | ((_: number) => BaseWgslData)> = T extends (_: number) => BaseWgslData ? ReturnType<T> : T;
953
+ type UnwrapRuntimeConstructor<T extends AnyData | ((_: number) => AnyData)> = T extends unknown ? UnwrapRuntimeConstructorInner<T> : never;
954
+ interface TgpuBindGroupLayout<Entries extends Record<string, TgpuLayoutEntry | null> = Record<string, TgpuLayoutEntry | null>> extends TgpuNamable {
955
+ readonly resourceType: 'bind-group-layout';
956
+ readonly label: string | undefined;
957
+ readonly entries: Entries;
958
+ readonly bound: {
959
+ [K in keyof Entries]: BindLayoutEntry<Entries[K]>;
960
+ };
961
+ /**
962
+ * An explicit numeric index assigned to this bind group layout. If undefined, a unique
963
+ * index is assigned automatically during resolution. This can be changed with the
964
+ * `.$idx()` method.
965
+ */
966
+ readonly index: number | undefined;
967
+ /**
968
+ * Associates this bind group layout with an explicit numeric index. When a call to this
969
+ * method is omitted, a unique numeric index is assigned to it automatically.
970
+ *
971
+ * Used when generating WGSL code: `@group(${index}) @binding(...) ...;`
972
+ */
973
+ $idx(index?: number): this;
974
+ /**
975
+ * @deprecated Use the `root.createBindGroup` API instead, accessible through `await tgpu.init()`
976
+ */
977
+ populate(entries: {
978
+ [K in keyof OmitProps<Entries, null>]: LayoutEntryToInput<Entries[K]>;
979
+ }): TgpuBindGroup<Entries>;
980
+ /**
981
+ * Creates a raw WebGPU resource based on the typed descriptor.
982
+ * NOTE: This creates a new resource every time, better to use `root.unwrap(...)` instead.
983
+ * @param unwrapper Used to unwrap any resources that this resource depends on.
984
+ */
985
+ unwrap(unwrapper: Unwrapper): GPUBindGroupLayout;
986
+ }
987
+ type StorageUsageForEntry<T extends TgpuLayoutStorage> = T extends {
988
+ access?: infer Access;
989
+ } ? 'mutable' | 'readonly' extends Access ? TgpuBufferReadonly<UnwrapRuntimeConstructor<T['storage']>> | TgpuBufferMutable<UnwrapRuntimeConstructor<T['storage']>> : 'readonly' extends Access ? TgpuBufferReadonly<UnwrapRuntimeConstructor<T['storage']>> : 'mutable' extends Access ? TgpuBufferMutable<UnwrapRuntimeConstructor<T['storage']>> : TgpuBufferReadonly<UnwrapRuntimeConstructor<T['storage']>> | TgpuBufferMutable<UnwrapRuntimeConstructor<T['storage']>> : TgpuBufferReadonly<UnwrapRuntimeConstructor<T['storage']>>;
990
+ type GetUsageForStorageTexture<T extends TgpuLayoutStorageTexture, TAccess extends 'readonly' | 'writeonly' | 'mutable'> = {
991
+ mutable: TgpuMutableTexture<Default<GetDimension<T['viewDimension']>, '2d'>, TexelFormatToDataType[T['storageTexture']]>;
992
+ readonly: TgpuReadonlyTexture<Default<GetDimension<T['viewDimension']>, '2d'>, TexelFormatToDataType[T['storageTexture']]>;
993
+ writeonly: TgpuWriteonlyTexture<Default<GetDimension<T['viewDimension']>, '2d'>, TexelFormatToDataType[T['storageTexture']]>;
994
+ }[TAccess];
995
+ type StorageTextureUsageForEntry<T extends TgpuLayoutStorageTexture> = T extends unknown ? GetUsageForStorageTexture<T, Default<T['access'], 'writeonly'>> : never;
996
+ type GetDimension<T extends GPUTextureViewDimension | undefined> = T extends keyof ViewDimensionToDimension ? ViewDimensionToDimension[T] : undefined;
997
+ type GetTextureRestriction<T extends TgpuLayoutTexture> = Default<GetDimension<T['viewDimension']>, '2d'> extends infer Dimension ? Dimension extends '2d' ? {
998
+ format: ChannelTypeToLegalFormats[SampleTypeToStringChannelType[T['texture']]];
999
+ dimension?: Dimension;
1000
+ } : {
1001
+ format: ChannelTypeToLegalFormats[SampleTypeToStringChannelType[T['texture']]];
1002
+ dimension: Dimension;
1003
+ } : never;
1004
+ type GetStorageTextureRestriction<T extends TgpuLayoutStorageTexture> = Default<GetDimension<T['viewDimension']>, '2d'> extends infer Dimension ? Dimension extends '2d' ? {
1005
+ format: T['storageTexture'];
1006
+ dimension?: Dimension;
1007
+ } : {
1008
+ format: T['storageTexture'];
1009
+ dimension: Dimension;
1010
+ } : never;
1011
+ type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer<UnwrapRuntimeConstructor<T['uniform']>> & Uniform) | GPUBuffer : T extends TgpuLayoutStorage ? (TgpuBuffer<UnwrapRuntimeConstructor<T['storage']>> & Storage) | GPUBuffer : T extends TgpuLayoutSampler ? GPUSampler : T extends TgpuLayoutTexture ? GPUTextureView | (Sampled & TgpuTexture<Prettify<TextureProps & GetTextureRestriction<T>>>) : T extends TgpuLayoutStorageTexture ? GPUTextureView | (Storage & TgpuTexture<Prettify<TextureProps & GetStorageTextureRestriction<T>>>) : T extends TgpuLayoutExternalTexture ? GPUExternalTexture : never;
1012
+ type BindLayoutEntry<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? TgpuBufferUniform<UnwrapRuntimeConstructor<T['uniform']>> : T extends TgpuLayoutStorage ? StorageUsageForEntry<T> : T extends TgpuLayoutSampler ? TgpuSampler : T extends TgpuLayoutTexture ? TgpuSampledTexture<Default<GetDimension<T['viewDimension']>, '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? StorageTextureUsageForEntry<T> : never;
1013
+ type TgpuBindGroup<Entries extends Record<string, TgpuLayoutEntry | null> = Record<string, TgpuLayoutEntry | null>> = {
1014
+ readonly resourceType: 'bind-group';
1015
+ readonly layout: TgpuBindGroupLayout<Entries>;
1016
+ unwrap(unwrapper: Unwrapper): GPUBindGroup;
1017
+ };
1018
+ type ExoticEntry<T> = T extends Record<string | number | symbol, unknown> ? {
1019
+ [Key in keyof T]: T[Key] extends BaseWgslData ? Exotic<T[Key]> : T[Key] extends (...args: infer TArgs) => infer TReturn ? (...args: TArgs) => Exotic<TReturn> : T[Key];
1020
+ } : T;
1021
+ type ExoticEntries<T extends Record<string, TgpuLayoutEntry | null>> = {
1022
+ [BindingKey in keyof T]: ExoticEntry<T[BindingKey]>;
1023
+ };
1024
+ declare function bindGroupLayout<Entries extends Record<string, TgpuLayoutEntry | null>>(entries: Entries): TgpuBindGroupLayout<Prettify<ExoticEntries<Entries>>>;
1025
+
1026
+ interface TgpuBufferUsage<TData extends BaseWgslData, TUsage extends BindableBufferUsage = BindableBufferUsage> extends TgpuResolvable {
1027
+ readonly resourceType: 'buffer-usage';
1028
+ readonly usage: TUsage;
1029
+ readonly '~repr': Infer<TData>;
1030
+ value: Infer<TData>;
1031
+ }
1032
+ interface TgpuBufferUniform<TData extends BaseWgslData> extends TgpuBufferUsage<TData, 'uniform'> {
1033
+ readonly value: Infer<TData>;
1034
+ }
1035
+ interface TgpuBufferReadonly<TData extends BaseWgslData> extends TgpuBufferUsage<TData, 'readonly'> {
1036
+ readonly value: Infer<TData>;
1037
+ }
1038
+ interface TgpuBufferMutable<TData extends BaseWgslData> extends TgpuBufferUsage<TData, 'mutable'> {
1039
+ }
1040
+
1041
+ interface TgpuSlot<T> extends TgpuNamable {
1042
+ readonly resourceType: 'slot';
1043
+ readonly defaultValue: T | undefined;
1044
+ readonly label?: string | undefined;
1045
+ /**
1046
+ * Used to determine if code generated using either value `a` or `b` in place
1047
+ * of the slot will be equivalent. Defaults to `Object.is`.
1048
+ */
1049
+ areEqual(a: T, b: T): boolean;
1050
+ readonly value: Infer<T>;
1051
+ }
1052
+ interface TgpuDerived<T> {
1053
+ readonly resourceType: 'derived';
1054
+ readonly value: Infer<T>;
1055
+ with<TValue>(slot: TgpuSlot<TValue>, value: Eventual<TValue>): TgpuDerived<T>;
1056
+ /**
1057
+ * @internal
1058
+ */
1059
+ '~compute'(): T;
1060
+ }
1061
+ /**
1062
+ * Represents a value that is available at resolution time.
1063
+ */
1064
+ type Eventual<T> = T | TgpuSlot<T> | TgpuDerived<T>;
1065
+ type SlotValuePair<T> = [TgpuSlot<T>, T];
1066
+
1067
+ type Wgsl = Eventual<string | number | boolean | TgpuResolvable | AnyWgslData>;
1068
+ declare const UnknownData: unique symbol;
1069
+ type UnknownData = typeof UnknownData;
1070
+ type Resource = {
1071
+ value: unknown;
1072
+ dataType: AnyWgslData | UnknownData;
1073
+ };
1074
+ type TgpuShaderStage = 'compute' | 'vertex' | 'fragment';
1075
+ interface FnToWgslOptions {
1076
+ args: Resource[];
1077
+ returnType: AnyWgslData;
1078
+ body: Block;
1079
+ externalMap: Record<string, unknown>;
1080
+ }
1081
+ /**
1082
+ * Passed into each resolvable item. All items in a tree share a resolution ctx,
1083
+ * but there can be layers added and removed from the item stack when going down
1084
+ * and up the tree.
1085
+ */
1086
+ interface ResolutionCtx {
1087
+ readonly names: NameRegistry;
1088
+ addDeclaration(declaration: string): void;
1089
+ /**
1090
+ * Reserves a bind group number, and returns a placeholder that will be replaced
1091
+ * with a concrete number at the end of the resolution process.
1092
+ */
1093
+ allocateLayoutEntry(layout: TgpuBindGroupLayout): string;
1094
+ /**
1095
+ * Reserves a spot in the catch-all bind group, without the indirection of a bind-group.
1096
+ * This means the resource is 'fixed', and cannot be swapped between code execution.
1097
+ */
1098
+ allocateFixedEntry(layoutEntry: TgpuLayoutEntry, resource: object): {
1099
+ group: string;
1100
+ binding: number;
1101
+ };
1102
+ withSlots<T>(pairs: SlotValuePair<unknown>[], callback: () => T): T;
1103
+ /**
1104
+ * Unwraps all layers of slot/derived indirection and returns the concrete value if available.
1105
+ * @throws {MissingSlotValueError}
1106
+ */
1107
+ unwrap<T>(eventual: Eventual<T>): T;
1108
+ resolve(item: Wgsl): string;
1109
+ resolveValue<T extends BaseWgslData>(value: Infer<T>, schema: T): string;
1110
+ transpileFn(fn: string): {
1111
+ argNames: string[];
1112
+ body: Block;
1113
+ externalNames: string[];
1114
+ };
1115
+ fnToWgsl(options: FnToWgslOptions): {
1116
+ head: Wgsl;
1117
+ body: Wgsl;
1118
+ };
1119
+ }
1120
+ interface TgpuResolvable {
1121
+ readonly label?: string | undefined;
1122
+ resolve(ctx: ResolutionCtx): string;
1123
+ toString(): string;
1124
+ }
1125
+ type BindableBufferUsage = 'uniform' | 'readonly' | 'mutable';
1126
+
1127
+ interface NumberArrayView {
1128
+ readonly length: number;
1129
+ [n: number]: number;
1130
+ }
1131
+ interface BaseWgslData {
1132
+ type: string;
1133
+ /** Type-token, not available at runtime */
1134
+ readonly '~repr': unknown;
1135
+ }
1136
+ interface Swizzle2<T2, T3, T4> {
1137
+ readonly xx: T2;
1138
+ readonly xy: T2;
1139
+ readonly yx: T2;
1140
+ readonly yy: T2;
1141
+ readonly xxx: T3;
1142
+ readonly xxy: T3;
1143
+ readonly xyx: T3;
1144
+ readonly xyy: T3;
1145
+ readonly yxx: T3;
1146
+ readonly yxy: T3;
1147
+ readonly yyx: T3;
1148
+ readonly yyy: T3;
1149
+ readonly xxxx: T4;
1150
+ readonly xxxy: T4;
1151
+ readonly xxyx: T4;
1152
+ readonly xxyy: T4;
1153
+ readonly xyxx: T4;
1154
+ readonly xyxy: T4;
1155
+ readonly xyyx: T4;
1156
+ readonly xyyy: T4;
1157
+ readonly yxxx: T4;
1158
+ readonly yxxy: T4;
1159
+ readonly yxyx: T4;
1160
+ readonly yxyy: T4;
1161
+ readonly yyxx: T4;
1162
+ readonly yyxy: T4;
1163
+ readonly yyyx: T4;
1164
+ readonly yyyy: T4;
1165
+ }
1166
+ interface Swizzle3<T2, T3, T4> extends Swizzle2<T2, T3, T4> {
1167
+ readonly xz: T2;
1168
+ readonly yz: T2;
1169
+ readonly zx: T2;
1170
+ readonly zy: T2;
1171
+ readonly zz: T2;
1172
+ readonly xxz: T3;
1173
+ readonly xyz: T3;
1174
+ readonly xzx: T3;
1175
+ readonly xzy: T3;
1176
+ readonly xzz: T3;
1177
+ readonly yxz: T3;
1178
+ readonly yyz: T3;
1179
+ readonly yzx: T3;
1180
+ readonly yzy: T3;
1181
+ readonly yzz: T3;
1182
+ readonly zxx: T3;
1183
+ readonly zxy: T3;
1184
+ readonly zxz: T3;
1185
+ readonly zyx: T3;
1186
+ readonly zyy: T3;
1187
+ readonly zyz: T3;
1188
+ readonly zzx: T3;
1189
+ readonly zzy: T3;
1190
+ readonly zzz: T3;
1191
+ readonly xxxz: T4;
1192
+ readonly xxyz: T4;
1193
+ readonly xxzx: T4;
1194
+ readonly xxzy: T4;
1195
+ readonly xxzz: T4;
1196
+ readonly xyxz: T4;
1197
+ readonly xyyz: T4;
1198
+ readonly xyzx: T4;
1199
+ readonly xyzy: T4;
1200
+ readonly xyzz: T4;
1201
+ readonly xzxx: T4;
1202
+ readonly xzxy: T4;
1203
+ readonly xzxz: T4;
1204
+ readonly xzyx: T4;
1205
+ readonly xzyy: T4;
1206
+ readonly xzyz: T4;
1207
+ readonly xzzx: T4;
1208
+ readonly xzzy: T4;
1209
+ readonly xzzz: T4;
1210
+ readonly yxxz: T4;
1211
+ readonly yxyz: T4;
1212
+ readonly yxzx: T4;
1213
+ readonly yxzy: T4;
1214
+ readonly yxzz: T4;
1215
+ readonly yyxz: T4;
1216
+ readonly yyyz: T4;
1217
+ readonly yyzx: T4;
1218
+ readonly yyzy: T4;
1219
+ readonly yyzz: T4;
1220
+ readonly yzxx: T4;
1221
+ readonly yzxy: T4;
1222
+ readonly yzxz: T4;
1223
+ readonly yzyx: T4;
1224
+ readonly yzyy: T4;
1225
+ readonly yzyz: T4;
1226
+ readonly yzzx: T4;
1227
+ readonly yzzy: T4;
1228
+ readonly yzzz: T4;
1229
+ readonly zxxx: T4;
1230
+ readonly zxxy: T4;
1231
+ readonly zxxz: T4;
1232
+ readonly zxyx: T4;
1233
+ readonly zxyy: T4;
1234
+ readonly zxyz: T4;
1235
+ readonly zxzx: T4;
1236
+ readonly zxzy: T4;
1237
+ readonly zxzz: T4;
1238
+ readonly zyxx: T4;
1239
+ readonly zyxy: T4;
1240
+ readonly zyxz: T4;
1241
+ readonly zyyx: T4;
1242
+ readonly zyyy: T4;
1243
+ readonly zyyz: T4;
1244
+ readonly zyzx: T4;
1245
+ readonly zyzy: T4;
1246
+ readonly zyzz: T4;
1247
+ readonly zzxx: T4;
1248
+ readonly zzxy: T4;
1249
+ readonly zzxz: T4;
1250
+ readonly zzyx: T4;
1251
+ readonly zzyy: T4;
1252
+ readonly zzyz: T4;
1253
+ readonly zzzx: T4;
1254
+ readonly zzzy: T4;
1255
+ readonly zzzz: T4;
1256
+ }
1257
+ interface Swizzle4<T2, T3, T4> extends Swizzle3<T2, T3, T4> {
1258
+ readonly yw: T2;
1259
+ readonly zw: T2;
1260
+ readonly wx: T2;
1261
+ readonly wy: T2;
1262
+ readonly wz: T2;
1263
+ readonly ww: T2;
1264
+ readonly xxw: T3;
1265
+ readonly xyw: T3;
1266
+ readonly xzw: T3;
1267
+ readonly xwx: T3;
1268
+ readonly xwy: T3;
1269
+ readonly xwz: T3;
1270
+ readonly xww: T3;
1271
+ readonly yxw: T3;
1272
+ readonly yyw: T3;
1273
+ readonly yzw: T3;
1274
+ readonly ywx: T3;
1275
+ readonly ywy: T3;
1276
+ readonly ywz: T3;
1277
+ readonly yww: T3;
1278
+ readonly zxw: T3;
1279
+ readonly zyw: T3;
1280
+ readonly zzw: T3;
1281
+ readonly zwx: T3;
1282
+ readonly zwy: T3;
1283
+ readonly zwz: T3;
1284
+ readonly zww: T3;
1285
+ readonly wxx: T3;
1286
+ readonly wxz: T3;
1287
+ readonly wxy: T3;
1288
+ readonly wyy: T3;
1289
+ readonly wyz: T3;
1290
+ readonly wzz: T3;
1291
+ readonly wwx: T3;
1292
+ readonly wwy: T3;
1293
+ readonly wwz: T3;
1294
+ readonly www: T3;
1295
+ readonly xxxw: T4;
1296
+ readonly xxyw: T4;
1297
+ readonly xxzw: T4;
1298
+ readonly xxwx: T4;
1299
+ readonly xxwy: T4;
1300
+ readonly xxwz: T4;
1301
+ readonly xxww: T4;
1302
+ readonly xyxw: T4;
1303
+ readonly xyyw: T4;
1304
+ readonly xyzw: T4;
1305
+ readonly xywx: T4;
1306
+ readonly xywy: T4;
1307
+ readonly xywz: T4;
1308
+ readonly xyww: T4;
1309
+ readonly xzxw: T4;
1310
+ readonly xzyw: T4;
1311
+ readonly xzzw: T4;
1312
+ readonly xzwx: T4;
1313
+ readonly xzwy: T4;
1314
+ readonly xzwz: T4;
1315
+ readonly xzww: T4;
1316
+ readonly xwxx: T4;
1317
+ readonly xwxy: T4;
1318
+ readonly xwxz: T4;
1319
+ readonly xwyy: T4;
1320
+ readonly xwyz: T4;
1321
+ readonly xwzz: T4;
1322
+ readonly xwwx: T4;
1323
+ readonly xwwy: T4;
1324
+ readonly xwwz: T4;
1325
+ readonly xwww: T4;
1326
+ readonly yxxw: T4;
1327
+ readonly yxyw: T4;
1328
+ readonly yxzw: T4;
1329
+ readonly yxwx: T4;
1330
+ readonly yxwy: T4;
1331
+ readonly yxwz: T4;
1332
+ readonly yxww: T4;
1333
+ readonly yyxw: T4;
1334
+ readonly yyyw: T4;
1335
+ readonly yyzw: T4;
1336
+ readonly yywx: T4;
1337
+ readonly yywy: T4;
1338
+ readonly yywz: T4;
1339
+ readonly yyww: T4;
1340
+ readonly yzxw: T4;
1341
+ readonly yzyw: T4;
1342
+ readonly yzzw: T4;
1343
+ readonly yzwx: T4;
1344
+ readonly yzwy: T4;
1345
+ readonly yzwz: T4;
1346
+ readonly yzww: T4;
1347
+ readonly ywxx: T4;
1348
+ readonly ywxy: T4;
1349
+ readonly ywxz: T4;
1350
+ readonly ywxw: T4;
1351
+ readonly ywyy: T4;
1352
+ readonly ywyz: T4;
1353
+ readonly ywzz: T4;
1354
+ readonly ywwx: T4;
1355
+ readonly ywwy: T4;
1356
+ readonly ywwz: T4;
1357
+ readonly ywww: T4;
1358
+ readonly zxxw: T4;
1359
+ readonly zxyw: T4;
1360
+ readonly zxzw: T4;
1361
+ readonly zxwx: T4;
1362
+ readonly zxwy: T4;
1363
+ readonly zxwz: T4;
1364
+ readonly zxww: T4;
1365
+ readonly zyxw: T4;
1366
+ readonly zyyw: T4;
1367
+ readonly zyzw: T4;
1368
+ readonly zywx: T4;
1369
+ readonly zywy: T4;
1370
+ readonly zywz: T4;
1371
+ readonly zyww: T4;
1372
+ readonly zzxw: T4;
1373
+ readonly zzyw: T4;
1374
+ readonly zzzw: T4;
1375
+ readonly zzwx: T4;
1376
+ readonly zzwy: T4;
1377
+ readonly zzwz: T4;
1378
+ readonly zzww: T4;
1379
+ readonly zwxx: T4;
1380
+ readonly zwxy: T4;
1381
+ readonly zwxz: T4;
1382
+ readonly zwxw: T4;
1383
+ readonly zwyy: T4;
1384
+ readonly zwyz: T4;
1385
+ readonly zwzz: T4;
1386
+ readonly zwwx: T4;
1387
+ readonly zwwy: T4;
1388
+ readonly zwwz: T4;
1389
+ readonly zwww: T4;
1390
+ readonly wxxx: T4;
1391
+ readonly wxxy: T4;
1392
+ readonly wxxz: T4;
1393
+ readonly wxxw: T4;
1394
+ readonly wxyx: T4;
1395
+ readonly wxyy: T4;
1396
+ readonly wxyz: T4;
1397
+ readonly wxyw: T4;
1398
+ readonly wxzx: T4;
1399
+ readonly wxzy: T4;
1400
+ readonly wxzz: T4;
1401
+ readonly wxzw: T4;
1402
+ readonly wxwx: T4;
1403
+ readonly wxwy: T4;
1404
+ readonly wxwz: T4;
1405
+ readonly wxww: T4;
1406
+ readonly wyxx: T4;
1407
+ readonly wyxy: T4;
1408
+ readonly wyxz: T4;
1409
+ readonly wyxw: T4;
1410
+ readonly wyyy: T4;
1411
+ readonly wyyz: T4;
1412
+ readonly wyzw: T4;
1413
+ readonly wywx: T4;
1414
+ readonly wywy: T4;
1415
+ readonly wywz: T4;
1416
+ readonly wyww: T4;
1417
+ readonly wzxx: T4;
1418
+ readonly wzxy: T4;
1419
+ readonly wzxz: T4;
1420
+ readonly wzxw: T4;
1421
+ readonly wzyy: T4;
1422
+ readonly wzyz: T4;
1423
+ readonly wzzy: T4;
1424
+ readonly wzzw: T4;
1425
+ readonly wzwx: T4;
1426
+ readonly wzwy: T4;
1427
+ readonly wzwz: T4;
1428
+ readonly wzww: T4;
1429
+ readonly wwxx: T4;
1430
+ readonly wwxy: T4;
1431
+ readonly wwxz: T4;
1432
+ readonly wwxw: T4;
1433
+ readonly wwyy: T4;
1434
+ readonly wwyz: T4;
1435
+ readonly wwzz: T4;
1436
+ readonly wwwx: T4;
1437
+ readonly wwwy: T4;
1438
+ readonly wwwz: T4;
1439
+ readonly wwww: T4;
1440
+ }
1441
+ /**
1442
+ * Interface representing its WGSL vector type counterpart: vec2f or vec2<f32>.
1443
+ * A vector with 2 elements of type f32
1444
+ */
1445
+ interface v2f extends NumberArrayView, Swizzle2<v2f, v3f, v4f>, TgpuResolvable {
1446
+ /** use to distinguish between vectors of the same size on the type level */
1447
+ readonly kind: 'vec2f';
1448
+ x: number;
1449
+ y: number;
1450
+ }
1451
+ /**
1452
+ * Interface representing its WGSL vector type counterpart: vec2h or vec2<f16>.
1453
+ * A vector with 2 elements of type f16
1454
+ */
1455
+ interface v2h extends NumberArrayView, Swizzle2<v2h, v3h, v4h>, TgpuResolvable {
1456
+ /** use to distinguish between vectors of the same size on the type level */
1457
+ readonly kind: 'vec2h';
1458
+ x: number;
1459
+ y: number;
1460
+ }
1461
+ /**
1462
+ * Interface representing its WGSL vector type counterpart: vec2i or vec2<i32>.
1463
+ * A vector with 2 elements of type i32
1464
+ */
1465
+ interface v2i extends NumberArrayView, Swizzle2<v2i, v3i, v4i>, TgpuResolvable {
1466
+ /** use to distinguish between vectors of the same size on the type level */
1467
+ readonly kind: 'vec2i';
1468
+ x: number;
1469
+ y: number;
1470
+ }
1471
+ /**
1472
+ * Interface representing its WGSL vector type counterpart: vec2u or vec2<u32>.
1473
+ * A vector with 2 elements of type u32
1474
+ */
1475
+ interface v2u extends NumberArrayView, Swizzle2<v2u, v3u, v4u>, TgpuResolvable {
1476
+ /** use to distinguish between vectors of the same size on the type level */
1477
+ readonly kind: 'vec2u';
1478
+ x: number;
1479
+ y: number;
1480
+ }
1481
+ /**
1482
+ * Interface representing its WGSL vector type counterpart: vec3f or vec3<f32>.
1483
+ * A vector with 3 elements of type f32
1484
+ */
1485
+ interface v3f extends NumberArrayView, Swizzle3<v2f, v3f, v4f>, TgpuResolvable {
1486
+ /** use to distinguish between vectors of the same size on the type level */
1487
+ readonly kind: 'vec3f';
1488
+ x: number;
1489
+ y: number;
1490
+ z: number;
1491
+ }
946
1492
  /**
947
- * Unsigned 32-bit integer schema representing a single WGSL u32 value.
1493
+ * Interface representing its WGSL vector type counterpart: vec3h or vec3<f16>.
1494
+ * A vector with 3 elements of type f16
948
1495
  */
949
- type NativeU32 = U32 & {
950
- '~exotic': U32;
951
- } & ((v: number | boolean) => number);
1496
+ interface v3h extends NumberArrayView, Swizzle3<v2h, v3h, v4h>, TgpuResolvable {
1497
+ /** use to distinguish between vectors of the same size on the type level */
1498
+ readonly kind: 'vec3h';
1499
+ x: number;
1500
+ y: number;
1501
+ z: number;
1502
+ }
952
1503
  /**
953
- * A schema that represents an unsigned 32-bit integer value. (equivalent to `u32` in WGSL)
954
- *
955
- * Can also be called to cast a value to an u32 in accordance with WGSL casting rules.
956
- *
957
- * @example
958
- * const value = u32(3.14); // 3
959
- * @example
960
- * const value = u32(-1); // 4294967295
961
- * @example
962
- * const value = u32(-3.1); // 0
1504
+ * Interface representing its WGSL vector type counterpart: vec3i or vec3<i32>.
1505
+ * A vector with 3 elements of type i32
963
1506
  */
964
- declare const u32: NativeU32;
1507
+ interface v3i extends NumberArrayView, Swizzle3<v2i, v3i, v4i>, TgpuResolvable {
1508
+ /** use to distinguish between vectors of the same size on the type level */
1509
+ readonly kind: 'vec3i';
1510
+ x: number;
1511
+ y: number;
1512
+ z: number;
1513
+ }
965
1514
  /**
966
- * Signed 32-bit integer schema representing a single WGSL i32 value.
1515
+ * Interface representing its WGSL vector type counterpart: vec3u or vec3<u32>.
1516
+ * A vector with 3 elements of type u32
967
1517
  */
968
- type NativeI32 = I32 & {
969
- '~exotic': I32;
970
- } & ((v: number | boolean) => number);
1518
+ interface v3u extends NumberArrayView, Swizzle3<v2u, v3u, v4u>, TgpuResolvable {
1519
+ /** use to distinguish between vectors of the same size on the type level */
1520
+ readonly kind: 'vec3u';
1521
+ x: number;
1522
+ y: number;
1523
+ z: number;
1524
+ }
971
1525
  /**
972
- * A schema that represents a signed 32-bit integer value. (equivalent to `i32` in WGSL)
973
- *
974
- * Can also be called to cast a value to an i32 in accordance with WGSL casting rules.
975
- *
976
- * @example
977
- * const value = i32(3.14); // 3
978
- * @example
979
- * const value = i32(-3.9); // -3
980
- * @example
981
- * const value = i32(10000000000) // 1410065408
1526
+ * Interface representing its WGSL vector type counterpart: vec4f or vec4<f32>.
1527
+ * A vector with 4 elements of type f32
982
1528
  */
983
- declare const i32: NativeI32;
1529
+ interface v4f extends NumberArrayView, Swizzle4<v2f, v3f, v4f>, TgpuResolvable {
1530
+ /** use to distinguish between vectors of the same size on the type level */
1531
+ readonly kind: 'vec4f';
1532
+ x: number;
1533
+ y: number;
1534
+ z: number;
1535
+ w: number;
1536
+ }
984
1537
  /**
985
- * 32-bit float schema representing a single WGSL f32 value.
1538
+ * Interface representing its WGSL vector type counterpart: vec4h or vec4<f16>.
1539
+ * A vector with 4 elements of type f16
986
1540
  */
987
- type NativeF32 = F32 & {
988
- '~exotic': F32;
989
- } & ((v: number | boolean) => number);
1541
+ interface v4h extends NumberArrayView, Swizzle4<v2h, v3h, v4h>, TgpuResolvable {
1542
+ /** use to distinguish between vectors of the same size on the type level */
1543
+ readonly kind: 'vec4h';
1544
+ x: number;
1545
+ y: number;
1546
+ z: number;
1547
+ w: number;
1548
+ }
990
1549
  /**
991
- * A schema that represents a 32-bit float value. (equivalent to `f32` in WGSL)
992
- *
993
- * Can also be called to cast a value to an f32.
994
- *
995
- * @example
996
- * const value = f32(true); // 1
1550
+ * Interface representing its WGSL vector type counterpart: vec4i or vec4<i32>.
1551
+ * A vector with 4 elements of type i32
997
1552
  */
998
- declare const f32: NativeF32;
1553
+ interface v4i extends NumberArrayView, Swizzle4<v2i, v3i, v4i>, TgpuResolvable {
1554
+ /** use to distinguish between vectors of the same size on the type level */
1555
+ readonly kind: 'vec4i';
1556
+ x: number;
1557
+ y: number;
1558
+ z: number;
1559
+ w: number;
1560
+ }
999
1561
  /**
1000
- * 16-bit float schema representing a single WGSL f16 value.
1562
+ * Interface representing its WGSL vector type counterpart: vec4u or vec4<u32>.
1563
+ * A vector with 4 elements of type u32
1001
1564
  */
1002
- type NativeF16 = F16 & {
1003
- '~exotic': F16;
1004
- } & ((v: number | boolean) => number);
1565
+ interface v4u extends NumberArrayView, Swizzle4<v2u, v3u, v4u>, TgpuResolvable {
1566
+ /** use to distinguish between vectors of the same size on the type level */
1567
+ readonly kind: 'vec4u';
1568
+ x: number;
1569
+ y: number;
1570
+ z: number;
1571
+ w: number;
1572
+ }
1573
+ interface matBase<TColumn> extends NumberArrayView {
1574
+ readonly columns: readonly TColumn[];
1575
+ }
1005
1576
  /**
1006
- * A schema that represents a 16-bit float value. (equivalent to `f16` in WGSL)
1007
- *
1008
- * Can also be called to cast a value to an f16.
1009
- *
1010
- * @example
1011
- * const value = f16(true); // 1
1012
- * @example
1013
- * const value = f16(21877.5); // 21872
1577
+ * Interface representing its WGSL matrix type counterpart: mat2x2
1578
+ * A matrix with 2 rows and 2 columns, with elements of type `TColumn`
1014
1579
  */
1015
- declare const f16: NativeF16;
1016
-
1017
- 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"];
1018
- type VertexFormat = (typeof vertexFormats)[number];
1019
-
1020
- type FormatToWGSLType<T extends VertexFormat> = (typeof formatToWGSLType)[T];
1021
- interface TgpuVertexFormatData<T extends VertexFormat> {
1022
- readonly '~repr': Infer<FormatToWGSLType<T>>;
1023
- readonly type: T;
1024
- }
1025
- declare const formatToWGSLType: {
1026
- readonly uint8: NativeU32;
1027
- readonly uint8x2: NativeVec2u;
1028
- readonly uint8x4: NativeVec4u;
1029
- readonly sint8: NativeI32;
1030
- readonly sint8x2: NativeVec2i;
1031
- readonly sint8x4: NativeVec4i;
1032
- readonly unorm8: NativeF32;
1033
- readonly unorm8x2: NativeVec2f;
1034
- readonly unorm8x4: NativeVec4f;
1035
- readonly snorm8: NativeF32;
1036
- readonly snorm8x2: NativeVec2f;
1037
- readonly snorm8x4: NativeVec4f;
1038
- readonly uint16: NativeU32;
1039
- readonly uint16x2: NativeVec2u;
1040
- readonly uint16x4: NativeVec4u;
1041
- readonly sint16: NativeI32;
1042
- readonly sint16x2: NativeVec2i;
1043
- readonly sint16x4: NativeVec4i;
1044
- readonly unorm16: NativeF32;
1045
- readonly unorm16x2: NativeVec2f;
1046
- readonly unorm16x4: NativeVec4f;
1047
- readonly snorm16: NativeF32;
1048
- readonly snorm16x2: NativeVec2f;
1049
- readonly snorm16x4: NativeVec4f;
1050
- readonly float16: NativeF32;
1051
- readonly float16x2: NativeVec2f;
1052
- readonly float16x4: NativeVec4f;
1053
- readonly float32: NativeF32;
1054
- readonly float32x2: NativeVec2f;
1055
- readonly float32x3: NativeVec3f;
1056
- readonly float32x4: NativeVec4f;
1057
- readonly uint32: NativeU32;
1058
- readonly uint32x2: NativeVec2u;
1059
- readonly uint32x3: NativeVec3u;
1060
- readonly uint32x4: NativeVec4u;
1061
- readonly sint32: NativeI32;
1062
- readonly sint32x2: NativeVec2i;
1063
- readonly sint32x3: NativeVec3i;
1064
- readonly sint32x4: NativeVec4i;
1065
- readonly 'unorm10-10-10-2': NativeVec4f;
1066
- readonly 'unorm8x4-bgra': NativeVec4f;
1067
- };
1068
- declare const packedFormats: string[];
1069
- type uint8 = TgpuVertexFormatData<'uint8'>;
1070
- declare const uint8: uint8;
1071
- type uint8x2 = TgpuVertexFormatData<'uint8x2'>;
1072
- declare const uint8x2: uint8x2;
1073
- type uint8x4 = TgpuVertexFormatData<'uint8x4'>;
1074
- declare const uint8x4: uint8x4;
1075
- type sint8 = TgpuVertexFormatData<'sint8'>;
1076
- declare const sint8: sint8;
1077
- type sint8x2 = TgpuVertexFormatData<'sint8x2'>;
1078
- declare const sint8x2: sint8x2;
1079
- type sint8x4 = TgpuVertexFormatData<'sint8x4'>;
1080
- declare const sint8x4: sint8x4;
1081
- type unorm8 = TgpuVertexFormatData<'unorm8'>;
1082
- declare const unorm8: unorm8;
1083
- type unorm8x2 = TgpuVertexFormatData<'unorm8x2'>;
1084
- declare const unorm8x2: unorm8x2;
1085
- type unorm8x4 = TgpuVertexFormatData<'unorm8x4'>;
1086
- declare const unorm8x4: unorm8x4;
1087
- type snorm8 = TgpuVertexFormatData<'snorm8'>;
1088
- declare const snorm8: snorm8;
1089
- type snorm8x2 = TgpuVertexFormatData<'snorm8x2'>;
1090
- declare const snorm8x2: snorm8x2;
1091
- type snorm8x4 = TgpuVertexFormatData<'snorm8x4'>;
1092
- declare const snorm8x4: snorm8x4;
1093
- type uint16 = TgpuVertexFormatData<'uint16'>;
1094
- declare const uint16: uint16;
1095
- type uint16x2 = TgpuVertexFormatData<'uint16x2'>;
1096
- declare const uint16x2: uint16x2;
1097
- type uint16x4 = TgpuVertexFormatData<'uint16x4'>;
1098
- declare const uint16x4: uint16x4;
1099
- type sint16 = TgpuVertexFormatData<'sint16'>;
1100
- declare const sint16: sint16;
1101
- type sint16x2 = TgpuVertexFormatData<'sint16x2'>;
1102
- declare const sint16x2: sint16x2;
1103
- type sint16x4 = TgpuVertexFormatData<'sint16x4'>;
1104
- declare const sint16x4: sint16x4;
1105
- type unorm16 = TgpuVertexFormatData<'unorm16'>;
1106
- declare const unorm16: unorm16;
1107
- type unorm16x2 = TgpuVertexFormatData<'unorm16x2'>;
1108
- declare const unorm16x2: unorm16x2;
1109
- type unorm16x4 = TgpuVertexFormatData<'unorm16x4'>;
1110
- declare const unorm16x4: unorm16x4;
1111
- type snorm16 = TgpuVertexFormatData<'snorm16'>;
1112
- declare const snorm16: snorm16;
1113
- type snorm16x2 = TgpuVertexFormatData<'snorm16x2'>;
1114
- declare const snorm16x2: snorm16x2;
1115
- type snorm16x4 = TgpuVertexFormatData<'snorm16x4'>;
1116
- declare const snorm16x4: snorm16x4;
1117
- type float16 = TgpuVertexFormatData<'float16'>;
1118
- declare const float16: float16;
1119
- type float16x2 = TgpuVertexFormatData<'float16x2'>;
1120
- declare const float16x2: float16x2;
1121
- type float16x4 = TgpuVertexFormatData<'float16x4'>;
1122
- declare const float16x4: float16x4;
1123
- type float32 = TgpuVertexFormatData<'float32'>;
1124
- declare const float32: float32;
1125
- type float32x2 = TgpuVertexFormatData<'float32x2'>;
1126
- declare const float32x2: float32x2;
1127
- type float32x3 = TgpuVertexFormatData<'float32x3'>;
1128
- declare const float32x3: float32x3;
1129
- type float32x4 = TgpuVertexFormatData<'float32x4'>;
1130
- declare const float32x4: float32x4;
1131
- type uint32 = TgpuVertexFormatData<'uint32'>;
1132
- declare const uint32: uint32;
1133
- type uint32x2 = TgpuVertexFormatData<'uint32x2'>;
1134
- declare const uint32x2: uint32x2;
1135
- type uint32x3 = TgpuVertexFormatData<'uint32x3'>;
1136
- declare const uint32x3: uint32x3;
1137
- type uint32x4 = TgpuVertexFormatData<'uint32x4'>;
1138
- declare const uint32x4: uint32x4;
1139
- type sint32 = TgpuVertexFormatData<'sint32'>;
1140
- declare const sint32: sint32;
1141
- type sint32x2 = TgpuVertexFormatData<'sint32x2'>;
1142
- declare const sint32x2: sint32x2;
1143
- type sint32x3 = TgpuVertexFormatData<'sint32x3'>;
1144
- declare const sint32x3: sint32x3;
1145
- type sint32x4 = TgpuVertexFormatData<'sint32x4'>;
1146
- declare const sint32x4: sint32x4;
1147
- type unorm10_10_10_2 = TgpuVertexFormatData<'unorm10-10-10-2'>;
1148
- declare const unorm10_10_10_2: unorm10_10_10_2;
1149
- type unorm8x4_bgra = TgpuVertexFormatData<'unorm8x4-bgra'>;
1150
- declare const unorm8x4_bgra: unorm8x4_bgra;
1151
- 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;
1152
-
1580
+ interface mat2x2<TColumn> extends matBase<TColumn> {
1581
+ readonly length: 4;
1582
+ [n: number]: number;
1583
+ }
1153
1584
  /**
1154
- * Array schema constructed via `d.looseArrayOf` function.
1155
- *
1156
- * Useful for defining vertex buffers.
1157
- * Elements in the schema are not aligned in respect to their `byteAlignment`,
1158
- * unless they are explicitly decorated with the custom align attribute
1159
- * via `d.align` function.
1585
+ * Interface representing its WGSL matrix type counterpart: mat2x2f or mat2x2<f32>
1586
+ * A matrix with 2 rows and 2 columns, with elements of type d.f32
1587
+ */
1588
+ interface m2x2f extends mat2x2<v2f> {
1589
+ readonly kind: 'mat2x2f';
1590
+ }
1591
+ /**
1592
+ * Interface representing its WGSL matrix type counterpart: mat3x3
1593
+ * A matrix with 3 rows and 3 columns, with elements of type `TColumn`
1594
+ */
1595
+ interface mat3x3<TColumn> extends matBase<TColumn> {
1596
+ readonly length: 12;
1597
+ [n: number]: number;
1598
+ }
1599
+ /**
1600
+ * Interface representing its WGSL matrix type counterpart: mat3x3f or mat3x3<f32>
1601
+ * A matrix with 3 rows and 3 columns, with elements of type d.f32
1602
+ */
1603
+ interface m3x3f extends mat3x3<v3f> {
1604
+ readonly kind: 'mat3x3f';
1605
+ }
1606
+ /**
1607
+ * Interface representing its WGSL matrix type counterpart: mat4x4
1608
+ * A matrix with 4 rows and 4 columns, with elements of type `TColumn`
1609
+ */
1610
+ interface mat4x4<TColumn> extends matBase<TColumn> {
1611
+ readonly length: 16;
1612
+ [n: number]: number;
1613
+ }
1614
+ /**
1615
+ * Interface representing its WGSL matrix type counterpart: mat4x4f or mat4x4<f32>
1616
+ * A matrix with 4 rows and 4 columns, with elements of type d.f32
1617
+ */
1618
+ interface m4x4f extends mat4x4<v4f> {
1619
+ readonly kind: 'mat4x4f';
1620
+ }
1621
+ /**
1622
+ * Boolean schema representing a single WGSL bool value.
1623
+ * Cannot be used inside buffers as it is not host-shareable.
1160
1624
  */
1161
- interface LooseArray<TElement extends BaseWgslData = BaseWgslData> {
1162
- readonly type: 'loose-array';
1625
+ interface Bool {
1626
+ readonly type: 'bool';
1627
+ readonly '~repr': boolean;
1628
+ }
1629
+ interface F32 {
1630
+ readonly type: 'f32';
1631
+ /** Type-token, not available at runtime */
1632
+ readonly '~repr': number;
1633
+ }
1634
+ interface F16 {
1635
+ readonly type: 'f16';
1636
+ /** Type-token, not available at runtime */
1637
+ readonly '~repr': number;
1638
+ }
1639
+ interface I32 {
1640
+ readonly type: 'i32';
1641
+ /** Type-token, not available at runtime */
1642
+ readonly '~repr': number;
1643
+ }
1644
+ interface U32 {
1645
+ readonly type: 'u32';
1646
+ /** Type-token, not available at runtime */
1647
+ readonly '~repr': number;
1648
+ }
1649
+ interface Vec2f {
1650
+ readonly type: 'vec2f';
1651
+ /** Type-token, not available at runtime */
1652
+ readonly '~repr': v2f;
1653
+ }
1654
+ interface Vec2h {
1655
+ readonly type: 'vec2h';
1656
+ /** Type-token, not available at runtime */
1657
+ readonly '~repr': v2h;
1658
+ }
1659
+ interface Vec2i {
1660
+ readonly type: 'vec2i';
1661
+ /** Type-token, not available at runtime */
1662
+ readonly '~repr': v2i;
1663
+ }
1664
+ interface Vec2u {
1665
+ readonly type: 'vec2u';
1666
+ /** Type-token, not available at runtime */
1667
+ readonly '~repr': v2u;
1668
+ }
1669
+ interface Vec3f {
1670
+ readonly type: 'vec3f';
1671
+ /** Type-token, not available at runtime */
1672
+ readonly '~repr': v3f;
1673
+ }
1674
+ interface Vec3h {
1675
+ readonly type: 'vec3h';
1676
+ /** Type-token, not available at runtime */
1677
+ readonly '~repr': v3h;
1678
+ }
1679
+ interface Vec3i {
1680
+ readonly type: 'vec3i';
1681
+ /** Type-token, not available at runtime */
1682
+ readonly '~repr': v3i;
1683
+ }
1684
+ interface Vec3u {
1685
+ readonly type: 'vec3u';
1686
+ /** Type-token, not available at runtime */
1687
+ readonly '~repr': v3u;
1688
+ }
1689
+ interface Vec4f {
1690
+ readonly type: 'vec4f';
1691
+ /** Type-token, not available at runtime */
1692
+ readonly '~repr': v4f;
1693
+ }
1694
+ interface Vec4h {
1695
+ readonly type: 'vec4h';
1696
+ /** Type-token, not available at runtime */
1697
+ readonly '~repr': v4h;
1698
+ }
1699
+ interface Vec4i {
1700
+ readonly type: 'vec4i';
1701
+ /** Type-token, not available at runtime */
1702
+ readonly '~repr': v4i;
1703
+ }
1704
+ interface Vec4u {
1705
+ readonly type: 'vec4u';
1706
+ /** Type-token, not available at runtime */
1707
+ readonly '~repr': v4u;
1708
+ }
1709
+ interface Mat2x2f {
1710
+ readonly type: 'mat2x2f';
1711
+ /** Type-token, not available at runtime */
1712
+ readonly '~repr': m2x2f;
1713
+ }
1714
+ interface Mat3x3f {
1715
+ readonly type: 'mat3x3f';
1716
+ /** Type-token, not available at runtime */
1717
+ readonly '~repr': m3x3f;
1718
+ }
1719
+ interface Mat4x4f {
1720
+ readonly type: 'mat4x4f';
1721
+ /** Type-token, not available at runtime */
1722
+ readonly '~repr': m4x4f;
1723
+ }
1724
+ interface WgslStruct<TProps extends Record<string, BaseWgslData> = Record<string, BaseWgslData>> {
1725
+ readonly type: 'struct';
1726
+ readonly label?: string | undefined;
1727
+ readonly propTypes: TProps;
1728
+ /** Type-token, not available at runtime */
1729
+ readonly '~repr': InferRecord<TProps>;
1730
+ }
1731
+ interface WgslArray<TElement = BaseWgslData> {
1732
+ readonly type: 'array';
1163
1733
  readonly elementCount: number;
1164
1734
  readonly elementType: TElement;
1735
+ /** Type-token, not available at runtime */
1165
1736
  readonly '~repr': Infer<TElement>[];
1166
1737
  }
1167
1738
  /**
1168
- * Struct schema constructed via `d.looseStruct` function.
1169
- *
1170
- * Useful for defining vertex buffers, as the standard layout restrictions do not apply.
1171
- * Members are not aligned in respect to their `byteAlignment`,
1172
- * unless they are explicitly decorated with the custom align attribute
1173
- * via `d.align` function.
1739
+ * Schema representing the `atomic<...>` WGSL data type.
1174
1740
  */
1175
- interface LooseStruct<TProps extends Record<string, BaseWgslData> = Record<string, BaseWgslData>> {
1176
- readonly type: 'loose-struct';
1177
- readonly propTypes: TProps;
1178
- readonly '~repr': InferRecord<TProps>;
1741
+ interface Atomic<TInner extends U32 | I32 = U32 | I32> {
1742
+ readonly type: 'atomic';
1743
+ readonly inner: TInner;
1744
+ /** Type-token, not available at runtime */
1745
+ readonly '~repr': Infer<TInner>;
1179
1746
  }
1180
- interface LooseDecorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends unknown[] = unknown[]> {
1181
- readonly type: 'loose-decorated';
1747
+ interface Align<T extends number> {
1748
+ readonly type: '@align';
1749
+ readonly value: T;
1750
+ }
1751
+ interface Size<T extends number> {
1752
+ readonly type: '@size';
1753
+ readonly value: T;
1754
+ }
1755
+ interface Location<T extends number> {
1756
+ readonly type: '@location';
1757
+ readonly value: T;
1758
+ }
1759
+ interface Builtin<T extends string> {
1760
+ readonly type: '@builtin';
1761
+ readonly value: T;
1762
+ }
1763
+ interface Decorated<TInner extends BaseWgslData = BaseWgslData, TAttribs extends unknown[] = unknown[]> {
1764
+ readonly type: 'decorated';
1182
1765
  readonly inner: TInner;
1183
1766
  readonly attribs: TAttribs;
1767
+ /** Type-token, not available at runtime */
1184
1768
  readonly '~repr': Infer<TInner>;
1185
1769
  }
1186
- declare const looseTypeLiterals: readonly ["loose-struct", "loose-array", "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"];
1187
- type LooseTypeLiteral = (typeof looseTypeLiterals)[number];
1188
- type AnyLooseData = LooseArray | LooseStruct | LooseDecorated | PackedData;
1189
- declare function isLooseData(data: unknown): data is AnyLooseData;
1770
+ 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"];
1771
+ type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
1772
+ 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;
1773
+ declare function isWgslData(value: unknown): value is AnyWgslData;
1190
1774
  /**
1191
- * Checks whether the passed in value is a loose-array schema,
1192
- * as opposed to, e.g., a regular array schema.
1775
+ * Checks whether passed in value is an array schema,
1776
+ * as opposed to, e.g., a disarray schema.
1193
1777
  *
1194
1778
  * Array schemas can be used to describe uniform and storage buffers,
1195
- * whereas looseArray schemas cannot. Loose arrays are useful for
1196
- * defining vertex buffers instead.
1779
+ * whereas disarray schemas cannot.
1197
1780
  *
1198
1781
  * @example
1199
- * isLooseArray(d.arrayOf(d.u32, 4)) // false
1200
- * isLooseArray(d.looseArrayOf(d.u32, 4)) // true
1201
- * isLooseArray(d.vec3f) // false
1782
+ * isWgslArray(d.arrayOf(d.u32, 4)) // true
1783
+ * isWgslArray(d.disarray(d.u32, 4)) // false
1784
+ * isWgslArray(d.vec3f) // false
1202
1785
  */
1203
- declare function isLooseArray<T extends LooseArray>(schema: T | unknown): schema is T;
1786
+ declare function isWgslArray<T extends WgslArray>(schema: T | unknown): schema is T;
1204
1787
  /**
1205
- * Checks whether passed in value is a looseStruct schema,
1206
- * as opposed to, e.g., a struct schema.
1788
+ * Checks whether passed in value is a struct schema,
1789
+ * as opposed to, e.g., an unstruct schema.
1207
1790
  *
1208
1791
  * Struct schemas can be used to describe uniform and storage buffers,
1209
- * whereas looseStruct schemas cannot. Loose structs are useful for
1210
- * defining vertex buffers instead.
1792
+ * whereas unstruct schemas cannot.
1211
1793
  *
1212
1794
  * @example
1213
- * isLooseStruct(d.struct({ a: d.u32 })) // false
1214
- * isLooseStruct(d.looseStruct({ a: d.u32 })) // true
1215
- * isLooseStruct(d.vec3f) // false
1216
- */
1217
- declare function isLooseStruct<T extends LooseStruct>(schema: T | unknown): schema is T;
1218
- declare function isLooseDecorated<T extends LooseDecorated>(value: T | unknown): value is T;
1219
- declare function isData(value: unknown): value is AnyData;
1220
- type AnyData = AnyWgslData | AnyLooseData;
1221
-
1222
- /**
1223
- * Strips schema types down to their most basic forms. (native -> exotic)
1224
- * This is used by schema constructors to be able to ingest native schemas (created by TypeGPU), and
1225
- * spit out a type that matches non-native schemas as well.
1226
- */
1227
- type Exotic<T> = T extends {
1228
- readonly '~exotic': infer TExotic;
1229
- } ? TExotic : T;
1230
- type ExoticRecord<T> = T extends Record<string | number | symbol, unknown> ? {
1231
- [Key in keyof T]: Exotic<T[Key]>;
1232
- } : T;
1233
-
1234
- /**
1235
- * Can be assigned a name. Not to be confused with
1236
- * being able to HAVE a name.
1237
- */
1238
- interface TgpuNamable {
1239
- $name(label?: string | undefined): this;
1240
- }
1241
-
1242
- type Default<T, TDefault> = unknown extends T ? TDefault : T extends undefined ? TDefault : T;
1243
- type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
1244
- type Prettify<T> = {
1245
- [K in keyof T]: T[K];
1246
- } & {};
1247
- /**
1248
- * Removes properties from record type that extend `Prop`
1795
+ * isWgslStruct(d.struct({ a: d.u32 })) // true
1796
+ * isWgslStruct(d.unstruct({ a: d.u32 })) // false
1797
+ * isWgslStruct(d.vec3f) // false
1249
1798
  */
1250
- type OmitProps<T extends Record<string, unknown>, Prop> = Pick<T, {
1251
- [Key in keyof T]: T[Key] extends Prop ? never : Key;
1252
- }[keyof T]>;
1799
+ declare function isWgslStruct<T extends WgslStruct>(schema: T | unknown): schema is T;
1253
1800
  /**
1254
- * The opposite of Readonly<T>
1801
+ * Checks whether the passed in value is an atomic schema.
1802
+ *
1803
+ * @example
1804
+ * isAtomic(d.atomic(d.u32)) // true
1805
+ * isAtomic(d.u32) // false
1255
1806
  */
1256
- type Mutable<T> = {
1257
- -readonly [P in keyof T]: T[P];
1258
- };
1807
+ declare function isAtomic<T extends Atomic<U32 | I32>>(schema: T | unknown): schema is T;
1808
+ declare function isAlignAttrib<T extends Align<number>>(value: unknown | T): value is T;
1809
+ declare function isSizeAttrib<T extends Size<number>>(value: unknown | T): value is T;
1810
+ declare function isLocationAttrib<T extends Location<number>>(value: unknown | T): value is T;
1811
+ declare function isBuiltinAttrib<T extends Builtin<string>>(value: unknown | T): value is T;
1812
+ declare function isDecorated<T extends Decorated>(value: unknown | T): value is T;
1259
1813
 
1260
- export { isBuiltinAttrib as $, type AnyData as A, type BaseWgslData as B, type Atomic as C, type Default as D, type Exotic as E, type F32 as F, bool as G, f32 as H, type Infer as I, f16 as J, i32 as K, type Location as L, type Mutable as M, u32 as N, type OmitProps as O, type Prettify as P, isWgslData as Q, isWgslArray as R, type Size as S, type TgpuNamable as T, type U32 as U, type Vec4f as V, type WgslTypeLiteral as W, isWgslStruct as X, isAtomic as Y, isDecorated as Z, isAlignAttrib as _, type I32 as a, float16x2 as a$, isLocationAttrib as a0, isSizeAttrib as a1, type Bool as a2, type F16 as a3, type Vec2f as a4, type Vec2h as a5, type Vec2i as a6, type Vec2u as a7, type Vec3f as a8, type Vec3h as a9, type TgpuVertexFormatData as aA, packedFormats as aB, uint8 as aC, uint8x2 as aD, uint8x4 as aE, sint8 as aF, sint8x2 as aG, sint8x4 as aH, unorm8 as aI, unorm8x2 as aJ, unorm8x4 as aK, snorm8 as aL, snorm8x2 as aM, snorm8x4 as aN, uint16 as aO, uint16x2 as aP, uint16x4 as aQ, sint16 as aR, sint16x2 as aS, sint16x4 as aT, unorm16 as aU, unorm16x2 as aV, unorm16x4 as aW, snorm16 as aX, snorm16x2 as aY, snorm16x4 as aZ, float16 as a_, type Vec3i as aa, type Vec4h 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, isLooseArray as au, isLooseStruct as av, isLooseDecorated as aw, isData as ax, isLooseData as ay, type FormatToWGSLType as az, type Vec4u as b, float16x4 as b0, float32 as b1, float32x2 as b2, float32x3 as b3, float32x4 as b4, uint32 as b5, uint32x2 as b6, uint32x3 as b7, uint32x4 as b8, sint32 as b9, sint32x2 as ba, sint32x3 as bb, sint32x4 as bc, unorm10_10_10_2 as bd, unorm8x4_bgra as be, type PackedData as bf, type Vec4i as c, type UnionToIntersection as d, type AnyWgslData as e, type Align as f, type Builtin as g, type Decorated as h, type LooseDecorated as i, type AnyLooseData as j, type LooseTypeLiteral as k, type WgslArray as l, type Vec3u as m, type WgslStruct as n, type ExoticRecord as o, type LooseArray as p, type LooseStruct as q, type m2x2f as r, type m3x3f as s, type m4x4f as t, type Mat2x2f as u, type v2f as v, type Mat3x3f as w, type v3f as x, type Mat4x4f as y, type v4f as z };
1814
+ export { type v2f as $, type AnyData as A, type TgpuLayoutTexture as B, type TgpuLayoutStorage as C, type TgpuLayoutStorageTexture as D, type Exotic as E, type TgpuLayoutExternalTexture as F, type TgpuLayoutUniform as G, type BindLayoutEntry as H, type Infer as I, type BaseWgslData as J, type TgpuNamable as K, type LayoutEntryToInput as L, type ExoticRecord as M, type WgslArray as N, type OmitProps as O, type Prettify as P, type Disarray as Q, type Unstruct as R, Storage as S, type TgpuBuffer as T, type Unwrapper as U, Vertex as V, type WgslStruct as W, type m2x2f as X, type m3x3f as Y, type m4x4f as Z, type Mat2x2f as _, type TgpuLayoutEntry as a, isDisarray as a$, type Mat3x3f as a0, type v3f as a1, type Mat4x4f as a2, type v4f as a3, type U32 as a4, type I32 as a5, type Atomic as a6, type Align as a7, type Size as a8, type Location as a9, type Vec2h as aA, type Vec2i as aB, type Vec2u as aC, type Vec3f as aD, type Vec3h as aE, type Vec3i as aF, type Vec4h as aG, type Vec4i as aH, type Vec4u as aI, type v2i as aJ, type v2u as aK, type v3i as aL, type v3u as aM, type v4i as aN, type v4u as aO, vec2f as aP, vec2h as aQ, vec2i as aR, vec2u as aS, vec3f as aT, vec3h as aU, vec3i as aV, vec3u as aW, vec4f as aX, vec4h as aY, vec4i as aZ, vec4u as a_, type Builtin as aa, type Decorated as ab, type LooseDecorated as ac, type AnyLooseData as ad, type WgslTypeLiteral as ae, type LooseTypeLiteral as af, type Vec4f as ag, type F32 as ah, type Vec3u as ai, bool as aj, f32 as ak, f16 as al, i32 as am, u32 as an, isWgslData as ao, isWgslArray as ap, isWgslStruct as aq, isAtomic as ar, isDecorated as as, isAlignAttrib as at, isBuiltinAttrib as au, isLocationAttrib as av, isSizeAttrib as aw, type Bool as ax, type F16 as ay, type Vec2f as az, type TgpuBindGroupLayout as b, isUnstruct as b0, isLooseDecorated as b1, isData as b2, isLooseData as b3, type FormatToWGSLType as b4, type TgpuVertexFormatData as b5, packedFormats as b6, uint8 as b7, uint8x2 as b8, uint8x4 as b9, float32x3 as bA, float32x4 as bB, uint32 as bC, uint32x2 as bD, uint32x3 as bE, uint32x4 as bF, sint32 as bG, sint32x2 as bH, sint32x3 as bI, sint32x4 as bJ, unorm10_10_10_2 as bK, unorm8x4_bgra as bL, type PackedData as bM, sint8 as ba, sint8x2 as bb, sint8x4 as bc, unorm8 as bd, unorm8x2 as be, unorm8x4 as bf, snorm8 as bg, snorm8x2 as bh, snorm8x4 as bi, uint16 as bj, uint16x2 as bk, uint16x4 as bl, sint16 as bm, sint16x2 as bn, sint16x4 as bo, unorm16 as bp, unorm16x2 as bq, unorm16x4 as br, snorm16 as bs, snorm16x2 as bt, snorm16x4 as bu, float16 as bv, float16x2 as bw, float16x4 as bx, float32 as by, float32x2 as bz, type TgpuBindGroup as c, type TgpuResolvable as d, type AnyWgslData as e, type TgpuBufferMutable as f, type TgpuBufferReadonly as g, type TgpuBufferUniform as h, bindGroupLayout as i, isBuffer as j, isUsableAsUniform as k, isUsableAsVertex as l, isSampler as m, isComparisonSampler as n, isSampledTextureView as o, isStorageTextureView as p, isUsableAsStorage as q, Uniform as r, type TgpuTexture as s, type TgpuReadonlyTexture as t, type TgpuWriteonlyTexture as u, type TgpuMutableTexture as v, type TgpuSampledTexture as w, type TgpuAnyTextureView as x, type TgpuSampler as y, type TgpuLayoutSampler as z };