TgpuComputePass
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:55
A compute pass recording into a TgpuCommandEncoder.
Dispatch either by binding TypeGPU pipelines to it
(pipeline.with(pass).dispatchWorkgroups(...)), or proxy-style via
pass.setPipeline(pipeline) followed by pass.dispatchWorkgroups(...).
Call end() when done recording.
Properties
Section titled “Properties”[$internal]
Section titled “[$internal]”
readonly[$internal]:ComputePassInternals
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:56
resourceType
Section titled “resourceType”
readonlyresourceType:"compute-pass"
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:57
Methods
Section titled “Methods”dispatchWorkgroups()
Section titled “dispatchWorkgroups()”dispatchWorkgroups(
x,y?,z?):void
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:85
Parameters
Section titled “Parameters”number
number
number
Returns
Section titled “Returns”void
dispatchWorkgroupsIndirect()
Section titled “dispatchWorkgroupsIndirect()”dispatchWorkgroupsIndirect<
T>(indirectBuffer,start?):void
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:95
Dispatches compute workgroups using parameters read from a buffer.
The buffer must contain 3 consecutive u32 values (x, y, z workgroup counts).
To get the correct offset within complex data structures, use d.memoryLayoutOf(...).
Type Parameters
Section titled “Type Parameters”T extends AnyWgslData
Parameters
Section titled “Parameters”indirectBuffer
Section titled “indirectBuffer”Buffer marked with ‘indirect’ usage containing dispatch parameters or raw GPUBuffer
GPUBuffer | TgpuBuffer<T> & IndirectFlag
start?
Section titled “start?”PrimitiveOffsetInfo pointing to the first dispatch parameter. If not provided, starts at offset 0. To obtain safe offsets, use d.memoryLayoutOf(...).
number | PrimitiveOffsetInfo
Returns
Section titled “Returns”void
end():
void
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:101
Completes the recording of this compute pass
Returns
Section titled “Returns”void
setBindGroup()
Section titled “setBindGroup()”Call Signature
Section titled “Call Signature”setBindGroup(
bindGroup):void
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:63
Associates a bind group with the layout it was created from
Parameters
Section titled “Parameters”bindGroup
Section titled “bindGroup”Returns
Section titled “Returns”void
Call Signature
Section titled “Call Signature”setBindGroup<
Entries>(bindGroupLayout,bindGroup):void
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:65
Associates a bind group with the given layout
Type Parameters
Section titled “Type Parameters”Entries
Section titled “Entries”Entries extends Record<string, TgpuLayoutEntry | null>
Parameters
Section titled “Parameters”bindGroupLayout
Section titled “bindGroupLayout”TgpuBindGroupLayout<Entries>
bindGroup
Section titled “bindGroup”GPUBindGroup | TgpuBindGroup<Entries>
Returns
Section titled “Returns”void
setImmediates()
Section titled “setImmediates()”setImmediates<
T>(immediate,value):void
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:80
Provides a value for the given immediate variable, used by subsequent dispatches.
The value is captured (copied) at call time; mutating it afterwards has no
effect until it is set again. Takes precedence over values held by the
pipeline (pipeline.with(immediate, value)) and persists across pipeline
switches until set again, like any other pass-level state.
Passing an ArrayBuffer or typed array skips serialization entirely; the bytes
are copied verbatim and the caller guarantees they match the schema’s layout.
Type Parameters
Section titled “Type Parameters”T extends AnyWgslData
Parameters
Section titled “Parameters”immediate
Section titled “immediate”ArrayBuffer | ArrayBufferView<ArrayBufferLike> | InferInput<T>
Returns
Section titled “Returns”void
setPipeline()
Section titled “setPipeline()”setPipeline(
pipeline):void
Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:60
Sets the current TgpuComputePipeline for subsequent dispatches
Parameters
Section titled “Parameters”pipeline
Section titled “pipeline”Returns
Section titled “Returns”void
© Software Mansion 2026. All trademarks and copyrights belong to their respective owners. Read about our Privacy Policy.