typegpu 0.3.0-alpha.7 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
package/index.d.ts CHANGED
@@ -1,6 +1,73 @@
1
- import { U as Unwrapper, A as AnyData, I as Infer, E as Exotic, T as TgpuBuffer$1, a as TgpuLayoutEntry, b as TgpuBindGroupLayout, O as OmitProps, L as LayoutEntryToInput, c as TgpuBindGroup, d as TgpuResolvable, e as AnyWgslData, f as TgpuBufferMutable$1, g as TgpuBufferReadonly$1, h as TgpuBufferUniform$1, i as bindGroupLayout } from './wgslTypes-BsqIvRBG.js';
2
- export { H as BindLayoutEntry, S as Storage, x as TgpuAnyTextureView, F as TgpuLayoutExternalTexture, z as TgpuLayoutSampler, C as TgpuLayoutStorage, D as TgpuLayoutStorageTexture, B as TgpuLayoutTexture, G as TgpuLayoutUniform, v as TgpuMutableTexture, t as TgpuReadonlyTexture, w as TgpuSampledTexture, y as TgpuSampler, s as TgpuTexture, u as TgpuWriteonlyTexture, r as Uniform, V as Vertex, j as isBuffer, n as isComparisonSampler, o as isSampledTextureView, m as isSampler, p as isStorageTextureView, q as isUsableAsStorage, k as isUsableAsUniform, l as isUsableAsVertex } from './wgslTypes-BsqIvRBG.js';
1
+ import { A as AnyWgslData, I as Infer, D as Decorated, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, B as BaseWgslData, L as Location, W as WgslArray, n as WgslStruct, o as WgslTypeLiteral, p as AnyVecInstance, q as AnyMatInstance } from './vector-BSez01sn.js';
2
+ import { T as TgpuNamable, E as Exotic, A as AnyBuiltin, a as AnyAttribute, D as Default, U as UnionToIntersection, b as AnyData, c as Decorate, d as TgpuStruct, I as IsBuiltin, H as HasCustomLocation, O as OmitBuiltins, e as Disarray, K as KindToAcceptedAttribMap, f as Unstruct, V as VertexFormat, g as TgpuVertexAttrib, h as KindToDefaultFormatMap, i as OmitProps, P as Prettify, M as Mutable, j as Infer$1, k as ExoticArray } from './index-BM7ZTN7E.js';
3
3
  import * as smol from 'tinyest';
4
+ import { Block } from 'tinyest';
5
+
6
+ interface TgpuConst<TDataType extends AnyWgslData = AnyWgslData> extends TgpuNamable {
7
+ readonly dataType: TDataType;
8
+ readonly value: Infer<TDataType>;
9
+ }
10
+ /**
11
+ * Creates a module constant with specified value.
12
+ */
13
+ declare function constant<TDataType extends AnyWgslData>(dataType: Exotic<TDataType>, value: Infer<Exotic<TDataType>>): TgpuConst<Exotic<TDataType>>;
14
+
15
+ /**
16
+ * Extra declaration that shall be included in final WGSL code,
17
+ * when resolving objects that use it.
18
+ */
19
+ interface TgpuDeclare {
20
+ $uses(dependencyMap: Record<string, unknown>): this;
21
+ }
22
+ /**
23
+ * Allows defining extra declarations that shall be included in the final WGSL code,
24
+ * when resolving objects that use them.
25
+ *
26
+ * Using this API is generally discouraged, as it shouldn't be necessary in any common scenario.
27
+ * It was developed to ensure full compatibility of TypeGPU programs with current and future versions of WGSL.
28
+ */
29
+ declare function declare(declaration: string): TgpuDeclare;
30
+
31
+ /**
32
+ * Describes a compute entry function signature (its arguments and return type)
33
+ */
34
+ interface TgpuComputeFnShell {
35
+ readonly argTypes: [];
36
+ readonly returnType: undefined;
37
+ readonly workgroupSize: [number, number, number];
38
+ /**
39
+ * Creates a type-safe implementation of this signature
40
+ */
41
+ does(implementation: () => undefined): TgpuComputeFn;
42
+ /**
43
+ * @param implementation
44
+ * Raw WGSL function implementation with header and body
45
+ * without `fn` keyword and function name
46
+ * e.g. `"(x: f32) -> f32 { return x; }"`;
47
+ */
48
+ does(implementation: string): TgpuComputeFn;
49
+ }
50
+ interface TgpuComputeFn extends TgpuNamable {
51
+ readonly shell: TgpuComputeFnShell;
52
+ $uses(dependencyMap: Record<string, unknown>): this;
53
+ }
54
+ interface ComputeFnOptions {
55
+ workgroupSize: number[];
56
+ }
57
+ /**
58
+ * Creates a shell of a typed entry function for the compute shader stage. Any function
59
+ * that implements this shell can perform general-purpose computation.
60
+ *
61
+ * @param workgroupSize
62
+ * Size of blocks that the thread grid will be divided into (up to 3 dimensions).
63
+ */
64
+ declare function computeFn(argTypes: AnyBuiltin[], options: ComputeFnOptions): TgpuComputeFnShell;
65
+
66
+ interface Storage {
67
+ usableAsStorage: true;
68
+ }
69
+ declare const Storage: Storage;
70
+ declare function isUsableAsStorage<T>(value: T): value is T & Storage;
4
71
 
5
72
  /**
6
73
  * Information extracted from transpiling a JS function.
@@ -14,6 +81,27 @@ type TranspilationResult = {
14
81
  */
15
82
  externalNames: string[];
16
83
  };
84
+ type InferArgs<T extends unknown[]> = {
85
+ [Idx in keyof T]: Infer<T[Idx]>;
86
+ };
87
+ type InferReturn<T> = T extends undefined ? void : Infer<T>;
88
+ type BaseIOData = F32 | F16 | I32 | U32 | Vec2f | Vec3f | Vec4f | Vec2h | Vec3h | Vec4h | Vec2i | Vec3i | Vec4i | Vec2u | Vec3u | Vec4u;
89
+ type IOData = BaseIOData | Decorated<BaseIOData, AnyAttribute[]>;
90
+ type IORecord<TElementType extends IOData = IOData> = Record<string, TElementType>;
91
+ /**
92
+ * Used for I/O definitions of entry functions.
93
+ */
94
+ type IOLayout<TElementType extends IOData = IOData> = TElementType | IORecord<TElementType>;
95
+ type InferIO<T> = T extends {
96
+ type: string;
97
+ } ? Infer<T> : T extends Record<string, unknown> ? {
98
+ [K in keyof T]: Infer<T[K]>;
99
+ } : T;
100
+ type ExoticIO<T> = T extends {
101
+ type: string;
102
+ } ? Exotic<T> : T extends Record<string, unknown> ? {
103
+ [K in keyof T]: Exotic<T[K]>;
104
+ } : T;
17
105
 
