# GPUQueue

Artifact: [androidx.webgpu:webgpu](https://developer.android.com/jetpack/androidx/releases/webgpu) [View Source](https://cs.android.com/search?q=file:androidx/webgpu/GPUQueue.kt+class:androidx.webgpu.GPUQueue) Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

*** ** * ** ***


```
public final class GPUQueue implements AutoCloseable
```

<br />

*** ** * ** ***

A queue for submitting command buffers to the GPU.

## Summary

| ### Public methods |
|---|---|
| `external void` | `https://developer.android.com/reference/androidx/webgpu/GPUQueue#close()()` Decrements the reference count of the object and frees resources when the count reaches zero. |
| `boolean` | `https://developer.android.com/reference/androidx/webgpu/GPUQueue#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final long` | `https://developer.android.com/reference/androidx/webgpu/GPUQueue#getHandle()()` |
| `int` | `https://developer.android.com/reference/androidx/webgpu/GPUQueue#hashCode()()` |
| `final void` | `https://developer.android.com/reference/androidx/webgpu/GPUQueue#onSubmittedWorkDone()()` Schedules a callback to be invoked when all previously submitted work is complete. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUQueue#onSubmittedWorkDone(java.util.concurrent.Executor,androidx.webgpu.GPURequestCallback)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html callbackExecutor, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPURequestCallback<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> callback )` Schedules a callback to be invoked when all previously submitted work is complete. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUQueue#setLabel(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html label)` Sets a human-readable label for debugging. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUQueue#submit(kotlin.Array)(@https://developer.android.com/reference/androidx/annotation/NonNull GPUCommandBuffer[] commands)` Submits a list of command buffers to be executed. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUQueue#writeBuffer(androidx.webgpu.GPUBuffer,kotlin.Long,java.nio.ByteBuffer)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUBuffer buffer, long bufferOffset, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/nio/ByteBuffer.html data )` Writes data to a buffer from the CPU. |
| `final external void` | `@https://developer.android.com/reference/dalvik/annotation/optimization/FastNative.html https://developer.android.com/reference/androidx/webgpu/GPUQueue#writeTexture(androidx.webgpu.GPUTexelCopyTextureInfo,java.nio.ByteBuffer,androidx.webgpu.GPUExtent3D,androidx.webgpu.GPUTexelCopyBufferLayout)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUTexelCopyTextureInfo destination, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/nio/ByteBuffer.html data, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUExtent3D writeSize, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUTexelCopyBufferLayout dataLayout )` Writes data to a texture from the CPU. |

## Public methods

### close

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
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.

### equals

```
public boolean equals(Object other)
```

### getHandle

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
public final long getHandle()
```

### hashCode

```
public int hashCode()
```

### onSubmittedWorkDone

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
public final void onSubmittedWorkDone()
```

Schedules a callback to be invoked when all previously submitted work is complete.

### onSubmittedWorkDone

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
public final external void onSubmittedWorkDone(
    @NonNull Executor callbackExecutor,
    @NonNull GPURequestCallback<Unit> callback
)
```

Schedules a callback to be invoked when all previously submitted work is complete.

### setLabel

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
public final external void setLabel(@NonNull String label)
```

Sets a human-readable label for debugging.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html label` | The label string. |

### submit

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
public final external void submit(@NonNull GPUCommandBuffer[] commands)
```

Submits a list of command buffers to be executed.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull GPUCommandBuffer[] commands` | An array of command buffers to submit. |

### writeBuffer

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
public final external void writeBuffer(
    @NonNull GPUBuffer buffer,
    long bufferOffset,
    @NonNull ByteBuffer data
)
```

Writes data to a buffer from the CPU.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUBuffer buffer` | The destination buffer. |
| `long bufferOffset` | The offset in the destination buffer. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/nio/ByteBuffer.html data` | A pointer to the data to write. |

### writeTexture

Added in [1.0.0-alpha06](https://developer.android.com/jetpack/androidx/releases/webgpu#1.0.0-alpha06)

```
@FastNative
public final external void writeTexture(
    @NonNull GPUTexelCopyTextureInfo destination,
    @NonNull ByteBuffer data,
    @NonNull GPUExtent3D writeSize,
    @NonNull GPUTexelCopyBufferLayout dataLayout
)
```

Writes data to a texture from the CPU.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUTexelCopyTextureInfo destination` | The destination texture information. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/nio/ByteBuffer.html data` | A pointer to the data to write. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUExtent3D writeSize` | The size of the region to write. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/webgpu/GPUTexelCopyBufferLayout dataLayout` | The layout of the data in the source buffer. |