typegpu 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/builtin-DdtWpk2t.js +818 -0
  3. package/builtin-DdtWpk2t.js.map +1 -0
  4. package/chunk-BYypO7fO.js +18 -0
  5. package/common/index.d.ts +8 -23
  6. package/common/index.d.ts.map +1 -0
  7. package/common/index.js +7 -5
  8. package/common/index.js.map +1 -1
  9. package/data/index.d.ts +7 -401
  10. package/data/index.d.ts.map +1 -0
  11. package/data/index.js +164 -1
  12. package/data/index.js.map +1 -1
  13. package/deepEqual-DQxK4vdp.js +413 -0
  14. package/deepEqual-DQxK4vdp.js.map +1 -0
  15. package/extensions-DIVuAfBM.js +2032 -0
  16. package/extensions-DIVuAfBM.js.map +1 -0
  17. package/fullScreenTriangle-CfFyQd_0.js +543 -0
  18. package/fullScreenTriangle-CfFyQd_0.js.map +1 -0
  19. package/index.d.ts +124 -310
  20. package/index.d.ts.map +1 -0
  21. package/index.js +6282 -153
  22. package/index.js.map +1 -1
  23. package/indexNamedExports-oL6tyaJ9.d.ts +5697 -0
  24. package/indexNamedExports-oL6tyaJ9.d.ts.map +1 -0
  25. package/operators-d-PMVTo7.js +4158 -0
  26. package/operators-d-PMVTo7.js.map +1 -0
  27. package/package.json +3 -2
  28. package/std/index.d.ts +7 -621
  29. package/std/index.d.ts.map +1 -0
  30. package/std/index.js +165 -1
  31. package/std/index.js.map +1 -1
  32. package/texture-BagDrrks.js +205 -0
  33. package/texture-BagDrrks.js.map +1 -0
  34. package/chunk-5ABKYSJD.js +0 -2
  35. package/chunk-5ABKYSJD.js.map +0 -1
  36. package/chunk-D5UYO3OX.js +0 -3
  37. package/chunk-D5UYO3OX.js.map +0 -1
  38. package/chunk-EHLRP4V2.js +0 -2
  39. package/chunk-EHLRP4V2.js.map +0 -1
  40. package/chunk-LMPPDGRD.js +0 -2
  41. package/chunk-LMPPDGRD.js.map +0 -1
  42. package/chunk-MBB2XFH6.js +0 -2
  43. package/chunk-MBB2XFH6.js.map +0 -1
  44. package/chunk-SHSILTWI.js +0 -10
  45. package/chunk-SHSILTWI.js.map +0 -1
  46. package/comptime-DKpw1IVu.d.ts +0 -28
  47. package/matrix-C4IFKU1R.d.ts +0 -123
  48. package/tgpuConstant-BOn7U_lv.d.ts +0 -4031