18
106
  /**
19
107
  * Used to transpile JS resources into SMoL on demand.
@@ -22,32 +110,1052 @@ interface JitTranspiler {
22
110
  transpileFn(rawJs: string): TranspilationResult;
23
111
  }
24
112
 
113
+ interface NameRegistry {
114
+ /**
115
+ * Creates a valid WGSL identifier, each guaranteed to be unique
116
+ * in the lifetime of a single resolution process.
117
+ * @param primer Used in the generation process, makes the identifier more recognizable.
118
+ */
119
+ makeUnique(primer?: string): string;
120
+ }
121
+ declare class RandomNameRegistry implements NameRegistry {
122
+ private lastUniqueId;
123
+ makeUnique(primer?: string | undefined): string;
124
+ }
125
+ declare class StrictNameRegistry implements NameRegistry {
126
+ /**
127
+ * Allows to provide a good fallback for instances of the
128
+ * same function that are bound to different slot values.
129
+ */
130
+ private readonly _usedNames;
131
+ makeUnique(primer?: string | undefined): string;
132
+ }
133
+
134
+ interface TgpuSlot<T> extends TgpuNamable, Labelled {
135
+ readonly resourceType: 'slot';
136
+ readonly defaultValue: T | undefined;
137
+ /**
138
+ * Used to determine if code generated using either value `a` or `b` in place
139
+ * of the slot will be equivalent. Defaults to `Object.is`.
140
+ */
141
+ areEqual(a: T, b: T): boolean;
142
+ readonly value: Infer<T>;
143
+ }
144
+ interface TgpuDerived<T> {
145
+ readonly resourceType: 'derived';
146
+ readonly value: Infer<T>;
147
+ with<TValue>(slot: TgpuSlot<TValue>, value: Eventual<TValue>): TgpuDerived<T>;
148
+ /**
149
+ * @internal
150
+ */
151
+ '~compute'(): T;
152
+ }
153
+ interface TgpuAccessor<T extends AnyWgslData = AnyWgslData> extends TgpuNamable, Labelled {
154
+ readonly resourceType: 'accessor';
155
+ readonly schema: T;
156
+ readonly defaultValue: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T> | undefined;
157
+ readonly slot: TgpuSlot<TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>>;
158
+ readonly value: Infer<T>;
159
+ }
160
+ /**
161
+ * Represents a value that is available at resolution time.
162
+ */
163
+ type Eventual<T> = T | TgpuSlot<T> | TgpuDerived<T>;
164
+ type SlotValuePair<T = unknown> = [TgpuSlot<T>, T];
165
+ declare function isSlot<T>(value: unknown | TgpuSlot<T>): value is TgpuSlot<T>;
166
+ declare function isDerived<T extends TgpuDerived<unknown>>(value: T | unknown): value is T;
167
+
168
+ interface TgpuComputePipeline extends TgpuNamable {
169
+ readonly resourceType: 'compute-pipeline';
170
+ readonly label: string | undefined;
171
+ with(bindGroupLayout: TgpuBindGroupLayout, bindGroup: TgpuBindGroup): TgpuComputePipeline;
172
+ dispatchWorkgroups(x: number, y?: number | undefined, z?: number | undefined): void;
173
+ }
174
+
175
+ type TextureProps = {
176
+ size: readonly number[];
177
+ format: GPUTextureFormat;
178
+ viewFormats?: GPUTextureFormat[] | undefined;
179
+ dimension?: GPUTextureDimension | undefined;
180
+ mipLevelCount?: number | undefined;
181
+ sampleCount?: number | undefined;
182
+ };
183
+
184
+ declare const texelFormatToChannelType: {
185
+ r8unorm: F32;
186
+ r8snorm: F32;
187
+ r8uint: U32;
188
+ r8sint: I32;
189
+ r16uint: U32;
190
+ r16sint: I32;
191
+ r16float: F32;
192
+ rg8unorm: F32;
193
+ rg8snorm: F32;
194
+ rg8uint: U32;
195
+ rg8sint: I32;
196
+ r32uint: U32;
197
+ r32sint: I32;
198
+ r32float: F32;
199
+ rg16uint: U32;
200
+ rg16sint: I32;
201
+ rg16float: F32;
202
+ rgba8unorm: F32;
203
+ 'rgba8unorm-srgb': F32;
204
+ rgba8snorm: F32;
205
+ rgba8uint: U32;
206
+ rgba8sint: I32;
207
+ bgra8unorm: F32;
208
+ 'bgra8unorm-srgb': F32;
209
+ rgb9e5ufloat: F32;
210
+ rgb10a2uint: U32;
211
+ rgb10a2unorm: F32;
212
+ rg11b10ufloat: F32;
213
+ rg32uint: U32;
214
+ rg32sint: I32;
215
+ rg32float: F32;
216
+ rgba16uint: U32;
217
+ rgba16sint: I32;
218
+ rgba16float: F32;
219
+ rgba32uint: U32;
220
+ rgba32sint: I32;
221
+ rgba32float: F32;
222
+ stencil8: F32;
223
+ depth16unorm: F32;
224
+ depth24plus: F32;
225
+ 'depth24plus-stencil8': F32;
226
+ depth32float: F32;
227
+ 'depth32float-stencil8': F32;
228
+ 'bc1-rgba-unorm': F32;
229
+ 'bc1-rgba-unorm-srgb': F32;
230
+ 'bc2-rgba-unorm': F32;
231
+ 'bc2-rgba-unorm-srgb': F32;
232
+ 'bc3-rgba-unorm': F32;
233
+ 'bc3-rgba-unorm-srgb': F32;
234
+ 'bc4-r-unorm': F32;
235
+ 'bc4-r-snorm': F32;
236
+ 'bc5-rg-unorm': F32;
237
+ 'bc5-rg-snorm': F32;
238
+ 'bc6h-rgb-ufloat': F32;
239
+ 'bc6h-rgb-float': F32;
240
+ 'bc7-rgba-unorm': F32;
241
+ 'bc7-rgba-unorm-srgb': F32;
242
+ 'etc2-rgb8unorm': F32;
243
+ 'etc2-rgb8unorm-srgb': F32;
244
+ 'etc2-rgb8a1unorm': F32;
245
+ 'etc2-rgb8a1unorm-srgb': F32;
246
+ 'etc2-rgba8unorm': F32;
247
+ 'etc2-rgba8unorm-srgb': F32;
248
+ 'eac-r11unorm': F32;
249
+ 'eac-r11snorm': F32;
250
+ 'eac-rg11unorm': F32;
251
+ 'eac-rg11snorm': F32;
252
+ 'astc-4x4-unorm': F32;
253
+ 'astc-4x4-unorm-srgb': F32;
254
+ 'astc-5x4-unorm': F32;
255
+ 'astc-5x4-unorm-srgb': F32;
256
+ 'astc-5x5-unorm': F32;
257
+ 'astc-5x5-unorm-srgb': F32;
258
+ 'astc-6x5-unorm': F32;
259
+ 'astc-6x5-unorm-srgb': F32;
260
+ 'astc-6x6-unorm': F32;
261
+ 'astc-6x6-unorm-srgb': F32;
262
+ 'astc-8x5-unorm': F32;
263
+ 'astc-8x5-unorm-srgb': F32;
264
+ 'astc-8x6-unorm': F32;
265
+ 'astc-8x6-unorm-srgb': F32;
266
+ 'astc-8x8-unorm': F32;
267
+ 'astc-8x8-unorm-srgb': F32;
268
+ 'astc-10x5-unorm': F32;
269
+ 'astc-10x5-unorm-srgb': F32;
270
+ 'astc-10x6-unorm': F32;
271
+ 'astc-10x6-unorm-srgb': F32;
272
+ 'astc-10x8-unorm': F32;
273
+ 'astc-10x8-unorm-srgb': F32;
274
+ 'astc-10x10-unorm': F32;
275
+ 'astc-10x10-unorm-srgb': F32;
276
+ 'astc-12x10-unorm': F32;
277
+ 'astc-12x10-unorm-srgb': F32;
278
+ 'astc-12x12-unorm': F32;
279
+ 'astc-12x12-unorm-srgb': F32;
280
+ };
281
+ type TexelFormatToChannelType = typeof texelFormatToChannelType;
282
+ type TexelFormatToStringChannels = {
283
+ [Key in keyof TexelFormatToChannelType]: TexelFormatToChannelType[Key]['type'];
284
+ };
285
+ type KeysWithValue<T extends Record<string, unknown>, TValue> = keyof {
286
+ [Key in keyof T as T[Key] extends TValue ? Key : never]: Key;
287
+ };
288
+ type ChannelTypeToLegalFormats = {
289
+ [Key in TexelFormatToChannelType[keyof TexelFormatToChannelType]['type']]: KeysWithValue<TexelFormatToStringChannels, Key>;
290
+ };
291
+ type SampleTypeToStringChannelType = {
292
+ float: 'f32';
293
+ 'unfilterable-float': 'f32';
294
+ depth: 'f32';
295
+ sint: 'i32';
296
+ uint: 'u32';
297
+ };
298
+ type ViewDimensionToDimension = {
299
+ '1d': '1d';
300
+ '2d': '2d';
301
+ '2d-array': '2d';
302
+ '3d': '3d';
303
+ cube: '2d';
304
+ 'cube-array': '2d';
305
+ };
306
+ /**
307
+ * https://www.w3.org/TR/WGSL/#storage-texel-formats
308
+ */
309
+ type StorageTextureTexelFormat = 'rgba8unorm' | 'rgba8snorm' | 'rgba8uint' | 'rgba8sint' | 'rgba16uint' | 'rgba16sint' | 'rgba16float' | 'r32uint' | 'r32sint' | 'r32float' | 'rg32uint' | 'rg32sint' | 'rg32float' | 'rgba32uint' | 'rgba32sint' | 'rgba32float' | 'bgra8unorm';
310
+ declare const texelFormatToDataType: {
311
+ readonly rgba8unorm: Vec4f;
312
+ readonly rgba8snorm: Vec4f;
313
+ readonly rgba8uint: Vec4u;
314
+ readonly rgba8sint: Vec4i;
315
+ readonly rgba16uint: Vec4u;
316
+ readonly rgba16sint: Vec4i;
317
+ readonly rgba16float: Vec4f;
318
+ readonly r32uint: Vec4u;
319
+ readonly r32sint: Vec4i;
320
+ readonly r32float: Vec4f;
321
+ readonly rg32uint: Vec4u;
322
+ readonly rg32sint: Vec4i;
323
+ readonly rg32float: Vec4f;
324
+ readonly rgba32uint: Vec4u;
325
+ readonly rgba32sint: Vec4i;
326
+ readonly rgba32float: Vec4f;
327
+ readonly bgra8unorm: Vec4f;
328
+ };
329
+ declare const channelFormatToSchema: {
330
+ float: F32;
331
+ 'unfilterable-float': F32;
332
+ uint: U32;
333
+ sint: I32;
334
+ depth: F32;
335
+ };
336
+ type ChannelFormatToSchema = typeof channelFormatToSchema;
337
+ type TexelFormatToDataType = typeof texelFormatToDataType;
338
+ type TexelFormatToDataTypeOrNever<T> = T extends keyof TexelFormatToDataType ? TexelFormatToDataType[T] : never;
339
+ /**
340
+ * Represents what formats a storage view can choose from based on its owner texture's props.
341
+ */
342
+ type StorageFormatOptions<TProps extends TextureProps> = Extract<TProps['format'] | Default<TProps['viewFormats'], []>[number], StorageTextureTexelFormat>;
343
+ /**
344
+ * Represents what formats a sampled view can choose from based on its owner texture's props.
345
+ */
346
+ type SampledFormatOptions<TProps extends TextureProps> = TProps['format'] | Default<TProps['viewFormats'], []>[number];
347
+
348
+ interface Sampled {
349
+ usableAsSampled: true;
350
+ }
351
+ interface Render {
352
+ usableAsRender: true;
353
+ }
354
+ type LiteralToExtensionMap = {
355
+ storage: Storage;
356
+ sampled: Sampled;
357
+ render: Render;
358
+ };
359
+ type AllowedUsages<TProps extends TextureProps> = 'sampled' | 'render' | (TProps['format'] extends StorageTextureTexelFormat ? 'storage' : never);
360
+ declare function isUsableAsSampled<T>(value: T): value is T & Sampled;
361
+ declare function isUsableAsRender<T>(value: T): value is T & Render;
362
+
363
+ type ResolveStorageDimension<TDimension extends GPUTextureViewDimension, TProps extends TextureProps> = StorageTextureDimension extends TDimension ? Default<TProps['dimension'], '2d'> : TDimension extends StorageTextureDimension ? TDimension : '2d';
364
+ 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';
365
+ type ChannelData = U32 | I32 | F32;
366
+ type TexelData = Vec4u | Vec4i | Vec4f;
367
+ /**
368
+ * @param TProps all properties that distinguish this texture apart from other textures on the type level.
369
+ */
370
+ interface TgpuTexture<TProps extends TextureProps = TextureProps> extends TgpuNamable {
371
+ readonly resourceType: 'texture';
372
+ readonly props: TProps;
373
+ readonly label: string | undefined;
374
+ readonly usableAsStorage: boolean;
375
+ readonly usableAsSampled: boolean;
376
+ readonly usableAsRender: boolean;
377
+ $usage<T extends AllowedUsages<TProps>[]>(...usages: T): this & UnionToIntersection<LiteralToExtensionMap[T[number]]>;
378
+ 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>): {
379
+ mutable: TgpuMutableTexture<ResolveStorageDimension<TDimension, TProps>, TexelFormatToDataTypeOrNever<StorageFormatOptions<TProps> extends TFormat ? TProps['format'] : TFormat>>;
380
+ readonly: TgpuReadonlyTexture<ResolveStorageDimension<TDimension, TProps>, TexelFormatToDataTypeOrNever<StorageFormatOptions<TProps> extends TFormat ? TProps['format'] : TFormat>>;
381
+ writeonly: TgpuWriteonlyTexture<ResolveStorageDimension<TDimension, TProps>, TexelFormatToDataTypeOrNever<StorageFormatOptions<TProps> extends TFormat ? TProps['format'] : TFormat>>;
382
+ sampled: TgpuSampledTexture<GPUTextureViewDimension extends TDimension ? Default<TProps['dimension'], '2d'> : TDimension, TexelFormatToChannelType[SampledFormatOptions<TProps> extends TFormat ? TProps['format'] : TFormat]>;
383
+ }[TUsage];
384
+ destroy(): void;
385
+ }
386
+ type StorageTextureAccess = 'readonly' | 'writeonly' | 'mutable';
387
+ /**
388
+ * Based on @see GPUTextureViewDimension
389
+ * https://www.w3.org/TR/WGSL/#texture-depth
390
+ */
391
+ type StorageTextureDimension = '1d' | '2d' | '2d-array' | '3d';
392
+ type TextureViewParams<TDimension extends GPUTextureViewDimension | undefined, TFormat extends GPUTextureFormat | undefined> = {
393
+ format?: TFormat;
394
+ dimension?: TDimension;
395
+ aspect?: GPUTextureAspect;
396
+ baseMipLevel?: number;
397
+ mipLevelCount?: number;
398
+ baseArrayLayout?: number;
399
+ arrayLayerCount?: number;
400
+ };
401
+ interface TgpuStorageTexture<TDimension extends StorageTextureDimension = StorageTextureDimension, TData extends TexelData = TexelData> {
402
+ readonly resourceType: 'texture-storage-view';
403
+ readonly dimension: TDimension;
404
+ readonly texelDataType: TData;
405
+ readonly access: StorageTextureAccess;
406
+ }
407
+ /**
408
+ * A texture accessed as "readonly" storage on the GPU.
409
+ */
410
+ interface TgpuReadonlyTexture<TDimension extends StorageTextureDimension = StorageTextureDimension, TData extends TexelData = TexelData> extends TgpuStorageTexture<TDimension, TData> {
411
+ readonly access: 'readonly';
412
+ }
413
+ /**
414
+ * A texture accessed as "writeonly" storage on the GPU.
415
+ */
416
+ interface TgpuWriteonlyTexture<TDimension extends StorageTextureDimension = StorageTextureDimension, TData extends TexelData = TexelData> extends TgpuStorageTexture<TDimension, TData> {
417
+ readonly access: 'writeonly';
418
+ }
419
+ /**
420
+ * A texture accessed as "mutable" (or read_write) storage on the GPU.
421
+ */
422
+ interface TgpuMutableTexture<TDimension extends StorageTextureDimension = StorageTextureDimension, TData extends TexelData = TexelData> extends TgpuStorageTexture<TDimension, TData> {
423
+ readonly access: 'mutable';
424
+ }
425
+ /**
426
+ * A texture accessed as sampled on the GPU.
427
+ */
428
+ interface TgpuSampledTexture<TDimension extends GPUTextureViewDimension = GPUTextureViewDimension, TData extends ChannelData = ChannelData> {
429
+ readonly resourceType: 'texture-sampled-view';
430
+ readonly dimension: TDimension;
431
+ readonly channelDataType: TData;
432
+ }
433
+ declare function isTexture<T extends TgpuTexture>(value: unknown | T): value is T;
434
+ declare function isStorageTextureView<T extends TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture>(value: unknown | T): value is T;
435
+ declare function isSampledTextureView<T extends TgpuSampledTexture>(value: unknown | T): value is T;
436
+ type TgpuAnyTextureView = TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture | TgpuSampledTexture;
437
+
438
+ interface Unwrapper {
439
+ readonly device: GPUDevice;
440
+ unwrap(resource: TgpuComputePipeline): GPUComputePipeline;
441
+ unwrap(resource: TgpuBindGroupLayout): GPUBindGroupLayout;
442
+ unwrap(resource: TgpuBindGroup): GPUBindGroup;
443
+ unwrap(resource: TgpuBuffer$1<AnyData>): GPUBuffer;
444
+ unwrap(resource: TgpuTexture): GPUTexture;
445
+ unwrap(resource: TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture | TgpuSampledTexture): GPUTextureView;
446
+ }
447
+
448
+ type WithLocations<T extends IORecord> = {
449
+ [Key in keyof T]: IsBuiltin<T[Key]> extends true ? T[Key] : HasCustomLocation<T[Key]> extends true ? T[Key] : Decorate<T[Key], Location<number>>;
450
+ };
451
+ type IOLayoutToOutputSchema<T extends IOLayout> = T extends BaseWgslData ? Decorate<T, Location<0>> : T extends IORecord ? TgpuStruct<WithLocations<T>> : never;
452
+
453
+ /**
454
+ * Describes a fragment entry function signature (its arguments and return type)
455
+ */
456
+ interface TgpuFragmentFnShell<FragmentIn extends IOLayout, FragmentOut extends IOLayout<Vec4f>> {
457
+ readonly argTypes: [FragmentIn];
458
+ readonly returnType: FragmentOut;
459
+ /**
460
+ * Creates a type-safe implementation of this signature
461
+ */
462
+ does(implementation: (input: InferIO<FragmentIn>) => InferIO<FragmentOut>): TgpuFragmentFn<OmitBuiltins<FragmentIn>, OmitBuiltins<FragmentOut>>;
463
+ /**
464
+ * @param implementation
465
+ * Raw WGSL function implementation with header and body
466
+ * without `fn` keyword and function name
467
+ * e.g. `"(x: f32) -> f32 { return x; }"`;
468
+ */
469
+ does(implementation: string): TgpuFragmentFn<OmitBuiltins<FragmentIn>, OmitBuiltins<FragmentOut>>;
470
+ }
471
+ interface TgpuFragmentFn<Varying extends IOLayout = IOLayout, Output extends IOLayout<Vec4f> = IOLayout<Vec4f>> extends TgpuNamable {
472
+ readonly shell: TgpuFragmentFnShell<Varying, Output>;
473
+ readonly outputType: IOLayoutToOutputSchema<Output>;
474
+ $uses(dependencyMap: Record<string, unknown>): this;
475
+ }
476
+ /**
477
+ * Creates a shell of a typed entry function for the fragment shader stage. Any function
478
+ * that implements this shell can run for each fragment (pixel), allowing the inner code
479
+ * to process information received from the vertex shader stage and builtins to determine
480
+ * the final color of the pixel (many pixels in case of multiple targets).
481
+ *
482
+ * @param inputType
483
+ * Values computed in the vertex stage and builtins to be made available to functions that implement this shell.
484
+ * @param outputType
485
+ * A `vec4f`, signaling this function outputs a color for one target, or a struct/array containing
486
+ * colors for multiple targets.
487
+ */
488
+ declare function fragmentFn<FragmentIn extends IORecord, FragmentOut extends IOLayout<Vec4f>>(inputType: FragmentIn, outputType: FragmentOut): TgpuFragmentFnShell<ExoticIO<FragmentIn>, ExoticIO<FragmentOut>>;
489
+
490
+ /**
491
+ * Describes a vertex entry function signature (its arguments and return type)
492
+ */
493
+ interface TgpuVertexFnShell<VertexIn extends IOLayout, VertexOut extends IOLayout> {
494
+ readonly argTypes: [VertexIn];
495
+ readonly returnType: VertexOut;
496
+ /**
497
+ * Creates a type-safe implementation of this signature
498
+ */
499
+ does(implementation: (input: InferIO<VertexIn>) => InferIO<VertexOut>): TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>;
500
+ /**
501
+ * @param implementation
502
+ * Raw WGSL function implementation with header and body
503
+ * without `fn` keyword and function name
504
+ * e.g. `"(x: f32) -> f32 { return x; }"`;
505
+ */
506
+ does(implementation: string): TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>;
507
+ }
508
+ interface TgpuVertexFn<VertexIn extends IOLayout = IOLayout, VertexOut extends IOLayout = IOLayout> extends TgpuNamable {
509
+ readonly shell: TgpuVertexFnShell<VertexIn, VertexOut>;
510
+ readonly outputType: IOLayoutToOutputSchema<VertexOut>;
511
+ $uses(dependencyMap: Record<string, unknown>): this;
512
+ }
513
+ /**
514
+ * Creates a shell of a typed entry function for the vertex shader stage. Any function
515
+ * that implements this shell can run for each vertex, allowing the inner code to process
516
+ * attributes and determine the final position of the vertex.
517
+ *
518
+ * @param inputType
519
+ * Vertex attributes and builtins to be made available to functions that implement this shell.
520
+ * @param outputType
521
+ * A struct type containing the final position of the vertex, and any information
522
+ * passed onto the fragment shader stage.
523
+ */
524
+ declare function vertexFn<VertexIn extends IOLayout, VertexOut extends IORecord>(inputType: VertexIn, outputType: VertexOut): TgpuVertexFnShell<ExoticIO<VertexIn>, ExoticIO<VertexOut>>;
525
+
526
+ /**
527
+ * The array can hold T, where T is a single/multi-component numeric, or a struct with members of type T.
528
+ * Examples of valid array members:
529
+ * - Vec3f,
530
+ * - unorm8x2
531
+ * - TgpuStruct<{ a: Vec3f, b: unorm8x2 }>
532
+ * - TgpuStruct<{ nested: TgpuStruct<{ a: Vec3f }> }>
533
+ */
534
+ type DataToContainedAttribs<T> = T extends WgslStruct | Unstruct ? {
535
+ [Key in keyof T['propTypes']]: DataToContainedAttribs<T['propTypes'][Key]>;
536
+ } : T extends {
537
+ type: VertexFormat;
538
+ } ? TgpuVertexAttrib<T['type']> : T extends {
539
+ type: keyof KindToDefaultFormatMap;
540
+ } ? TgpuVertexAttrib<KindToDefaultFormatMap[T['type']]> : never;
541
+ /**
542
+ * Interprets an array as a set of vertex attributes.
543
+ */
544
+ type ArrayToContainedAttribs<T extends WgslArray | Disarray> = DataToContainedAttribs<T['elementType']>;
545
+ type LayoutToAllowedAttribs<T> = T extends {
546
+ type: keyof KindToAcceptedAttribMap;
547
+ } ? KindToAcceptedAttribMap[T['type']] : T extends Record<string, unknown> ? {
548
+ [Key in keyof T]: LayoutToAllowedAttribs<T[Key]>;
549
+ } : never;
550
+
551
+ interface TgpuVertexLayout<TData extends WgslArray | Disarray = WgslArray | Disarray> extends TgpuNamable, Labelled {
552
+ readonly resourceType: 'vertex-layout';
553
+ readonly stride: number;
554
+ readonly stepMode: 'vertex' | 'instance';
555
+ readonly attrib: ArrayToContainedAttribs<TData>;
556
+ schemaForCount(n: number): TData;
557
+ }
558
+ declare function vertexLayout<TData extends WgslArray | Disarray>(schemaForCount: (count: number) => TData, stepMode?: 'vertex' | 'instance'): TgpuVertexLayout<ExoticIO<TData>>;
559
+
560
+ interface TgpuRenderPipeline<Output extends IOLayout = IOLayout> extends TgpuNamable {
561
+ readonly resourceType: 'render-pipeline';
562
+ readonly label: string | undefined;
563
+ with<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: TgpuBuffer$1<TData> & Vertex): TgpuRenderPipeline<IOLayout>;
564
+ with<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries>): TgpuRenderPipeline<IOLayout>;
565
+ withColorAttachment(attachment: FragmentOutToColorAttachment<Output>): TgpuRenderPipeline<IOLayout>;
566
+ draw(vertexCount: number, instanceCount?: number, firstVertex?: number, firstInstance?: number): void;
567
+ }
568
+ type FragmentOutToTargets<T extends IOLayout> = T extends IOData ? GPUColorTargetState : T extends Record<string, unknown> ? {
569
+ [Key in keyof T]: GPUColorTargetState;
570
+ } : never;
571
+ type FragmentOutToColorAttachment<T extends IOLayout> = T extends IOData ? ColorAttachment : T extends Record<string, unknown> ? {
572
+ [Key in keyof T]: ColorAttachment;
573
+ } : never;
574
+ interface ColorAttachment {
575
+ /**
576
+ * A {@link GPUTextureView} describing the texture subresource that will be output to for this
577
+ * color attachment.
578
+ */
579
+ view: (TgpuTexture & Render) | GPUTextureView;
580
+ /**
581
+ * Indicates the depth slice index of {@link GPUTextureViewDimension#"3d"} {@link GPURenderPassColorAttachment#view}
582
+ * that will be output to for this color attachment.
583
+ */
584
+ depthSlice?: GPUIntegerCoordinate;
585
+ /**
586
+ * A {@link GPUTextureView} describing the texture subresource that will receive the resolved
587
+ * output for this color attachment if {@link GPURenderPassColorAttachment#view} is
588
+ * multisampled.
589
+ */
590
+ resolveTarget?: GPUTextureView;
591
+ /**
592
+ * Indicates the value to clear {@link GPURenderPassColorAttachment#view} to prior to executing the
593
+ * render pass. If not map/exist|provided, defaults to `{r: 0, g: 0, b: 0, a: 0}`. Ignored
594
+ * if {@link GPURenderPassColorAttachment#loadOp} is not {@link GPULoadOp#"clear"}.
595
+ * The components of {@link GPURenderPassColorAttachment#clearValue} are all double values.
596
+ * They are converted to a texel value of texture format matching the render attachment.
597
+ * If conversion fails, a validation error is generated.
598
+ */
599
+ clearValue?: GPUColor;
600
+ /**
601
+ * Indicates the load operation to perform on {@link GPURenderPassColorAttachment#view} prior to
602
+ * executing the render pass.
603
+ * Note: It is recommended to prefer clearing; see {@link GPULoadOp#"clear"} for details.
604
+ */
605
+ loadOp: GPULoadOp;
606
+ /**
607
+ * The store operation to perform on {@link GPURenderPassColorAttachment#view}
608
+ * after executing the render pass.
609
+ */
610
+ storeOp: GPUStoreOp;
611
+ }
612
+
613
+ interface WithCompute {
614
+ createPipeline(): TgpuComputePipeline;
615
+ }
616
+ type ValidateFragmentIn<VertexOut extends IORecord, FragmentIn extends IORecord, FragmentOut extends IOLayout<Vec4f>> = FragmentIn extends Partial<VertexOut> ? VertexOut extends FragmentIn ? [
617
+ entryFn: TgpuFragmentFn<FragmentIn, FragmentOut>,
618
+ targets: FragmentOutToTargets<FragmentOut>
619
+ ] : [
620
+ entryFn: 'n/a',
621
+ targets: 'n/a',
622
+ MissingFromVertexOutput: {
623
+ [Key in Exclude<keyof FragmentIn, keyof VertexOut>]: FragmentIn[Key];
624
+ }
625
+ ] : [
626
+ entryFn: 'n/a',
627
+ targets: 'n/a',
628
+ MismatchedVertexOutput: {
629
+ [Key in keyof FragmentIn & keyof VertexOut as FragmentIn[Key] extends VertexOut[Key] ? never : Key]: [got: VertexOut[Key], expecting: FragmentIn[Key]];
630
+ }
631
+ ];
632
+ interface WithVertex<VertexOut extends IORecord = IORecord> {
633
+ withFragment<FragmentIn extends IORecord, FragmentOut extends IOLayout<Vec4f>>(...args: ValidateFragmentIn<VertexOut, FragmentIn, FragmentOut>): WithFragment<FragmentOut>;
634
+ }
635
+ interface WithFragment<Output extends IOLayout<Vec4f> = IOLayout<Vec4f>> {
636
+ withPrimitive(primitiveState: GPUPrimitiveState | undefined): WithFragment<Output>;
637
+ createPipeline(): TgpuRenderPipeline<Output>;
638
+ }
639
+ interface WithBinding {
640
+ with<T>(slot: TgpuSlot<T>, value: Eventual<T>): WithBinding;
641
+ with<T extends AnyWgslData>(accessor: TgpuAccessor<T>, value: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>): WithBinding;
642
+ withCompute(entryFn: TgpuComputeFn): WithCompute;
643
+ withVertex<VertexIn extends IOLayout, VertexOut extends IORecord>(entryFn: TgpuVertexFn<VertexIn, VertexOut>, attribs: LayoutToAllowedAttribs<OmitBuiltins<VertexIn>>): WithVertex<VertexOut>;
644
+ }
645
+ type CreateTextureOptions<TSize, TFormat extends GPUTextureFormat, TMipLevelCount extends number, TSampleCount extends number, TViewFormat extends GPUTextureFormat, TDimension extends GPUTextureDimension> = {
646
+ /**
647
+ * The width, height, and depth or layer count of the texture.
648
+ */
649
+ size: TSize;
650
+ /**
651
+ * The format of the texture.
652
+ */
653
+ format: TFormat;
654
+ /**
655
+ * The number of mip levels the texture will contain.
656
+ * @default 1
657
+ */
658
+ mipLevelCount?: TMipLevelCount | undefined;
659
+ /**
660
+ * The sample count of the texture. A sampleCount > 1 indicates a multisampled texture.
661
+ * @default 1
662
+ */
663
+ sampleCount?: TSampleCount | undefined;
664
+ /**
665
+ * Specifies extra formats (in addition to the texture's actual format) that can be used
666
+ * when creating views of this texture.
667
+ * @default []
668
+ */
669
+ viewFormats?: TViewFormat[] | undefined;
670
+ /**
671
+ * Whether the texture is one-dimensional, an array of two-dimensional layers, or three-dimensional.
672
+ * @default '2d'
673
+ */
674
+ dimension?: TDimension | undefined;
675
+ };
676
+ type CreateTextureResult<TSize extends readonly number[], TFormat extends GPUTextureFormat, TMipLevelCount extends number, TSampleCount extends number, TViewFormat extends GPUTextureFormat, TDimension extends GPUTextureDimension> = Prettify<{
677
+ size: Mutable<TSize>;
678
+ format: TFormat;
679
+ } & OmitProps<{
680
+ dimension: GPUTextureDimension extends TDimension ? undefined : TDimension extends '2d' ? undefined : TDimension;
681
+ mipLevelCount: number extends TMipLevelCount ? undefined : TMipLevelCount extends 1 ? undefined : TMipLevelCount;
682
+ sampleCount: number extends TSampleCount ? undefined : TSampleCount extends 1 ? undefined : TSampleCount;
683
+ viewFormats: GPUTextureFormat extends TViewFormat ? undefined : TViewFormat[] extends never[] ? undefined : TViewFormat[];
684
+ }, undefined>>;
25
685
  interface TgpuRoot extends Unwrapper {
26
686
  /**
27
687
  * The GPU device associated with this root.
28
688
  */
29
689
  readonly device: GPUDevice;
30
690
  /**
691
+ * Allocates memory on the GPU, allows passing data between host and shader.
692
+ *
693
+ * @remarks
694
+ * Typed wrapper around a GPUBuffer.
695
+ *
31
696
  * @param typeSchema The type of data that this buffer will hold.
32
697
  * @param initial The initial value of the buffer. (optional)
33
698
  */
34
699
  createBuffer<TData extends AnyData>(typeSchema: TData, initial?: Infer<Exotic<TData>> | undefined): TgpuBuffer$1<Exotic<TData>>;
35
700
  /**
701
+ * Allocates memory on the GPU, allows passing data between host and shader.
702
+ *
703
+ * @remarks
704
+ * Typed wrapper around a GPUBuffer.
705
+ *
36
706
  * @param typeSchema The type of data that this buffer will hold.
37
707
  * @param gpuBuffer A vanilla WebGPU buffer.
38
708
  */
39
709
  createBuffer<TData extends AnyData>(typeSchema: TData, gpuBuffer: GPUBuffer): TgpuBuffer$1<Exotic<TData>>;
710
+ /**
711
+ * Creates a group of resources that can be bound to a shader based on a specified layout.
712
+ *
713
+ * @remarks
714
+ * Typed wrapper around a GPUBindGroup.
715
+ *
716
+ * @example
717
+ * const fooLayout = tgpu.bindGroupLayout({
718
+ * foo: { uniform: d.vec3f },
719
+ * bar: { texture: 'float' },
720
+ * });
721
+ *
722
+ * const fooBuffer = ...;
723
+ * const barTexture = ...;
724
+ *
725
+ * const fooBindGroup = root.createBindGroup(fooLayout, {
726
+ * foo: fooBuffer,
727
+ * bar: barTexture,
728
+ * });
729
+ *
730
+ * @param layout Layout describing the bind group to be created.
731
+ * @param entries A record with values being the resources populating the bind group
732
+ * and keys being their associated names, matching the layout keys.
733
+ */
40
734
  createBindGroup<Entries extends Record<string, TgpuLayoutEntry | null> = Record<string, TgpuLayoutEntry | null>>(layout: TgpuBindGroupLayout<Entries>, entries: {
41
735
  [K in keyof OmitProps<Entries, null>]: LayoutEntryToInput<Entries[K]>;
42
736
  }): TgpuBindGroup<Entries>;
737
+ /**
738
+ * Destroys all underlying resources (i.e. buffers...) created through this root object.
739
+ * If the object is created via `tgpu.init` instead of `tgpu.initFromDevice`,
740
+ * then the inner GPU device is destroyed as well.
741
+ */
43
742
  destroy(): void;
743
+ '~unstable': Omit<ExperimentalTgpuRoot, keyof TgpuRoot>;
744
+ }
745
+ interface ExperimentalTgpuRoot extends TgpuRoot, WithBinding {
746
+ readonly jitTranspiler?: JitTranspiler | undefined;
747
+ readonly nameRegistry: NameRegistry;
748
+ /**
749
+ * The current command encoder. This property will
750
+ * hold the same value until `flush()` is called.
751
+ */
752
+ readonly commandEncoder: GPUCommandEncoder;
753
+ createTexture<TWidth extends number, THeight extends number, TDepth extends number, TSize extends readonly [TWidth] | readonly [TWidth, THeight] | readonly [TWidth, THeight, TDepth], TFormat extends GPUTextureFormat, TMipLevelCount extends number, TSampleCount extends number, TViewFormat extends GPUTextureFormat, TDimension extends GPUTextureDimension>(props: CreateTextureOptions<TSize, TFormat, TMipLevelCount, TSampleCount, TViewFormat, TDimension>): TgpuTexture<CreateTextureResult<TSize, TFormat, TMipLevelCount, TSampleCount, TViewFormat, TDimension>>;
754
+ /**
755
+ * Causes all commands enqueued by pipelines to be
756
+ * submitted to the GPU.
757
+ */
758
+ flush(): void;
759
+ }
760
+
761
+ interface Uniform {
762
+ usableAsUniform: true;
763
+ }
764
+ declare const Uniform: Uniform;
765
+ interface Vertex {
766
+ usableAsVertex: true;
767
+ }
768
+ declare const Vertex: Vertex;
769
+ type LiteralToUsageType<T extends 'uniform' | 'storage' | 'vertex'> = T extends 'uniform' ? Uniform : T extends 'storage' ? Storage : T extends 'vertex' ? Vertex : never;
770
+ interface TgpuBuffer$1<TData extends AnyData> extends TgpuNamable {
771
+ readonly resourceType: 'buffer';
772
+ readonly dataType: TData;
773
+ readonly initial?: Infer<TData> | undefined;
774
+ readonly label: string | undefined;
775
+ readonly buffer: GPUBuffer;
776
+ readonly destroyed: boolean;
777
+ $usage<T extends RestrictVertexUsages<TData>>(...usages: T): this & UnionToIntersection<LiteralToUsageType<T[number]>>;
778
+ $addFlags(flags: GPUBufferUsageFlags): this;
779
+ write(data: Infer<TData>): void;
780
+ copyFrom(srcBuffer: TgpuBuffer$1<TData>): void;
781
+ read(): Promise<Infer<TData>>;
782
+ destroy(): void;
783
+ }
784
+ declare function isBuffer<T extends TgpuBuffer$1<AnyData>>(value: T | unknown): value is T;
785
+ declare function isUsableAsUniform<T extends TgpuBuffer$1<AnyData>>(buffer: T): buffer is T & Uniform;
786
+ declare function isUsableAsVertex<T extends TgpuBuffer$1<AnyData>>(buffer: T): buffer is T & Vertex;
787
+ type RestrictVertexUsages<TData extends AnyData> = TData extends {
788
+ readonly type: WgslTypeLiteral;
789
+ } ? ('uniform' | 'storage' | 'vertex')[] : 'vertex'[];
790
+
791
+ interface SamplerProps {
792
+ addressModeU?: GPUAddressMode;
793
+ addressModeV?: GPUAddressMode;
794
+ /**
795
+ * Specifies the address modes for the texture width, height, and depth
796
+ * coordinates, respectively.
797
+ */
798
+ addressModeW?: GPUAddressMode;
799
+ /**
800
+ * Specifies the sampling behavior when the sample footprint is smaller than or equal to one
801
+ * texel.
802
+ */
803
+ magFilter?: GPUFilterMode;
804
+ /**
805
+ * Specifies the sampling behavior when the sample footprint is larger than one texel.
806
+ */
807
+ minFilter?: GPUFilterMode;
808
+ /**
809
+ * Specifies behavior for sampling between mipmap levels.
810
+ */
811
+ mipmapFilter?: GPUMipmapFilterMode;
812
+ lodMinClamp?: number;
813
+ /**
814
+ * Specifies the minimum and maximum levels of detail, respectively, used internally when
815
+ * sampling a texture.
816
+ */
817
+ lodMaxClamp?: number;
818
+ /**
819
+ * Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
820
+ * enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
821
+ * Anisotropic filtering improves the image quality of textures sampled at oblique viewing
822
+ * angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
823
+ * anisotropy supported when filtering.
824
+ *
825
+ * Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
826
+ * between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
827
+ * will be clamped to the maximum value that the platform supports.
828
+ * The precise filtering behavior is implementation-dependent.
829
+ */
830
+ maxAnisotropy?: number;
831
+ }
832
+ interface ComparisonSamplerProps {
833
+ compare: GPUCompareFunction;
834
+ addressModeU?: GPUAddressMode;
835
+ addressModeV?: GPUAddressMode;
836
+ /**
837
+ * Specifies the address modes for the texture width, height, and depth
838
+ * coordinates, respectively.
839
+ */
840
+ addressModeW?: GPUAddressMode;
841
+ /**
842
+ * Specifies the sampling behavior when the sample footprint is smaller than or equal to one
843
+ * texel.
844
+ */
845
+ magFilter?: GPUFilterMode;
846
+ /**
847
+ * Specifies the sampling behavior when the sample footprint is larger than one texel.
848
+ */
849
+ minFilter?: GPUFilterMode;
850
+ /**
851
+ * Specifies behavior for sampling between mipmap levels.
852
+ */
853
+ mipmapFilter?: GPUMipmapFilterMode;
854
+ lodMinClamp?: number;
855
+ /**
856
+ * Specifies the minimum and maximum levels of detail, respectively, used internally when
857
+ * sampling a texture.
858
+ */
859
+ lodMaxClamp?: number;
860
+ /**
861
+ * Specifies the maximum anisotropy value clamp used by the sampler. Anisotropic filtering is
862
+ * enabled when {@link GPUSamplerDescriptor.maxAnisotropy} is > 1 and the implementation supports it.
863
+ * Anisotropic filtering improves the image quality of textures sampled at oblique viewing
864
+ * angles. Higher {@link GPUSamplerDescriptor.maxAnisotropy} values indicate the maximum ratio of
865
+ * anisotropy supported when filtering.
866
+ *
867
+ * Most implementations support {@link GPUSamplerDescriptor.maxAnisotropy} values in range
868
+ * between 1 and 16, inclusive. The used value of {@link GPUSamplerDescriptor.maxAnisotropy}
869
+ * will be clamped to the maximum value that the platform supports.
870
+ * The precise filtering behavior is implementation-dependent.
871
+ */
872
+ maxAnisotropy?: number;
873
+ }
874
+ interface TgpuSampler {
875
+ readonly resourceType: 'sampler';
876
+ }
877
+ interface TgpuComparisonSampler {
878
+ readonly resourceType: 'sampler-comparison';
879
+ }
880
+ declare function sampler(props: SamplerProps): TgpuSampler;
881
+ declare function comparisonSampler(props: ComparisonSamplerProps): TgpuComparisonSampler;
882
+ declare function isSampler(resource: unknown): resource is TgpuSampler;
883
+ declare function isComparisonSampler(resource: unknown): resource is TgpuComparisonSampler;
884
+
885
+ type TgpuLayoutEntryBase = {
886
+ /**
887
+ * Limits this resource's visibility to specific shader stages.
888
+ *
889
+ * By default, each resource is visible to all shader stage types, but
890
+ * depending on the underlying implementation, this may have performance implications.
891
+ *
892
+ * @default ['compute'] for mutable resources
893
+ * @default ['compute','vertex','fragment'] for everything else
894
+ */
895
+ visibility?: TgpuShaderStage[];
896
+ };
897
+ type TgpuLayoutUniform = TgpuLayoutEntryBase & {
898
+ uniform: AnyWgslData;
899
+ };
900
+ type TgpuLayoutStorage = TgpuLayoutEntryBase & {
901
+ storage: AnyWgslData | ((arrayLength: number) => AnyWgslData);
902
+ /** @default 'readonly' */
903
+ access?: 'mutable' | 'readonly';
904
+ };
905
+ type TgpuLayoutSampler = TgpuLayoutEntryBase & {
906
+ sampler: 'filtering' | 'non-filtering';
907
+ };
908
+ type TgpuLayoutComparisonSampler = TgpuLayoutEntryBase & {
909
+ sampler: 'comparison';
910
+ };
911
+ type TgpuLayoutTexture<TSampleType extends GPUTextureSampleType = GPUTextureSampleType> = TgpuLayoutEntryBase & {
912
+ /**
913
+ * - 'float' - f32
914
+ * - 'unfilterable-float' - f32, cannot be used with filtering samplers
915
+ * - 'depth' - f32
916
+ * - 'sint' - i32
917
+ * - 'uint' - u32
918
+ */
919
+ texture: TSampleType;
920
+ /**
921
+ * @default '2d'
922
+ */
923
+ viewDimension?: GPUTextureViewDimension;
924
+ /**
925
+ * @default false
926
+ */
927
+ multisampled?: boolean;
928
+ };
929
+ type TgpuLayoutStorageTexture<TFormat extends StorageTextureTexelFormat = StorageTextureTexelFormat> = TgpuLayoutEntryBase & {
930
+ storageTexture: TFormat;
931
+ /** @default 'writeonly' */
932
+ access?: 'readonly' | 'writeonly' | 'mutable';
933
+ /** @default '2d' */
934
+ viewDimension?: StorageTextureDimension;
935
+ };
936
+ type TgpuLayoutExternalTexture = TgpuLayoutEntryBase & {
937
+ externalTexture: Record<string, never>;
938
+ };
939
+ type TgpuLayoutEntry = TgpuLayoutUniform | TgpuLayoutStorage | TgpuLayoutSampler | TgpuLayoutComparisonSampler | TgpuLayoutTexture | TgpuLayoutStorageTexture | TgpuLayoutExternalTexture;
940
+ type UnwrapRuntimeConstructorInner<T extends BaseWgslData | ((_: number) => BaseWgslData)> = T extends (_: number) => BaseWgslData ? ReturnType<T> : T;
941
+ type UnwrapRuntimeConstructor<T extends AnyData | ((_: number) => AnyData)> = T extends unknown ? UnwrapRuntimeConstructorInner<T> : never;
942
+ interface TgpuBindGroupLayout<Entries extends Record<string, TgpuLayoutEntry | null> = Record<string, TgpuLayoutEntry | null>> extends TgpuNamable {
943
+ readonly resourceType: 'bind-group-layout';
944
+ readonly label: string | undefined;
945
+ readonly entries: Entries;
946
+ readonly bound: {
947
+ [K in keyof Entries]: BindLayoutEntry<Entries[K]>;
948
+ };
949
+ /**
950
+ * An explicit numeric index assigned to this bind group layout. If undefined, a unique
951
+ * index is assigned automatically during resolution. This can be changed with the
952
+ * `.$idx()` method.
953
+ */
954
+ readonly index: number | undefined;
955
+ /**
956
+ * Associates this bind group layout with an explicit numeric index. When a call to this
957
+ * method is omitted, a unique numeric index is assigned to it automatically.
958
+ *
959
+ * Used when generating WGSL code: `@group(${index}) @binding(...) ...;`
960
+ */
961
+ $idx(index?: number): this;
962
+ /**
963
+ * @deprecated Use the `root.createBindGroup` API instead, accessible through `await tgpu.init()`
964
+ */
965
+ populate(entries: {
966
+ [K in keyof OmitProps<Entries, null>]: LayoutEntryToInput<Entries[K]>;
967
+ }): TgpuBindGroup<Entries>;
968
+ /**
969
+ * Creates a raw WebGPU resource based on the typed descriptor.
970
+ * NOTE: This creates a new resource every time, better to use `root.unwrap(...)` instead.
971
+ * @param unwrapper Used to unwrap any resources that this resource depends on.
972
+ */
973
+ unwrap(unwrapper: Unwrapper): GPUBindGroupLayout;
974
+ }
975
+ type StorageUsageForEntry<T extends TgpuLayoutStorage> = T extends {
976
+ access?: infer Access;
977
+ } ? 'mutable' | 'readonly' extends Access ? TgpuBufferReadonly$1<UnwrapRuntimeConstructor<T['storage']>> | TgpuBufferMutable$1<UnwrapRuntimeConstructor<T['storage']>> : 'readonly' extends Access ? TgpuBufferReadonly$1<UnwrapRuntimeConstructor<T['storage']>> : 'mutable' extends Access ? TgpuBufferMutable$1<UnwrapRuntimeConstructor<T['storage']>> : TgpuBufferReadonly$1<UnwrapRuntimeConstructor<T['storage']>> | TgpuBufferMutable$1<UnwrapRuntimeConstructor<T['storage']>> : TgpuBufferReadonly$1<UnwrapRuntimeConstructor<T['storage']>>;
978
+ type GetUsageForStorageTexture<T extends TgpuLayoutStorageTexture, TAccess extends 'readonly' | 'writeonly' | 'mutable'> = {
979
+ mutable: TgpuMutableTexture<Default<GetDimension<T['viewDimension']>, '2d'>, TexelFormatToDataType[T['storageTexture']]>;
980
+ readonly: TgpuReadonlyTexture<Default<GetDimension<T['viewDimension']>, '2d'>, TexelFormatToDataType[T['storageTexture']]>;
981
+ writeonly: TgpuWriteonlyTexture<Default<GetDimension<T['viewDimension']>, '2d'>, TexelFormatToDataType[T['storageTexture']]>;
982
+ }[TAccess];
983
+ type StorageTextureUsageForEntry<T extends TgpuLayoutStorageTexture> = T extends unknown ? GetUsageForStorageTexture<T, Default<T['access'], 'writeonly'>> : never;
984
+ type GetDimension<T extends GPUTextureViewDimension | undefined> = T extends keyof ViewDimensionToDimension ? ViewDimensionToDimension[T] : undefined;
985
+ type GetTextureRestriction<T extends TgpuLayoutTexture> = Default<GetDimension<T['viewDimension']>, '2d'> extends infer Dimension ? Dimension extends '2d' ? {
986
+ format: ChannelTypeToLegalFormats[SampleTypeToStringChannelType[T['texture']]];
987
+ dimension?: Dimension;
988
+ } : {
989
+ format: ChannelTypeToLegalFormats[SampleTypeToStringChannelType[T['texture']]];
990
+ dimension: Dimension;
991
+ } : never;
992
+ type GetStorageTextureRestriction<T extends TgpuLayoutStorageTexture> = Default<GetDimension<T['viewDimension']>, '2d'> extends infer Dimension ? Dimension extends '2d' ? {
993
+ format: T['storageTexture'];
994
+ dimension?: Dimension;
995
+ } : {
996
+ format: T['storageTexture'];
997
+ dimension: Dimension;
998
+ } : never;
999
+ type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer$1<UnwrapRuntimeConstructor<T['uniform']>> & Uniform) | GPUBuffer : T extends TgpuLayoutStorage ? (TgpuBuffer$1<UnwrapRuntimeConstructor<T['storage']>> & Storage) | GPUBuffer : T extends TgpuLayoutSampler ? TgpuSampler | GPUSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler | 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;
1000
+ type BindLayoutEntry<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? TgpuBufferUniform$1<UnwrapRuntimeConstructor<T['uniform']>> : T extends TgpuLayoutStorage ? StorageUsageForEntry<T> : T extends TgpuLayoutSampler ? TgpuSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler : T extends TgpuLayoutTexture ? TgpuSampledTexture<Default<GetDimension<T['viewDimension']>, '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? StorageTextureUsageForEntry<T> : never;
1001
+ type TgpuBindGroup<Entries extends Record<string, TgpuLayoutEntry | null> = Record<string, TgpuLayoutEntry | null>> = {
1002
+ readonly resourceType: 'bind-group';
1003
+ readonly layout: TgpuBindGroupLayout<Entries>;
1004
+ unwrap(unwrapper: Unwrapper): GPUBindGroup;
1005
+ };
1006
+ type ExoticEntry<T> = T extends Record<string | number | symbol, unknown> ? {
1007
+ [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];
1008
+ } : T;
1009
+ type ExoticEntries<T extends Record<string, TgpuLayoutEntry | null>> = {
1010
+ [BindingKey in keyof T]: ExoticEntry<T[BindingKey]>;
1011
+ };
1012
+ declare function bindGroupLayout<Entries extends Record<string, TgpuLayoutEntry | null>>(entries: Entries): TgpuBindGroupLayout<Prettify<ExoticEntries<Entries>>>;
1013
+
1014
+ interface TgpuBufferUsage<TData extends BaseWgslData = BaseWgslData, TUsage extends BindableBufferUsage = BindableBufferUsage> {
1015
+ readonly resourceType: 'buffer-usage';
1016
+ readonly usage: TUsage;
1017
+ readonly '~repr': Infer<TData>;
1018
+ value: Infer<TData>;
1019
+ }
1020
+ interface TgpuBufferUniform$1<TData extends BaseWgslData> extends TgpuBufferUsage<TData, 'uniform'> {
1021
+ readonly value: Infer<TData>;
1022
+ }
1023
+ interface TgpuBufferReadonly$1<TData extends BaseWgslData> extends TgpuBufferUsage<TData, 'readonly'> {
1024
+ readonly value: Infer<TData>;
1025
+ }
1026
+ interface TgpuBufferMutable$1<TData extends BaseWgslData> extends TgpuBufferUsage<TData, 'mutable'> {
1027
+ }
1028
+ declare function asMutable<TData extends AnyWgslData>(buffer: TgpuBuffer$1<TData> & Storage): TgpuBufferMutable$1<TData>;
1029
+ declare function asReadonly<TData extends AnyWgslData>(buffer: TgpuBuffer$1<TData> & Storage): TgpuBufferReadonly$1<TData>;
1030
+ declare function asUniform<TData extends AnyWgslData>(buffer: TgpuBuffer$1<TData> & Uniform): TgpuBufferUniform$1<TData>;
1031
+
1032
+ interface TgpuExternalTexture {
1033
+ readonly resourceType: 'external-texture';
1034
+ }
1035
+
1036
+ type VariableScope = 'private' | 'workgroup';
1037
+ interface TgpuVar<TScope extends VariableScope = VariableScope, TDataType extends AnyWgslData = AnyWgslData> extends TgpuNamable {
1038
+ value: Infer<TDataType>;
1039
+ readonly scope: TScope;
1040
+ }
1041
+ /**
1042
+ * Defines a variable scoped to each entry function (private).
1043
+ *
1044
+ * @param dataType The schema of the held data's type
1045
+ * @param initialValue If not provided, the variable will be initialized to the dataType's "zero-value".
1046
+ */
1047
+ declare function privateVar<TDataType extends AnyWgslData>(dataType: Exotic<TDataType>, initialValue?: Infer<Exotic<TDataType>>): TgpuVar<'private', Exotic<TDataType>>;
1048
+ /**
1049
+ * Defines a variable scoped to the whole workgroup, shared between entry functions
1050
+ * of the same invocation.
1051
+ *
1052
+ * @param dataType The schema of the held data's type
1053
+ */
1054
+ declare function workgroupVar<TDataType extends AnyWgslData>(dataType: TDataType): TgpuVar<'workgroup', TDataType>;
1055
+
1056
+ type ResolvableObject = SelfResolvable | TgpuBufferUsage | TgpuConst | TgpuDeclare | TgpuFn | TgpuComputeFn | TgpuFragmentFn | TgpuComputePipeline | TgpuRenderPipeline | TgpuVertexFn | TgpuSampler | TgpuAccessor | TgpuExternalTexture | TgpuTexture | TgpuAnyTextureView | TgpuVar | AnyVecInstance | AnyMatInstance | AnyWgslData | TgpuFn<any, any>;
1057
+ type Wgsl = Eventual<string | number | boolean | ResolvableObject>;
1058
+ declare const UnknownData: unique symbol;
1059
+ type UnknownData = typeof UnknownData;
1060
+ type Resource = {
1061
+ value: unknown;
1062
+ dataType: AnyWgslData | UnknownData;
1063
+ };
1064
+ type TgpuShaderStage = 'compute' | 'vertex' | 'fragment';
1065
+ interface FnToWgslOptions {
1066
+ args: Resource[];
1067
+ returnType: AnyWgslData;
1068
+ body: Block;
1069
+ externalMap: Record<string, unknown>;
1070
+ }
1071
+ /**
1072
+ * Passed into each resolvable item. All items in a tree share a resolution ctx,
1073
+ * but there can be layers added and removed from the item stack when going down
1074
+ * and up the tree.
1075
+ */
1076
+ interface ResolutionCtx {
1077
+ readonly names: NameRegistry;
1078
+ addDeclaration(declaration: string): void;
1079
+ /**
1080
+ * Reserves a bind group number, and returns a placeholder that will be replaced
1081
+ * with a concrete number at the end of the resolution process.
1082
+ */
1083
+ allocateLayoutEntry(layout: TgpuBindGroupLayout): string;
1084
+ /**
1085
+ * Reserves a spot in the catch-all bind group, without the indirection of a bind-group.
1086
+ * This means the resource is 'fixed', and cannot be swapped between code execution.
1087
+ */
1088
+ allocateFixedEntry(layoutEntry: TgpuLayoutEntry, resource: object): {
1089
+ group: string;
1090
+ binding: number;
1091
+ };
1092
+ withSlots<T>(pairs: SlotValuePair<unknown>[], callback: () => T): T;
1093
+ /**
1094
+ * Unwraps all layers of slot/derived indirection and returns the concrete value if available.
1095
+ * @throws {MissingSlotValueError}
1096
+ */
1097
+ unwrap<T>(eventual: Eventual<T>): T;
1098
+ resolve(item: unknown): string;
1099
+ resolveValue<T extends BaseWgslData>(value: Infer<T>, schema: T): string;
1100
+ transpileFn(fn: string): {
1101
+ argNames: string[];
1102
+ body: Block;
1103
+ externalNames: string[];
1104
+ };
1105
+ fnToWgsl(options: FnToWgslOptions): {
1106
+ head: Wgsl;
1107
+ body: Wgsl;
1108
+ };
44
1109
  }
