Aller au contenu

GPUCommandEncoder

Encodes render, compute, and copy commands into a command buffer.

Properties

label

abstract var label: String
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

beginComputePass

Begins encoding a compute pass described by descriptor.

beginRenderPass

Begins encoding a render pass described by descriptor. **Parameters** - descriptor: Description of the GPURenderPassEncoder to create.

clearBuffer

abstract fun clearBuffer(
    buffer: GPUBuffer, 
    offset: GPUSize64, 
    size: GPUSize64? = null
)
Encode a command into the GPUCommandEncoder that fills a sub-region of a GPUBuffer with zeros. **Parameters** - buffer: The GPUBuffer to clear. - offset: Offset in bytes into buffer where the sub-region to clear begins. - size: Size in bytes of the sub-region to clear. Defaults to the size of the buffer minus offset.

close

expect abstract fun close()

copyBufferToBuffer

abstract fun copyBufferToBuffer(
    source: GPUBuffer, 
    sourceOffset: GPUSize64, 
    destination: GPUBuffer, 
    destinationOffset: GPUSize64, 
    size: GPUSize64? = null
)
Encode a command into the GPUCommandEncoder that copies data from a sub-region of a GPUBuffer to a sub-region of another GPUBuffer. **Parameters** - source: The GPUBuffer to copy from. - sourceOffset: Offset in bytes into source to begin copying from. - destination: The GPUBuffer to copy to. - destinationOffset: Offset in bytes into destination to place the copied data. - size: Bytes to copy.

copyBufferToTexture

abstract fun copyBufferToTexture(
    source: GPUTexelCopyBufferInfo, 
    destination: GPUTexelCopyTextureInfo, 
    copySize: GPUExtent3D
)
Encode a command into the GPUCommandEncoder that copies data from a sub-region of a GPUBuffer to a sub-region of one or multiple continuous texture subresources. **Parameters** - source: Combined with copySize, defines the region of the source buffer. - destination: Combined with copySize, defines the region of the destination texture subresource.

copyTextureToBuffer

abstract fun copyTextureToBuffer(
    source: GPUTexelCopyTextureInfo, 
    destination: GPUTexelCopyBufferInfo, 
    copySize: GPUExtent3D
)
Encode a command into the GPUCommandEncoder that copies data from a sub-region of one or multiple continuous texture subresources to a sub-region of a GPUBuffer. **Parameters** - source: Combined with copySize, defines the region of the source texture subresources. - destination: Combined with copySize, defines the region of the destination buffer.

copyTextureToTexture

abstract fun copyTextureToTexture(
    source: GPUTexelCopyTextureInfo, 
    destination: GPUTexelCopyTextureInfo, 
    copySize: GPUExtent3D
)
Encode a command into the GPUCommandEncoder that copies data from a sub-region of one or multiple contiguous texture subresources to another sub-region of one or multiple continuous texture subresources. **Parameters** - source: Combined with copySize, defines the region of the source texture subresources. - destination: Combined with copySize, defines the region of the destination texture subresources.

finish

abstract fun finish(descriptor: GPUCommandBufferDescriptor? = null): GPUCommandBuffer
Completes recording of the commands sequence and returns a corresponding GPUCommandBuffer.

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.

resolveQuerySet

abstract fun resolveQuerySet(
    querySet: GPUQuerySet, 
    firstQuery: GPUSize32, 
    queryCount: GPUSize32, 
    destination: GPUBuffer, 
    destinationOffset: GPUSize64
)
Resolves query results from a GPUQuerySet out into a range of a GPUBuffer.