typegpu 0.8.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +2 -2
  2. package/builtin-ClEnM-Ye.js +818 -0
  3. package/builtin-ClEnM-Ye.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 -400
  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-yZXvaV2C.js +413 -0
  14. package/deepEqual-yZXvaV2C.js.map +1 -0
  15. package/extensions-0SFbU9FH.js +2032 -0
  16. package/extensions-0SFbU9FH.js.map +1 -0
  17. package/fullScreenTriangle-MdLGaAMR.js +543 -0
  18. package/fullScreenTriangle-MdLGaAMR.js.map +1 -0
  19. package/index.d.ts +167 -264
  20. package/index.d.ts.map +1 -0
  21. package/index.js +6294 -160
  22. package/index.js.map +1 -1
  23. package/indexNamedExports-Cdy7USiY.d.ts +5696 -0
  24. package/indexNamedExports-Cdy7USiY.d.ts.map +1 -0
  25. package/operators-HTxa_0k9.js +4156 -0
  26. package/operators-HTxa_0k9.js.map +1 -0
  27. package/package.json +3 -2
  28. package/std/index.d.ts +7 -637
  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-Dg5ybJro.js +205 -0
  33. package/texture-Dg5ybJro.js.map +1 -0
  34. package/chunk-6U5HPHCJ.js +0 -2
  35. package/chunk-6U5HPHCJ.js.map +0 -1
  36. package/chunk-CGQB3SER.js +0 -3
  37. package/chunk-CGQB3SER.js.map +0 -1
  38. package/chunk-CRZWTZM2.js +0 -10
  39. package/chunk-CRZWTZM2.js.map +0 -1
  40. package/chunk-ECR2EGZX.js +0 -7
  41. package/chunk-ECR2EGZX.js.map +0 -1
  42. package/chunk-PWBIFP67.js +0 -2
  43. package/chunk-PWBIFP67.js.map +0 -1
  44. package/matrix-DIfOiRyz.d.ts +0 -122
  45. package/tgpuConstant-BTQFNlQH.d.ts +0 -5201
