typegpu 0.5.8 → 0.6.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 (47) hide show
  1. package/chunk-APTRHY5Y.js +41 -0
  2. package/chunk-APTRHY5Y.js.map +1 -0
  3. package/chunk-RC26P3MP.cjs +2 -0
  4. package/chunk-RC26P3MP.cjs.map +1 -0
  5. package/chunk-RK6TMFVW.js +2 -0
  6. package/chunk-RK6TMFVW.js.map +1 -0
  7. package/chunk-S62QJDM6.js +2 -0
  8. package/chunk-S62QJDM6.js.map +1 -0
  9. package/chunk-TG4A6AM3.cjs +2 -0
  10. package/chunk-TG4A6AM3.cjs.map +1 -0
  11. package/chunk-UMHCZDPA.cjs +41 -0
  12. package/chunk-UMHCZDPA.cjs.map +1 -0
  13. package/data/index.cjs +1 -1
  14. package/data/index.cjs.map +1 -1
  15. package/data/index.d.cts +30 -77
  16. package/data/index.d.ts +30 -77
  17. package/data/index.js +1 -1
  18. package/index.cjs +21 -20
  19. package/index.cjs.map +1 -1
  20. package/index.d.cts +65 -12
  21. package/index.d.ts +65 -12
  22. package/index.js +21 -20
  23. package/index.js.map +1 -1
  24. package/matrix-BN6ObiMv.d.cts +122 -0
  25. package/matrix-S8W4dk8I.d.ts +122 -0
  26. package/package.json +1 -1
  27. package/std/index.cjs +1 -1
  28. package/std/index.cjs.map +1 -1
  29. package/std/index.d.cts +69 -2
  30. package/std/index.d.ts +69 -2
  31. package/std/index.js +1 -1
  32. package/std/index.js.map +1 -1
  33. package/{tgpuComputeFn-S61HxwW-.d.ts → tgpuComputeFn-DOUjhQua.d.cts} +402 -127
  34. package/{tgpuComputeFn-S61HxwW-.d.cts → tgpuComputeFn-DOUjhQua.d.ts} +402 -127
  35. package/chunk-7ACLI4JY.cjs +0 -2
  36. package/chunk-7ACLI4JY.cjs.map +0 -1
  37. package/chunk-L7HIBZAX.js +0 -4
  38. package/chunk-L7HIBZAX.js.map +0 -1
  39. package/chunk-SFECI7OX.js +0 -2
  40. package/chunk-SFECI7OX.js.map +0 -1
  41. package/chunk-SLWTVY6K.js +0 -2
  42. package/chunk-SLWTVY6K.js.map +0 -1
  43. package/chunk-TF6YPHJS.cjs +0 -2
  44. package/chunk-TF6YPHJS.cjs.map +0 -1
  45. package/chunk-V4CSEIB2.cjs +0 -4
  46. package/chunk-V4CSEIB2.cjs.map +0 -1
  47. /package/{LICENSE.md → LICENSE} +0 -0
