GPUDevice


class GPUDevice : AutoCloseable


A logical graphics device.

Summary

Public functions

open external Unit

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

external GPUBindGroup

Creates a new bind group.

external GPUBindGroupLayout

Creates a new bind group layout.

external GPUBuffer

Creates a new buffer.

external GPUCommandEncoder

Creates a new command encoder.

external GPUComputePipeline

Creates a new compute pipeline.

suspend GPUComputePipeline

Asynchronously creates a new compute pipeline.

external Unit
@FastNative
createComputePipelineAsync(
    descriptor: GPUComputePipelineDescriptor,
    callbackExecutor: Executor,
    callback: GPURequestCallback<GPUComputePipeline>
)

Asynchronously creates a new compute pipeline.

external GPUPipelineLayout

Creates a new pipeline layout.

external GPUQuerySet

Creates a new query set.

external GPURenderBundleEncoder

Creates a new render bundle encoder.

external GPURenderPipeline

Creates a new render pipeline.

suspend GPURenderPipeline

Asynchronously creates a new render pipeline.

external Unit
@FastNative
createRenderPipelineAsync(
    descriptor: GPURenderPipelineDescriptor,
    callbackExecutor: Executor,
    callback: GPURequestCallback<GPURenderPipeline>
)

Asynchronously creates a new render pipeline.

external GPUSampler

Creates a new sampler.

external GPUShaderModule

Creates a new shader module.

external GPUTexture

Creates a new texture.

external Unit

Destroys the device and releases its resources.

open operator Boolean
equals(other: Any?)
external GPUAdapterInfo

Retrieves information about the adapter that created this device.

external GPUSupportedFeatures

Retrieves the list of features supported by the device.

external GPULimits

Retrieves the limits supported by the device.

external GPUQueue

Gets the default queue for the device.

external Boolean

Checks if a specific feature is supported by the device.

open Int
suspend Int

Asynchronously pops an error scope from the error scope stack.

external Unit
@FastNative
popErrorScope(
    callbackExecutor: Executor,
    callback: GPURequestCallback<Int>
)

Asynchronously pops an error scope from the error scope stack.

external Unit

Pushes an error scope onto the error scope stack.

external Unit

Sets a human-readable label for debugging.

Public properties

Long
GPUQueue

Public functions

close

Added in 1.0.0-alpha04
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.

createBindGroup

Added in 1.0.0-alpha04
@FastNative
external fun createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup

Creates a new bind group.

Parameters
descriptor: GPUBindGroupDescriptor

The descriptor for the bind group.

Returns
GPUBindGroup

The created bind group.

createBindGroupLayout

Added in 1.0.0-alpha04
@FastNative
external fun createBindGroupLayout(
    descriptor: GPUBindGroupLayoutDescriptor = GPUBindGroupLayoutDescriptor()
): GPUBindGroupLayout

Creates a new bind group layout.

Parameters
descriptor: GPUBindGroupLayoutDescriptor = GPUBindGroupLayoutDescriptor()

The descriptor for the bind group layout.

Returns
GPUBindGroupLayout

The created bind group layout.

createBuffer

Added in 1.0.0-alpha04
@FastNative
external fun createBuffer(descriptor: GPUBufferDescriptor): GPUBuffer

Creates a new buffer.

Parameters
descriptor: GPUBufferDescriptor

The descriptor for the buffer.

Returns
GPUBuffer

The created buffer, or {@code null} on failure.

createCommandEncoder

Added in 1.0.0-alpha04
@FastNative
external fun createCommandEncoder(descriptor: GPUCommandEncoderDescriptor? = null): GPUCommandEncoder

Creates a new command encoder.

Parameters
descriptor: GPUCommandEncoderDescriptor? = null

The descriptor for the command encoder.

Returns
GPUCommandEncoder

The created command encoder.

createComputePipeline

Added in 1.0.0-alpha04
@FastNative
external fun createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline

Creates a new compute pipeline.

Parameters
descriptor: GPUComputePipelineDescriptor

The descriptor for the compute pipeline.

Returns
GPUComputePipeline

The created compute pipeline.

createComputePipelineAndAwait

