GPUCommandEncoder


public final class GPUCommandEncoder implements AutoCloseable


An object used to record GPU commands.

Summary

Public methods

final external @NonNull GPUComputePassEncoder

Begins recording a compute pass.

final external @NonNull GPURenderPassEncoder

Begins recording a render pass.

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

Fills a buffer with zeros.

external void

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

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

Copies data from a buffer to a texture.

final external void

Copies data from a texture to a buffer.

final external void

Copies data from one texture to another.

boolean
equals(Object other)
final external @NonNull GPUCommandBuffer

Finishes recording commands and creates a command buffer.

final long
int
final external void

Inserts a debug marker into the command stream.

final external void

Pops the current debug group.

final external void

Pushes a new debug group.

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

Resolves the results of a query set into a buffer.

final external void

Sets a human-readable label for debugging.

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

Writes a timestamp value into a query set.

Public methods

beginComputePass

Added in 1.0.0-alpha04
@FastNative
public final external @NonNull GPUComputePassEncoder beginComputePass(GPUComputePassDescriptor descriptor)

Begins recording a compute pass.

Parameters
GPUComputePassDescriptor descriptor

The descriptor for the compute pass.

Returns
@NonNull GPUComputePassEncoder

A compute pass encoder.

beginRenderPass

Added in 1.0.0-alpha04
@FastNative
public final external @NonNull GPURenderPassEncoder beginRenderPass(@NonNull GPURenderPassDescriptor descriptor)

Begins recording a render pass.

Parameters
@NonNull GPURenderPassDescriptor descriptor

The descriptor for the render pass.

Returns
@NonNull GPURenderPassEncoder

A render pass encoder.

clearBuffer

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

Fills a buffer with zeros.

Parameters
@NonNull GPUBuffer buffer

The buffer to clear.

long offset

The offset in the buffer.

long size

The number of bytes to clear.

close

Added in 1.0.0-alpha04
public external void close()

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
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 offset in the source buffer.

@NonNull GPUBuffer destination

The destination buffer.

long destinationOffset

The offset in the destination buffer.

long size

The number of bytes to copy.

copyBufferToTexture

Added in 1.0.0-alpha04
@FastNative
public final external void copyBufferToTexture(
    @NonNull GPUTexelCopyBufferInfo source,
    @NonNull GPUTexelCopyTextureInfo destination,
    @NonNull GPUExtent3D copySize
)

Copies data from a buffer to a texture.

Parameters
@NonNull GPUTexelCopyBufferInfo source

The source buffer information.

@NonNull GPUTexelCopyTextureInfo destination

The destination texture information.

@NonNull GPUExtent3D copySize

The size of the region to copy.

copyTextureToBuffer

Added in 1.0.0-alpha04
@FastNative
public final external void copyTextureToBuffer(
    @NonNull GPUTexelCopyTextureInfo source,
    @NonNull GPUTexelCopyBufferInfo destination,
    @NonNull GPUExtent3D copySize
)

Copies data from a texture to a buffer.

Parameters
@NonNull GPUTexelCopyTextureInfo source

The source texture information.

@NonNull GPUTexelCopyBufferInfo destination

The destination buffer information.

@NonNull GPUExtent3D copySize

The size of the region to copy.

copyTextureToTexture

Added in 1.0.0-alpha04
@FastNative
public final external void copyTextureToTexture(
    @NonNull GPUTexelCopyTextureInfo source,
    @NonNull GPUTexelCopyTextureInfo destination,
    @NonNull GPUExtent3D copySize
)

Copies data from one texture to another.

Parameters
@NonNull GPUTexelCopyTextureInfo source

The source texture information.

@NonNull GPUTexelCopyTextureInfo destination

The destination texture information.

@NonNull GPUExtent3D copySize

The size of the region to copy.

equals

public boolean equals(Object other)

finish

Added in 1.0.0-alpha04
@FastNative
public final external @NonNull GPUCommandBuffer finish(GPUCommandBufferDescriptor descriptor)

Finishes recording commands and creates a command buffer.

Parameters
GPUCommandBufferDescriptor descriptor

The descriptor for the command buffer.

Returns
@NonNull GPUCommandBuffer

The created command buffer.

getHandle

Added in 1.0.0-alpha04
public final long getHandle()

hashCode

public int hashCode()

insertDebugMarker

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

Inserts a debug marker into the command stream.

Parameters
@NonNull String markerLabel

The label for the debug marker.

popDebugGroup

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

Pops the current debug group.

pushDebugGroup

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

Pushes a new debug group.

Parameters
@NonNull String groupLabel

The label for the debug group.

resolveQuerySet

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

Resolves the results of a query set into a buffer.

Parameters
@NonNull GPUQuerySet querySet

The query set to resolve.

int firstQuery

The index of the first query to resolve.

int queryCount

The number of queries to resolve.

@NonNull GPUBuffer destination

The destination buffer.

long destinationOffset

The offset in the destination buffer.

setLabel

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

Sets a human-readable label for debugging.

Parameters
@NonNull String label

The label string.

writeTimestamp

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

Writes a timestamp value into a query set.

Parameters
@NonNull GPUQuerySet querySet

The query set to write to.

int queryIndex

The index in the query set.