package/index.d.ts CHANGED
@@ -1,116 +1,9 @@
1
- import { A as AnyData, O as Origin, I as InferGPU, $ as $internal, S as ShelllessRepository, T as TgpuSlot, R as ResolvedSnippet, a as TgpuDerived, b as TgpuBindGroupLayout, c as TgpuBindGroup, L as LogResources, C as Configurable, W as WgslExtension, d as ShaderGenerator, e as Wgsl, f as ResolvableObject, g as TgpuBuffer, h as TgpuVar, i as LogGeneratorOptions, j as TgpuRoot, k as AnyWgslData, l as TgpuFn, m as TgpuBufferUsage, n as TgpuBufferShorthand, o as Infer, p as TgpuAccessor, q as TgpuVertexLayout, r as WgslArray, D as Disarray, s as fn, t as bindGroupLayout, v as vertexLayout, u as privateVar, w as workgroupVar, x as constant, y as fragmentFn, z as vertexFn, B as computeFn, E as declare } from './tgpuConstant-BOn7U_lv.js';
2
- export { aA as BindLayoutEntry, an as Eventual, aB as ExtractBindGroupInputFromLayout, aS as INTERNAL_GlobalExt, ab as IndexFlag, aC as LayoutEntryToInput, ar as RenderFlag, as as SampledFlag, a7 as Storage, a8 as StorageFlag, aq as TextureProps, ah as TgpuBufferMutable, ai as TgpuBufferReadonly, aj as TgpuBufferUniform, av as TgpuComparisonSampler, aP as TgpuComputeFn, aQ as TgpuComputeFnShell, aa as TgpuComputePipeline, at as TgpuConst, aR as TgpuDeclare, aw as TgpuFixedComparisonSampler, ax as TgpuFixedSampler, aK as TgpuFnShell, aN as TgpuFragmentFn, aO as TgpuFragmentFnShell, _ as TgpuGuardedComputePipeline, aD as TgpuLayoutComparisonSampler, aE as TgpuLayoutEntry, aF as TgpuLayoutExternalTexture, aG as TgpuLayoutSampler, aH as TgpuLayoutStorage, aI as TgpuLayoutTexture, aJ as TgpuLayoutUniform, ak as TgpuMutable, az as TgpuQuerySet, al as TgpuReadonly, a9 as TgpuRenderPipeline, ay as TgpuSampler, ao as TgpuTexture, ap as TgpuTextureView, am as TgpuUniform, aL as TgpuVertexFn, aM as TgpuVertexFnShell, ac as Uniform, ad as UniformFlag, ae as ValidUsagesFor, a0 as ValidateBufferSchema, a1 as ValidateStorageSchema, a2 as ValidateUniformSchema, au as VariableScope, af as Vertex, ag as VertexFlag, a3 as WithBinding, a4 as WithCompute, a5 as WithFragment, a6 as WithVertex, F as isBuffer, X as isBufferShorthand, K as isComparisonSampler, H as isDerived, M as isSampler, J as isSlot, N as isTexture, Y as isTgpuFn, P as isUsableAsRender, Q as isUsableAsSampled, U as isUsableAsStorage, V as isUsableAsUniform, G as isUsableAsVertex, Z as isVariable } from './tgpuConstant-BOn7U_lv.js';
3
- import { c as comptime } from './comptime-DKpw1IVu.js';
4
- export { T as TgpuComptime } from './comptime-DKpw1IVu.js';
5
- import 'tinyest';
6
-
7
- /**
8
- * Extra declaration that will be included in final WGSL code
9
- * when resolving objects that use it.
10
- */
11
- interface TgpuRawCodeSnippet<TDataType extends AnyData> {
12
- $: InferGPU<TDataType>;
13
- value: InferGPU<TDataType>;
14
- $uses(dependencyMap: Record<string, unknown>): this;
15
- }
16
- type RawCodeSnippetOrigin = Exclude<Origin, 'function' | 'this-function' | 'argument' | 'constant-ref'>;
17
- /**
18
- * An advanced API that creates a typed shader expression which
19
- * can be injected into the final shader bundle upon use.
20
- *
21
- * @param expression The code snippet that will be injected in place of `foo.$`
22
- * @param type The type of the expression
23
- * @param [origin='runtime'] Where the value originates from.
24
- *
25
- * **-- Which origin to choose?**
26
- *
27
- * Usually 'runtime' (the default) is a safe bet, but if you're sure that the expression or
28
- * computation is constant (either a reference to a constant, a numeric literal,
29
- * or an operation on constants), then pass 'constant' as it might lead to better
30
- * optimizations.
31
- *
32
- * If what the expression is a direct reference to an existing value (e.g. a uniform, a
33
- * storage binding, ...), then choose from 'uniform', 'mutable', 'readonly', 'workgroup',
34
- * 'private' or 'handle' depending on the address space of the referred value.
35
- *
36
- * @example
37
- * ```ts
38
- * // An identifier that we know will be in the
39
- * // final shader bundle, but we cannot
40
- * // refer to it in any other way.
41
- * const existingGlobal = tgpu['~unstable']
42
- * .rawCodeSnippet('EXISTING_GLOBAL', d.f32, 'constant');
43
- *
44
- * const foo = () => {
45
- * 'use gpu';
46
- * return existingGlobal.$ * 2;
47
- * };
48
- *
49
- * const wgsl = tgpu.resolve([foo]);
50
- * // fn foo() -> f32 {
51
- * // return EXISTING_GLOBAL * 2;
52
- * // }
53
- * ```
54
- */
55
- declare function rawCodeSnippet<TDataType extends AnyData>(expression: string, type: TDataType, origin?: RawCodeSnippetOrigin | undefined): TgpuRawCodeSnippet<TDataType>;
56
-
57
- interface NameRegistry {
58
- /**
59
- * Creates a valid WGSL identifier, each guaranteed to be unique
60
- * in the lifetime of a single resolution process.
61
- * Should append "_" to primer, followed by some id.
62
- * @param primer Used in the generation process, makes the identifier more recognizable.
63
- * @param global Whether the name should be registered in the global scope (true), or in the current function scope (false)
64
- */
65
- makeUnique(primer: string | undefined, global: boolean): string;
66
- /**
67
- * Creates a valid WGSL identifier.
68
- * Renames identifiers that are WGSL reserved words.
69
- * @param primer Used in the generation process.
70
- *
71
- * @example
72
- * makeValid("notAKeyword"); // "notAKeyword"
73
- * makeValid("struct"); // makeUnique("struct")
74
- * makeValid("struct_1"); // makeUnique("struct_1") (to avoid potential name collisions)
75
- * makeValid("_"); // ERROR (too difficult to make valid to care)
76
- */
77
- makeValid(primer: string): string;
78
- pushFunctionScope(): void;
79
- popFunctionScope(): void;
80
- }
81
-
82
- type SlotToValueMap = Map<TgpuSlot<unknown>, unknown>;
83
- interface NamespaceInternal {
84
- readonly nameRegistry: NameRegistry;
85
- readonly shelllessRepo: ShelllessRepository;
86
- memoizedResolves: WeakMap<object, {
87
- slotToValueMap: SlotToValueMap;
88
- result: ResolvedSnippet;
89
- }[]>;
90
- memoizedDerived: WeakMap<TgpuDerived<unknown>, {
91
- slotToValueMap: SlotToValueMap;
92
- result: unknown;
93
- }[]>;
94
- listeners: {
95
- [K in keyof NamespaceEventMap]: Set<(event: NamespaceEventMap[K]) => void>;
96
- };
97
- }
98
- type NamespaceEventMap = {
99
- 'name': {
100
- target: object;
101
- name: string;
102
- };
103
- };
104
- type DetachListener = () => void;
105
- interface Namespace {
106
- readonly [$internal]: NamespaceInternal;
107
- on<TEvent extends keyof NamespaceEventMap>(event: TEvent, listener: (event: NamespaceEventMap[TEvent]) => void): DetachListener;
108
- }
109
- interface NamespaceOptions {
110
- names?: 'random' | 'strict' | undefined;
111
- }
112
- declare function namespace(options?: NamespaceOptions | undefined): Namespace;
1
+ import { $o as TgpuLayoutComparisonSampler, $r as comptime, Ac as TgpuComputePipeline, Al as Storage, Ao as UniformFlag, Bc as isSlot, Bo as ValidateStorageSchema, Cc as TgpuFragmentFnShell, Co as fn, Dc as AutoFragmentOut, Do as IndexFlag, Ec as AutoFragmentIn, Eo as declare, Fc as TgpuMutableAccessor, Fo as isUsableAsVertex, Gc as workgroupVar, Go as WithVertex, Gr as rawCodeSnippet, Hc as VariableScope, Ho as WithBinding, Ic as TgpuSlot, Io as Configurable, Jc as computeFn, Jo as BindLayoutEntry, Jr as init, Kc as TgpuComputeFn, Ko as Withable, Kr as InitFromDeviceOptions, Lc as isAccessor, Ll as $internal, Lo as TgpuGuardedComputePipeline, Mc as Eventual, Ml as isUsableAsStorage, Mo as Vertex, Nc as TgpuAccessor, No as VertexFlag, Oc as AutoVertexIn, Oo as TgpuBuffer, Pc as TgpuLazy, Po as isBuffer, Qo as TgpuBindGroupLayout, Qr as TgpuComptime, Rc as isLazy, Rl as INTERNAL_GlobalExt, Ro as TgpuRoot, Sc as TgpuFragmentFn, So as TgpuGenericFn, Tc as isTgpuFragmentFn, To as TgpuDeclare, Uc as isVariable, Uo as WithCompute, Ur as RawCodeSnippetOrigin, Vc as TgpuVar, Vo as ValidateUniformSchema, Wc as privateVar, Wo as WithFragment, Wr as TgpuRawCodeSnippet, Xo as LayoutEntryToInput, Xr as Namespace, Yc as isTgpuComputeFn, Yo as ExtractBindGroupInputFromLayout, Yr as initFromDevice, Zo as TgpuBindGroup, Zr as namespace, _c as TextureProps, _i as isTexture, _o as ResolvableObject, _s as TgpuVertexLayout, a as MissingVertexBuffersError, al as LogResources, as as TgpuLayoutUniform, bc as isTgpuVertexFn, bo as TgpuFn, cl as TgpuUniform, cs as TgpuComparisonSampler, dl as TgpuBufferReadonly, ds as TgpuSampler, ei as TgpuConst, es as TgpuLayoutEntry, fl as TgpuBufferUniform, fs as isComparisonSampler, gc as isUsableAsSampled, gi as TgpuTextureView, go as GPUCallable, gs as TgpuRenderPipeline, hc as isUsableAsRender, hi as TgpuTexture, hs as TgpuPrimitiveState, i as MissingSlotValueError, is as TgpuLayoutTexture, jl as StorageFlag, jo as ValidUsagesFor, kc as AutoVertexOut, ko as Uniform, ll as isBufferShorthand, ls as TgpuFixedComparisonSampler, mc as SampledFlag, ml as TgpuQuerySet, ms as ColorAttachment, n as MissingBindGroupsError, ni as AnyData, ns as TgpuLayoutSampler, o as NotUniformError, oa as BaseData, ol as TgpuMutable, os as UnwrapRuntimeConstructor, pc as RenderFlag, pl as isUsableAsUniform, ps as isSampler, qc as TgpuComputeFnShell, qo as ShaderGenerator, qr as InitOptions, r as MissingLinksError, rs as TgpuLayoutStorage, s as ResolutionError, sl as TgpuReadonly, ss as bindGroupLayout, t as TgpuRenderPipelineDescriptor, ti as constant, ts as TgpuLayoutExternalTexture, ul as TgpuBufferMutable, us as TgpuFixedSampler, vc as TgpuVertexFn, vo as Wgsl, vs as vertexLayout, wc as fragmentFn, wo as isTgpuFn, xc as vertexFn, xo as TgpuFnShell, yc as TgpuVertexFnShell, yo as WgslExtension, zc as isMutableAccessor, zo as ValidateBufferSchema } from "./indexNamedExports-oL6tyaJ9.js";
2
+ import { t as index_d_exports$1 } from "./data/index.js";
3
+ import { t as index_d_exports$2 } from "./std/index.js";
4
+ import { t as index_d_exports } from "./common/index.js";
113
5
 