suspend fun createComputePipelineAndAwait(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline

Asynchronously creates a new compute pipeline.

Parameters
descriptor: GPUComputePipelineDescriptor

The descriptor for the compute pipeline.

createComputePipelineAsync

Added in 1.0.0-alpha04
@FastNative
external fun createComputePipelineAsync(
    descriptor: GPUComputePipelineDescriptor,
    callbackExecutor: Executor,
    callback: GPURequestCallback<GPUComputePipeline>
): Unit

Asynchronously creates a new compute pipeline.

createPipelineLayout

Added in 1.0.0-alpha04
@FastNative
external fun createPipelineLayout(descriptor: GPUPipelineLayoutDescriptor): GPUPipelineLayout

Creates a new pipeline layout.

Parameters
descriptor: GPUPipelineLayoutDescriptor

The descriptor for the pipeline layout.

Returns
GPUPipelineLayout

The created pipeline layout.

createQuerySet

Added in 1.0.0-alpha04
@FastNative
external fun createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet

Creates a new query set.

Parameters
descriptor: GPUQuerySetDescriptor

The descriptor for the query set.

Returns
GPUQuerySet

The created query set.

createRenderBundleEncoder

Added in 1.0.0-alpha04
@FastNative
external fun createRenderBundleEncoder(descriptor: GPURenderBundleEncoderDescriptor): GPURenderBundleEncoder

Creates a new render bundle encoder.

Parameters
descriptor: GPURenderBundleEncoderDescriptor

The descriptor for the render bundle encoder.

Returns
GPURenderBundleEncoder

The created render bundle encoder.

createRenderPipeline

Added in 1.0.0-alpha04
@FastNative
external fun createRenderPipeline(descriptor: GPURenderPipelineDescriptor): GPURenderPipeline

Creates a new render pipeline.

Parameters
descriptor: GPURenderPipelineDescriptor

The descriptor for the render pipeline.

Returns
GPURenderPipeline

The created render pipeline.

createRenderPipelineAndAwait

suspend fun createRenderPipelineAndAwait(descriptor: GPURenderPipelineDescriptor): GPURenderPipeline

Asynchronously creates a new render pipeline.

Parameters
descriptor: GPURenderPipelineDescriptor

The descriptor for the render pipeline.

createRenderPipelineAsync

Added in 1.0.0-alpha04
@FastNative
external fun createRenderPipelineAsync(
    descriptor: GPURenderPipelineDescriptor,
    callbackExecutor: Executor,
    callback: GPURequestCallback<GPURenderPipeline>
): Unit

Asynchronously creates a new render pipeline.

createSampler

Added in 1.0.0-alpha04
@FastNative
external fun createSampler(descriptor: GPUSamplerDescriptor? = null): GPUSampler

Creates a new sampler.

Parameters
descriptor: GPUSamplerDescriptor? = null

The descriptor for the sampler.

Returns
GPUSampler

The created sampler.

createShaderModule

Added in 1.0.0-alpha04
@FastNative
external fun createShaderModule(
    descriptor: GPUShaderModuleDescriptor = GPUShaderModuleDescriptor()
): GPUShaderModule

Creates a new shader module.

Parameters
descriptor: GPUShaderModuleDescriptor = GPUShaderModuleDescriptor()

The descriptor for the shader module.

Returns
GPUShaderModule

The created shader module.

createTexture

Added in 1.0.0-alpha04
@FastNative
external fun createTexture(descriptor: GPUTextureDescriptor): GPUTexture

Creates a new texture.

Parameters
descriptor: GPUTextureDescriptor

The descriptor for the texture.

Returns
GPUTexture

The created texture.

destroy

Added in 1.0.0-alpha04
@FastNative
external fun destroy(): Unit

Destroys the device and releases its resources.

equals

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

getAdapterInfo

Added in 1.0.0-alpha04
@FastNative
external fun getAdapterInfo(): GPUAdapterInfo

Retrieves information about the adapter that created this device.

Returns
GPUAdapterInfo

The status of the operation.

getFeatures

Added in 1.0.0-alpha04
@FastNative
external fun getFeatures(): GPUSupportedFeatures

Retrieves the list of features supported by the device.

getLimits

Added in 1.0.0-alpha04
@FastNative
external fun getLimits(): GPULimits

Retrieves the limits supported by the device.

Returns
GPULimits

The status of the operation.

getQueue

Added in 1.0.0-alpha04
@FastNative
external fun getQueue(): GPUQueue

Gets the default queue for the device.

Returns
GPUQueue

The default queue.

hasFeature

Added in 1.0.0-alpha04
@FastNative
external fun hasFeature(feature: Int): Boolean

Checks if a specific feature is supported by the device.

Parameters
feature: Int

The feature to check for.

Returns
Boolean

{@code true} if the feature is supported, {@code false} otherwise.

hashCode

open fun hashCode(): Int

popErrorScope

suspend fun popErrorScope(): Int

Asynchronously pops an error scope from the error scope stack.

popErrorScope

Added in 1.0.0-alpha04
@FastNative
external fun popErrorScope(
    callbackExecutor: Executor,
    callback: GPURequestCallback<Int>
): Unit

Asynchronously pops an error scope from the error scope stack.

pushErrorScope

Added in 1.0.0-alpha04
@FastNative
external fun pushErrorScope(filter: Int): Unit

Pushes an error scope onto the error scope stack.

Parameters
filter: Int

The filter for the types of errors to capture.

setLabel

Added in 1.0.0-alpha04
@FastNative
external fun setLabel(label: String): Unit

Sets a human-readable label for debugging.

Parameters
label: String

The label string.

Public properties

handle

Added in 1.0.0-alpha04
val handleLong

queue

Added in 1.0.0-alpha04
val queueGPUQueue