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.
- package/README.md +2 -2
- package/builtin-ClEnM-Ye.js +818 -0
- package/builtin-ClEnM-Ye.js.map +1 -0
- package/chunk-BYypO7fO.js +18 -0
- package/common/index.d.ts +8 -23
- package/common/index.d.ts.map +1 -0
- package/common/index.js +7 -5
- package/common/index.js.map +1 -1
- package/data/index.d.ts +7 -400
- package/data/index.d.ts.map +1 -0
- package/data/index.js +164 -1
- package/data/index.js.map +1 -1
- package/deepEqual-yZXvaV2C.js +413 -0
- package/deepEqual-yZXvaV2C.js.map +1 -0
- package/extensions-0SFbU9FH.js +2032 -0
- package/extensions-0SFbU9FH.js.map +1 -0
- package/fullScreenTriangle-MdLGaAMR.js +543 -0
- package/fullScreenTriangle-MdLGaAMR.js.map +1 -0
- package/index.d.ts +167 -264
- package/index.d.ts.map +1 -0
- package/index.js +6294 -160
- package/index.js.map +1 -1
- package/indexNamedExports-Cdy7USiY.d.ts +5696 -0
- package/indexNamedExports-Cdy7USiY.d.ts.map +1 -0
- package/operators-HTxa_0k9.js +4156 -0
- package/operators-HTxa_0k9.js.map +1 -0
- package/package.json +3 -2
- package/std/index.d.ts +7 -637
- package/std/index.d.ts.map +1 -0
- package/std/index.js +165 -1
- package/std/index.js.map +1 -1
- package/texture-Dg5ybJro.js +205 -0
- package/texture-Dg5ybJro.js.map +1 -0
- package/chunk-6U5HPHCJ.js +0 -2
- package/chunk-6U5HPHCJ.js.map +0 -1
- package/chunk-CGQB3SER.js +0 -3
- package/chunk-CGQB3SER.js.map +0 -1
- package/chunk-CRZWTZM2.js +0 -10
- package/chunk-CRZWTZM2.js.map +0 -1
- package/chunk-ECR2EGZX.js +0 -7
- package/chunk-ECR2EGZX.js.map +0 -1
- package/chunk-PWBIFP67.js +0 -2
- package/chunk-PWBIFP67.js.map +0 -1
- package/matrix-DIfOiRyz.d.ts +0 -122
- package/tgpuConstant-BTQFNlQH.d.ts +0 -5201
package/index.d.ts
CHANGED
|
@@ -1,61 +1,9 @@
|
|
|
1
|
-
import { $ as $
|
|
2
|
-
|
|
3
|
-
import
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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:
|
|
94
|
+
declare function resolveWithContext(options: TgpuExtendedResolveOptions): ResolutionResult;
|
|
147
95
|
/**
|
|
148
|
-
* Resolves
|
|
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
|
|
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
|
|
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(
|
|
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:
|
|
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
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
303
|
-
*/
|
|
304
|
-
declare
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
declare
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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,
|
|
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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