6
+ //#region src/resolutionCtx.d.ts
114
7
  /**
115
8
  * The results of a WGSL resolution.
116
9
  *
@@ -120,50 +13,51 @@ declare function namespace(options?: NamespaceOptions | undefined): Namespace;
120
13
  * @param logResources - Buffers and information about used console.logs needed to decode the raw data.
121
14
  */
122
15
  interface ResolutionResult {
123
- code: string;
124
- usedBindGroupLayouts: TgpuBindGroupLayout[];
125
- catchall: [number, TgpuBindGroup] | undefined;
126
- logResources: LogResources | undefined;
16
+ code: string;
17
+ usedBindGroupLayouts: TgpuBindGroupLayout[];
18
+ catchall: [number, TgpuBindGroup] | undefined;
19
+ logResources: LogResources | undefined;
127
20
  }
128
-
21
+ //#endregion
22
+ //#region src/core/resolve/tgpuResolve.d.ts
129
23
  interface TgpuResolveOptions {
130
- /**
131
- * The naming strategy used for generating identifiers for resolved externals and their dependencies.
132
- *
133
- * ## Namespaces
134
- * Each call to `tgpu.resolve` uses it's own namespace by default, but a
135
- * custom namespace can be created with `tgpu.namespace` and passed in.
136
- *
137
- * This allows tracking the behavior of the resolution process, as well as
138
- * sharing state between calls to `tgpu.resolve`.
139
- *
140
- * @default 'random'
141
- */
142
- names?: 'strict' | 'random' | Namespace | undefined;
143
- /**
144
- * A function to configure the resolution context.
145
- */
146
- config?: ((cfg: Configurable) => Configurable) | undefined;
147
- /**
148
- * List of WGSL shader extensions to enable.
149
- */
150
- enableExtensions?: WgslExtension[] | undefined;
151
- /**
152
- * A custom shader code generator, used when resolving TGSL.
153
- * If not provided, the default WGSL generator will be used.
154
- */
155
- shaderGenerator?: ShaderGenerator | undefined;
24
+ /**
25
+ * The naming strategy used for generating identifiers for resolved externals and their dependencies.
26
+ *
27
+ * ## Namespaces
28
+ * Each call to `tgpu.resolve` uses it's own namespace by default, but a
29
+ * custom namespace can be created with `tgpu.namespace` and passed in.
30
+ *
31
+ * This allows tracking the behavior of the resolution process, as well as
32
+ * sharing state between calls to `tgpu.resolve`.
33
+ *
34
+ * @default 'random'
35
+ */
36
+ names?: 'strict' | 'random' | Namespace | undefined;
37
+ /**
38
+ * A function to configure the resolution context.
39
+ */
40
+ config?: ((cfg: Configurable) => Configurable) | undefined;
41
+ /**
42
+ * List of WGSL shader extensions to enable.
43
+ */
44
+ enableExtensions?: WgslExtension[] | undefined;
45
+ /**
46
+ * A custom shader code generator, used when resolving TypeGPU functions.
47
+ * If not provided, the default WGSL generator will be used.
48
+ */
49
+ shaderGenerator?: ShaderGenerator | undefined;
156
50
  }