package/index.d.cts CHANGED
@@ -1,7 +1,20 @@
1
- import { W as Wgsl, J as JitTranspiler, T as TgpuRoot, A as AnyWgslData, a as TgpuFn, b as TgpuBufferUsage, I as Infer, c as TgpuAccessor, d as TgpuDerived, e as TgpuSlot, f as TgpuBindGroupLayout, g as TgpuVertexLayout, h as WgslArray, D as Disarray, i as TgpuBuffer, j as AnyData, k as bindGroupLayout, v as vertexLayout, l as fn, m as fragmentFn, n as vertexFn, o as computeFn, p as privateVar, w as workgroupVar, q as constant, r as declare, s as sampler, t as comparisonSampler } from './tgpuComputeFn-S61HxwW-.cjs';
2
- export { am as BindLayoutEntry, a8 as Eventual, an as ExtractBindGroupInputFromLayout, ao as LayoutEntryToInput, R as RandomNameRegistry, ag as Render, ah as Sampled, Z as Storage, _ as StorageFlag, S as StrictNameRegistry, af as TextureProps, a9 as TgpuAnyTextureView, ap as TgpuBindGroup, a5 as TgpuBufferMutable, a6 as TgpuBufferReadonly, a7 as TgpuBufferUniform, aD as TgpuComputeFn, aE as TgpuComputeFnShell, a0 as TgpuComputePipeline, ai as TgpuConst, aF as TgpuDeclare, ay as TgpuFnShell, aB as TgpuFragmentFn, aC as TgpuFragmentFnShell, aq as TgpuLayoutComparisonSampler, ar as TgpuLayoutEntry, as as TgpuLayoutExternalTexture, at as TgpuLayoutSampler, au as TgpuLayoutStorage, av as TgpuLayoutStorageTexture, aw as TgpuLayoutTexture, ax as TgpuLayoutUniform, aa as TgpuMutableTexture, ab as TgpuReadonlyTexture, $ as TgpuRenderPipeline, ac as TgpuSampledTexture, al as TgpuSampler, ad as TgpuTexture, aj as TgpuVar, az as TgpuVertexFn, aA as TgpuVertexFnShell, ae as TgpuWriteonlyTexture, a1 as Uniform, a2 as UniformFlag, ak as VariableScope, a3 as Vertex, a4 as VertexFlag, U as WithBinding, V as WithCompute, X as WithFragment, Y as WithVertex, u as isBuffer, B as isComparisonSampler, y as isDerived, E as isSampledTextureView, C as isSampler, z as isSlot, F as isStorageTextureView, G as isTexture, Q as isTgpuFn, H as isUsableAsRender, K as isUsableAsSampled, L as isUsableAsStorage, P as isUsableAsUniform, x as isUsableAsVertex, M as unstable_asMutable, N as unstable_asReadonly, O as unstable_asUniform } from './tgpuComputeFn-S61HxwW-.cjs';
1
+ import { T as TgpuBindGroupLayout, a as TgpuBindGroup, W as Wgsl, b as TgpuRoot, A as AnyWgslData, c as TgpuFn, d as TgpuBufferUsage, I as Infer, e as TgpuAccessor, f as TgpuDerived, g as TgpuSlot, h as TgpuVertexLayout, i as WgslArray, D as Disarray, j as TgpuBuffer, k as AnyData, l as fn, m as bindGroupLayout, v as vertexLayout, n as fragmentFn, o as vertexFn, p as computeFn, q as privateVar, w as workgroupVar, r as constant, s as declare, t as sampler, u as comparisonSampler } from './tgpuComputeFn-DOUjhQua.cjs';
2
+ export { as as BindLayoutEntry, V as Configurable, ae as Eventual, at as ExtractBindGroupInputFromLayout, aL as INTERNAL_GlobalExt, a3 as IndexFlag, au as LayoutEntryToInput, R as RandomNameRegistry, am as Render, an as Sampled, $ as Storage, a0 as StorageFlag, S as StrictNameRegistry, al as TextureProps, af as TgpuAnyTextureView, a8 as TgpuBufferMutable, a9 as TgpuBufferReadonly, aa as TgpuBufferUniform, aI as TgpuComputeFn, aJ as TgpuComputeFnShell, a2 as TgpuComputePipeline, ao as TgpuConst, aK as TgpuDeclare, aD as TgpuFnShell, aG as TgpuFragmentFn, aH as TgpuFragmentFnShell, av as TgpuLayoutComparisonSampler, aw as TgpuLayoutEntry, ax as TgpuLayoutExternalTexture, ay as TgpuLayoutSampler, az as TgpuLayoutStorage, aA as TgpuLayoutStorageTexture, aB as TgpuLayoutTexture, aC as TgpuLayoutUniform, ab as TgpuMutable, ag as TgpuMutableTexture, ac as TgpuReadonly, ah as TgpuReadonlyTexture, a1 as TgpuRenderPipeline, ai as TgpuSampledTexture, ar as TgpuSampler, aj as TgpuTexture, ad as TgpuUniform, ap as TgpuVar, aE as TgpuVertexFn, aF as TgpuVertexFnShell, ak as TgpuWriteonlyTexture, a4 as Uniform, a5 as UniformFlag, aq as VariableScope, a6 as Vertex, a7 as VertexFlag, X as WithBinding, Y as WithCompute, Z as WithFragment, _ as WithVertex, x as isBuffer, Q as isBufferShorthand, C as isComparisonSampler, z as isDerived, F as isSampledTextureView, E as isSampler, B as isSlot, G as isStorageTextureView, H as isTexture, U as isTgpuFn, J as isUsableAsRender, K as isUsableAsSampled, L as isUsableAsStorage, P as isUsableAsUniform, y as isUsableAsVertex, M as unstable_asMutable, N as unstable_asReadonly, O as unstable_asUniform } from './tgpuComputeFn-DOUjhQua.cjs';
3
3
  import 'tinyest';