package/index.d.ts CHANGED
@@ -1,61 +1,9 @@
1
- import { $ as $internal, S as ShelllessRepository, T as TgpuSlot, R as ResolvedSnippet, a as TgpuDerived, b as TgpuBindGroupLayout, c as TgpuBindGroup, L as LogResources, W as Wgsl, C as Configurable, d as WgslExtension, e as ShaderGenerator, f as TgpuBuffer, A as AnyData, g as TgpuVar, h as LogGeneratorOptions, i as TgpuRoot, j as AnyWgslData, k as TgpuFn, l as TgpuBufferUsage, I as Infer, m as TgpuAccessor, n as TgpuVertexLayout, o as WgslArray, D as Disarray, p as fn, q as bindGroupLayout, v as vertexLayout, r as privateVar, w as workgroupVar, s as constant, t as fragmentFn, u as vertexFn, x as computeFn, y as declare } from './tgpuConstant-BTQFNlQH.js';
2
- export { aw as BindLayoutEntry, aj as Eventual, ax as ExtractBindGroupInputFromLayout, aO as INTERNAL_GlobalExt, a7 as IndexFlag, ay as LayoutEntryToInput, an as RenderFlag, ao as SampledFlag, a3 as Storage, a4 as StorageFlag, am as TextureProps, ad as TgpuBufferMutable, ae as TgpuBufferReadonly, af as TgpuBufferUniform, ar as TgpuComparisonSampler, aL as TgpuComputeFn, aM as TgpuComputeFnShell, a6 as TgpuComputePipeline, ap as TgpuConst, aN as TgpuDeclare, as as TgpuFixedComparisonSampler, at as TgpuFixedSampler, aG as TgpuFnShell, aJ as TgpuFragmentFn, aK as TgpuFragmentFnShell, V as TgpuGuardedComputePipeline, az as TgpuLayoutComparisonSampler, aA as TgpuLayoutEntry, aB as TgpuLayoutExternalTexture, aC as TgpuLayoutSampler, aD as TgpuLayoutStorage, aE as TgpuLayoutTexture, aF as TgpuLayoutUniform, ag as TgpuMutable, av as TgpuQuerySet, ah as TgpuReadonly, a5 as TgpuRenderPipeline, au as TgpuSampler, ak as TgpuTexture, al as TgpuTextureView, ai as TgpuUniform, aH as TgpuVertexFn, aI as TgpuVertexFnShell, a8 as Uniform, a9 as UniformFlag, aa as ValidUsagesFor, X as ValidateBufferSchema, Y as ValidateStorageSchema, Z as ValidateUniformSchema, aq as VariableScope, ab as Vertex, ac as VertexFlag, _ as WithBinding, a0 as WithCompute, a1 as WithFragment, a2 as WithVertex, z as isBuffer, P as isBufferShorthand, G as isComparisonSampler, E as isDerived, H as isSampler, F as isSlot, J as isTexture, Q as isTgpuFn, K as isUsableAsRender, M as isUsableAsSampled, N as isUsableAsStorage, O as isUsableAsUniform, B as isUsableAsVertex, U as isVariable } from './tgpuConstant-BTQFNlQH.js';
3
- import 'tinyest';
4
-
5
- interface NameRegistry {
6
- /**
7
- * Creates a valid WGSL identifier, each guaranteed to be unique
8
- * in the lifetime of a single resolution process.
9
- * Should append "_" to primer, followed by some id.
10
- * @param primer Used in the generation process, makes the identifier more recognizable.
11
- */
12
- makeUnique(primer?: string): string;
13
- /**
14
- * Creates a valid WGSL identifier.
15
- * Renames identifiers that are WGSL reserved words.
16
- * @param primer Used in the generation process.
17
- *
18
- * @example
19
- * makeValid("notAKeyword"); // "notAKeyword"
20
- * makeValid("struct"); // makeUnique("struct")
21
- * makeValid("struct_1"); // makeUnique("struct_1") (to avoid potential name collisions)
22
- * makeValid("_"); // ERROR (too difficult to make valid to care)
23
- */
24
- makeValid(primer: string): string;
25
- }
26
-
27
- type SlotToValueMap = Map<TgpuSlot<unknown>, unknown>;
28
- interface NamespaceInternal {
29
- readonly nameRegistry: NameRegistry;
30
- readonly shelllessRepo: ShelllessRepository;
31
- memoizedResolves: WeakMap<object, {
32
- slotToValueMap: SlotToValueMap;
33
- result: ResolvedSnippet;
34
- }[]>;
35
- memoizedDerived: WeakMap<TgpuDerived<unknown>, {
36
- slotToValueMap: SlotToValueMap;
37
- result: unknown;
38
- }[]>;
39
- listeners: {
40
- [K in keyof NamespaceEventMap]: Set<(event: NamespaceEventMap[K]) => void>;
41
- };
42
- }
43
- type NamespaceEventMap = {
44
- 'name': {
45
- target: object;
46
- name: string;
47
- };
48
- };
49
- type DetachListener = () => void;
50
- interface Namespace {
51
- readonly [$internal]: NamespaceInternal;
52
- on<TEvent extends keyof NamespaceEventMap>(event: TEvent, listener: (event: NamespaceEventMap[TEvent]) => void): DetachListener;
53
- }
54
- interface NamespaceOptions {
55
- names?: 'random' | 'strict' | undefined;
56
- }
57
- 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-Cdy7USiY.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";
58
5
 
6
+ //#region src/resolutionCtx.d.ts
59
7
  /**
60
8
  * The results of a WGSL resolution.
61
9
  *
@@ -65,51 +13,54 @@ declare function namespace(options?: NamespaceOptions | undefined): Namespace;
65
13
  * @param logResources - Buffers and information about used console.logs needed to decode the raw data.
66
14
  */
67
15
  interface ResolutionResult {
68
- code: string;
69
- usedBindGroupLayouts: TgpuBindGroupLayout[];
70
- catchall: [number, TgpuBindGroup] | undefined;
71
- logResources: LogResources | undefined;
16
+ code: string;
17
+ usedBindGroupLayouts: TgpuBindGroupLayout[];
18
+ catchall: [number, TgpuBindGroup] | undefined;
19
+ logResources: LogResources | undefined;
72
20
  }