157
51
  interface TgpuExtendedResolveOptions extends TgpuResolveOptions {
158
- /**
159
- * Map of external names to their resolvable values.
160
- */
161
- externals: Record<string, Wgsl | object>;
162
- /**
163
- * The code template to use for the resolution. All external names will be replaced with their resolved values.
164
- * @default ''
165
- */
166
- template?: string | undefined;
52
+ /**
53
+ * Map of external names to their resolvable values.
54
+ */
55
+ externals: Record<string, Wgsl | object>;
56
+ /**
57
+ * The code template to use for the resolution. All external names will be replaced with their resolved values.
58
+ * @default ''
59
+ */
60
+ template?: string | undefined;
167
61
  }
168
62
  /**
169
63
  * Resolves a template with external values. Each external that is used will get resolved to a code string and replaced in the template.
@@ -267,12 +161,31 @@ declare function resolveWithContext(items: ResolvableObject[], options?: TgpuRes
267
161
  */
268
162
  declare function resolve(options: TgpuExtendedResolveOptions): string;
269
163
  declare function resolve(items: ResolvableObject[], options?: TgpuResolveOptions): string;
270
-
164
+ //#endregion
165
+ //#region src/core/slot/slot.d.ts
166
+ declare function slot<T>(defaultValue?: T): TgpuSlot<T>;
167
+ //#endregion
168
+ //#region src/core/slot/lazy.d.ts
169
+ declare function lazy<T>(compute: () => T): TgpuLazy<T>;
170
+ //#endregion
171
+ //#region src/core/slot/accessor.d.ts
172
+ declare function accessor<T extends AnyData | ((count: number) => AnyData)>(schemaOrConstructor: T, defaultValue?: TgpuAccessor.In<NoInfer<T>>): TgpuAccessor<UnwrapRuntimeConstructor<T>>;
173
+ declare function mutableAccessor<T extends AnyData | ((count: number) => AnyData)>(schemaOrConstructor: T, defaultValue?: TgpuMutableAccessor.In<NoInfer<T>>): TgpuMutableAccessor<UnwrapRuntimeConstructor<T>>;
174
+ //#endregion
175
+ //#region src/core/unroll/tgpuUnroll.d.ts
176
+ /**
177
+ * Marks an iterable to be unrolled by the wgslGenerator.
178
+ */
179
+ declare const unroll: (<T extends Iterable<unknown>>(value: T) => T) & GPUCallable<[value: Iterable<unknown>]> & {
180
+ [$internal]: true;
181
+ };
182
+ //#endregion
183
+ //#region src/core/simulate/tgpuSimulate.d.ts
271
184
  interface SimulationResult<T> {
272
- value: T;
273
- buffers: Map<TgpuBuffer<AnyData>, unknown>;
274
- privateVars: Map<TgpuVar<'private', AnyData>, unknown>[][][];
275
- workgroupVars: Map<TgpuVar<'workgroup', AnyData>, unknown>[][][];
185
+ value: T;
186
+ buffers: Map<TgpuBuffer<BaseData>, unknown>;
187
+ privateVars: Map<TgpuVar<'private'>, unknown>[][][];
188
+ workgroupVars: Map<TgpuVar<'workgroup'>, unknown>[][][];
276
189
  }
