GPUCommandEncoder


class GPUCommandEncoder : AutoCloseable


An object used to record GPU commands.

Summary

Public functions

external GPUComputePassEncoder

Begins recording a compute pass.

external GPURenderPassEncoder

Begins recording a render pass.

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

Fills a buffer with zeros.

open external Unit

Decrements the reference count of the object and frees resources when the count reaches zero.

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: GPUTexelCopyBufferInfo,
    destination: GPUTexelCopyTextureInfo,
    copySize: GPUExtent3D
)

Copies data from a buffer to a texture.

external Unit
@FastNative
copyTextureToBuffer(
    source: GPUTexelCopyTextureInfo,
    destination: GPUTexelCopyBufferInfo,
    copySize: GPUExtent3D
)

Copies data from a texture to a buffer.

external Unit
@FastNative
copyTextureToTexture(
    source: GPUTexelCopyTextureInfo,
    destination: GPUTexelCopyTextureInfo,
    copySize: GPUExtent3D
)

Copies data from one texture to another.

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

Finishes recording commands and creates a command buffer.

open Int
external Unit

Inserts a debug marker into the command stream.

external Unit

Pops the current debug group.

external Unit

Pushes a new debug group.

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

Resolves the results of a query set into a buffer.

external Unit

Sets a human-readable label for debugging.

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

Writes a timestamp value into a query set.

Public properties

Long

Public functions

beginComputePass

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

Begins recording a compute pass.

Parameters
descriptor: GPUComputePassDescriptor? = null

The descriptor for the compute pass.

Returns
GPUComputePassEncoder

A compute pass encoder.

beginRenderPass

Added in 1.0.0-alpha04
@FastNative
external fun beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder

Begins recording a render pass.

Parameters
descriptor: GPURenderPassDescriptor

The descriptor for the render pass.

Returns
GPURenderPassEncoder

A render pass encoder.

clearBuffer

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

Fills a buffer with zeros.

Parameters
buffer: GPUBuffer

The buffer to clear.

offset: Long = 0

The offset in the buffer.

size: Long = Constants.WHOLE_SIZE

The number of bytes to clear.

close

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

Decrements the reference count of the object and frees resources when the count reaches zero.

This is the standard way to manage object lifetimes and should be used in use blocks. After calling this, the object is no longer usable.

copyBufferToBuffer

Added in 1.0.0-alpha04
@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 offset in the source buffer.

destination: GPUBuffer

The destination buffer.

destinationOffset: Long

The offset in the destination buffer.

size: Long

The number of bytes to copy.

copyBufferToTexture

Added in 1.0.0-alpha04
@FastNative
external fun copyBufferToTexture(
    source: GPUTexelCopyBufferInfo,
    destination: GPUTexelCopyTextureInfo,
    copySize: GPUExtent3D
): Unit

Copies data from a buffer to a texture.

Parameters
source: GPUTexelCopyBufferInfo

The source buffer information.

destination: GPUTexelCopyTextureInfo

The destination texture information.

copySize: GPUExtent3D

The size of the region to copy.

copyTextureToBuffer

Added in 1.0.0-alpha04
@FastNative
external fun copyTextureToBuffer(
    source: GPUTexelCopyTextureInfo,
    destination: GPUTexelCopyBufferInfo,
    copySize: GPUExtent3D
): Unit

Copies data from a texture to a buffer.

Parameters
source: GPUTexelCopyTextureInfo

The source texture information.

destination: GPUTexelCopyBufferInfo

The destination buffer information.

copySize: GPUExtent3D

The size of the region to copy.

copyTextureToTexture

Added in 1.0.0-alpha04
@FastNative
external fun copyTextureToTexture(
    source: GPUTexelCopyTextureInfo,
    destination: GPUTexelCopyTextureInfo,
    copySize: GPUExtent3D
): Unit

Copies data from one texture to another.

Parameters
source: GPUTexelCopyTextureInfo

The source texture information.

destination: GPUTexelCopyTextureInfo

The destination texture information.

copySize: GPUExtent3D

The size of the region to copy.

equals

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

finish

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

Finishes recording commands and creates a command buffer.

Parameters
descriptor: GPUCommandBufferDescriptor? = null

The descriptor for the command buffer.

Returns
GPUCommandBuffer

The created command buffer.

hashCode

open fun hashCode(): Int

insertDebugMarker

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

Inserts a debug marker into the command stream.

Parameters
markerLabel: String

The label for the debug marker.

popDebugGroup

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

Pops the current debug group.

pushDebugGroup

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

Pushes a new debug group.

Parameters
groupLabel: String

The label for the debug group.

resolveQuerySet

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

Resolves the results of a query set into a buffer.

Parameters
querySet: GPUQuerySet

The query set to resolve.

firstQuery: Int

The index of the first query to resolve.

queryCount: Int

The number of queries to resolve.

destination: GPUBuffer

The destination buffer.

destinationOffset: Long

The offset in the destination buffer.

setLabel

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

Sets a human-readable label for debugging.

Parameters
label: String

The label string.

writeTimestamp

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

Writes a timestamp value into a query set.

Parameters
querySet: GPUQuerySet

The query set to write to.

queryIndex: Int

The index in the query set.

Public properties

handle

Added in 1.0.0-alpha04
val handleLong