4
4
 
5
+ /**
6
+ * The results of a WGSL resolution.
7
+ *
8
+ * @param code - The resolved code.
9
+ * @param usedBindGroupLayouts - List of used `tgpu.bindGroupLayout`s.
10
+ * @param catchall - Automatically constructed bind group for buffer usages and buffer shorthands, preceded by its index.
11
+ */
12
+ interface ResolutionResult {
13
+ code: string;
14
+ usedBindGroupLayouts: TgpuBindGroupLayout[];
15
+ catchall: [number, TgpuBindGroup] | undefined;
16
+ }
17
+
5
18
  interface TgpuResolveOptions {
6
19
  /**
7
20
  * Map of external names to their resolvable values.
@@ -17,12 +30,43 @@ interface TgpuResolveOptions {
17
30
  * @default 'random'
18
31
  */
19
32
  names?: 'strict' | 'random' | undefined;
20
- /**
21
- * Optional JIT transpiler for resolving TGSL functions.
22
- * @experimental
23
- */
24
- unstable_jitTranspiler?: JitTranspiler | undefined;
25
33
  }
34
+ /**
35
+ * Resolves a template with external values. Each external will get resolved to a code string and replaced in the template.
36
+ * Any dependencies of the externals will also be resolved and included in the output.
37
+ * @param options - The options for the resolution.
38
+ *
39
+ * @returns {ResolutionResult}
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const Gradient = d.struct({
44
+ * from: d.vec3f,
45
+ * to: d.vec3f,
46
+ * });
47
+ *
48
+ * const { code, usedBindGroupLayouts, catchall } = tgpu.resolveWithContext({
49
+ * template: `
50
+ * fn getGradientAngle(gradient: Gradient) -> f32 {
51
+ * return atan(gradient.to.y - gradient.from.y, gradient.to.x - gradient.from.x);
52
+ * }
53
+ * `,
54
+ * externals: {
55
+ * Gradient,
56
+ * },
57
+ * });
58
+ *
59
+ * console.log(code);
60
+ * // struct Gradient_0 {
61
+ * // from: vec3f,
62
+ * // to: vec3f,
63
+ * // }
64
+ * // fn getGradientAngle(gradient: Gradient_0) -> f32 {
65
+ * // return atan(gradient.to.y - gradient.from.y, gradient.to.x - gradient.from.x);
66
+ * // }
67
+ * ```
68
+ */
69
+ declare function resolveWithContext(options: TgpuResolveOptions): ResolutionResult;
26
70
  /**
27
71
  * Resolves a template with external values. Each external will get resolved to a code string and replaced in the template.
28
72
  * Any dependencies of the externals will also be resolved and included in the output.
@@ -65,10 +109,11 @@ declare function resolve(options: TgpuResolveOptions): string;
65
109
  */