277
190
  /**
278
191
  * Runs the provided callback in a simulated environment, giving
@@ -297,162 +210,63 @@ interface SimulationResult<T> {
297
210
  * console.log(result.value); // 3
298
211
  */
299
212
  declare function simulate<T>(callback: () => T): SimulationResult<T>;
300
-
301
- /**
302
- * Options passed into {@link init}.
303
- */
304
- type InitOptions = {
305
- adapter?: GPURequestAdapterOptions | undefined;
306
- device?: GPUDeviceDescriptor & {
307
- optionalFeatures?: Iterable<GPUFeatureName>;
308
- } | undefined;
309
- /** @default 'random' */
310
- unstable_names?: 'random' | 'strict' | undefined;
311
- /**
312
- * A custom shader code generator, used when resolving TGSL.
313
- * If not provided, the default WGSL generator will be used.
314
- */
315
- shaderGenerator?: ShaderGenerator | undefined;
316
- unstable_logOptions?: LogGeneratorOptions;
317
- };
318
- /**
319
- * Options passed into {@link initFromDevice}.
320
- */
321
- type InitFromDeviceOptions = {
322
- device: GPUDevice;
323
- /** @default 'random' */
324
- unstable_names?: 'random' | 'strict' | undefined;
325
- /**
326
- * A custom shader code generator, used when resolving TGSL.
327
- * If not provided, the default WGSL generator will be used.
328
- */
329
- shaderGenerator?: ShaderGenerator | undefined;
330
- unstable_logOptions?: LogGeneratorOptions;
331
- };
332
- /**
333
- * Requests a new GPU device and creates a root around it.
334
- * If a specific device should be used instead, use @see initFromDevice.
335
- *
336
- * @example
337
- * When given no options, the function will ask the browser for a suitable GPU device.
338
- * ```ts
339
- * const root = await tgpu.init();
340
- * ```
341
- *
342
- * @example
343
- * If there are specific options that should be used when requesting a device, you can pass those in.
344
- * ```ts
345
- * const adapterOptions: GPURequestAdapterOptions = ...;
346
- * const deviceDescriptor: GPUDeviceDescriptor = ...;
347
- * const root = await tgpu.init({ adapter: adapterOptions, device: deviceDescriptor });
348
- * ```
349
- */
350
- declare function init(options?: InitOptions): Promise<TgpuRoot>;
351
- /**
352
- * Creates a root from the given device, instead of requesting it like @see init.
353
- *
354
- * @example
355
- * ```ts
356
- * const device: GPUDevice = ...;
357
- * const root = tgpu.initFromDevice({ device });
358
- * ```
359
- */
360
- declare function initFromDevice(options: InitFromDeviceOptions): TgpuRoot;
361
-
362
- declare function accessor<T extends AnyWgslData>(schema: T, defaultValue?: TgpuFn<() => T> | TgpuBufferUsage<T> | TgpuBufferShorthand<T> | Infer<T>): TgpuAccessor<T>;
363
-
364
- declare function derived<T>(compute: () => T): TgpuDerived<T>;
365
-
366
- declare function slot<T>(defaultValue?: T): TgpuSlot<T>;
367
-
368
- /**
369
- * An error that happens during resolution of WGSL code.
370
- * Contains a trace of all ancestor resolvables in
371
- * which this error originated.
372
- *
373
- * @category Errors
374
- */
375
- declare class ResolutionError extends Error {
376
- readonly cause: unknown;
377
- readonly trace: unknown[];
378
- constructor(cause: unknown, trace: unknown[]);
379
- appendToTrace(ancestor: unknown): ResolutionError;
380
- }
381
- /**
382
- * @category Errors
383
- */
384
- declare class MissingSlotValueError extends Error {
385
- readonly slot: TgpuSlot<unknown>;
386
- constructor(slot: TgpuSlot<unknown>);
213
+ declare namespace tgpuUnstable_d_exports {
214
+ export { _accessor as accessor, _comptime as comptime, _computeFn as computeFn, _constant as const, declare, _lazy as derived, _fn as fn, _fragmentFn as fragmentFn, _mutableAccessor as mutableAccessor, namespace, _privateVar as privateVar, rawCodeSnippet, simulate, _slot as slot, _vertexFn as vertexFn, _vertexLayout as vertexLayout, _workgroupVar as workgroupVar };
387
215
  }
388
- /**
389
- * @category Errors
390
- */
391
- declare class NotUniformError extends Error {
392
- constructor(value: TgpuBuffer<AnyData>);
393
- }
394
- declare class MissingLinksError extends Error {
395
- constructor(fnLabel: string | undefined, externalNames: string[]);
396
- }
397
- declare class MissingBindGroupsError extends Error {
398
- constructor(layouts: Iterable<TgpuBindGroupLayout>);
399
- }
400
- declare class MissingVertexBuffersError extends Error {
401
- constructor(layouts: Iterable<TgpuVertexLayout<WgslArray | Disarray>>);
402
- }
403
-
216
+ /** @deprecated This feature is now stable, use tgpu.const. */
217
+ declare const _constant: typeof constant;
218
+ /** @deprecated This feature is now stable, use tgpu.comptime. */
219
+ declare const _comptime: typeof comptime;
220
+ /** @deprecated This feature is now stable, use tgpu.computeFn. */
221
+ declare const _computeFn: typeof computeFn;
222
+ /** @deprecated This feature is now stable, use tgpu.fn. */
223
+ declare const _fn: typeof fn;
224
+ /** @deprecated This feature is now stable, use tgpu.fragmentFn. */
225
+ declare const _fragmentFn: typeof fragmentFn;
226
+ /** @deprecated This feature is now stable, use tgpu.vertexFn. */
227
+ declare const _vertexFn: typeof vertexFn;
228
+ /** @deprecated This feature is now stable, use tgpu.accessor. */
229
+ declare const _accessor: typeof accessor;
230
+ /** @deprecated This feature is now stable, use tgpu.mutableAccessor. */
231
+ declare const _mutableAccessor: typeof mutableAccessor;
232
+ /** @deprecated This feature is now stable, use tgpu.lazy. */
233
+ declare const _lazy: typeof lazy;
234
+ /** @deprecated This feature is now stable, use tgpu.slot. */
235
+ declare const _slot: typeof slot;
236
+ /** @deprecated This feature is now stable, use tgpu.privateVar. */
237
+ declare const _privateVar: typeof privateVar;
238
+ /** @deprecated This feature is now stable, use tgpu.workgroupVar. */
239
+ declare const _workgroupVar: typeof workgroupVar;
240
+ /** @deprecated This feature is now stable, use tgpu.vertexLayout. */
241
+ declare const _vertexLayout: typeof vertexLayout;
242
+ //#endregion
243
+ //#region src/index.d.ts
404
244
  /**
405
245
  * @module typegpu
406
246
  */
407
-
247
+ // NOTE: This is a barrel file, internal files should not import things from this file
408
248
  declare const tgpu: {
409
- fn: typeof fn;
410
- bindGroupLayout: typeof bindGroupLayout;
411
- vertexLayout: typeof vertexLayout;
412
- slot: typeof slot;
413
- init: typeof init;
414
- initFromDevice: typeof initFromDevice;
415
- resolve: typeof resolve;
416
- resolveWithContext: typeof resolveWithContext;
417
- privateVar: typeof privateVar;
418
- workgroupVar: typeof workgroupVar;
419
- const: typeof constant;
420
- '~unstable': {
421
- /**
422
- * @deprecated This feature is now stable, use tgpu.fn.
423
- */
424
- fn: typeof fn;
425
- fragmentFn: typeof fragmentFn;
426
- vertexFn: typeof vertexFn;
427
- computeFn: typeof computeFn;
428
- comptime: typeof comptime;
429
- /**
430
- * @deprecated This feature is now stable, use tgpu.vertexLayout.
431
- */
432
- vertexLayout: typeof vertexLayout;
433
- namespace: typeof namespace;
434
- derived: typeof derived;
435
- /**
436
- * @deprecated This feature is now stable, use tgpu.slot.
437
- */
438
- slot: typeof slot;
439
- accessor: typeof accessor;
440
- /**
441
- * @deprecated This feature is now stable, use tgpu.privateVar.
442
- */
443
- privateVar: typeof privateVar;
444
- /**
445
- * @deprecated This feature is now stable, use tgpu.workgroupVar.
446
- */
447
- workgroupVar: typeof workgroupVar;
448
- /**
449
- * @deprecated This feature is now stable, use tgpu.const.
450
- */
451
- const: typeof constant;
452
- declare: typeof declare;
453
- rawCodeSnippet: typeof rawCodeSnippet;
454
- simulate: typeof simulate;
455
- };
249
+ const: typeof constant;
250
+ fn: typeof fn;
251
+ comptime: typeof comptime;
252
+ resolve: typeof resolve;
253
+ resolveWithContext: typeof resolveWithContext;
254
+ init: typeof init;
255
+ initFromDevice: typeof initFromDevice;
256
+ slot: typeof slot;
257
+ lazy: typeof lazy;
258
+ accessor: typeof accessor;
259
+ mutableAccessor: typeof mutableAccessor;
260
+ privateVar: typeof privateVar;
261
+ workgroupVar: typeof workgroupVar;
262
+ vertexLayout: typeof vertexLayout;
263
+ bindGroupLayout: typeof bindGroupLayout;
264
+ computeFn: typeof computeFn;
265
+ fragmentFn: typeof fragmentFn;
266
+ vertexFn: typeof vertexFn;
267
+ unroll: typeof unroll;
268
+ '~unstable': typeof tgpuUnstable_d_exports;
456
269
  };
457
-
458
- export { Configurable, type InitFromDeviceOptions, type InitOptions, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, type Namespace, NotUniformError, type RawCodeSnippetOrigin, ResolutionError, TgpuAccessor, TgpuBindGroup, TgpuBindGroupLayout, TgpuBuffer, TgpuDerived, TgpuFn, type TgpuRawCodeSnippet, TgpuRoot, TgpuSlot, TgpuVar, TgpuVertexLayout, tgpu as default, tgpu };
270
+ //#endregion
271
+ export { AutoFragmentIn, AutoFragmentOut, AutoVertexIn, AutoVertexOut, BindLayoutEntry, ColorAttachment, Configurable, Eventual, ExtractBindGroupInputFromLayout, INTERNAL_GlobalExt, IndexFlag, InitFromDeviceOptions, InitOptions, LayoutEntryToInput, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, Namespace, NotUniformError, RawCodeSnippetOrigin, RenderFlag, ResolutionError, SampledFlag, Storage, StorageFlag, TextureProps, TgpuAccessor, TgpuBindGroup, TgpuBindGroupLayout, TgpuBuffer, TgpuBufferMutable, TgpuBufferReadonly, TgpuBufferUniform, TgpuComparisonSampler, TgpuComptime, TgpuComputeFn, TgpuComputeFnShell, TgpuComputePipeline, TgpuConst, TgpuDeclare, TgpuFixedComparisonSampler, TgpuFixedSampler, TgpuFn, TgpuFnShell, TgpuFragmentFn, TgpuFragmentFnShell, TgpuGenericFn, TgpuGuardedComputePipeline, TgpuLayoutComparisonSampler, TgpuLayoutEntry, TgpuLayoutExternalTexture, TgpuLayoutSampler, TgpuLayoutStorage, TgpuLayoutTexture, TgpuLayoutUniform, TgpuLazy, TgpuMutable, TgpuMutableAccessor, TgpuPrimitiveState, TgpuQuerySet, TgpuRawCodeSnippet, TgpuReadonly, TgpuRenderPipeline, TgpuRenderPipelineDescriptor, TgpuRoot, TgpuSampler, TgpuSlot, TgpuTexture, TgpuTextureView, TgpuUniform, TgpuVar, TgpuVertexFn, TgpuVertexFnShell, TgpuVertexLayout, Uniform, UniformFlag, ValidUsagesFor, ValidateBufferSchema, ValidateStorageSchema, ValidateUniformSchema, VariableScope, Vertex, VertexFlag, WithBinding, WithCompute, WithFragment, WithVertex, Withable, index_d_exports as common, index_d_exports$1 as d, tgpu as default, tgpu, isAccessor, isBuffer, isBufferShorthand, isComparisonSampler, isLazy, isMutableAccessor, isSampler, isSlot, isTexture, isTgpuComputeFn, isTgpuFn, isTgpuFragmentFn, isTgpuVertexFn, isUsableAsRender, isUsableAsSampled, isUsableAsStorage, isUsableAsUniform, isUsableAsVertex, isVariable, index_d_exports$2 as std };
272
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["__core_function_tgpuFn_ts0","__core_function_comptime_ts0","__core_resolve_tgpuResolve_ts0","__core_root_init_ts0","__core_slot_slot_ts0","__core_slot_lazy_ts0","__core_slot_accessor_ts0","__core_variable_tgpuVariable_ts0","__core_vertexLayout_vertexLayout_ts0","__tgpuBindGroupLayout_ts0","__core_function_tgpuComputeFn_ts0","__core_function_tgpuFragmentFn_ts0","__core_function_tgpuVertexFn_ts0","__core_unroll_tgpuUnroll_ts0","__tgpuUnstable_ts0","tgpu","__core_constant_tgpuConstant_ts0","constant","fn","comptime","resolve","resolveWithContext","init","initFromDevice","slot","lazy","accessor","mutableAccessor","privateVar","workgroupVar","vertexLayout","bindGroupLayout","computeFn","fragmentFn","vertexFn","unroll","const","default"],"sources":["../src/resolutionCtx.ts","../src/core/resolve/tgpuResolve.ts","../src/core/slot/slot.ts","../src/core/slot/lazy.ts","../src/core/slot/accessor.ts","../src/core/unroll/tgpuUnroll.ts","../src/core/simulate/tgpuSimulate.ts","../src/tgpuUnstable.ts","../src/index.d.ts"],"mappings":"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"}