Skip to content

GPUComputePassEncoder

Encodes compute dispatches and related commands in a compute pass.

Properties

label

abstract var label: String
A developer-provided label which is used in an implementation-defined way. It can be used by the browser, OS, or other tools to help identify the underlying internal object to the developer. Examples include displaying the label in GPUError messages, console warnings, browser developer tools, and platform debugging utilities.

Functions

dispatchWorkgroups

abstract fun dispatchWorkgroups(
    workgroupCountX: GPUSize32, 
    workgroupCountY: GPUSize32, 
    workgroupCountZ: GPUSize32
)
Dispatch work to be performed with the current GPUComputePipeline. See § 23.1 Computing for the detailed specification. **Parameters** - workgroupCountX: X dimension of the grid of workgroups to dispatch. - workgroupCountY: Y dimension of the grid of workgroups to dispatch. - workgroupCountZ: Z dimension of the grid of workgroups to dispatch.

dispatchWorkgroupsIndirect

abstract fun dispatchWorkgroupsIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64)
Dispatch work to be performed with the current GPUComputePipeline using parameters read from a GPUBuffer. See § 23.1 Computing for the detailed specification. The indirect dispatch parameters encoded in the buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatchWorkgroups(). **Parameters** - indirectBuffer: Buffer containing the indirect dispatch parameters. - indirectOffset: Offset in bytes into indirectBuffer where the dispatch data begins.

end

abstract fun end()
Completes recording of the compute pass commands sequence.

insertDebugMarker

abstract fun insertDebugMarker(markerLabel: String)
Marks a point in a stream of commands with a label. **Parameters** - markerLabel: The label to insert.

popDebugGroup

abstract fun popDebugGroup()
Ends the labeled debug group most recently started by pushDebugGroup().

pushDebugGroup

abstract fun pushDebugGroup(groupLabel: String)
Begins a labeled debug group containing subsequent commands. **Parameters** - groupLabel: The label for the command group.

setBindGroup

abstract fun setBindGroup(
    index: GPUIndex32, 
    bindGroup: GPUBindGroup?, 
    dynamicOffsetsData: List<UInt> = emptyList()
)
Sets the current GPUBindGroup for the given index. See [GPUBindingCommandsMixin.setBindGroup(index, bindGroup, dynamicOffsetsData) in the WebGPU specification](https://www.w3.org/TR/webgpu/#dom-gpubindingcommandsmixin-setbindgroup).

setImmediates

abstract fun setImmediates(
    rangeOffset: GPUSize32, 
    data: ArrayBuffer, 
    dataOffset: GPUSize64, 
    dataSize: GPUSize64? = null
)
Sets immediate data for subsequent render or compute commands. **Parameters** - rangeOffset: Offset in bytes into the immediate data range to begin writing at. - data: Data to write into the immediate data range. - dataOffset: Offset into data to begin writing from. Given in elements if data is a TypedArray and bytes otherwise. - dataSize: Size of content to write from data. Given in elements if data is a TypedArray and bytes otherwise.

setPipeline

abstract fun setPipeline(pipeline: GPUComputePipeline)
Sets the current GPUComputePipeline. **Parameters** - pipeline: The compute pipeline to use for subsequent dispatch commands.