73
-
21
+ //#endregion
22
+ //#region src/core/resolve/tgpuResolve.d.ts
74
23
  interface TgpuResolveOptions {
75
- /**
76
- * Map of external names to their resolvable values.
77
- */
78
- externals: Record<string, Wgsl | object>;
79
- /**
80
- * The code template to use for the resolution. All external names will be replaced with their resolved values.
81
- * @default ''
82
- */
83
- template?: string | undefined;
84
- /**
85
- * The naming strategy used for generating identifiers for resolved externals and their dependencies.
86
- *
87
- * ## Namespaces
88
- * Each call to `tgpu.resolve` uses it's own namespace by default, but a
89
- * custom namespace can be created with `tgpu.namespace` and passed in.
90
- *
91
- * This allows tracking the behavior of the resolution process, as well as
92
- * sharing state between calls to `tgpu.resolve`.
93
- *
94
- * @default 'random'
95
- */
96
- names?: 'strict' | 'random' | Namespace | undefined;
97
- /**
98
- * A function to configure the resolution context.
99
- */
100
- config?: ((cfg: Configurable) => Configurable) | undefined;
101
- /**
102
- * List of WGSL shader extensions to enable.
103
- */
104
- enableExtensions?: WgslExtension[] | undefined;
105
- /**
106
- * A custom shader code generator, used when resolving TGSL.
107
- * If not provided, the default WGSL generator will be used.
108
- */
109
- 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;
50
+ }
51
+ interface TgpuExtendedResolveOptions extends TgpuResolveOptions {
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;
110
61
  }
111
62
  /**
112
- * Resolves a template with external values. Each external will get resolved to a code string and replaced in the template.
63
+ * Resolves a template with external values. Each external that is used will get resolved to a code string and replaced in the template.
113
64
  * Any dependencies of the externals will also be resolved and included in the output.
114
65
  * @param options - The options for the resolution.
115
66
  *
@@ -117,10 +68,7 @@ interface TgpuResolveOptions {
117
68
  *
118
69
  * @example
119
70
  * ```ts
120
- * const Gradient = d.struct({
121
- * from: d.vec3f,
122
- * to: d.vec3f,
123
- * });
71
+ * const Gradient = d.struct({ from: d.vec3f, to: d.vec3f });
124
72
  *
125
73
  * const { code, usedBindGroupLayouts, catchall } = tgpu.resolveWithContext({
126
74
  * template: `
@@ -143,13 +91,14 @@ interface TgpuResolveOptions {
143
91
  * // }
144
92
  * ```
145
93
  */
146
- declare function resolveWithContext(options: TgpuResolveOptions): ResolutionResult;
94
+ declare function resolveWithContext(options: TgpuExtendedResolveOptions): ResolutionResult;
147
95
  /**
148
- * Resolves a template with external values. Each external will get resolved to a code string and replaced in the template.
96
+ * Resolves given TypeGPU resources.
149
97
  * Any dependencies of the externals will also be resolved and included in the output.
98
+ * @param items - An array of items to resolve.
150
99
  * @param options - The options for the resolution.
151
100
  *
152
- * @returns The resolved code.
101
+ * @returns {ResolutionResult}
153
102
  *
154
103
  * @example
155
104
  * ```ts
@@ -158,7 +107,38 @@ declare function resolveWithContext(options: TgpuResolveOptions): ResolutionResu
158
107
  * to: d.vec3f,
159
108
  * });
160
109
  *
161
- * const resolved = tgpu.resolve({
110
+ * const { code, usedBindGroupLayouts, catchall } =
111
+ * tgpu.resolveWithContext([Gradient]);
112
+ *
113
+ * console.log(code);
114
+ * // struct Gradient_0 {
115
+ * // from: vec3f,
116
+ * // to: vec3f,
117
+ * // }
118
+ * ```
119
+ */
120
+ declare function resolveWithContext(items: ResolvableObject[], options?: TgpuResolveOptions): ResolutionResult;
121
+ /**
122
+ * A shorthand for calling `tgpu.resolveWithContext(...).code`.
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * const Gradient = d.struct({ from: d.vec3f, to: d.vec3f });
127
+ *
128
+ * const resolved = tgpu.resolve([Gradient]);
129
+ *
130
+ * console.log(resolved);
131
+ * // struct Gradient_0 {
132
+ * // from: vec3f,
133
+ * // to: vec3f,
134
+ * // }
135
+ * ```
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const Gradient = d.struct({ from: d.vec3f, to: d.vec3f });
140
+ *
141
+ * const code = tgpu.resolve({
162
142
  * template: `
163
143
  * fn getGradientAngle(gradient: Gradient) -> f32 {
164
144
  * return atan(gradient.to.y - gradient.from.y, gradient.to.x - gradient.from.x);
@@ -169,7 +149,7 @@ declare function resolveWithContext(options: TgpuResolveOptions): ResolutionResu
169
149
  * },
170
150
  * });
171
151
  *
172
- * console.log(resolved);
152
+ * console.log(code);
173
153
  * // struct Gradient_0 {
174
154
  * // from: vec3f,
175
155
  * // to: vec3f,
@@ -179,13 +159,33 @@ declare function resolveWithContext(options: TgpuResolveOptions): ResolutionResu
179
159
  * // }
180
160
  * ```
181
161
  */