1110
+ /**
1111
+ * Houses a method '~resolve` that returns a code string
1112
+ * representing it, as opposed to offloading the resolution
1113
+ * to another mechanism.
1114
+ */
1115
+ interface SelfResolvable {
1116
+ '~resolve'(ctx: ResolutionCtx): string;
1117
+ toString(): string;
1118
+ }
1119
+ interface Labelled {
1120
+ readonly label?: string | undefined;
1121
+ }
1122
+ type BindableBufferUsage = 'uniform' | 'readonly' | 'mutable';
1123
+
1124
+ /**
1125
+ * Describes a function signature (its arguments and return type)
1126
+ */
1127
+ interface TgpuFnShell<Args extends AnyWgslData[] = AnyWgslData[], Return extends AnyWgslData | undefined = AnyWgslData | undefined> {
1128
+ readonly argTypes: Args;
1129
+ readonly returnType: Return | undefined;
1130
+ /**
1131
+ * Creates a type-safe implementation of this signature
1132
+ */
1133
+ does(implementation: (...args: InferArgs<Args>) => InferReturn<Return>): TgpuFn<Args, Return>;
1134
+ /**
1135
+ * @param implementation
1136
+ * Raw WGSL function implementation with header and body
1137
+ * without `fn` keyword and function name
1138
+ * e.g. `"(x: f32) -> f32 { return x; }"`;
1139
+ */
1140
+ does(implementation: string): TgpuFn<Args, Return>;
1141
+ }
1142
+ interface TgpuFnBase<Args extends AnyWgslData[], Return extends AnyWgslData | undefined = undefined> extends TgpuNamable, Labelled {
1143
+ readonly resourceType: 'function';
1144
+ readonly shell: TgpuFnShell<Args, Return>;
1145
+ $uses(dependencyMap: Record<string, unknown>): this;
1146
+ with<T>(slot: TgpuSlot<T>, value: Eventual<T>): TgpuFn<Args, Return>;
1147
+ with<T extends AnyWgslData>(accessor: TgpuAccessor<T>, value: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer$1<T>): TgpuFn<Args, Return>;
1148
+ }
1149
+ type TgpuFn<Args extends AnyWgslData[] = AnyWgslData[], Return extends AnyWgslData | undefined = AnyWgslData | undefined> = TgpuFnBase<Args, Return> & ((...args: InferArgs<Args>) => InferReturn<Return>);
1150
+ declare function fn<Args extends AnyWgslData[] | []>(argTypes: Args, returnType?: undefined): TgpuFnShell<ExoticArray<Args>, undefined>;
1151
+ declare function fn<Args extends AnyWgslData[] | [], Return extends AnyWgslData>(argTypes: Args, returnType: Return): TgpuFnShell<ExoticArray<Args>, Exotic<Return>>;
1152
+ declare function isTgpuFn<Args extends AnyWgslData[], Return extends AnyWgslData | undefined = undefined>(value: unknown | TgpuFn<Args, Return>): value is TgpuFn<Args, Return>;
45
1153
 
