typegpu 0.10.2 → 0.11.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/_virtual/_rolldown/runtime.js +6 -11
- package/builtin.js +1 -3
- package/common/fullScreenTriangle.d.ts +1 -5
- package/common/fullScreenTriangle.js +1 -3
- package/common/index.d.ts +3 -2
- package/common/index.js +6 -4
- package/common/writeSoA.d.ts +16 -0
- package/common/writeSoA.js +90 -0
- package/core/buffer/buffer.d.ts +12 -7
- package/core/buffer/buffer.js +102 -53
- package/core/buffer/bufferShorthand.d.ts +5 -5
- package/core/buffer/bufferShorthand.js +9 -5
- package/core/buffer/bufferUsage.d.ts +0 -2
- package/core/buffer/bufferUsage.js +6 -4
- package/core/constant/tgpuConstant.d.ts +2 -1
- package/core/constant/tgpuConstant.js +8 -7
- package/core/declare/tgpuDeclare.js +8 -9
- package/core/function/autoIO.d.ts +7 -6
- package/core/function/autoIO.js +1 -3
- package/core/function/comptime.js +1 -3
- package/core/function/createCallableSchema.js +4 -6
- package/core/function/dualImpl.js +1 -3
- package/core/function/entryInputRouter.js +39 -0
- package/core/function/extractArgs.js +2 -2
- package/core/function/fnCore.js +19 -8
- package/core/function/fnTypes.d.ts +14 -8
- package/core/function/ioSchema.js +24 -3
- package/core/function/shelllessImpl.js +1 -3
- package/core/function/templateUtils.js +1 -2
- package/core/function/tgpuComputeFn.d.ts +2 -3
- package/core/function/tgpuComputeFn.js +9 -16
- package/core/function/tgpuFn.d.ts +2 -2
- package/core/function/tgpuFn.js +1 -3
- package/core/function/tgpuFragmentFn.d.ts +5 -1
- package/core/function/tgpuFragmentFn.js +5 -10
- package/core/function/tgpuVertexFn.d.ts +4 -0
- package/core/function/tgpuVertexFn.js +6 -12
- package/core/pipeline/applyPipelineState.js +1 -3
- package/core/pipeline/computePipeline.d.ts +2 -6
- package/core/pipeline/computePipeline.js +64 -63
- package/core/pipeline/connectAttachmentToShader.js +1 -3
- package/core/pipeline/connectTargetsToShader.js +1 -3
- package/core/pipeline/limitsOverflow.js +1 -2
- package/core/pipeline/pipelineUtils.js +29 -0
- package/core/pipeline/renderPipeline.d.ts +23 -5
- package/core/pipeline/renderPipeline.js +32 -14
- package/core/pipeline/timeable.d.ts +0 -3
- package/core/pipeline/timeable.js +3 -9
- package/core/pipeline/typeGuards.js +1 -3
- package/core/querySet/querySet.d.ts +0 -2
- package/core/querySet/querySet.js +37 -36
- package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +1 -3
- package/core/resolve/externals.d.ts +0 -2
- package/core/resolve/externals.js +2 -4
- package/core/resolve/namespace.js +1 -3
- package/core/resolve/resolveData.js +1 -3
- package/core/resolve/stitch.js +1 -3
- package/core/resolve/tgpuResolve.d.ts +3 -1
- package/core/resolve/tgpuResolve.js +3 -5
- package/core/root/configurableImpl.js +2 -3
- package/core/root/init.d.ts +0 -5
- package/core/root/init.js +35 -28
- package/core/root/rootTypes.d.ts +25 -5
- package/core/sampler/sampler.d.ts +0 -4
- package/core/sampler/sampler.js +3 -3
- package/core/simulate/tgpuSimulate.js +1 -3
- package/core/slot/accessor.d.ts +0 -4
- package/core/slot/accessor.js +1 -3
- package/core/slot/internalSlots.js +1 -3
- package/core/slot/lazy.js +1 -3
- package/core/slot/slot.js +2 -3
- package/core/slot/slotTypes.js +1 -3
- package/core/texture/externalTexture.d.ts +0 -6
- package/core/texture/externalTexture.js +2 -3
- package/core/texture/texture.d.ts +0 -4
- package/core/texture/texture.js +5 -3
- package/core/texture/textureFormats.js +1 -3
- package/core/texture/textureUtils.js +1 -3
- package/core/texture/usageExtension.js +1 -3
- package/core/unroll/tgpuUnroll.d.ts +58 -3
- package/core/unroll/tgpuUnroll.js +63 -5
- package/core/valueProxyUtils.js +1 -3
- package/core/variable/tgpuVariable.js +1 -3
- package/core/vertexLayout/connectAttributesToShader.js +1 -3
- package/core/vertexLayout/vertexLayout.js +9 -9
- package/data/alignIO.js +1 -2
- package/data/alignmentOf.d.ts +0 -1
- package/data/alignmentOf.js +1 -3
- package/data/array.d.ts +1 -3
- package/data/array.js +2 -4
- package/data/atomic.js +2 -3
- package/data/attributes.js +3 -3
- package/data/autoStruct.d.ts +1 -3
- package/data/autoStruct.js +1 -3
- package/data/compiledIO.js +83 -86
- package/data/dataIO.js +46 -39
- package/data/dataTypes.d.ts +7 -7
- package/data/dataTypes.js +6 -3
- package/data/deepEqual.js +1 -3
- package/data/disarray.d.ts +1 -3
- package/data/disarray.js +1 -3
- package/data/getLongestContiguousPrefix.d.ts +0 -1
- package/data/getLongestContiguousPrefix.js +1 -3
- package/data/index.d.ts +3 -3
- package/data/index.js +10 -3
- package/data/isContiguous.d.ts +0 -1
- package/data/isContiguous.js +1 -3
- package/data/matrix.d.ts +8 -10
- package/data/matrix.js +32 -18
- package/data/numberOps.js +1 -2
- package/data/numeric.js +16 -29
- package/data/offsetUtils.d.ts +2 -2
- package/data/offsetUtils.js +3 -5
- package/data/offsets.js +1 -3
- package/data/partialIO.js +84 -39
- package/data/ptr.d.ts +0 -1
- package/data/ptr.js +1 -3
- package/data/ref.d.ts +0 -3
- package/data/ref.js +1 -3
- package/data/sampler.js +1 -3
- package/data/schemaCallWrapper.js +1 -3
- package/data/schemaMemoryLayout.js +1 -3
- package/data/sizeOf.d.ts +0 -1
- package/data/sizeOf.js +1 -3
- package/data/snippet.js +12 -3
- package/data/struct.js +1 -3
- package/data/texture.js +1 -3
- package/data/unstruct.js +1 -3
- package/data/vector.js +4 -12
- package/data/vectorImpl.js +27 -28
- package/data/vectorOps.js +20 -3
- package/data/vertexFormatData.js +2 -3
- package/data/wgslTypes.d.ts +39 -11
- package/data/wgslTypes.js +10 -3
- package/errors.js +6 -3
- package/execMode.js +1 -3
- package/extension.js +1 -3
- package/getGPUValue.js +1 -3
- package/index.d.ts +4 -2
- package/index.js +3 -3
- package/indexNamedExports.d.ts +3 -1
- package/mathUtils.js +1 -2
- package/memo.js +8 -8
- package/nameRegistry.js +1 -3
- package/package.js +2 -3
- package/package.json +7 -7
- package/resolutionCtx.d.ts +0 -10
- package/resolutionCtx.js +84 -18
- package/shared/env.js +1 -2
- package/shared/generators.js +1 -2
- package/shared/meta.js +1 -3
- package/shared/repr.d.ts +32 -2
- package/shared/stringify.js +1 -3
- package/shared/symbols.d.ts +10 -1
- package/shared/symbols.js +10 -33
- package/shared/utilityTypes.d.ts +6 -2
- package/shared/utilityTypes.js +1 -2
- package/shared/vertexFormat.js +1 -2
- package/std/array.d.ts +1 -1
- package/std/array.js +1 -3
- package/std/atomic.d.ts +12 -12
- package/std/atomic.js +1 -3
- package/std/bitcast.d.ts +2 -2
- package/std/bitcast.js +1 -3
- package/std/boolean.d.ts +30 -16
- package/std/boolean.js +37 -12
- package/std/derivative.d.ts +9 -9
- package/std/derivative.js +1 -3
- package/std/discard.d.ts +1 -1
- package/std/discard.js +1 -3
- package/std/extensions.d.ts +1 -3
- package/std/extensions.js +1 -3
- package/std/index.d.ts +5 -4
- package/std/index.js +8 -5
- package/std/matrix.d.ts +5 -5
- package/std/matrix.js +1 -3
- package/std/numeric.d.ts +78 -132
- package/std/numeric.js +1 -3
- package/std/operators.d.ts +16 -8
- package/std/operators.js +80 -6
- package/std/packing.d.ts +4 -4
- package/std/packing.js +1 -3
- package/std/range.d.ts +24 -0
- package/std/range.js +38 -0
- package/std/subgroup.d.ts +21 -21
- package/std/subgroup.js +1 -3
- package/std/texture.d.ts +20 -11
- package/std/texture.js +13 -3
- package/tgpu.js +1 -3
- package/tgpuBindGroupLayout.js +9 -8
- package/tgpuUnstable.js +1 -3
- package/tgsl/accessIndex.js +2 -4
- package/tgsl/accessProp.js +8 -6
- package/tgsl/consoleLog/deserializers.js +1 -3
- package/tgsl/consoleLog/logGenerator.js +2 -4
- package/tgsl/consoleLog/serializers.js +24 -26
- package/tgsl/consoleLog/types.d.ts +0 -2
- package/tgsl/consoleLog/types.js +1 -2
- package/tgsl/conversion.js +1 -3
- package/tgsl/forOfUtils.js +35 -9
- package/tgsl/generationHelpers.js +3 -3
- package/tgsl/math.js +1 -3
- package/tgsl/shaderGenerator.d.ts +10 -8
- package/tgsl/shaderGenerator_members.d.ts +2 -0
- package/tgsl/shaderGenerator_members.js +6 -0
- package/tgsl/shellless.js +1 -8
- package/tgsl/wgslGenerator.d.ts +36 -0
- package/tgsl/wgslGenerator.js +144 -81
- package/types.d.ts +14 -4
- package/types.js +3 -3
- package/wgslExtensions.js +1 -2
package/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { $cast, $gpuCallable, $internal } from "./shared/symbols.js";
|
|
2
2
|
import { MapValueToSnippet, ResolvedSnippet, Snippet } from "./data/snippet.js";
|
|
3
3
|
import { TgpuBufferUsage } from "./core/buffer/bufferUsage.js";
|
|
4
|
+
import { SeparatedEntryArgs } from "./core/function/fnTypes.js";
|
|
4
5
|
import { TgpuComputeFn } from "./core/function/tgpuComputeFn.js";
|
|
5
6
|
import { TgpuVar } from "./core/variable/tgpuVariable.js";
|
|
6
7
|
import { Eventual, SlotValuePair, TgpuAccessor, TgpuSlot } from "./core/slot/slotTypes.js";
|
|
@@ -11,6 +12,7 @@ import { TgpuRenderPipeline } from "./core/pipeline/renderPipeline.js";
|
|
|
11
12
|
import { TgpuSampler } from "./core/sampler/sampler.js";
|
|
12
13
|
import { TgpuExternalTexture } from "./core/texture/externalTexture.js";
|
|
13
14
|
import { TgpuBindGroupLayout, TgpuLayoutEntry } from "./tgpuBindGroupLayout.js";
|
|
15
|
+
import { ShaderGenerator } from "./tgsl/shaderGenerator.js";
|
|
14
16
|
import { TgpuBuffer } from "./core/buffer/buffer.js";
|
|
15
17
|
import { TgpuDeclare } from "./core/declare/tgpuDeclare.js";
|
|
16
18
|
import { TgpuFn } from "./core/function/tgpuFn.js";
|
|
@@ -37,6 +39,11 @@ interface FnToWgslOptions {
|
|
|
37
39
|
body: Block;
|
|
38
40
|
params: FuncParameter[];
|
|
39
41
|
externalMap: Record<string, unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* For entry functions: positional args and optional data struct.
|
|
44
|
+
* When provided, takes precedence over `argTypes` for WGSL header generation.
|
|
45
|
+
*/
|
|
46
|
+
entryInput?: SeparatedEntryArgs | undefined;
|
|
40
47
|
}
|
|
41
48
|
type ItemLayer = {
|
|
42
49
|
type: 'item';
|
|
@@ -152,12 +159,12 @@ declare class CodegenState {
|
|
|
152
159
|
readonly type: "codegen";
|
|
153
160
|
}
|
|
154
161
|
declare class SimulationState {
|
|
162
|
+
readonly type: "simulate";
|
|
155
163
|
readonly buffers: Map<TgpuBuffer<BaseData>, unknown>;
|
|
156
164
|
readonly vars: {
|
|
157
165
|
private: Map<TgpuVar, unknown>;
|
|
158
166
|
workgroup: Map<TgpuVar, unknown>;
|
|
159
167
|
};
|
|
160
|
-
readonly type: "simulate";
|
|
161
168
|
constructor(buffers: Map<TgpuBuffer<BaseData>, unknown>, vars: {
|
|
162
169
|
private: Map<TgpuVar, unknown>;
|
|
163
170
|
workgroup: Map<TgpuVar, unknown>;
|
|
@@ -175,6 +182,7 @@ interface ResolutionCtx {
|
|
|
175
182
|
};
|
|
176
183
|
readonly mode: ExecState;
|
|
177
184
|
readonly enableExtensions: WgslExtension[] | undefined;
|
|
185
|
+
readonly gen: ShaderGenerator;
|
|
178
186
|
addDeclaration(declaration: string): void;
|
|
179
187
|
withResetIndentLevel<T>(callback: () => T): T;
|
|
180
188
|
/**
|
|
@@ -203,10 +211,12 @@ interface ResolutionCtx {
|
|
|
203
211
|
*
|
|
204
212
|
* @param item The value to resolve
|
|
205
213
|
* @param schema Additional information about the item's data type
|
|
206
|
-
* @param exact Should the inferred value of the resulting code be typed exactly as `schema` (true),
|
|
207
|
-
* or is being assignable to `schema` enough (false). Default is false.
|
|
208
214
|
*/
|
|
209
|
-
resolve(item: unknown, schema?: BaseData | UnknownData
|
|
215
|
+
resolve(item: unknown, schema?: BaseData | UnknownData): ResolvedSnippet;
|
|
216
|
+
/**
|
|
217
|
+
* Equivalent to `snip(ctx.resolve(snippet.value, snippet.dataType).value, snippet.dataType, snippet.origin)`.
|
|
218
|
+
*/
|
|
219
|
+
resolveSnippet(snippet: Snippet): ResolvedSnippet;
|
|
210
220
|
fnToWgsl(options: FnToWgslOptions): {
|
|
211
221
|
head: Wgsl;
|
|
212
222
|
body: Wgsl;
|
package/types.js
CHANGED
|
@@ -2,7 +2,6 @@ import { $cast, $gpuCallable, $ownSnippet, $resolve } from "./shared/symbols.js"
|
|
|
2
2
|
import { isWgslData } from "./data/wgslTypes.js";
|
|
3
3
|
import { UnknownData } from "./data/dataTypes.js";
|
|
4
4
|
import { isLazy, isProviding, isSlot } from "./core/slot/slotTypes.js";
|
|
5
|
-
|
|
6
5
|
//#region src/types.ts
|
|
7
6
|
var NormalState = class {
|
|
8
7
|
type = "normal";
|
|
@@ -12,6 +11,8 @@ var CodegenState = class {
|
|
|
12
11
|
};
|
|
13
12
|
var SimulationState = class {
|
|
14
13
|
type = "simulate";
|
|
14
|
+
buffers;
|
|
15
|
+
vars;
|
|
15
16
|
constructor(buffers, vars) {
|
|
16
17
|
this.buffers = buffers;
|
|
17
18
|
this.vars = vars;
|
|
@@ -38,6 +39,5 @@ function isWgsl(value) {
|
|
|
38
39
|
function isGPUBuffer(value) {
|
|
39
40
|
return !!value && typeof value === "object" && "getMappedRange" in value && "mapAsync" in value;
|
|
40
41
|
}
|
|
41
|
-
|
|
42
42
|
//#endregion
|
|
43
|
-
export { CodegenState, NormalState, SimulationState, getOwnSnippet, hasCast, isGPUBuffer, isGPUCallable, isKnownAtComptime, isSelfResolvable, isWgsl };
|
|
43
|
+
export { CodegenState, NormalState, SimulationState, getOwnSnippet, hasCast, isGPUBuffer, isGPUCallable, isKnownAtComptime, isSelfResolvable, isWgsl };
|
package/wgslExtensions.js
CHANGED