66
110
  type InitOptions = {
67
111
  adapter?: GPURequestAdapterOptions | undefined;
68
- device?: GPUDeviceDescriptor | undefined;
112
+ device?: GPUDeviceDescriptor & {
113
+ optionalFeatures?: Iterable<GPUFeatureName>;
114
+ } | undefined;
69
115
  /** @default 'random' */
70
116
  unstable_names?: 'random' | 'strict' | undefined;
71
- unstable_jitTranspiler?: JitTranspiler | undefined;
72
117
  };
73
118
  /**
74
119
  * Options passed into {@link initFromDevice}.
@@ -77,7 +122,6 @@ type InitFromDeviceOptions = {
77
122
  device: GPUDevice;
78
123
  /** @default 'random' */
79
124
  unstable_names?: 'random' | 'strict' | undefined;
80
- unstable_jitTranspiler?: JitTranspiler | undefined;
81
125
  };
82
126
  /**
83
127
  * Requests a new GPU device and creates a root around it.
@@ -109,7 +153,7 @@ declare function init(options?: InitOptions): Promise<TgpuRoot>;
109
153
  */
110
154
  declare function initFromDevice(options: InitFromDeviceOptions): TgpuRoot;
111
155
 
112
- declare function accessor<T extends AnyWgslData>(schema: T, defaultValue?: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>): TgpuAccessor<T>;
156
+ declare function accessor<T extends AnyWgslData>(schema: T, defaultValue?: TgpuFn<() => T> | TgpuBufferUsage<T> | Infer<T>): TgpuAccessor<T>;
113
157
 
114
158
  declare function derived<T>(compute: () => T): TgpuDerived<T>;
115
159
 
