GPURenderBundleEncoder


class GPURenderBundleEncoder : AutoCloseable


Used to record rendering commands into a render bundle.

Summary

Public functions

open external Unit
external Unit
@FastNative
draw(
    vertexCount: Int,
    instanceCount: Int,
    firstVertex: Int,
    firstInstance: Int
)

Draws primitives without an index buffer.

external Unit
@FastNative
drawIndexed(
    indexCount: Int,
    instanceCount: Int,
    firstIndex: Int,
    baseVertex: Int,
    firstInstance: Int
)

Draws primitives using an index buffer.

external Unit
@FastNative
drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: Long)

Draws primitives using an index buffer with arguments from a buffer.

external Unit
@FastNative
drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: Long)

Draws primitives without an index buffer using arguments from a buffer.

open operator Boolean
equals(other: Any?)
external GPURenderBundle

Finalizes the recorded commands and creates an immutable render bundle.

open Int
external Unit

Inserts a debug marker command into the bundle.

external Unit

Ends the most recently pushed debug group.

external Unit

Starts a new named debug group.

external Unit
@FastNative
setBindGroup(
    groupIndex: Int,
    group: GPUBindGroup?,
    dynamicOffsets: IntArray
)

Sets the bind group for a given index.

external Unit
@FastNative
setIndexBuffer(buffer: GPUBuffer, format: Int, offset: Long, size: Long)

Binds an index buffer to be used for indexed drawing.

external Unit

Sets a debug label for the render bundle encoder.

external Unit

Sets the active render pipeline.

external Unit
@FastNative
setVertexBuffer(slot: Int, buffer: GPUBuffer?, offset: Long, size: Long)

Binds a vertex buffer to a specific slot.

Public properties

Long

Public functions

close

Added in 1.0.0-alpha01
open external fun close(): Unit

draw

Added in 1.0.0-alpha01
@FastNative
external fun draw(
    vertexCount: Int,
    instanceCount: Int = 1,
    firstVertex: Int = 0,
    firstInstance: Int = 0
): Unit

Draws primitives without an index buffer.

Parameters
vertexCount: Int

The number of vertices to draw.

instanceCount: Int = 1

The number of instances to draw.

firstVertex: Int = 0

The index of the first vertex to draw.

firstInstance: Int = 0

The index of the first instance to draw.

drawIndexed

Added in 1.0.0-alpha01
@FastNative
external fun drawIndexed(
    indexCount: Int,
    instanceCount: Int = 1,
    firstIndex: Int = 0,
    baseVertex: Int = 0,
    firstInstance: Int = 0
): Unit

Draws primitives using an index buffer.

Parameters
indexCount: Int

The number of indices to use.

instanceCount: Int = 1

The number of instances to draw.

firstIndex: Int = 0

The index of the first element in the index buffer.

baseVertex: Int = 0

A signed integer added to each index value read from the index buffer.

firstInstance: Int = 0

The index of the first instance to draw.

drawIndexedIndirect

Added in 1.0.0-alpha01
@FastNative
external fun drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: Long): Unit

Draws primitives using an index buffer with arguments from a buffer.

Parameters
indirectBuffer: GPUBuffer

The buffer containing the indexed draw arguments.

indirectOffset: Long

The offset in the buffer where indexed draw arguments start.

drawIndirect

Added in 1.0.0-alpha01
@FastNative
external fun drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: Long): Unit

Draws primitives without an index buffer using arguments from a buffer.

Parameters
indirectBuffer: GPUBuffer

The buffer containing the draw arguments.

indirectOffset: Long

The offset in the buffer where draw arguments start.

equals

open operator fun equals(other: Any?): Boolean

finish

Added in 1.0.0-alpha01
@FastNative
external fun finish(descriptor: RenderBundleDescriptor? = null): GPURenderBundle

Finalizes the recorded commands and creates an immutable render bundle.

Parameters
descriptor: RenderBundleDescriptor? = null

The descriptor for the resulting render bundle.

Returns
GPURenderBundle

The generated render bundle.

hashCode

open fun hashCode(): Int

insertDebugMarker

Added in 1.0.0-alpha01
@FastNative
external fun insertDebugMarker(markerLabel: String): Unit

Inserts a debug marker command into the bundle.

Parameters
markerLabel: String

The label for the debug marker.

popDebugGroup

Added in 1.0.0-alpha01
@FastNative
external fun popDebugGroup(): Unit

Ends the most recently pushed debug group.

pushDebugGroup

Added in 1.0.0-alpha01
@FastNative
external fun pushDebugGroup(groupLabel: String): Unit

Starts a new named debug group.

Parameters
groupLabel: String

The label for the debug group.

setBindGroup

Added in 1.0.0-alpha01
@FastNative
external fun setBindGroup(
    groupIndex: Int,
    group: GPUBindGroup? = null,
    dynamicOffsets: IntArray = intArrayOf()
): Unit

Sets the bind group for a given index.

Parameters
groupIndex: Int

The index of the bind group to set.

group: GPUBindGroup? = null

The bind group object to set.

dynamicOffsets: IntArray = intArrayOf()

An array of dynamic offsets for uniform/storage buffers.

setIndexBuffer

Added in 1.0.0-alpha01
@FastNative
external fun setIndexBuffer(
    buffer: GPUBuffer,
    format: Int = IndexFormat.Undefined,
    offset: Long = 0,
    size: Long = Constants.WHOLE_SIZE
): Unit

Binds an index buffer to be used for indexed drawing.

Parameters
buffer: GPUBuffer

The index buffer.

format: Int = IndexFormat.Undefined

The format of the indices in the buffer.

offset: Long = 0

The offset in the buffer to start reading index data.

size: Long = Constants.WHOLE_SIZE

The size of the index buffer range to use.

setLabel

Added in 1.0.0-alpha01
@FastNative
external fun setLabel(label: String): Unit

Sets a debug label for the render bundle encoder.

Parameters
label: String

The label to assign to the render bundle encoder.

setPipeline

Added in 1.0.0-alpha01
@FastNative
external fun setPipeline(pipeline: GPURenderPipeline): Unit

Sets the active render pipeline.

Parameters
pipeline: GPURenderPipeline

The render pipeline to use for subsequent drawing calls.

setVertexBuffer

Added in 1.0.0-alpha01
@FastNative
external fun setVertexBuffer(
    slot: Int,
    buffer: GPUBuffer? = null,
    offset: Long = 0,
    size: Long = Constants.WHOLE_SIZE
): Unit

Binds a vertex buffer to a specific slot.

Parameters
slot: Int

The vertex buffer slot index.

buffer: GPUBuffer? = null

The buffer to bind to the slot.

offset: Long = 0

The offset in the buffer to start reading vertex data.

size: Long = Constants.WHOLE_SIZE

The size of the vertex buffer range to use.

Public properties

handle

Added in 1.0.0-alpha01
val handleLong