GPURenderBundleEncoder¶
Encodes render commands into a GPURenderBundle.
See [GPURenderBundleEncoder in the WebGPU specification](https://www.w3.org/TR/webgpu/#gpurenderbundleencoder).
Properties¶
label¶
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¶
close¶
expect abstract fun close()
draw¶
Draws primitives. See § 23.2 Rendering for the detailed specification.
**Parameters**
- vertexCount: The number of vertices to draw.
- instanceCount: The number of instances to draw.
- firstVertex: Offset into the vertex buffers, in vertices, to begin drawing from.
- firstInstance: First instance to draw.
drawIndexed¶
abstract fun drawIndexed(
indexCount: GPUSize32,
instanceCount: GPUSize32,
firstIndex: GPUSize32,
baseVertex: GPUSignedOffset32 = 0,
firstInstance: GPUSize32
)
Draws indexed primitives. See § 23.2 Rendering for the detailed specification.
**Parameters**
- indexCount: The number of indices to draw.
- instanceCount: The number of instances to draw.
- firstIndex: Offset into the index buffer, in indices, begin drawing from.
- baseVertex: Added to each index value before indexing into the vertex buffers.
- firstInstance: First instance to draw.
drawIndexedIndirect¶
abstract fun drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64)
Draws indexed primitives using parameters read from a GPUBuffer. See § 23.2 Rendering for the detailed specification. The indirect drawIndexed parameters encoded in the buffer must be a tightly packed block of five 32-bit values (20 bytes total), given in the same order as the arguments for drawIndexed(). The value corresponding to baseVertex is a signed 32-bit integer, and all others are unsigned 32-bit integers.
**Parameters**
- indirectBuffer: Buffer containing the indirect drawIndexed parameters.
- indirectOffset: Offset in bytes into indirectBuffer where the drawing data begins.
drawIndirect¶
abstract fun drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64)
Draws primitives using parameters read from a GPUBuffer. See § 23.2 Rendering for the detailed specification. The indirect draw parameters encoded in the buffer must be a tightly packed block of four 32-bit unsigned integer values (16 bytes total), given in the same order as the arguments for draw().
**Parameters**
- indirectBuffer: Buffer containing the indirect draw parameters.
- indirectOffset: Offset in bytes into indirectBuffer where the drawing data begins.
finish¶
abstract fun finish(descriptor: GPURenderBundleDescriptor? = null): GPURenderBundle
Completes recording of the render bundle 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.
setIndexBuffer¶
abstract fun setIndexBuffer(
buffer: GPUBuffer,
indexFormat: GPUIndexFormat,
offset: GPUSize64,
size: GPUSize64? = null
)
Sets the current index buffer.
**Parameters**
- buffer: Buffer containing index data to use for subsequent drawing commands.
- indexFormat: Format of the index data contained in buffer.
- offset: Offset in bytes into buffer where the index data begins. Defaults to 0.
- size: Size in bytes of the index data in buffer. Defaults to the size of the buffer minus the offset.
setPipeline¶
abstract fun setPipeline(pipeline: GPURenderPipeline)
Sets the current GPURenderPipeline.
**Parameters**
- pipeline: The render pipeline to use for subsequent drawing commands.
setVertexBuffer¶
abstract fun setVertexBuffer(
slot: GPUIndex32,
buffer: GPUBuffer?,
offset: GPUSize64,
size: GPUSize64? = null
)
Sets the current vertex buffer for the given slot.
**Parameters**
- slot: The vertex buffer slot to set the vertex buffer for.
- buffer: Buffer containing vertex data to use for subsequent drawing commands.
- offset: Offset in bytes into buffer where the vertex data begins. Defaults to 0.
- size: Size in bytes of the vertex data in buffer. Defaults to the size of the buffer minus the offset.