182
- declare function resolve(options: TgpuResolveOptions): string;
183
-
162
+ declare function resolve(options: TgpuExtendedResolveOptions): string;
163
+ declare function resolve(items: ResolvableObject[], options?: TgpuResolveOptions): string;
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
184
184
  interface SimulationResult<T> {
185
- value: T;
186
- buffers: Map<TgpuBuffer<AnyData>, unknown>;
187
- privateVars: Map<TgpuVar<'private', AnyData>, unknown>[][][];
188
- 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>[][][];
189
189
  }
190
190
  /**
191
191
  * Runs the provided callback in a simulated environment, giving
@@ -210,160 +210,63 @@ interface SimulationResult<T> {
210
210
  * console.log(result.value); // 3
211
211
  */
212
212
  declare function simulate<T>(callback: () => T): SimulationResult<T>;
213
-
214
- /**
215
- * Options passed into {@link init}.
216
- */
217
- type InitOptions = {
218
- adapter?: GPURequestAdapterOptions | undefined;
219
- device?: GPUDeviceDescriptor & {
220
- optionalFeatures?: Iterable<GPUFeatureName>;
221
- } | undefined;
222
- /** @default 'random' */
223
- unstable_names?: 'random' | 'strict' | undefined;
224
- /**
225
- * A custom shader code generator, used when resolving TGSL.
226
- * If not provided, the default WGSL generator will be used.
227
- */
228
- shaderGenerator?: ShaderGenerator | undefined;
229
- unstable_logOptions?: LogGeneratorOptions;
230
- };
231
- /**
232
- * Options passed into {@link initFromDevice}.
233
- */
234
- type InitFromDeviceOptions = {
235
- device: GPUDevice;
236
- /** @default 'random' */
237
- unstable_names?: 'random' | 'strict' | undefined;
238
- /**
239
- * A custom shader code generator, used when resolving TGSL.
240
- * If not provided, the default WGSL generator will be used.
241
- */
242
- shaderGenerator?: ShaderGenerator | undefined;
243
- unstable_logOptions?: LogGeneratorOptions;
244
- };
245
- /**
246
- * Requests a new GPU device and creates a root around it.
247
- * If a specific device should be used instead, use @see initFromDevice.
248
- *
249
- * @example
250
- * When given no options, the function will ask the browser for a suitable GPU device.
251
- * ```ts
252
- * const root = await tgpu.init();
253
- * ```
254
- *
255
- * @example
256
- * If there are specific options that should be used when requesting a device, you can pass those in.
257
- * ```ts
258
- * const adapterOptions: GPURequestAdapterOptions = ...;
259
- * const deviceDescriptor: GPUDeviceDescriptor = ...;
260
- * const root = await tgpu.init({ adapter: adapterOptions, device: deviceDescriptor });
261
- * ```
262
- */
263
- declare function init(options?: InitOptions): Promise<TgpuRoot>;
264
- /**
265
- * Creates a root from the given device, instead of requesting it like @see init.
266
- *
267
- * @example
268
- * ```ts
269
- * const device: GPUDevice = ...;
270
- * const root = tgpu.initFromDevice({ device });
271
- * ```
272
- */
273
- declare function initFromDevice(options: InitFromDeviceOptions): TgpuRoot;
274
-
275
- declare function accessor<T extends AnyWgslData>(schema: T, defaultValue?: TgpuFn<() => T> | TgpuBufferUsage<T> | Infer<T>): TgpuAccessor<T>;
276
-
277
- declare function derived<T>(compute: () => T): TgpuDerived<T>;
278
-
279
- declare function slot<T>(defaultValue?: T): TgpuSlot<T>;
280
-
281
- /**
282
- * An error that happens during resolution of WGSL code.
283
- * Contains a trace of all ancestor resolvables in
284
- * which this error originated.
285
- *
286
- * @category Errors
287
- */
288
- declare class ResolutionError extends Error {
289
- readonly cause: unknown;
290
- readonly trace: unknown[];
291
- constructor(cause: unknown, trace: unknown[]);
292
- appendToTrace(ancestor: unknown): ResolutionError;
293
- }
294
- /**
295
- * @category Errors
296
- */
297
- declare class MissingSlotValueError extends Error {
298
- readonly slot: TgpuSlot<unknown>;
299
- 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 };
300
215
  }