@@ -156,12 +200,18 @@ declare class MissingVertexBuffersError extends Error {
156
200
  */
157
201
 
158
202
  declare const tgpu: {
203
+ fn: typeof fn;
159
204
  bindGroupLayout: typeof bindGroupLayout;
160
205
  vertexLayout: typeof vertexLayout;
206
+ slot: typeof slot;
161
207
  init: typeof init;
162
208
  initFromDevice: typeof initFromDevice;
163
209
  resolve: typeof resolve;
210
+ resolveWithContext: typeof resolveWithContext;
164
211
  '~unstable': {
212
+ /**
213
+ * @deprecated This feature is now stable, use tgpu.fn.
214
+ */
165
215
  fn: typeof fn;
166
216
  fragmentFn: typeof fragmentFn;
167
217
  vertexFn: typeof vertexFn;
@@ -171,6 +221,9 @@ declare const tgpu: {
171
221
  */
172
222
  vertexLayout: typeof vertexLayout;
173
223
  derived: typeof derived;
224
+ /**
225
+ * @deprecated This feature is now stable, use tgpu.slot.
226
+ */
174
227
  slot: typeof slot;
175
228
  accessor: typeof accessor;
176
229
  privateVar: typeof privateVar;
@@ -182,4 +235,4 @@ declare const tgpu: {
182
235
  };
183
236
  };
184
237
 
185
- export { type InitFromDeviceOptions, type InitOptions, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, TgpuAccessor, TgpuBindGroupLayout, TgpuBuffer, TgpuDerived, TgpuFn, TgpuRoot, TgpuSlot, TgpuVertexLayout, tgpu as default, tgpu };
238
+ export { type InitFromDeviceOptions, type InitOptions, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, TgpuAccessor, TgpuBindGroup, TgpuBindGroupLayout, TgpuBuffer, TgpuDerived, TgpuFn, TgpuRoot, TgpuSlot, TgpuVertexLayout, tgpu as default, tgpu };
package/index.d.ts CHANGED
@@ -1,7 +1,20 @@
1
- import { W as Wgsl, J as JitTranspiler, T as TgpuRoot, A as AnyWgslData, a as TgpuFn, b as TgpuBufferUsage, I as Infer, c as TgpuAccessor, d as TgpuDerived, e as TgpuSlot, f as TgpuBindGroupLayout, g as TgpuVertexLayout, h as WgslArray, D as Disarray, i as TgpuBuffer, j as AnyData, k as bindGroupLayout, v as vertexLayout, l as fn, m as fragmentFn, n as vertexFn, o as computeFn, p as privateVar, w as workgroupVar, q as constant, r as declare, s as sampler, t as comparisonSampler } from './tgpuComputeFn-S61HxwW-.js';
2
- export { am as BindLayoutEntry, a8 as Eventual, an as ExtractBindGroupInputFromLayout, ao as LayoutEntryToInput, R as RandomNameRegistry, ag as Render, ah as Sampled, Z as Storage, _ as StorageFlag, S as StrictNameRegistry, af as TextureProps, a9 as TgpuAnyTextureView, ap as TgpuBindGroup, a5 as TgpuBufferMutable, a6 as TgpuBufferReadonly, a7 as TgpuBufferUniform, aD as TgpuComputeFn, aE as TgpuComputeFnShell, a0 as TgpuComputePipeline, ai as TgpuConst, aF as TgpuDeclare, ay as TgpuFnShell, aB as TgpuFragmentFn, aC as TgpuFragmentFnShell, aq as TgpuLayoutComparisonSampler, ar as TgpuLayoutEntry, as as TgpuLayoutExternalTexture, at as TgpuLayoutSampler, au as TgpuLayoutStorage, av as TgpuLayoutStorageTexture, aw as TgpuLayoutTexture, ax as TgpuLayoutUniform, aa as TgpuMutableTexture, ab as TgpuReadonlyTexture, $ as TgpuRenderPipeline, ac as TgpuSampledTexture, al as TgpuSampler, ad as TgpuTexture, aj as TgpuVar, az as TgpuVertexFn, aA as TgpuVertexFnShell, ae as TgpuWriteonlyTexture, a1 as Uniform, a2 as UniformFlag, ak as VariableScope, a3 as Vertex, a4 as VertexFlag, U as WithBinding, V as WithCompute, X as WithFragment, Y as WithVertex, u as isBuffer, B as isComparisonSampler, y as isDerived, E as isSampledTextureView, C as isSampler, z as isSlot, F as isStorageTextureView, G as isTexture, Q as isTgpuFn, H as isUsableAsRender, K as isUsableAsSampled, L as isUsableAsStorage, P as isUsableAsUniform, x as isUsableAsVertex, M as unstable_asMutable, N as unstable_asReadonly, O as unstable_asUniform } from './tgpuComputeFn-S61HxwW-.js';
1
+ import { T as TgpuBindGroupLayout, a as TgpuBindGroup, W as Wgsl, b as TgpuRoot, A as AnyWgslData, c as TgpuFn, d as TgpuBufferUsage, I as Infer, e as TgpuAccessor, f as TgpuDerived, g as TgpuSlot, h as TgpuVertexLayout, i as WgslArray, D as Disarray, j as TgpuBuffer, k as AnyData, l as fn, m as bindGroupLayout, v as vertexLayout, n as fragmentFn, o as vertexFn, p as computeFn, q as privateVar, w as workgroupVar, r as constant, s as declare, t as sampler, u as comparisonSampler } from './tgpuComputeFn-DOUjhQua.js';
2
+ export { as as BindLayoutEntry, V as Configurable, ae as Eventual, at as ExtractBindGroupInputFromLayout, aL as INTERNAL_GlobalExt, a3 as IndexFlag, au as LayoutEntryToInput, R as RandomNameRegistry, am as Render, an as Sampled, $ as Storage, a0 as StorageFlag, S as StrictNameRegistry, al as TextureProps, af as TgpuAnyTextureView, a8 as TgpuBufferMutable, a9 as TgpuBufferReadonly, aa as TgpuBufferUniform, aI as TgpuComputeFn, aJ as TgpuComputeFnShell, a2 as TgpuComputePipeline, ao as TgpuConst, aK as TgpuDeclare, aD as TgpuFnShell, aG as TgpuFragmentFn, aH as TgpuFragmentFnShell, av as TgpuLayoutComparisonSampler, aw as TgpuLayoutEntry, ax as TgpuLayoutExternalTexture, ay as TgpuLayoutSampler, az as TgpuLayoutStorage, aA as TgpuLayoutStorageTexture, aB as TgpuLayoutTexture, aC as TgpuLayoutUniform, ab as TgpuMutable, ag as TgpuMutableTexture, ac as TgpuReadonly, ah as TgpuReadonlyTexture, a1 as TgpuRenderPipeline, ai as TgpuSampledTexture, ar as TgpuSampler, aj as TgpuTexture, ad as TgpuUniform, ap as TgpuVar, aE as TgpuVertexFn, aF as TgpuVertexFnShell, ak as TgpuWriteonlyTexture, a4 as Uniform, a5 as UniformFlag, aq as VariableScope, a6 as Vertex, a7 as VertexFlag, X as WithBinding, Y as WithCompute, Z as WithFragment, _ as WithVertex, x as isBuffer, Q as isBufferShorthand, C as isComparisonSampler, z as isDerived, F as isSampledTextureView, E as isSampler, B as isSlot, G as isStorageTextureView, H as isTexture, U as isTgpuFn, J as isUsableAsRender, K as isUsableAsSampled, L as isUsableAsStorage, P as isUsableAsUniform, y as isUsableAsVertex, M as unstable_asMutable, N as unstable_asReadonly, O as unstable_asUniform } from './tgpuComputeFn-DOUjhQua.js';
3
3
  import 'tinyest';
4
4
 
5
+ /**
6
+ * The results of a WGSL resolution.
7
+ *
8
+ * @param code - The resolved code.
9
+ * @param usedBindGroupLayouts - List of used `tgpu.bindGroupLayout`s.
10
+ * @param catchall - Automatically constructed bind group for buffer usages and buffer shorthands, preceded by its index.
11
+ */
12
+ interface ResolutionResult {
13
+ code: string;
14
+ usedBindGroupLayouts: TgpuBindGroupLayout[];
15
+ catchall: [number, TgpuBindGroup] | undefined;
16
+ }
17
+
5
18
  interface TgpuResolveOptions {
6
19
  /**
7
20
  * Map of external names to their resolvable values.
@@ -17,12 +30,43 @@ interface TgpuResolveOptions {
17
30
  * @default 'random'
18
31
  */
19
32
  names?: 'strict' | 'random' | undefined;
20
- /**
21
- * Optional JIT transpiler for resolving TGSL functions.
22
- * @experimental
23
- */
24
- unstable_jitTranspiler?: JitTranspiler | undefined;
25
33
  }
34
+ /**
35
+ * Resolves a template with external values. Each external will get resolved to a code string and replaced in the template.
36
+ * Any dependencies of the externals will also be resolved and included in the output.
37
+ * @param options - The options for the resolution.
38
+ *
39
+ * @returns {ResolutionResult}
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const Gradient = d.struct({
44
+ * from: d.vec3f,
45
+ * to: d.vec3f,
46
+ * });
47
+ *
48
+ * const { code, usedBindGroupLayouts, catchall } = tgpu.resolveWithContext({
49
+ * template: `
50
+ * fn getGradientAngle(gradient: Gradient) -> f32 {
51
+ * return atan(gradient.to.y - gradient.from.y, gradient.to.x - gradient.from.x);
52
+ * }
53
+ * `,
54
+ * externals: {
55
+ * Gradient,
56
+ * },
57
+ * });
58
+ *
59
+ * console.log(code);
60
+ * // struct Gradient_0 {
61
+ * // from: vec3f,
62
+ * // to: vec3f,
63
+ * // }
64
+ * // fn getGradientAngle(gradient: Gradient_0) -> f32 {
65
+ * // return atan(gradient.to.y - gradient.from.y, gradient.to.x - gradient.from.x);
66
+ * // }
67
+ * ```
68
+ */
69
+ declare function resolveWithContext(options: TgpuResolveOptions): ResolutionResult;
26
70
  /**
27
71
  * Resolves a template with external values. Each external will get resolved to a code string and replaced in the template.
28
72
  * Any dependencies of the externals will also be resolved and included in the output.
@@ -65,10 +109,11 @@ declare function resolve(options: TgpuResolveOptions): string;
65
109
  */
66
110
  type InitOptions = {
67
111
  adapter?: GPURequestAdapterOptions | undefined;
68
- device?: GPUDeviceDescriptor | undefined;
112
+ device?: GPUDeviceDescriptor & {
113
+ optionalFeatures?: Iterable<GPUFeatureName>;
114
+ } | undefined;
69
115
  /** @default 'random' */
70
116
  unstable_names?: 'random' | 'strict' | undefined;
71
- unstable_jitTranspiler?: JitTranspiler | undefined;
72
117
  };
73
118
  /**
74
119
  * Options passed into {@link initFromDevice}.
@@ -77,7 +122,6 @@ type InitFromDeviceOptions = {
77
122
  device: GPUDevice;
78
123
  /** @default 'random' */
79
124
  unstable_names?: 'random' | 'strict' | undefined;
80
- unstable_jitTranspiler?: JitTranspiler | undefined;
81
125
  };
82
126
  /**
83
127
  * Requests a new GPU device and creates a root around it.
@@ -109,7 +153,7 @@ declare function init(options?: InitOptions): Promise<TgpuRoot>;
109
153
  */
110
154
  declare function initFromDevice(options: InitFromDeviceOptions): TgpuRoot;
111
155
 
112
- declare function accessor<T extends AnyWgslData>(schema: T, defaultValue?: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>): TgpuAccessor<T>;
156
+ declare function accessor<T extends AnyWgslData>(schema: T, defaultValue?: TgpuFn<() => T> | TgpuBufferUsage<T> | Infer<T>): TgpuAccessor<T>;
113
157
 
114
158
  declare function derived<T>(compute: () => T): TgpuDerived<T>;
115
159
 
@@ -156,12 +200,18 @@ declare class MissingVertexBuffersError extends Error {
156
200
  */
157
201
 
158
202
  declare const tgpu: {
203
+ fn: typeof fn;
159
204
  bindGroupLayout: typeof bindGroupLayout;
160
205
  vertexLayout: typeof vertexLayout;
206
+ slot: typeof slot;
161
207
  init: typeof init;
162
208
  initFromDevice: typeof initFromDevice;
163
209
  resolve: typeof resolve;
210
+ resolveWithContext: typeof resolveWithContext;
164
211
  '~unstable': {
212
+ /**
213
+ * @deprecated This feature is now stable, use tgpu.fn.
214
+ */
165
215
  fn: typeof fn;
166
216
  fragmentFn: typeof fragmentFn;
167
217
  vertexFn: typeof vertexFn;
@@ -171,6 +221,9 @@ declare const tgpu: {
171
221
  */
172
222
  vertexLayout: typeof vertexLayout;
173
223
  derived: typeof derived;
224
+ /**
225
+ * @deprecated This feature is now stable, use tgpu.slot.
226
+ */
174
227
  slot: typeof slot;
175
228
  accessor: typeof accessor;
176
229
  privateVar: typeof privateVar;
@@ -182,4 +235,4 @@ declare const tgpu: {
182
235
  };
183
236
  };
184
237
 
185
- export { type InitFromDeviceOptions, type InitOptions, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, TgpuAccessor, TgpuBindGroupLayout, TgpuBuffer, TgpuDerived, TgpuFn, TgpuRoot, TgpuSlot, TgpuVertexLayout, tgpu as default, tgpu };
238
+ export { type InitFromDeviceOptions, type InitOptions, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, TgpuAccessor, TgpuBindGroup, TgpuBindGroupLayout, TgpuBuffer, TgpuDerived, TgpuFn, TgpuRoot, TgpuSlot, TgpuVertexLayout, tgpu as default, tgpu };