typegpu 0.10.1 → 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-BagDrrks.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-DdtWpk2t.js +0 -818
- package/builtin-DdtWpk2t.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-DQxK4vdp.js +0 -413
- package/deepEqual-DQxK4vdp.js.map +0 -1
- package/extensions-DIVuAfBM.js +0 -2032
- package/extensions-DIVuAfBM.js.map +0 -1
- package/fullScreenTriangle-CfFyQd_0.js +0 -543
- package/fullScreenTriangle-CfFyQd_0.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/index.js.map +0 -1
- package/indexNamedExports-oL6tyaJ9.d.ts +0 -5697
- package/indexNamedExports-oL6tyaJ9.d.ts.map +0 -1
- package/operators-d-PMVTo7.js +0 -4158
- package/operators-d-PMVTo7.js.map +0 -1
- package/std/index.d.ts.map +0 -1
- package/std/index.js.map +0 -1
- package/texture-BagDrrks.js.map +0 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { $getNameForward, $internal, $providing, $resolve, isMarkedInternal } from "../../shared/symbols.js";
|
|
2
|
+
import { getName, setName } from "../../shared/meta.js";
|
|
3
|
+
import { Void } from "../../data/wgslTypes.js";
|
|
4
|
+
import { ExecutionError } from "../../errors.js";
|
|
5
|
+
import { isAccessor, isMutableAccessor } from "../slot/slotTypes.js";
|
|
6
|
+
import { provideInsideTgpuFn } from "../../execMode.js";
|
|
7
|
+
import { stitch } from "../resolve/stitch.js";
|
|
8
|
+
import { schemaCallWrapper } from "../../data/schemaCallWrapper.js";
|
|
9
|
+
import { dualImpl } from "./dualImpl.js";
|
|
10
|
+
import { comptime } from "./comptime.js";
|
|
11
|
+
import { addArgTypesToExternals, addReturnTypeToExternals } from "../resolve/externals.js";
|
|
12
|
+
import { createFnCore } from "./fnCore.js";
|
|
13
|
+
import { stripTemplate } from "./templateUtils.js";
|
|
14
|
+
|
|
15
|
+
//#region src/core/function/tgpuFn.ts
|
|
16
|
+
function fn(argTypesOrCallback, returnType) {
|
|
17
|
+
if (typeof argTypesOrCallback === "function") return createGenericFn(argTypesOrCallback, []);
|
|
18
|
+
const argTypes = argTypesOrCallback;
|
|
19
|
+
const shell = {
|
|
20
|
+
[$internal]: true,
|
|
21
|
+
argTypes,
|
|
22
|
+
returnType: returnType ?? Void
|
|
23
|
+
};
|
|
24
|
+
const call = (arg, ...values) => createFn(shell, stripTemplate(arg, ...values));
|
|
25
|
+
return Object.assign(call, shell);
|
|
26
|
+
}
|
|
27
|
+
function isTgpuFn(value) {
|
|
28
|
+
return isMarkedInternal(value) && value?.resourceType === "function";
|
|
29
|
+
}
|
|
30
|
+
function isGenericFn(value) {
|
|
31
|
+
return isMarkedInternal(value) && value?.resourceType === "generic-function";
|
|
32
|
+
}
|
|
33
|
+
function stringifyPair([slot, value]) {
|
|
34
|
+
return `${getName(slot) ?? "<unnamed>"}=${value}`;
|
|
35
|
+
}
|
|
36
|
+
function createFn(shell, _implementation) {
|
|
37
|
+
let pairs = [];
|
|
38
|
+
let implementation;
|
|
39
|
+
if (isGenericFn(_implementation)) {
|
|
40
|
+
pairs = _implementation[$providing]?.pairs ?? [];
|
|
41
|
+
implementation = _implementation[$internal].inner;
|
|
42
|
+
} else implementation = _implementation;
|
|
43
|
+
const core = createFnCore(implementation, "");
|
|
44
|
+
const fnBase = {
|
|
45
|
+
shell,
|
|
46
|
+
resourceType: "function",
|
|
47
|
+
[$internal]: { implementation },
|
|
48
|
+
$uses(newExternals) {
|
|
49
|
+
core.applyExternals(newExternals);
|
|
50
|
+
return this;
|
|
51
|
+
},
|
|
52
|
+
[$getNameForward]: core,
|
|
53
|
+
$name(label) {
|
|
54
|
+
setName(this, label);
|
|
55
|
+
return this;
|
|
56
|
+
},
|
|
57
|
+
with: comptime((slot, value) => {
|
|
58
|
+
return createBoundFunction(fn, [[isAccessor(slot) || isMutableAccessor(slot) ? slot.slot : slot, value]]);
|
|
59
|
+
}),
|
|
60
|
+
[$resolve](ctx) {
|
|
61
|
+
if (typeof implementation === "string") {
|
|
62
|
+
addArgTypesToExternals(implementation, shell.argTypes, core.applyExternals);
|
|
63
|
+
addReturnTypeToExternals(implementation, shell.returnType, core.applyExternals);
|
|
64
|
+
}
|
|
65
|
+
return core.resolve(ctx, shell.argTypes, shell.returnType);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const call = dualImpl({
|
|
69
|
+
name: void 0,
|
|
70
|
+
noComptime: true,
|
|
71
|
+
signature: {
|
|
72
|
+
argTypes: shell.argTypes,
|
|
73
|
+
returnType: shell.returnType
|
|
74
|
+
},
|
|
75
|
+
normalImpl: (...args) => provideInsideTgpuFn(() => {
|
|
76
|
+
try {
|
|
77
|
+
if (typeof implementation === "string") throw new Error("Cannot execute on the CPU functions constructed with raw WGSL");
|
|
78
|
+
const castAndCopiedArgs = args.map((arg, index) => schemaCallWrapper(shell.argTypes[index], arg));
|
|
79
|
+
const result = implementation(...castAndCopiedArgs);
|
|
80
|
+
return schemaCallWrapper(shell.returnType, result);
|
|
81
|
+
} catch (err) {
|
|
82
|
+
if (err instanceof ExecutionError) throw err.appendToTrace(fn);
|
|
83
|
+
throw new ExecutionError(err, [fn]);
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
codegenImpl: (ctx, args) => ctx.withResetIndentLevel(() => stitch`${ctx.resolve(fn).value}(${args})`)
|
|
87
|
+
});
|
|
88
|
+
const fn = Object.assign(call, fnBase);
|
|
89
|
+
Object.defineProperty(fn, "toString", { value() {
|
|
90
|
+
return `fn:${getName(core) ?? "<unnamed>"}`;
|
|
91
|
+
} });
|
|
92
|
+
if (pairs.length > 0) return createBoundFunction(fn, pairs);
|
|
93
|
+
return fn;
|
|
94
|
+
}
|
|
95
|
+
function createBoundFunction(innerFn, pairs) {
|
|
96
|
+
const fnBase = {
|
|
97
|
+
resourceType: "function",
|
|
98
|
+
shell: innerFn.shell,
|
|
99
|
+
[$internal]: { implementation: innerFn[$internal].implementation },
|
|
100
|
+
[$providing]: {
|
|
101
|
+
inner: innerFn,
|
|
102
|
+
pairs
|
|
103
|
+
},
|
|
104
|
+
$uses(newExternals) {
|
|
105
|
+
innerFn.$uses(newExternals);
|
|
106
|
+
return this;
|
|
107
|
+
},
|
|
108
|
+
$name(label) {
|
|
109
|
+
setName(this, label);
|
|
110
|
+
return this;
|
|
111
|
+
},
|
|
112
|
+
with: comptime((slot, value) => {
|
|
113
|
+
const s = isAccessor(slot) || isMutableAccessor(slot) ? slot.slot : slot;
|
|
114
|
+
return createBoundFunction(innerFn, [...pairs, [s, value]]);
|
|
115
|
+
})
|
|
116
|
+
};
|
|
117
|
+
const call = dualImpl({
|
|
118
|
+
name: void 0,
|
|
119
|
+
noComptime: true,
|
|
120
|
+
signature: {
|
|
121
|
+
argTypes: innerFn.shell.argTypes,
|
|
122
|
+
returnType: innerFn.shell.returnType
|
|
123
|
+
},
|
|
124
|
+
normalImpl: innerFn,
|
|
125
|
+
codegenImpl: (ctx, args) => ctx.withResetIndentLevel(() => stitch`${ctx.resolve(fn).value}(${args})`)
|
|
126
|
+
});
|
|
127
|
+
const fn = Object.assign(call, fnBase);
|
|
128
|
+
Object.defineProperty(fn, "toString", { value() {
|
|
129
|
+
return `fn:${getName(this) ?? "<unnamed>"}[${pairs.map(stringifyPair).join(", ")}]`;
|
|
130
|
+
} });
|
|
131
|
+
const innerName = getName(innerFn);
|
|
132
|
+
if (innerName) setName(fn, innerName);
|
|
133
|
+
return fn;
|
|
134
|
+
}
|
|
135
|
+
function createGenericFn(inner, pairs) {
|
|
136
|
+
const fnBase = {
|
|
137
|
+
[$internal]: { inner },
|
|
138
|
+
resourceType: "generic-function",
|
|
139
|
+
[$providing]: pairs.length > 0 ? {
|
|
140
|
+
inner,
|
|
141
|
+
pairs
|
|
142
|
+
} : void 0,
|
|
143
|
+
$name(label) {
|
|
144
|
+
setName(this, label);
|
|
145
|
+
if (!getName(inner)) setName(inner, label);
|
|
146
|
+
return this;
|
|
147
|
+
},
|
|
148
|
+
[$resolve](ctx) {
|
|
149
|
+
return ctx.resolve(inner);
|
|
150
|
+
},
|
|
151
|
+
with(slot, value) {
|
|
152
|
+
const s = isAccessor(slot) || isMutableAccessor(slot) ? slot.slot : slot;
|
|
153
|
+
return createGenericFn(inner, [...pairs, [s, value]]);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const call = (...args) => {
|
|
157
|
+
return inner(...args);
|
|
158
|
+
};
|
|
159
|
+
const genericFn = Object.assign(call, fnBase);
|
|
160
|
+
if (getName(inner)) setName(genericFn, getName(inner));
|
|
161
|
+
Object.defineProperty(genericFn, "toString", { value() {
|
|
162
|
+
const fnLabel = getName(genericFn) ?? "<unnamed>";
|
|
163
|
+
if (pairs.length > 0) return `fn*:${fnLabel}[${pairs.map(stringifyPair).join(", ")}]`;
|
|
164
|
+
return `fn*:${fnLabel}`;
|
|
165
|
+
} });
|
|
166
|
+
return genericFn;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
170
|
+
export { fn, isGenericFn, isTgpuFn };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { TgpuNamable } from "../../shared/meta.js";
|
|
2
|
+
import { $internal } from "../../shared/symbols.js";
|
|
3
|
+
import { Prettify } from "../../shared/utilityTypes.js";
|
|
4
|
+
import { AnyFragmentInputBuiltin, AnyFragmentOutputBuiltin, OmitBuiltins } from "../../builtin.js";
|
|
5
|
+
import { BaseIOData, IOLayout, IORecord, InferIO } from "./fnTypes.js";
|
|
6
|
+
import { IOLayoutToSchema } from "./ioSchema.js";
|
|
7
|
+
import { InstanceToSchema } from "../../data/instanceToSchema.js";
|
|
8
|
+
import { BaseData, Decorated, Interpolate, Location, Vec4f, Vec4i, Vec4u, WgslStruct } from "../../data/wgslTypes.js";
|
|
9
|
+
import { UndecorateRecord } from "../../data/dataTypes.js";
|
|
10
|
+
|
|
11
|
+
//#region src/core/function/tgpuFragmentFn.d.ts
|
|
12
|
+
type FragmentInConstrained = IORecord<BaseIOData | Decorated<BaseIOData, (Location | Interpolate)[]> | AnyFragmentInputBuiltin>;
|
|
13
|
+
type VertexOutToVarying<T> = OmitBuiltins<{ [K in keyof T]: InstanceToSchema<T[K]> }>;
|
|
14
|
+
type FragmentColorValue = Vec4f | Vec4i | Vec4u;
|
|
15
|
+
type FragmentOutConstrained = IOLayout<FragmentColorValue | Decorated<FragmentColorValue, (Location | Interpolate)[]> | AnyFragmentOutputBuiltin>;
|
|
16
|
+
/**
|
|
17
|
+
* Describes a fragment entry function signature (its arguments, return type and targets)
|
|
18
|
+
*/
|
|
19
|
+
type TgpuFragmentFnShellHeader<FragmentIn extends TgpuFragmentFn.In = TgpuFragmentFn.In, FragmentOut extends TgpuFragmentFn.Out = TgpuFragmentFn.Out> = {
|
|
20
|
+
readonly in: FragmentIn | undefined;
|
|
21
|
+
readonly out: FragmentOut;
|
|
22
|
+
readonly returnType: IOLayoutToSchema<FragmentOut>;
|
|
23
|
+
readonly entryPoint: 'fragment';
|
|
24
|
+
};
|
|
25
|
+
type CleanIO<T> = T extends Record<string, BaseData> ? Prettify<UndecorateRecord<OmitBuiltins<T>>> : Prettify<UndecorateRecord<OmitBuiltins<{
|
|
26
|
+
a: T;
|
|
27
|
+
}>>> extends {
|
|
28
|
+
a: infer Result;
|
|
29
|
+
} ? Result : Record<string, never>;
|
|
30
|
+
/**
|
|
31
|
+
* Describes a fragment entry function signature (its arguments, return type and targets).
|
|
32
|
+
* Allows creating tgpu fragment functions by calling this shell
|
|
33
|
+
* and passing the implementation (as WGSL string or JS function) as the argument.
|
|
34
|
+
*/
|
|
35
|
+
interface TgpuFragmentFnShell<out TIn extends TgpuFragmentFn.In = TgpuFragmentFn.In, out TOut extends TgpuFragmentFn.Out = TgpuFragmentFn.Out> extends TgpuFragmentFnShellHeader<TIn, TOut> {
|
|
36
|
+
/**
|
|
37
|
+
* Creates a type-safe implementation of this signature
|
|
38
|
+
*/
|
|
39
|
+
(implementation: (input: InferIO<TIn>, out: TOut extends IORecord ? WgslStruct<TOut> : TOut) => InferIO<TOut>): TgpuFragmentFn<CleanIO<TIn>, CleanIO<TOut>>;
|
|
40
|
+
/**
|
|
41
|
+
* @param implementation
|
|
42
|
+
* Raw WGSL function implementation with header and body
|
|
43
|
+
* without `fn` keyword and function name
|
|
44
|
+
* e.g. `"(x: f32) -> f32 { return x; }"`;
|
|
45
|
+
*/
|
|
46
|
+
(implementation: string): TgpuFragmentFn<CleanIO<TIn>, CleanIO<TOut>>;
|
|
47
|
+
(strings: TemplateStringsArray, ...values: unknown[]): TgpuFragmentFn<CleanIO<TIn>, CleanIO<TOut>>;
|
|
48
|
+
}
|
|
49
|
+
interface TgpuFragmentFn<in Varying extends TgpuFragmentFn.In = Record<string, never>, out Output extends TgpuFragmentFn.Out = TgpuFragmentFn.Out> extends TgpuNamable {
|
|
50
|
+
readonly [$internal]: true;
|
|
51
|
+
readonly shell: TgpuFragmentFnShellHeader<Varying, Output>;
|
|
52
|
+
readonly outputType: IOLayoutToSchema<Output>;
|
|
53
|
+
$uses(dependencyMap: Record<string, unknown>): this;
|
|
54
|
+
}
|
|
55
|
+
declare namespace TgpuFragmentFn {
|
|
56
|
+
type In = Record<string, BaseData>;
|
|
57
|
+
type Out = Record<string, BaseData> | BaseData;
|
|
58
|
+
}
|
|
59
|
+
declare function fragmentFn<FragmentOut extends FragmentOutConstrained>(options: {
|
|
60
|
+
out: FragmentOut;
|
|
61
|
+
}): TgpuFragmentFnShell<{}, FragmentOut>;
|
|
62
|
+
declare function fragmentFn<FragmentIn extends FragmentInConstrained, FragmentOut extends FragmentOutConstrained>(options: {
|
|
63
|
+
in: FragmentIn;
|
|
64
|
+
out: FragmentOut;
|
|
65
|
+
}): TgpuFragmentFnShell<FragmentIn, FragmentOut>;
|
|
66
|
+
declare function isTgpuFragmentFn<FragmentIn extends FragmentInConstrained, FragmentOut extends FragmentOutConstrained>(value: unknown): value is TgpuFragmentFn<FragmentIn, FragmentOut>;
|
|
67
|
+
//#endregion
|
|
68
|
+
export { FragmentInConstrained, FragmentOutConstrained, TgpuFragmentFn, TgpuFragmentFnShell, VertexOutToVarying, fragmentFn, isTgpuFragmentFn };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { $getNameForward, $internal, $resolve } from "../../shared/symbols.js";
|
|
2
|
+
import { getName, isNamable, setName } from "../../shared/meta.js";
|
|
3
|
+
import { createIoSchema } from "./ioSchema.js";
|
|
4
|
+
import { addReturnTypeToExternals } from "../resolve/externals.js";
|
|
5
|
+
import { createFnCore } from "./fnCore.js";
|
|
6
|
+
import { stripTemplate } from "./templateUtils.js";
|
|
7
|
+
import { shaderStageSlot } from "../slot/internalSlots.js";
|
|
8
|
+
|
|
9
|
+
//#region src/core/function/tgpuFragmentFn.ts
|
|
10
|
+
/**
|
|
11
|
+
* Creates a shell of a typed entry function for the fragment shader stage. Any function
|
|
12
|
+
* that implements this shell can run for each fragment (pixel), allowing the inner code
|
|
13
|
+
* to process information received from the vertex shader stage and builtins to determine
|
|
14
|
+
* the final color of the pixel (many pixels in case of multiple targets).
|
|
15
|
+
*
|
|
16
|
+
* @param options.in
|
|
17
|
+
* Values computed in the vertex stage and builtins to be made available to functions that implement this shell.
|
|
18
|
+
* @param options.out
|
|
19
|
+
* A `vec4f`, signaling this function outputs a color for one target, or a record containing colors for multiple targets.
|
|
20
|
+
*/
|
|
21
|
+
function fragmentFn(options) {
|
|
22
|
+
const shell = {
|
|
23
|
+
in: options.in,
|
|
24
|
+
out: options.out,
|
|
25
|
+
returnType: createIoSchema(options.out),
|
|
26
|
+
entryPoint: "fragment"
|
|
27
|
+
};
|
|
28
|
+
const call = (arg, ...values) => createFragmentFn(shell, stripTemplate(arg, ...values));
|
|
29
|
+
return Object.assign(call, shell);
|
|
30
|
+
}
|
|
31
|
+
function isTgpuFragmentFn(value) {
|
|
32
|
+
return value?.shell?.entryPoint === "fragment";
|
|
33
|
+
}
|
|
34
|
+
function createFragmentFn(shell, implementation) {
|
|
35
|
+
const core = createFnCore(implementation, "@fragment ");
|
|
36
|
+
const outputType = shell.returnType;
|
|
37
|
+
if (typeof implementation === "string") addReturnTypeToExternals(implementation, outputType, (externals) => core.applyExternals(externals));
|
|
38
|
+
return {
|
|
39
|
+
shell,
|
|
40
|
+
outputType,
|
|
41
|
+
$uses(newExternals) {
|
|
42
|
+
core.applyExternals(newExternals);
|
|
43
|
+
return this;
|
|
44
|
+
},
|
|
45
|
+
[$internal]: true,
|
|
46
|
+
[$getNameForward]: core,
|
|
47
|
+
$name(newLabel) {
|
|
48
|
+
setName(this, newLabel);
|
|
49
|
+
if (isNamable(outputType)) outputType.$name(`${newLabel}_Output`);
|
|
50
|
+
return this;
|
|
51
|
+
},
|
|
52
|
+
[$resolve](ctx) {
|
|
53
|
+
const inputWithLocation = shell.in ? createIoSchema(shell.in, ctx.varyingLocations) : void 0;
|
|
54
|
+
if (inputWithLocation) {
|
|
55
|
+
inputWithLocation.$name(`${getName(this) ?? ""}_Input`);
|
|
56
|
+
core.applyExternals({ In: inputWithLocation });
|
|
57
|
+
}
|
|
58
|
+
core.applyExternals({ Out: outputType });
|
|
59
|
+
return ctx.withSlots([[shaderStageSlot, "fragment"]], () => core.resolve(ctx, inputWithLocation ? [inputWithLocation] : [], shell.returnType));
|
|
60
|
+
},
|
|
61
|
+
toString() {
|
|
62
|
+
return `fragmentFn:${getName(core) ?? "<unnamed>"}`;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { fragmentFn, isTgpuFragmentFn };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TgpuNamable } from "../../shared/meta.js";
|
|
2
|
+
import { $internal } from "../../shared/symbols.js";
|
|
3
|
+
import { Prettify } from "../../shared/utilityTypes.js";
|
|
4
|
+
import { AnyVertexInputBuiltin, AnyVertexOutputBuiltin, OmitBuiltins } from "../../builtin.js";
|
|
5
|
+
import { BaseIOData, IORecord, InferIO } from "./fnTypes.js";
|
|
6
|
+
import { IOLayoutToSchema } from "./ioSchema.js";
|
|
7
|
+
import { BaseData, Decorated, Interpolate, Location } from "../../data/wgslTypes.js";
|
|
8
|
+
import { UndecorateRecord } from "../../data/dataTypes.js";
|
|
9
|
+
|
|
10
|
+
//#region src/core/function/tgpuVertexFn.d.ts
|
|
11
|
+
type VertexInConstrained = IORecord<BaseIOData | Decorated<BaseIOData, Location[]> | AnyVertexInputBuiltin>;
|
|
12
|
+
type VertexOutConstrained = IORecord<BaseIOData | Decorated<BaseIOData, (Location | Interpolate)[]> | AnyVertexOutputBuiltin>;
|
|
13
|
+
/**
|
|
14
|
+
* Describes a vertex entry function signature (its arguments, return type and attributes)
|
|
15
|
+
*/
|
|
16
|
+
type TgpuVertexFnShellHeader<VertexIn extends TgpuVertexFn.In, VertexOut extends TgpuVertexFn.Out> = {
|
|
17
|
+
readonly in: VertexIn | undefined;
|
|
18
|
+
readonly out: VertexOut;
|
|
19
|
+
readonly argTypes: [IOLayoutToSchema<VertexIn>] | [];
|
|
20
|
+
readonly entryPoint: 'vertex';
|
|
21
|
+
};
|
|
22
|
+
type CleanIO<T> = T extends Record<string, BaseData> ? Prettify<UndecorateRecord<OmitBuiltins<T>>> : Prettify<UndecorateRecord<OmitBuiltins<{
|
|
23
|
+
a: T;
|
|
24
|
+
}>>> extends {
|
|
25
|
+
a: infer Result;
|
|
26
|
+
} ? Result : never;
|
|
27
|
+
/**
|
|
28
|
+
* Describes a vertex entry function signature (its arguments, return type and attributes).
|
|
29
|
+
* Allows creating tgpu vertex functions by calling this shell
|
|
30
|
+
* and passing the implementation (as WGSL string or JS function) as the argument.
|
|
31
|
+
*/
|
|
32
|
+
interface TgpuVertexFnShell<out TIn extends TgpuVertexFn.In, out TOut extends TgpuVertexFn.Out> extends TgpuVertexFnShellHeader<TIn, TOut> {
|
|
33
|
+
(implementation: (input: InferIO<TIn>, out: IOLayoutToSchema<TOut>) => InferIO<TOut>): TgpuVertexFn<CleanIO<TIn>, CleanIO<TOut>>;
|
|
34
|
+
(implementation: string): TgpuVertexFn<CleanIO<TIn>, CleanIO<TOut>>;
|
|
35
|
+
(strings: TemplateStringsArray, ...values: unknown[]): TgpuVertexFn<CleanIO<TIn>, CleanIO<TOut>>;
|
|
36
|
+
}
|
|
37
|
+
interface TgpuVertexFn<in VertexIn extends TgpuVertexFn.In = Record<string, never>, out VertexOut extends TgpuVertexFn.Out = TgpuVertexFn.Out> extends TgpuNamable {
|
|
38
|
+
readonly [$internal]: true;
|
|
39
|
+
readonly shell: TgpuVertexFnShellHeader<VertexIn, VertexOut>;
|
|
40
|
+
$uses(dependencyMap: Record<string, unknown>): this;
|
|
41
|
+
}
|
|
42
|
+
declare namespace TgpuVertexFn {
|
|
43
|
+
type In = BaseData | Record<string, BaseData>;
|
|
44
|
+
type Out = Record<string, BaseData>;
|
|
45
|
+
}
|
|
46
|
+
declare function vertexFn<VertexOut extends VertexOutConstrained>(options: {
|
|
47
|
+
out: VertexOut;
|
|
48
|
+
}): TgpuVertexFnShell<{}, VertexOut>;
|
|
49
|
+
declare function vertexFn<VertexIn extends VertexInConstrained, VertexOut extends VertexOutConstrained>(options: {
|
|
50
|
+
in: VertexIn;
|
|
51
|
+
out: VertexOut;
|
|
52
|
+
}): TgpuVertexFnShell<VertexIn, VertexOut>;
|
|
53
|
+
declare function isTgpuVertexFn<VertexIn extends VertexInConstrained, VertexOut extends VertexOutConstrained>(value: unknown): value is TgpuVertexFn<VertexIn, VertexOut>;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { TgpuVertexFn, TgpuVertexFnShell, isTgpuVertexFn, vertexFn };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { $getNameForward, $internal, $resolve } from "../../shared/symbols.js";
|
|
2
|
+
import { getName, isNamable, setName } from "../../shared/meta.js";
|
|
3
|
+
import { createIoSchema } from "./ioSchema.js";
|
|
4
|
+
import { createFnCore } from "./fnCore.js";
|
|
5
|
+
import { stripTemplate } from "./templateUtils.js";
|
|
6
|
+
import { shaderStageSlot } from "../slot/internalSlots.js";
|
|
7
|
+
|
|
8
|
+
//#region src/core/function/tgpuVertexFn.ts
|
|
9
|
+
/**
|
|
10
|
+
* Creates a shell of a typed entry function for the vertex shader stage. Any function
|
|
11
|
+
* that implements this shell can run for each vertex, allowing the inner code to process
|
|
12
|
+
* attributes and determine the final position of the vertex.
|
|
13
|
+
*
|
|
14
|
+
* @param options.in
|
|
15
|
+
* Vertex attributes and builtins to be made available to functions that implement this shell.
|
|
16
|
+
* @param options.out
|
|
17
|
+
* A record containing the final position of the vertex, and any information
|
|
18
|
+
* passed onto the fragment shader stage.
|
|
19
|
+
*/
|
|
20
|
+
function vertexFn(options) {
|
|
21
|
+
if (Object.keys(options.out).length === 0) throw new Error(`A vertexFn output cannot be empty since it must include the 'position' builtin.`);
|
|
22
|
+
const shell = {
|
|
23
|
+
in: options.in,
|
|
24
|
+
out: options.out,
|
|
25
|
+
argTypes: options.in && Object.keys(options.in).length !== 0 ? [createIoSchema(options.in)] : [],
|
|
26
|
+
entryPoint: "vertex"
|
|
27
|
+
};
|
|
28
|
+
const call = (arg, ...values) => createVertexFn(shell, stripTemplate(arg, ...values));
|
|
29
|
+
return Object.assign(call, shell);
|
|
30
|
+
}
|
|
31
|
+
function isTgpuVertexFn(value) {
|
|
32
|
+
return value?.shell?.entryPoint === "vertex";
|
|
33
|
+
}
|
|
34
|
+
function createVertexFn(shell, implementation) {
|
|
35
|
+
const core = createFnCore(implementation, "@vertex ");
|
|
36
|
+
const inputType = shell.argTypes[0];
|
|
37
|
+
return {
|
|
38
|
+
shell,
|
|
39
|
+
$uses(newExternals) {
|
|
40
|
+
core.applyExternals(newExternals);
|
|
41
|
+
return this;
|
|
42
|
+
},
|
|
43
|
+
[$internal]: true,
|
|
44
|
+
[$getNameForward]: core,
|
|
45
|
+
$name(newLabel) {
|
|
46
|
+
setName(this, newLabel);
|
|
47
|
+
if (isNamable(inputType)) inputType.$name(`${newLabel}_Input`);
|
|
48
|
+
return this;
|
|
49
|
+
},
|
|
50
|
+
[$resolve](ctx) {
|
|
51
|
+
const outputWithLocation = createIoSchema(shell.out, ctx.varyingLocations).$name(`${getName(this) ?? ""}_Output`);
|
|
52
|
+
if (typeof implementation === "string") {
|
|
53
|
+
if (inputType) core.applyExternals({ In: inputType });
|
|
54
|
+
core.applyExternals({ Out: outputWithLocation });
|
|
55
|
+
}
|
|
56
|
+
return ctx.withSlots([[shaderStageSlot, "vertex"]], () => core.resolve(ctx, shell.argTypes, outputWithLocation));
|
|
57
|
+
},
|
|
58
|
+
toString() {
|
|
59
|
+
return `vertexFn:${getName(core) ?? "<unnamed>"}`;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { isTgpuVertexFn, vertexFn };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MissingBindGroupsError, MissingVertexBuffersError } from "../../errors.js";
|
|
2
|
+
import { isBuffer } from "../buffer/buffer.js";
|
|
3
|
+
import { isBindGroup } from "../../tgpuBindGroupLayout.js";
|
|
4
|
+
import { warnIfOverflow } from "./limitsOverflow.js";
|
|
5
|
+
|
|
6
|
+
//#region src/core/pipeline/applyPipelineState.ts
|
|
7
|
+
function applyBindGroups(encoder, root, usedBindGroupLayouts, catchall, resolveBindGroup) {
|
|
8
|
+
const missingBindGroups = new Set(usedBindGroupLayouts);
|
|
9
|
+
warnIfOverflow(usedBindGroupLayouts, root.device.limits);
|
|
10
|
+
usedBindGroupLayouts.forEach((layout, idx) => {
|
|
11
|
+
if (catchall && idx === catchall[0]) {
|
|
12
|
+
encoder.setBindGroup(idx, root.unwrap(catchall[1]));
|
|
13
|
+
missingBindGroups.delete(layout);
|
|
14
|
+
} else {
|
|
15
|
+
const bindGroup = resolveBindGroup(layout);
|
|
16
|
+
if (bindGroup !== void 0) {
|
|
17
|
+
missingBindGroups.delete(layout);
|
|
18
|
+
if (isBindGroup(bindGroup)) encoder.setBindGroup(idx, root.unwrap(bindGroup));
|
|
19
|
+
else encoder.setBindGroup(idx, bindGroup);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
if (missingBindGroups.size > 0) throw new MissingBindGroupsError(missingBindGroups);
|
|
24
|
+
}
|
|
25
|
+
function applyVertexBuffers(encoder, root, usedVertexLayouts, resolveVertexBuffer) {
|
|
26
|
+
const missingVertexLayouts = /* @__PURE__ */ new Set();
|
|
27
|
+
usedVertexLayouts.forEach((vertexLayout, idx) => {
|
|
28
|
+
const entry = resolveVertexBuffer(vertexLayout);
|
|
29
|
+
if (!entry || !entry.buffer) missingVertexLayouts.add(vertexLayout);
|
|
30
|
+
else if (isBuffer(entry.buffer)) encoder.setVertexBuffer(idx, root.unwrap(entry.buffer), entry.offset, entry.size);
|
|
31
|
+
else encoder.setVertexBuffer(idx, entry.buffer, entry.offset, entry.size);
|
|
32
|
+
});
|
|
33
|
+
if (missingVertexLayouts.size > 0) throw new MissingVertexBuffersError(missingVertexLayouts);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { applyBindGroups, applyVertexBuffers };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { TgpuNamable } from "../../shared/meta.js";
|
|
2
|
+
import { $internal } from "../../shared/symbols.js";
|
|
3
|
+
import { AnyComputeBuiltin } from "../../builtin.js";
|
|
4
|
+
import "../querySet/querySet.js";
|
|
5
|
+
import "../../data/snippet.js";
|
|
6
|
+
import "../../tgsl/consoleLog/types.js";
|
|
7
|
+
import { IORecord } from "../function/fnTypes.js";
|
|
8
|
+
import { TgpuComputeFn } from "../function/tgpuComputeFn.js";
|
|
9
|
+
import "../slot/slotTypes.js";
|
|
10
|
+
import { PrimitiveOffsetInfo } from "../../data/offsetUtils.js";
|
|
11
|
+
import { Timeable, TimestampWritesPriors } from "./timeable.js";
|
|
12
|
+
import { TgpuBindGroup, TgpuBindGroupLayout, TgpuLayoutEntry } from "../../tgpuBindGroupLayout.js";
|
|
13
|
+
import { ExperimentalTgpuRoot } from "../root/rootTypes.js";
|
|
14
|
+
import { IndirectFlag, TgpuBuffer } from "../buffer/buffer.js";
|
|
15
|
+
import { SelfResolvable } from "../../types.js";
|
|
16
|
+
import { AnyWgslData } from "../../data/wgslTypes.js";
|
|
17
|
+
|
|
18
|
+
//#region src/core/pipeline/computePipeline.d.ts
|
|
19
|
+
interface ComputePipelineInternals {
|
|
20
|
+
readonly rawPipeline: GPUComputePipeline;
|
|
21
|
+
readonly priors: TgpuComputePipelinePriors & TimestampWritesPriors;
|
|
22
|
+
readonly root: ExperimentalTgpuRoot;
|
|
23
|
+
}
|
|
24
|
+
interface TgpuComputePipeline extends TgpuNamable, SelfResolvable, Timeable {
|
|
25
|
+
readonly [$internal]: ComputePipelineInternals;
|
|
26
|
+
readonly resourceType: 'compute-pipeline';
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated This overload is outdated.
|
|
29
|
+
* Call `pipeline.with(bindGroup)` instead.
|
|
30
|
+
*/
|
|
31
|
+
with<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries>): this;
|
|
32
|
+
with(bindGroupLayout: TgpuBindGroupLayout, bindGroup: GPUBindGroup): this;
|
|
33
|
+
with(bindGroup: TgpuBindGroup): this;
|
|
34
|
+
with(encoder: GPUCommandEncoder): this;
|
|
35
|
+
with(pass: GPUComputePassEncoder): this;
|
|
36
|
+
dispatchWorkgroups(x: number, y?: number, z?: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* Dispatches compute workgroups using parameters read from a buffer.
|
|
39
|
+
* The buffer must contain 3 consecutive u32 values (x, y, z workgroup counts).
|
|
40
|
+
* To get the correct offset within complex data structures, use `d.memoryLayoutOf(...)`.
|
|
41
|
+
*
|
|
42
|
+
* @param indirectBuffer - Buffer marked with 'indirect' usage containing dispatch parameters
|
|
43
|
+
* @param start - PrimitiveOffsetInfo pointing to the first dispatch parameter. If not provided, starts at offset 0. To obtain safe offsets, use `d.memoryLayoutOf(...)`.
|
|
44
|
+
*/
|
|
45
|
+
dispatchWorkgroupsIndirect<T extends AnyWgslData>(indirectBuffer: TgpuBuffer<T> & IndirectFlag, start?: PrimitiveOffsetInfo | number): void;
|
|
46
|
+
}
|
|
47
|
+
declare namespace TgpuComputePipeline {
|
|
48
|
+
type Descriptor<Input extends IORecord<AnyComputeBuiltin> = IORecord<AnyComputeBuiltin>> = {
|
|
49
|
+
compute: TgpuComputeFn<Input>;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
type TgpuComputePipelinePriors = {
|
|
53
|
+
readonly bindGroupLayoutMap?: Map<TgpuBindGroupLayout, TgpuBindGroup | GPUBindGroup>;
|
|
54
|
+
readonly externalEncoder?: GPUCommandEncoder | undefined;
|
|
55
|
+
readonly externalPass?: GPUComputePassEncoder | undefined;
|
|
56
|
+
} & TimestampWritesPriors;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { TgpuComputePipeline };
|