301
- /**
302
- * @category Errors
303
- */
304
- declare class NotUniformError extends Error {
305
- constructor(value: TgpuBuffer<AnyData>);
306
- }
307
- declare class MissingLinksError extends Error {
308
- constructor(fnLabel: string | undefined, externalNames: string[]);
309
- }
310
- declare class MissingBindGroupsError extends Error {
311
- constructor(layouts: Iterable<TgpuBindGroupLayout>);
312
- }
313
- declare class MissingVertexBuffersError extends Error {
314
- constructor(layouts: Iterable<TgpuVertexLayout<WgslArray | Disarray>>);
315
- }
316
-
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
317
244
  /**
318
245
  * @module typegpu
319
246
  */
320
-
247
+ // NOTE: This is a barrel file, internal files should not import things from this file
321
248
  declare const tgpu: {
322
- fn: typeof fn;
323
- bindGroupLayout: typeof bindGroupLayout;
324
- vertexLayout: typeof vertexLayout;
325
- slot: typeof slot;
326
- init: typeof init;
327
- initFromDevice: typeof initFromDevice;
328
- resolve: typeof resolve;
329
- resolveWithContext: typeof resolveWithContext;
330
- privateVar: typeof privateVar;
331
- workgroupVar: typeof workgroupVar;
332
- const: typeof constant;
333
- '~unstable': {
334
- /**
335
- * @deprecated This feature is now stable, use tgpu.fn.
336
- */
337
- fn: typeof fn;
338
- fragmentFn: typeof fragmentFn;
339
- vertexFn: typeof vertexFn;
340
- computeFn: typeof computeFn;
341
- /**
342
- * @deprecated This feature is now stable, use tgpu.vertexLayout.
343
- */
344
- vertexLayout: typeof vertexLayout;
345
- namespace: typeof namespace;
346
- derived: typeof derived;
347
- /**
348
- * @deprecated This feature is now stable, use tgpu.slot.
349
- */
350
- slot: typeof slot;
351
- accessor: typeof accessor;
352
- /**
353
- * @deprecated This feature is now stable, use tgpu.privateVar.
354
- */
355
- privateVar: typeof privateVar;
356
- /**
357
- * @deprecated This feature is now stable, use tgpu.workgroupVar.
358
- */
359
- workgroupVar: typeof workgroupVar;
360
- /**
361
- * @deprecated This feature is now stable, use tgpu.const.
362
- */
363
- const: typeof constant;
364
- declare: typeof declare;
365
- simulate: typeof simulate;
366
- };
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;
367
269
  };
368
-
369
- export { Configurable, type InitFromDeviceOptions, type InitOptions, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, type Namespace, NotUniformError, ResolutionError, TgpuAccessor, TgpuBindGroup, TgpuBindGroupLayout, TgpuBuffer, TgpuDerived, TgpuFn, 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":";;;;;;;;;;;;;;UAs+BiB,gBAAA;EACf,IAAA;EACA,oBAAA,EAAsB,mBAAA;EACtB,QAAA,WAAmB,aAAA;EACnB,YAAA,EAAc,YAAA;AAAA;;;UC19BC,kBAAA;EDs9BA;;;;;;;;;;;;ECz8Bf,KAAA,yBAA8B,SAAA;ED68B9B;;;ECz8BA,MAAA,KAAW,GAAA,EAAK,YAAA,KAAiB,YAAA;;;;EAIjC,gBAAA,GAAmB,aAAA;EArBc;;;;EA0BjC,eAAA,GAAkB,eAAA;AAAA;AAAA,UAGH,0BAAA,SAAmC,kBAAA;EAHjB;;;EAOjC,SAAA,EAAW,MAAA,SAAe,IAAA;EAhB1B;;;;EAqBA,QAAA;AAAA;;;;;AATF;;;;;;;;;;;;;;;AA4CA;;;;;;;;;AA4BA;;;;iBA5BgB,kBAAA,CACd,OAAA,EAAS,0BAAA,GACR,gBAAA;;;;;;;;;;;AAiFH;;;;;AACA;;;;;;;;;;iBAxDgB,kBAAA,CACd,KAAA,EAAO,gBAAA,IACP,OAAA,GAAU,kBAAA,GACT,gBAAA;;;AC7GH;;;;;;;;;;;;;;;;;;ACQA;;;;;;;;;;;;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