Skip to content

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.

readonly [$internal]: ComputePassInternals

Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:56


readonly resourceType: "compute-pass"

Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:57

dispatchWorkgroups(x, y?, z?): void

Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:85

number

number

number

void


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(...).

T extends AnyWgslData

Buffer marked with ‘indirect’ usage containing dispatch parameters or raw GPUBuffer

GPUBuffer | TgpuBuffer<T> & IndirectFlag

PrimitiveOffsetInfo pointing to the first dispatch parameter. If not provided, starts at offset 0. To obtain safe offsets, use d.memoryLayoutOf(...).

number | PrimitiveOffsetInfo

void


end(): void

Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:101

Completes the recording of this compute pass

void


setBindGroup(bindGroup): void

Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:63

Associates a bind group with the layout it was created from

TgpuBindGroup

void

setBindGroup<Entries>(bindGroupLayout, bindGroup): void

Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:65

Associates a bind group with the given layout

Entries extends Record<string, TgpuLayoutEntry | null>

TgpuBindGroupLayout<Entries>

GPUBindGroup | TgpuBindGroup<Entries>

void


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.

T extends AnyWgslData

TgpuImmediateVar<T>

ArrayBuffer | ArrayBufferView<ArrayBufferLike> | InferInput<T>

void


setPipeline(pipeline): void

Defined in: packages/typegpu/src/core/commandEncoder/computePass.ts:60

Sets the current TgpuComputePipeline for subsequent dispatches

TgpuComputePipeline

void

© Software Mansion 2026. All trademarks and copyrights belong to their respective owners. Read about our Privacy Policy.