GPUCommandEncoder


public final class GPUCommandEncoder implements AutoCloseable


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

Summary

Public methods

final external @NonNull GPUComputePassEncoder

Starts recording a compute pass.

final external @NonNull GPURenderPassEncoder

Starts recording a render pass.

final external void
@FastNative
clearBuffer(@NonNull GPUBuffer buffer, long offset, long size)

Clears a range of a buffer to zero.

external void
final external void
@FastNative
copyBufferToBuffer(
    @NonNull GPUBuffer source,
    long sourceOffset,
    @NonNull GPUBuffer destination,
    long destinationOffset,
    long size
)

Copies data from one buffer to another.

final external void
@FastNative
copyBufferToTexture(
    @NonNull TexelCopyBufferInfo source,
    @NonNull TexelCopyTextureInfo destination,
    @NonNull Extent3D copySize
)

Copies data from a buffer into a texture.

final external void
@FastNative
copyTextureToBuffer(
    @NonNull TexelCopyTextureInfo source,
    @NonNull TexelCopyBufferInfo destination,
    @NonNull Extent3D copySize
)

Copies data from a texture into a buffer.

final external void
@FastNative
copyTextureToTexture(
    @NonNull TexelCopyTextureInfo source,
    @NonNull TexelCopyTextureInfo destination,
    @NonNull Extent3D copySize
)

Copies data from one texture to another.

boolean
equals(Object other)
final external @NonNull GPUCommandBuffer

Finalizes the recorded commands and creates an immutable command buffer.

final long
int
final external void

Inserts a debug marker command into the command stream.

final external void

Ends the most recently pushed debug group.

final external void

Starts a new named debug group.

final external void
@FastNative
resolveQuerySet(
    @NonNull GPUQuerySet querySet,
    int firstQuery,
    int queryCount,
    @NonNull GPUBuffer destination,
    long destinationOffset
)

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

final external void

Sets a debug label for the command encoder.

final external void
@FastNative
writeTimestamp(@NonNull GPUQuerySet querySet, int queryIndex)

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

Public methods

beginComputePass

Added in 1.0.0-alpha01
@FastNative
public final external @NonNull GPUComputePassEncoder beginComputePass(ComputePassDescriptor descriptor)

Starts recording a compute pass.

Parameters
ComputePassDescriptor descriptor

The descriptor for the compute pass.

Returns
@NonNull GPUComputePassEncoder

A compute pass encoder for recording compute commands.

beginRenderPass

Added in 1.0.0-alpha01
@FastNative
public final external @NonNull GPURenderPassEncoder beginRenderPass(@NonNull RenderPassDescriptor descriptor)

Starts recording a render pass.

Parameters
@NonNull RenderPassDescriptor descriptor

The descriptor for the render pass.

Returns
@NonNull GPURenderPassEncoder

A render pass encoder for recording rendering commands.

clearBuffer

Added in 1.0.0-alpha01
@FastNative
public final external void clearBuffer(@NonNull GPUBuffer buffer, long offset, long size)

Clears a range of a buffer to zero.

Parameters
@NonNull GPUBuffer buffer

The buffer to clear.

long offset

The starting offset in bytes to clear from.

long size

The size in bytes to clear.

close

Added in 1.0.0-alpha01
public external void close()

copyBufferToBuffer

Added in 1.0.0-alpha01
@FastNative
public final external void copyBufferToBuffer(
    @NonNull GPUBuffer source,
    long sourceOffset,
    @NonNull GPUBuffer destination,
    long destinationOffset,
    long size
)

Copies data from one buffer to another.

Parameters
@NonNull GPUBuffer source

The source buffer.

long sourceOffset

The starting offset in bytes in the source buffer.

@NonNull GPUBuffer destination

The destination buffer.

long destinationOffset

The starting offset in bytes in the destination buffer.

long size

The size in bytes to copy.

copyBufferToTexture

Added in 1.0.0-alpha01
@FastNative
public final external void copyBufferToTexture(
    @NonNull TexelCopyBufferInfo source,
    @NonNull TexelCopyTextureInfo destination,
    @NonNull Extent3D copySize
)

Copies data from a buffer into a texture.

Parameters
@NonNull TexelCopyBufferInfo source

Information about the source buffer and data layout.

@NonNull TexelCopyTextureInfo destination

Information about the destination texture and coordinates.

@NonNull Extent3D copySize

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

copyTextureToBuffer

Added in 1.0.0-alpha01
@FastNative
public final external void copyTextureToBuffer(
    @NonNull TexelCopyTextureInfo source,
    @NonNull TexelCopyBufferInfo destination,
    @NonNull Extent3D copySize
)

Copies data from a texture into a buffer.

Parameters
@NonNull TexelCopyTextureInfo source

Information about the source texture and coordinates.

@NonNull TexelCopyBufferInfo destination

Information about the destination buffer and data layout.

@NonNull Extent3D copySize

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

copyTextureToTexture

Added in 1.0.0-alpha01
@FastNative
public final external void copyTextureToTexture(
    @NonNull TexelCopyTextureInfo source,
    @NonNull TexelCopyTextureInfo destination,
    @NonNull Extent3D copySize
)

Copies data from one texture to another.

Parameters
@NonNull TexelCopyTextureInfo source

Information about the source texture and coordinates.

@NonNull TexelCopyTextureInfo destination

Information about the destination texture and coordinates.

@NonNull Extent3D copySize

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

equals

public boolean equals(Object other)

finish

Added in 1.0.0-alpha01
@FastNative
public final external @NonNull GPUCommandBuffer finish(CommandBufferDescriptor descriptor)

Finalizes the recorded commands and creates an immutable command buffer.

Parameters
CommandBufferDescriptor descriptor

The descriptor for the resulting command buffer.

Returns
@NonNull GPUCommandBuffer

The generated command buffer.

getHandle

Added in 1.0.0-alpha01
public final long getHandle()

hashCode

public int hashCode()

insertDebugMarker

Added in 1.0.0-alpha01
@FastNative
public final external void insertDebugMarker(@NonNull String markerLabel)

Inserts a debug marker command into the command stream.

Parameters
@NonNull String markerLabel

The label for the debug marker.

popDebugGroup

Added in 1.0.0-alpha01
@FastNative
public final external void popDebugGroup()

Ends the most recently pushed debug group.

pushDebugGroup

Added in 1.0.0-alpha01
@FastNative
public final external void pushDebugGroup(@NonNull String groupLabel)

Starts a new named debug group.

Parameters
@NonNull String groupLabel

The label for the debug group.

resolveQuerySet

Added in 1.0.0-alpha01
@FastNative
public final external void resolveQuerySet(
    @NonNull GPUQuerySet querySet,
    int firstQuery,
    int queryCount,
    @NonNull GPUBuffer destination,
    long destinationOffset
)

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

Parameters
@NonNull GPUQuerySet querySet

The query set containing the queries to resolve.

int firstQuery

The index of the first query to resolve.

int queryCount

The number of queries to resolve.

@NonNull GPUBuffer destination

The buffer to write the resolved query results to.

long destinationOffset

The offset in the destination buffer to start writing.

setLabel

Added in 1.0.0-alpha01
@FastNative
public final external void setLabel(@NonNull String label)

Sets a debug label for the command encoder.

Parameters
@NonNull String label

The label to assign to the command encoder.

writeTimestamp

Added in 1.0.0-alpha01
@FastNative
public final external void writeTimestamp(@NonNull GPUQuerySet querySet, int queryIndex)

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

Parameters
@NonNull GPUQuerySet querySet

The query set to write the timestamp to.

int queryIndex

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