46
1154
  interface TgpuResolveOptions {
47
1155
  /**
48
1156
  * Map of external names to their resolvable values.
49
1157
  */
50
- externals: Record<string, TgpuResolvable | AnyWgslData | boolean | number>;
1158
+ externals: Record<string, Wgsl | object>;
51
1159
  /**
52
1160
  * The code template to use for the resolution. All external names will be replaced with their resolved values.
53
1161
  * @default ''
@@ -150,6 +1258,12 @@ declare function init(options?: InitOptions): Promise<TgpuRoot>;
150
1258
  */
151
1259
  declare function initFromDevice(options: InitFromDeviceOptions): TgpuRoot;
152
1260
 
1261
+ declare function accessor<T extends AnyWgslData>(schema: T, defaultValue?: TgpuFn<[], Exotic<T>> | TgpuBufferUsage<Exotic<T>> | Infer<Exotic<T>>): TgpuAccessor<Exotic<T>>;
1262
+
1263
+ declare function derived<T>(compute: () => T): TgpuDerived<T>;
1264
+
1265
+ declare function slot<T>(defaultValue?: T): TgpuSlot<T>;
1266
+
153
1267
  /**
154
1268
  * An error that happens during resolution of WGSL code.
155
1269
  * Contains a trace of all ancestor resolvables in
@@ -163,12 +1277,25 @@ declare class ResolutionError extends Error {
163
1277
  constructor(cause: unknown, trace: unknown[]);
164
1278
  appendToTrace(ancestor: unknown): ResolutionError;
165
1279
  }
1280
+ /**
1281
+ * @category Errors
1282
+ */
1283
+ declare class MissingSlotValueError extends Error {
1284
+ readonly slot: TgpuSlot<unknown>;
1285
+ constructor(slot: TgpuSlot<unknown>);
1286
+ }
166
1287
  /**
167
1288
  * @category Errors
168
1289
  */
169
1290
  declare class NotUniformError extends Error {
170
1291
  constructor(value: TgpuBuffer$1<AnyData>);
171
1292
  }
1293
+ declare class MissingLinksError extends Error {
1294
+ constructor(fnLabel: string | undefined, externalNames: string[]);
1295
+ }
1296
+ declare class MissingBindGroupError extends Error {
1297
+ constructor(layoutLabel: string | undefined);
1298
+ }
172
1299
 
173
1300
  type TgpuBuffer<TData extends AnyData> = TgpuBuffer$1<Exotic<TData>>;
174
1301
  type TgpuBufferMutable<TData extends AnyData> = TgpuBufferMutable$1<Exotic<TData>>;
@@ -180,16 +1307,26 @@ type TgpuBufferUniform<TData extends AnyData> = TgpuBufferUniform$1<Exotic<TData
180
1307
  */
181
1308
 
182
1309
  declare const tgpu: {
183
- /** @hidden @deprecated Use `'uniform'` string literal instead. */
184
- Uniform: "uniform";
185
- /** @hidden @deprecated Use `'storage'` string literal instead. */
186
- Storage: "storage";
187
- /** @hidden @deprecated Use `'vertex'` string literal instead. */
188
- Vertex: "vertex";
189
1310
  bindGroupLayout: typeof bindGroupLayout;
190
1311
  init: typeof init;
191
1312
  initFromDevice: typeof initFromDevice;
192
1313
  resolve: typeof resolve;
1314
+ '~unstable': {
1315
+ fn: typeof fn;
1316
+ fragmentFn: typeof fragmentFn;
1317
+ vertexFn: typeof vertexFn;
1318
+ computeFn: typeof computeFn;
1319
+ vertexLayout: typeof vertexLayout;
1320
+ derived: typeof derived;
1321
+ slot: typeof slot;
1322
+ accessor: typeof accessor;
1323
+ privateVar: typeof privateVar;
1324
+ workgroupVar: typeof workgroupVar;
1325
+ const: typeof constant;
1326
+ declare: typeof declare;
1327
+ sampler: typeof sampler;
1328
+ comparisonSampler: typeof comparisonSampler;
1329
+ };
193
1330
  };
194
1331
 
195
- export { type InitFromDeviceOptions, type InitOptions, LayoutEntryToInput, NotUniformError, ResolutionError, TgpuBindGroup, TgpuBindGroupLayout, type TgpuBuffer, type TgpuBufferMutable, type TgpuBufferReadonly, type TgpuBufferUniform, TgpuLayoutEntry, type TgpuRoot, tgpu as default, tgpu };
1332
+ export { type BindLayoutEntry, type Eventual, type InitFromDeviceOptions, type InitOptions, type LayoutEntryToInput, MissingBindGroupError, MissingLinksError, MissingSlotValueError, NotUniformError, RandomNameRegistry, type Render, ResolutionError, type Sampled, Storage, StrictNameRegistry, type TextureProps, type TgpuAccessor, type TgpuAnyTextureView, type TgpuBindGroup, type TgpuBindGroupLayout, type TgpuBuffer, type TgpuBufferMutable, type TgpuBufferReadonly, type TgpuBufferUniform, type TgpuComputeFn, type TgpuComputeFnShell, type TgpuComputePipeline, type TgpuConst, type TgpuDeclare, type TgpuDerived, type TgpuFn, type TgpuFnShell, type TgpuFragmentFn, type TgpuFragmentFnShell, type TgpuLayoutComparisonSampler, type TgpuLayoutEntry, type TgpuLayoutExternalTexture, type TgpuLayoutSampler, type TgpuLayoutStorage, type TgpuLayoutStorageTexture, type TgpuLayoutTexture, type TgpuLayoutUniform, type TgpuMutableTexture, type TgpuReadonlyTexture, type TgpuRenderPipeline, type TgpuRoot, type TgpuSampledTexture, type TgpuSampler, type TgpuSlot, type TgpuTexture, type TgpuVar, type TgpuVertexFn, type TgpuVertexFnShell, type TgpuVertexLayout, type TgpuWriteonlyTexture, Uniform, type VariableScope, Vertex, type WithBinding, type WithCompute, type WithFragment, type WithVertex, tgpu as default, isBuffer, isComparisonSampler, isDerived, isSampledTextureView, isSampler, isSlot, isStorageTextureView, isTexture, isTgpuFn, isUsableAsRender, isUsableAsSampled, isUsableAsStorage, isUsableAsUniform, isUsableAsVertex, tgpu, asMutable as unstable_asMutable, asReadonly as unstable_asReadonly, asUniform as unstable_asUniform };