# 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)

*** ** * ** ***


```
class GPUQueue : AutoCloseable
```

<br />

*** ** * ** ***

A queue for submitting command buffers to the GPU.

## Summary

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

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/webgpu/GPUQueue#handle()` |

## Public functions

### close

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

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

### equals

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

### hashCode

```
open fun hashCode(): Int
```

### onSubmittedWorkDone

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

```
suspend fun onSubmittedWorkDone(): Unit
```

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
external fun onSubmittedWorkDone(
    callbackExecutor: Executor,
    callback: GPURequestCallback<Unit>
): Unit
```

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
external fun setLabel(label: String): Unit
```

Sets a human-readable label for debugging.

| Parameters |
|---|---|
| `label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The label string. |

### submit

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

```
@FastNative
external fun submit(commands: Array<GPUCommandBuffer> = arrayOf()): Unit
```

Submits a list of command buffers to be executed.

| Parameters |
|---|---|
| `commands: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/webgpu/GPUCommandBuffer> = arrayOf()` | 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
external fun writeBuffer(buffer: GPUBuffer, bufferOffset: Long, data: ByteBuffer): Unit
```

Writes data to a buffer from the CPU.

| Parameters |
|---|---|
| `buffer: https://developer.android.com/reference/kotlin/androidx/webgpu/GPUBuffer` | The destination buffer. |
| `bufferOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The offset in the destination buffer. |
| `data: https://developer.android.com/reference/java/nio/ByteBuffer.html` | 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
external fun writeTexture(
    destination: GPUTexelCopyTextureInfo,
    data: ByteBuffer,
    writeSize: GPUExtent3D,
    dataLayout: GPUTexelCopyBufferLayout = GPUTexelCopyBufferLayout()
): Unit
```

Writes data to a texture from the CPU.

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

## Public properties

### handle

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

```
val handle: Long
```