Aller au contenu

GPURenderCommandsMixin

GPURenderCommandsMixin defines rendering commands common to GPURenderPassEncoder and GPURenderBundleEncoder. #### Inheritors - [`GPURenderPassEncoder`](../-g-p-u-render-pass-encoder/index.md) - [`GPURenderBundleEncoder`](../-g-p-u-render-bundle-encoder/index.md)

Functions

draw

abstract fun draw(
    vertexCount: GPUSize32, 
    instanceCount: GPUSize32, 
    firstVertex: GPUSize32, 
    firstInstance: GPUSize32
)
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.

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.