typegpu 0.10.0 → 0.10.2
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/{chunk-BYypO7fO.js → _virtual/_rolldown/runtime.js} +1 -1
- package/builtin.d.ts +50 -0
- package/builtin.js +37 -0
- package/common/fullScreenTriangle.d.ts +26 -0
- package/common/fullScreenTriangle.js +36 -0
- package/common/index.d.ts +2 -3
- package/common/index.js +3 -4
- package/core/buffer/buffer.d.ts +74 -0
- package/core/buffer/buffer.js +197 -0
- package/core/buffer/bufferShorthand.d.ts +48 -0
- package/core/buffer/bufferShorthand.js +49 -0
- package/core/buffer/bufferUsage.d.ts +45 -0
- package/core/buffer/bufferUsage.js +163 -0
- package/core/constant/tgpuConstant.d.ts +28 -0
- package/core/constant/tgpuConstant.js +67 -0
- package/core/declare/tgpuDeclare.d.ts +18 -0
- package/core/declare/tgpuDeclare.js +40 -0
- package/core/function/autoIO.d.ts +37 -0
- package/core/function/autoIO.js +87 -0
- package/core/function/comptime.d.ts +39 -0
- package/core/function/comptime.js +51 -0
- package/core/function/createCallableSchema.js +42 -0
- package/core/function/dualImpl.js +54 -0
- package/core/function/extractArgs.js +204 -0
- package/core/function/fnCore.js +79 -0
- package/core/function/fnTypes.d.ts +34 -0
- package/core/function/ioSchema.d.ts +10 -0
- package/core/function/ioSchema.js +30 -0
- package/core/function/shelllessImpl.d.ts +28 -0
- package/core/function/shelllessImpl.js +23 -0
- package/core/function/templateUtils.js +13 -0
- package/core/function/tgpuComputeFn.d.ts +49 -0
- package/core/function/tgpuComputeFn.js +62 -0
- package/core/function/tgpuFn.d.ts +52 -0
- package/core/function/tgpuFn.js +170 -0
- package/core/function/tgpuFragmentFn.d.ts +68 -0
- package/core/function/tgpuFragmentFn.js +68 -0
- package/core/function/tgpuVertexFn.d.ts +55 -0
- package/core/function/tgpuVertexFn.js +65 -0
- package/core/pipeline/applyPipelineState.js +37 -0
- package/core/pipeline/computePipeline.d.ts +58 -0
- package/core/pipeline/computePipeline.js +226 -0
- package/core/pipeline/connectAttachmentToShader.js +26 -0
- package/core/pipeline/connectTargetsToShader.js +29 -0
- package/core/pipeline/limitsOverflow.js +13 -0
- package/core/pipeline/renderPipeline.d.ts +266 -0
- package/core/pipeline/renderPipeline.js +471 -0
- package/core/pipeline/timeable.d.ts +23 -0
- package/core/pipeline/timeable.js +61 -0
- package/core/pipeline/typeGuards.js +29 -0
- package/core/querySet/querySet.d.ts +22 -0
- package/core/querySet/querySet.js +103 -0
- package/core/rawCodeSnippet/tgpuRawCodeSnippet.d.ts +59 -0
- package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +96 -0
- package/core/resolve/externals.d.ts +10 -0
- package/core/resolve/externals.js +58 -0
- package/core/resolve/namespace.d.ts +38 -0
- package/core/resolve/namespace.js +41 -0
- package/core/resolve/resolveData.js +146 -0
- package/core/resolve/stitch.js +25 -0
- package/core/resolve/tgpuResolve.d.ts +151 -0
- package/core/resolve/tgpuResolve.js +68 -0
- package/core/root/configurableImpl.js +18 -0
- package/core/root/init.d.ts +69 -0
- package/core/root/init.js +457 -0
- package/core/root/rootTypes.d.ts +622 -0
- package/core/sampler/sampler.d.ts +35 -0
- package/core/sampler/sampler.js +116 -0
- package/core/simulate/tgpuSimulate.d.ts +36 -0
- package/core/simulate/tgpuSimulate.js +76 -0
- package/core/slot/accessor.d.ts +13 -0
- package/core/slot/accessor.js +97 -0
- package/core/slot/internalSlots.js +7 -0
- package/core/slot/lazy.d.ts +6 -0
- package/core/slot/lazy.js +42 -0
- package/core/slot/slot.d.ts +6 -0
- package/core/slot/slot.js +40 -0
- package/core/slot/slotTypes.d.ts +92 -0
- package/core/slot/slotTypes.js +21 -0
- package/core/texture/externalTexture.d.ts +12 -0
- package/core/texture/externalTexture.js +48 -0
- package/core/texture/texture.d.ts +118 -0
- package/core/texture/texture.js +312 -0
- package/core/texture/textureFormats.d.ts +29 -0
- package/core/texture/textureFormats.js +99 -0
- package/core/texture/textureProps.d.ts +11 -0
- package/core/texture/textureUtils.js +224 -0
- package/core/texture/usageExtension.d.ts +21 -0
- package/core/texture/usageExtension.js +21 -0
- package/core/unroll/tgpuUnroll.d.ts +13 -0
- package/core/unroll/tgpuUnroll.js +36 -0
- package/core/valueProxyUtils.js +44 -0
- package/core/variable/tgpuVariable.d.ts +38 -0
- package/core/variable/tgpuVariable.js +101 -0
- package/core/vertexLayout/connectAttributesToShader.js +59 -0
- package/core/vertexLayout/vertexAttribute.d.ts +29 -0
- package/core/vertexLayout/vertexLayout.d.ts +19 -0
- package/core/vertexLayout/vertexLayout.js +103 -0
- package/data/alignIO.js +15 -0
- package/data/alignmentOf.d.ts +10 -0
- package/data/alignmentOf.js +88 -0
- package/data/array.d.ts +28 -0
- package/data/array.js +48 -0
- package/data/atomic.d.ts +15 -0
- package/data/atomic.js +25 -0
- package/data/attributes.d.ts +121 -0
- package/data/attributes.js +145 -0
- package/data/autoStruct.d.ts +3 -0
- package/data/autoStruct.js +83 -0
- package/data/compiledIO.js +231 -0
- package/data/dataIO.js +549 -0
- package/data/dataTypes.d.ts +115 -0
- package/data/dataTypes.js +97 -0
- package/data/deepEqual.d.ts +25 -0
- package/data/deepEqual.js +58 -0
- package/data/disarray.d.ts +34 -0
- package/data/disarray.js +52 -0
- package/data/getLongestContiguousPrefix.d.ts +10 -0
- package/data/getLongestContiguousPrefix.js +15 -0
- package/data/index.d.ts +26 -4
- package/data/index.js +27 -7
- package/data/instanceToSchema.d.ts +33 -0
- package/data/isContiguous.d.ts +10 -0
- package/data/isContiguous.js +15 -0
- package/data/matrix.d.ts +126 -0
- package/data/matrix.js +517 -0
- package/data/numberOps.js +24 -0
- package/data/numeric.d.ts +81 -0
- package/data/numeric.js +234 -0
- package/data/offsetUtils.d.ts +33 -0
- package/data/offsetUtils.js +167 -0
- package/data/offsets.js +36 -0
- package/data/partialIO.js +68 -0
- package/data/ptr.d.ts +12 -0
- package/data/ptr.js +46 -0
- package/data/ref.d.ts +37 -0
- package/data/ref.js +96 -0
- package/data/sampler.d.ts +107 -0
- package/data/sampler.js +26 -0
- package/data/schemaCallWrapper.js +32 -0
- package/data/schemaMemoryLayout.js +200 -0
- package/data/sizeOf.d.ts +10 -0
- package/data/sizeOf.js +15 -0
- package/data/snippet.d.ts +26 -0
- package/data/snippet.js +61 -0
- package/data/struct.d.ts +17 -0
- package/data/struct.js +46 -0
- package/data/texture.d.ts +292 -0
- package/{texture-Dg5ybJro.js → data/texture.js} +6 -3
- package/data/unstruct.d.ts +24 -0
- package/data/unstruct.js +43 -0
- package/data/vector.d.ts +191 -0
- package/data/vector.js +247 -0
- package/data/vectorImpl.js +516 -0
- package/data/vectorOps.js +664 -0
- package/data/vertexFormatData.d.ts +190 -0
- package/data/vertexFormatData.js +110 -0
- package/data/wgslTypes.d.ts +896 -0
- package/data/wgslTypes.js +215 -0
- package/errors.d.ts +44 -0
- package/errors.js +128 -0
- package/execMode.js +51 -0
- package/extension.d.ts +11 -0
- package/extension.js +18 -0
- package/getGPUValue.js +9 -0
- package/index.d.ts +40 -243
- package/index.js +19 -6318
- package/indexNamedExports.d.ts +38 -0
- package/mathUtils.js +13 -0
- package/memo.js +22 -0
- package/nameRegistry.d.ts +30 -0
- package/nameRegistry.js +449 -0
- package/package.js +5 -0
- package/package.json +23 -23
- package/resolutionCtx.d.ts +29 -0
- package/resolutionCtx.js +546 -0
- package/shared/env.js +13 -0
- package/shared/generators.js +14 -0
- package/shared/meta.d.ts +39 -0
- package/shared/meta.js +63 -0
- package/shared/repr.d.ts +108 -0
- package/shared/stringify.js +22 -0
- package/shared/symbols.d.ts +61 -0
- package/shared/symbols.js +71 -0
- package/shared/utilityTypes.d.ts +29 -0
- package/shared/utilityTypes.js +7 -0
- package/shared/vertexFormat.d.ts +70 -0
- package/shared/vertexFormat.js +64 -0
- package/std/array.d.ts +7 -0
- package/std/array.js +27 -0
- package/std/atomic.d.ts +19 -0
- package/std/atomic.js +113 -0
- package/std/bitcast.d.ts +10 -0
- package/std/bitcast.js +43 -0
- package/std/boolean.d.ts +127 -0
- package/std/boolean.js +274 -0
- package/std/derivative.d.ts +16 -0
- package/std/derivative.js +89 -0
- package/std/discard.d.ts +6 -0
- package/std/discard.js +16 -0
- package/std/extensions.d.ts +8 -0
- package/std/extensions.js +14 -0
- package/std/index.d.ts +15 -3
- package/std/index.js +16 -5
- package/std/matrix.d.ts +41 -0
- package/std/matrix.js +87 -0
- package/std/numeric.d.ts +254 -0
- package/std/numeric.js +847 -0
- package/std/operators.d.ts +48 -0
- package/std/operators.js +153 -0
- package/std/packing.d.ts +26 -0
- package/std/packing.js +86 -0
- package/std/subgroup.d.ts +47 -0
- package/std/subgroup.js +220 -0
- package/std/texture.d.ts +108 -0
- package/std/texture.js +197 -0
- package/tgpu.js +44 -0
- package/tgpuBindGroupLayout.d.ts +161 -0
- package/tgpuBindGroupLayout.js +271 -0
- package/tgpuUnstable.d.ts +48 -0
- package/tgpuUnstable.js +66 -0
- package/tgsl/accessIndex.js +45 -0
- package/tgsl/accessProp.js +113 -0
- package/tgsl/consoleLog/deserializers.js +117 -0
- package/tgsl/consoleLog/logGenerator.js +86 -0
- package/tgsl/consoleLog/serializers.js +225 -0
- package/tgsl/consoleLog/types.d.ts +54 -0
- package/tgsl/consoleLog/types.js +12 -0
- package/tgsl/conversion.js +200 -0
- package/tgsl/forOfUtils.js +45 -0
- package/tgsl/generationHelpers.d.ts +37 -0
- package/tgsl/generationHelpers.js +67 -0
- package/tgsl/math.js +45 -0
- package/tgsl/shaderGenerator.d.ts +18 -0
- package/tgsl/shellless.d.ts +11 -0
- package/tgsl/shellless.js +53 -0
- package/tgsl/wgslGenerator.js +585 -0
- package/types.d.ts +255 -0
- package/types.js +43 -0
- package/unwrapper.d.ts +27 -0
- package/wgslExtensions.d.ts +5 -0
- package/wgslExtensions.js +18 -0
- package/builtin-ClEnM-Ye.js +0 -818
- package/builtin-ClEnM-Ye.js.map +0 -1
- package/common/index.d.ts.map +0 -1
- package/common/index.js.map +0 -1
- package/data/index.d.ts.map +0 -1
- package/data/index.js.map +0 -1
- package/deepEqual-yZXvaV2C.js +0 -413
- package/deepEqual-yZXvaV2C.js.map +0 -1
- package/extensions-0SFbU9FH.js +0 -2032
- package/extensions-0SFbU9FH.js.map +0 -1
- package/fullScreenTriangle-MdLGaAMR.js +0 -543
- package/fullScreenTriangle-MdLGaAMR.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/index.js.map +0 -1
- package/indexNamedExports-Cdy7USiY.d.ts +0 -5696
- package/indexNamedExports-Cdy7USiY.d.ts.map +0 -1
- package/operators-HTxa_0k9.js +0 -4156
- package/operators-HTxa_0k9.js.map +0 -1
- package/std/index.d.ts.map +0 -1
- package/std/index.js.map +0 -1
- package/texture-Dg5ybJro.js.map +0 -1
package/index.d.ts
CHANGED
|
@@ -1,245 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { INTERNAL_GlobalExt } from "./shared/meta.js";
|
|
2
|
+
import { Storage, StorageFlag, isUsableAsStorage } from "./extension.js";
|
|
3
|
+
import { TgpuQuerySet } from "./core/querySet/querySet.js";
|
|
4
|
+
import { TgpuBufferMutable, TgpuBufferReadonly, TgpuBufferUniform, isUsableAsUniform } from "./core/buffer/bufferUsage.js";
|
|
5
|
+
import { TgpuMutable, TgpuReadonly, TgpuUniform, isBufferShorthand } from "./core/buffer/bufferShorthand.js";
|
|
6
|
+
import { TgpuComputeFn, TgpuComputeFnShell, computeFn, isTgpuComputeFn } from "./core/function/tgpuComputeFn.js";
|
|
7
|
+
import { TgpuVar, VariableScope, isVariable, privateVar, workgroupVar } from "./core/variable/tgpuVariable.js";
|
|
8
|
+
import { Eventual, TgpuAccessor, TgpuLazy, TgpuMutableAccessor, TgpuSlot, isAccessor, isLazy, isMutableAccessor, isSlot } from "./core/slot/slotTypes.js";
|
|
9
|
+
import { TgpuComputePipeline } from "./core/pipeline/computePipeline.js";
|
|
10
|
+
import { AutoFragmentIn, AutoFragmentOut, AutoVertexIn, AutoVertexOut } from "./core/function/autoIO.js";
|
|
11
|
+
import { TgpuFragmentFn, TgpuFragmentFnShell, fragmentFn, isTgpuFragmentFn } from "./core/function/tgpuFragmentFn.js";
|
|
12
|
+
import { TgpuVertexFn, TgpuVertexFnShell, isTgpuVertexFn, vertexFn } from "./core/function/tgpuVertexFn.js";
|
|
13
|
+
import { TextureProps } from "./core/texture/textureProps.js";
|
|
14
|
+
import { RenderFlag, SampledFlag, isUsableAsRender, isUsableAsSampled } from "./core/texture/usageExtension.js";
|
|
15
|
+
import { TgpuVertexLayout, vertexLayout } from "./core/vertexLayout/vertexLayout.js";
|
|
16
|
+
import { ColorAttachment, TgpuPrimitiveState, TgpuRenderPipeline } from "./core/pipeline/renderPipeline.js";
|
|
17
|
+
import { TgpuComparisonSampler, TgpuFixedComparisonSampler, TgpuFixedSampler, TgpuSampler, isComparisonSampler, isSampler } from "./core/sampler/sampler.js";
|
|
18
|
+
import { BindLayoutEntry, ExtractBindGroupInputFromLayout, LayoutEntryToInput, TgpuBindGroup, TgpuBindGroupLayout, TgpuLayoutComparisonSampler, TgpuLayoutEntry, TgpuLayoutExternalTexture, TgpuLayoutSampler, TgpuLayoutStorage, TgpuLayoutTexture, TgpuLayoutUniform, bindGroupLayout } from "./tgpuBindGroupLayout.js";
|
|
19
|
+
import { Configurable, TgpuGuardedComputePipeline, TgpuRoot, ValidateBufferSchema, ValidateStorageSchema, ValidateUniformSchema, WithBinding, WithCompute, WithFragment, WithVertex, Withable } from "./core/root/rootTypes.js";
|
|
20
|
+
import { IndexFlag, TgpuBuffer, Uniform, UniformFlag, ValidUsagesFor, Vertex, VertexFlag, isBuffer, isUsableAsVertex } from "./core/buffer/buffer.js";
|
|
21
|
+
import { TgpuDeclare } from "./core/declare/tgpuDeclare.js";
|
|
22
|
+
import { TgpuFn, TgpuFnShell, TgpuGenericFn, fn, isTgpuFn } from "./core/function/tgpuFn.js";
|
|
23
|
+
import { TgpuTexture, TgpuTextureView, isTexture } from "./core/texture/texture.js";
|
|
24
|
+
import { TgpuConst, constant } from "./core/constant/tgpuConstant.js";
|
|
25
|
+
import { TgpuComptime, comptime } from "./core/function/comptime.js";
|
|
26
|
+
import { Namespace } from "./core/resolve/namespace.js";
|
|
27
|
+
import { resolve, resolveWithContext } from "./core/resolve/tgpuResolve.js";
|
|
28
|
+
import { InitFromDeviceOptions, InitOptions, init, initFromDevice } from "./core/root/init.js";
|
|
29
|
+
import { slot } from "./core/slot/slot.js";
|
|
30
|
+
import { lazy } from "./core/slot/lazy.js";
|
|
31
|
+
import { accessor, mutableAccessor } from "./core/slot/accessor.js";
|
|
32
|
+
import { unroll } from "./core/unroll/tgpuUnroll.js";
|
|
33
|
+
import { RawCodeSnippetOrigin, TgpuRawCodeSnippet } from "./core/rawCodeSnippet/tgpuRawCodeSnippet.js";
|
|
34
|
+
import { tgpuUnstable_d_exports } from "./tgpuUnstable.js";
|
|
35
|
+
import { index_d_exports as index_d_exports$1 } from "./data/index.js";
|
|
36
|
+
import { index_d_exports as index_d_exports$2 } from "./std/index.js";
|
|
37
|
+
import { index_d_exports } from "./common/index.js";
|
|
38
|
+
import { MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError } from "./errors.js";
|
|
39
|
+
import { TgpuRenderPipelineDescriptor } from "./indexNamedExports.js";
|
|
5
40
|
|
|
6
|
-
//#region src/resolutionCtx.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* The results of a WGSL resolution.
|
|
9
|
-
*
|
|
10
|
-
* @param code - The resolved code.
|
|
11
|
-
* @param usedBindGroupLayouts - List of used `tgpu.bindGroupLayout`s.
|
|
12
|
-
* @param catchall - Automatically constructed bind group for buffer usages and buffer shorthands, preceded by its index.
|
|
13
|
-
* @param logResources - Buffers and information about used console.logs needed to decode the raw data.
|
|
14
|
-
*/
|
|
15
|
-
interface ResolutionResult {
|
|
16
|
-
code: string;
|
|
17
|
-
usedBindGroupLayouts: TgpuBindGroupLayout[];
|
|
18
|
-
catchall: [number, TgpuBindGroup] | undefined;
|
|
19
|
-
logResources: LogResources | undefined;
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/core/resolve/tgpuResolve.d.ts
|
|
23
|
-
interface TgpuResolveOptions {
|
|
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;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Resolves a template with external values. Each external that is used will get resolved to a code string and replaced in the template.
|
|
64
|
-
* Any dependencies of the externals will also be resolved and included in the output.
|
|
65
|
-
* @param options - The options for the resolution.
|
|
66
|
-
*
|
|
67
|
-
* @returns {ResolutionResult}
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```ts
|
|
71
|
-
* const Gradient = d.struct({ from: d.vec3f, to: d.vec3f });
|
|
72
|
-
*
|
|
73
|
-
* const { code, usedBindGroupLayouts, catchall } = tgpu.resolveWithContext({
|
|
74
|
-
* template: `
|
|
75
|
-
* fn getGradientAngle(gradient: Gradient) -> f32 {
|
|
76
|
-
* return atan(gradient.to.y - gradient.from.y, gradient.to.x - gradient.from.x);
|
|
77
|
-
* }
|
|
78
|
-
* `,
|
|
79
|
-
* externals: {
|
|
80
|
-
* Gradient,
|
|
81
|
-
* },
|
|
82
|
-
* });
|
|
83
|
-
*
|
|
84
|
-
* console.log(code);
|
|
85
|
-
* // struct Gradient_0 {
|
|
86
|
-
* // from: vec3f,
|
|
87
|
-
* // to: vec3f,
|
|
88
|
-
* // }
|
|
89
|
-
* // fn getGradientAngle(gradient: Gradient_0) -> f32 {
|
|
90
|
-
* // return atan(gradient.to.y - gradient.from.y, gradient.to.x - gradient.from.x);
|
|
91
|
-
* // }
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
declare function resolveWithContext(options: TgpuExtendedResolveOptions): ResolutionResult;
|
|
95
|
-
/**
|
|
96
|
-
* Resolves given TypeGPU resources.
|
|
97
|
-
* Any dependencies of the externals will also be resolved and included in the output.
|
|
98
|
-
* @param items - An array of items to resolve.
|
|
99
|
-
* @param options - The options for the resolution.
|
|
100
|
-
*
|
|
101
|
-
* @returns {ResolutionResult}
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```ts
|
|
105
|
-
* const Gradient = d.struct({
|
|
106
|
-
* from: d.vec3f,
|
|
107
|
-
* to: d.vec3f,
|
|
108
|
-
* });
|
|
109
|
-
*
|
|
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({
|
|
142
|
-
* template: `
|
|
143
|
-
* fn getGradientAngle(gradient: Gradient) -> f32 {
|
|
144
|
-
* return atan(gradient.to.y - gradient.from.y, gradient.to.x - gradient.from.x);
|
|
145
|
-
* }
|
|
146
|
-
* `,
|
|
147
|
-
* externals: {
|
|
148
|
-
* Gradient,
|
|
149
|
-
* },
|
|
150
|
-
* });
|
|
151
|
-
*
|
|
152
|
-
* console.log(code);
|
|
153
|
-
* // struct Gradient_0 {
|
|
154
|
-
* // from: vec3f,
|
|
155
|
-
* // to: vec3f,
|
|
156
|
-
* // }
|
|
157
|
-
* // fn getGradientAngle(gradient: Gradient_0) -> f32 {
|
|
158
|
-
* // return atan(gradient.to.y - gradient.from.y, gradient.to.x - gradient.from.x);
|
|
159
|
-
* // }
|
|
160
|
-
* ```
|
|
161
|
-
*/
|
|
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
|
-
interface SimulationResult<T> {
|
|
185
|
-
value: T;
|
|
186
|
-
buffers: Map<TgpuBuffer<BaseData>, unknown>;
|
|
187
|
-
privateVars: Map<TgpuVar<'private'>, unknown>[][][];
|
|
188
|
-
workgroupVars: Map<TgpuVar<'workgroup'>, unknown>[][][];
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Runs the provided callback in a simulated environment, giving
|
|
192
|
-
* it access to buffers and variables as if it were running on the GPU.
|
|
193
|
-
*
|
|
194
|
-
* The result of the simulation is returned, and does not affect the actual GPU state,
|
|
195
|
-
* nor does it carry over to other simulations.
|
|
196
|
-
*
|
|
197
|
-
* @param callback The callback to run in the simulated environment.
|
|
198
|
-
* @returns An object containing the result of the simulation, and
|
|
199
|
-
* the final state of the environment.
|
|
200
|
-
*
|
|
201
|
-
* @example
|
|
202
|
-
* const counter = tgpu.privateVar(d.u32);
|
|
203
|
-
*
|
|
204
|
-
* const result = tgpu.simulate(() => {
|
|
205
|
-
* counter.$ += 1;
|
|
206
|
-
* counter.$ += 2;
|
|
207
|
-
* return counter.$;
|
|
208
|
-
* });
|
|
209
|
-
*
|
|
210
|
-
* console.log(result.value); // 3
|
|
211
|
-
*/
|
|
212
|
-
declare function simulate<T>(callback: () => T): SimulationResult<T>;
|
|
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 };
|
|
215
|
-
}
|
|
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
41
|
//#region src/index.d.ts
|
|
244
42
|
/**
|
|
245
43
|
* @module typegpu
|
|
@@ -268,5 +66,4 @@ declare const tgpu: {
|
|
|
268
66
|
'~unstable': typeof tgpuUnstable_d_exports;
|
|
269
67
|
};
|
|
270
68
|
//#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
|
|
69
|
+
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 };
|