GPUCommandEncoder


class GPUCommandEncoder : AutoCloseable


Used to record a sequence of GPU commands and produce a command buffer.

Summary

Public functions

external GPUComputePassEncoder

Starts recording a compute pass.

external GPURenderPassEncoder

Starts recording a render pass.

external Unit
@FastNative
clearBuffer(buffer: GPUBuffer, offset: Long, size: Long)

Clears a range of a buffer to zero.

open external Unit
external Unit
@FastNative
copyBufferToBuffer(
    source: GPUBuffer,
    sourceOffset: Long,
    destination: GPUBuffer,
    destinationOffset: Long,
    size: Long
)

Copies data from one buffer to another.

external Unit
@FastNative
copyBufferToTexture(
    source: TexelCopyBufferInfo,
    destination: TexelCopyTextureInfo,
    copySize: Extent3D
)

Copies data from a buffer into a texture.

external Unit
@FastNative
copyTextureToBuffer(
    source: TexelCopyTextureInfo,
    destination: TexelCopyBufferInfo,
    copySize: Extent3D
)

Copies data from a texture into a buffer.

external Unit
@FastNative
copyTextureToTexture(
    source: TexelCopyTextureInfo,
    destination: TexelCopyTextureInfo,
    copySize: Extent3D
)

Copies data from one texture to another.

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

Finalizes the recorded commands and creates an immutable command buffer.

open Int
external Unit

Inserts a debug marker command into the command stream.

external Unit

Ends the most recently pushed debug group.

external Unit

Starts a new named debug group.

external Unit
@FastNative
resolveQuerySet(
    querySet: GPUQuerySet,
    firstQuery: Int,
    queryCount: Int,
    destination: GPUBuffer,
    destinationOffset: Long
)

Writes the results of a range of queries into a destination buffer.

external Unit

Sets a debug label for the command encoder.

external Unit
@FastNative
writeTimestamp(querySet: GPUQuerySet, queryIndex: Int)

Writes a GPU timestamp into a query set at the current point in the command stream.

Public properties

Long

Public functions

beginComputePass

Added in 1.0.0-alpha01
@FastNative
external fun beginComputePass(descriptor: ComputePassDescriptor? = null): GPUComputePassEncoder

Starts recording a compute pass.

Parameters
descriptor: ComputePassDescriptor? = null

The descriptor for the compute pass.

Returns
GPUComputePassEncoder

A compute pass encoder for recording compute commands.

beginRenderPass

Added in 1.0.0-alpha01
@FastNative
external fun beginRenderPass(descriptor: RenderPassDescriptor): GPURenderPassEncoder

Starts recording a render pass.

Parameters
descriptor: RenderPassDescriptor

The descriptor for the render pass.

Returns
GPURenderPassEncoder

A render pass encoder for recording rendering commands.

clearBuffer

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

Clears a range of a buffer to zero.

Parameters
buffer: GPUBuffer

The buffer to clear.

offset: Long = 0

The starting offset in bytes to clear from.

size: Long = Constants.WHOLE_SIZE

The size in bytes to clear.

close

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

copyBufferToBuffer

Added in 1.0.0-alpha01
@FastNative
external fun copyBufferToBuffer(
    source: GPUBuffer,
    sourceOffset: Long,
    destination: GPUBuffer,
    destinationOffset: Long,
    size: Long
): Unit

Copies data from one buffer to another.

Parameters
source: GPUBuffer

The source buffer.

sourceOffset: Long

The starting offset in bytes in the source buffer.

destination: GPUBuffer

The destination buffer.

destinationOffset: Long

The starting offset in bytes in the destination buffer.

size: Long

The size in bytes to copy.

copyBufferToTexture

Added in 1.0.0-alpha01
@FastNative
external fun copyBufferToTexture(
    source: TexelCopyBufferInfo,
    destination: TexelCopyTextureInfo,
    copySize: Extent3D
): Unit

Copies data from a buffer into a texture.

Parameters
source: TexelCopyBufferInfo

Information about the source buffer and data layout.

destination: TexelCopyTextureInfo

Information about the destination texture and coordinates.

copySize: Extent3D

The size (width, height, depth/layers) of the region to copy.

copyTextureToBuffer

Added in 1.0.0-alpha01
@FastNative
external fun copyTextureToBuffer(
    source: TexelCopyTextureInfo,
    destination: TexelCopyBufferInfo,
    copySize: Extent3D
): Unit

Copies data from a texture into a buffer.

Parameters
source: TexelCopyTextureInfo

Information about the source texture and coordinates.

destination: TexelCopyBufferInfo

Information about the destination buffer and data layout.

copySize: Extent3D

The size (width, height, depth/layers) of the region to copy.

copyTextureToTexture

Added in 1.0.0-alpha01
@FastNative
external fun copyTextureToTexture(
    source: TexelCopyTextureInfo,
    destination: TexelCopyTextureInfo,
    copySize: Extent3D
): Unit

Copies data from one texture to another.

Parameters
source: TexelCopyTextureInfo

Information about the source texture and coordinates.

destination: TexelCopyTextureInfo

Information about the destination texture and coordinates.

copySize: Extent3D

The size (width, height, depth/layers) of the region to copy.

equals

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

finish

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

Finalizes the recorded commands and creates an immutable command buffer.

Parameters
descriptor: CommandBufferDescriptor? = null

The descriptor for the resulting command buffer.

Returns
GPUCommandBuffer

The generated command buffer.

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 command stream.

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.

resolveQuerySet

Added in 1.0.0-alpha01
@FastNative
external fun resolveQuerySet(
    querySet: GPUQuerySet,
    firstQuery: Int,
    queryCount: Int,
    destination: GPUBuffer,
    destinationOffset: Long
): Unit

Writes the results of a range of queries into a destination buffer.

Parameters
querySet: GPUQuerySet

The query set containing the queries to resolve.

firstQuery: Int

The index of the first query to resolve.

queryCount: Int

The number of queries to resolve.

destination: GPUBuffer

The buffer to write the resolved query results to.

destinationOffset: Long

The offset in the destination buffer to start writing.

setLabel

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

Sets a debug label for the command encoder.

Parameters
label: String

The label to assign to the command encoder.

writeTimestamp

Added in 1.0.0-alpha01
@FastNative
external fun writeTimestamp(querySet: GPUQuerySet, queryIndex: Int): Unit

Writes a GPU timestamp into a query set at the current point in the command stream.

Parameters
querySet: GPUQuerySet

The query set to write the timestamp to.

queryIndex: Int

The index in the query set to write the timestamp to.

Public properties

handle

Added in 1.0.0-alpha01
val handleLong