GPUDevice


class GPUDevice : AutoCloseable


The primary interface for interacting with the GPU, used to create most resources.

Summary

Public functions

open external Unit
external GPUBindGroup

Creates a new bind group.

external GPUBindGroupLayout

Creates a new bind group layout.

external GPUBuffer

Creates a new GPU buffer.

external GPUCommandEncoder

Creates a new command encoder to record command buffers.

external GPUComputePipeline

Creates a new compute pipeline synchronously.

suspend GPUComputePipeline

Creates a new compute pipeline asynchronously.

external Unit
@FastNative
createComputePipelineAsync(
    descriptor: ComputePipelineDescriptor,
    callbackExecutor: Executor,
    callback: CreateComputePipelineAsyncCallback
)

Creates a new compute pipeline asynchronously.

external GPUPipelineLayout

Creates a new pipeline layout.

external GPUQuerySet

Creates a new query set.

external GPURenderBundleEncoder

Creates a new render bundle encoder to record render bundles.

external GPURenderPipeline

Creates a new render pipeline synchronously.

suspend GPURenderPipeline

Creates a new render pipeline asynchronously.

external Unit
@FastNative
createRenderPipelineAsync(
    descriptor: RenderPipelineDescriptor,
    callbackExecutor: Executor,
    callback: CreateRenderPipelineAsyncCallback
)

Creates a new render pipeline asynchronously.

external GPUSampler

Creates a new sampler.

external GPUShaderModule

Creates a new shader module.

external GPUTexture

Creates a new GPU texture.

external Unit

Destroys the device and frees its resources.

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

Gets information about the adapter that was used to create this device.

external SupportedFeatures

Gets the set of features supported by the device.

external Limits

Gets the limits supported by the device.

external GPUQueue

Gets the queue object for submitting commands to the GPU.

external Boolean

Checks if a specific feature is enabled on the device.

open Int
suspend Int

Pops the current error scope from the stack asynchronously and returns a possible error.

external Unit
@FastNative
popErrorScope(
    callbackExecutor: Executor,
    callback: PopErrorScopeCallback
)

Pops the current error scope from the stack asynchronously and returns a possible error.

external Unit

Pushes a new error scope onto the device's error scope stack.

external Unit

Sets a debug label for the device.

Public properties

Long
GPUQueue

Public functions

close

Added in 1.0.0-alpha01
open external fun close(): Unit

createBindGroup

Added in 1.0.0-alpha01
@FastNative
external fun createBindGroup(descriptor: BindGroupDescriptor): GPUBindGroup

Creates a new bind group.

Parameters
descriptor: BindGroupDescriptor

The descriptor for the bind group.

Returns
GPUBindGroup

The newly created bind group.

createBindGroupLayout

Added in 1.0.0-alpha01
@FastNative
external fun createBindGroupLayout(
    descriptor: BindGroupLayoutDescriptor = BindGroupLayoutDescriptor()
): GPUBindGroupLayout

Creates a new bind group layout.

Parameters
descriptor: BindGroupLayoutDescriptor = BindGroupLayoutDescriptor()

The descriptor for the bind group layout.

Returns
GPUBindGroupLayout

The newly created bind group layout.

createBuffer

Added in 1.0.0-alpha01
@FastNative
external fun createBuffer(descriptor: BufferDescriptor): GPUBuffer

Creates a new GPU buffer.

Parameters
descriptor: BufferDescriptor

The descriptor for the buffer.

Returns
GPUBuffer

The newly created buffer.

createCommandEncoder

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

Creates a new command encoder to record command buffers.

Parameters
descriptor: CommandEncoderDescriptor? = null

The descriptor for the command encoder.

Returns
GPUCommandEncoder

The newly created command encoder.

createComputePipeline

Added in 1.0.0-alpha01
@FastNative
external fun createComputePipeline(descriptor: ComputePipelineDescriptor): GPUComputePipeline

Creates a new compute pipeline synchronously.

Parameters
descriptor: ComputePipelineDescriptor

The descriptor for the compute pipeline.

Returns
GPUComputePipeline

The newly created compute pipeline.

createComputePipelineAndAwait

suspend fun createComputePipelineAndAwait(descriptor: ComputePipelineDescriptor): GPUComputePipeline

Creates a new compute pipeline asynchronously.

Parameters
descriptor: ComputePipelineDescriptor

The descriptor for the compute pipeline.

createComputePipelineAsync

Added in 1.0.0-alpha01
@FastNative
external fun createComputePipelineAsync(
    descriptor: ComputePipelineDescriptor,
    callbackExecutor: Executor,
    callback: CreateComputePipelineAsyncCallback
): Unit

Creates a new compute pipeline asynchronously.

createPipelineLayout

Added in 1.0.0-alpha01
@FastNative
external fun createPipelineLayout(descriptor: PipelineLayoutDescriptor): GPUPipelineLayout

Creates a new pipeline layout.

Parameters
descriptor: PipelineLayoutDescriptor

The descriptor for the pipeline layout.

Returns
GPUPipelineLayout

The newly created pipeline layout.

createQuerySet

Added in 1.0.0-alpha01
@FastNative
external fun createQuerySet(descriptor: QuerySetDescriptor): GPUQuerySet

Creates a new query set.

Parameters
descriptor: QuerySetDescriptor

The descriptor for the query set.

Returns
GPUQuerySet

The newly created query set.

createRenderBundleEncoder

Added in 1.0.0-alpha01
@FastNative
external fun createRenderBundleEncoder(descriptor: RenderBundleEncoderDescriptor): GPURenderBundleEncoder

Creates a new render bundle encoder to record render bundles.

Parameters
descriptor: RenderBundleEncoderDescriptor

The descriptor for the render bundle encoder.

Returns
GPURenderBundleEncoder

The newly created render bundle encoder.

createRenderPipeline

Added in 1.0.0-alpha01
@FastNative
external fun createRenderPipeline(descriptor: RenderPipelineDescriptor): GPURenderPipeline

Creates a new render pipeline synchronously.

Parameters
descriptor: RenderPipelineDescriptor

The descriptor for the render pipeline.

Returns
GPURenderPipeline

The newly created render pipeline.

createRenderPipelineAndAwait

suspend fun createRenderPipelineAndAwait(descriptor: RenderPipelineDescriptor): GPURenderPipeline

Creates a new render pipeline asynchronously.

Parameters
descriptor: RenderPipelineDescriptor

The descriptor for the render pipeline.

createRenderPipelineAsync

Added in 1.0.0-alpha01
@FastNative
external fun createRenderPipelineAsync(
    descriptor: RenderPipelineDescriptor,
    callbackExecutor: Executor,
    callback: CreateRenderPipelineAsyncCallback
): Unit

Creates a new render pipeline asynchronously.

createSampler

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

Creates a new sampler.

Parameters
descriptor: SamplerDescriptor? = null

The descriptor for the sampler.

Returns
GPUSampler

The newly created sampler.

createShaderModule

Added in 1.0.0-alpha01
@FastNative
external fun createShaderModule(
    descriptor: ShaderModuleDescriptor = ShaderModuleDescriptor()
): GPUShaderModule

Creates a new shader module.

Parameters
descriptor: ShaderModuleDescriptor = ShaderModuleDescriptor()

The descriptor for the shader module.

Returns
GPUShaderModule

The newly created shader module.

createTexture

Added in 1.0.0-alpha01
@FastNative
external fun createTexture(descriptor: TextureDescriptor): GPUTexture

Creates a new GPU texture.

Parameters
descriptor: TextureDescriptor

The descriptor for the texture.

Returns
GPUTexture

The newly created texture.

destroy

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

Destroys the device and frees its resources. The device becomes lost.

equals

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

getAdapterInfo

Added in 1.0.0-alpha01
@FastNative
external fun getAdapterInfo(): AdapterInfo

Gets information about the adapter that was used to create this device.

Returns
AdapterInfo

Status code of the operation.

getFeatures

Added in 1.0.0-alpha01
@FastNative
external fun getFeatures(): SupportedFeatures

Gets the set of features supported by the device.

getLimits

Added in 1.0.0-alpha01
@FastNative
external fun getLimits(): Limits

Gets the limits supported by the device.

Returns
Limits

Status code of the operation.

getQueue

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

Gets the queue object for submitting commands to the GPU.

Returns
GPUQueue

The device's queue.

hasFeature

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

Checks if a specific feature is enabled on the device.

Parameters
feature: Int

The feature to check for support.

Returns
Boolean

True if the feature is enabled, {@code false} otherwise.

hashCode

open fun hashCode(): Int

popErrorScope

suspend fun popErrorScope(): Int

Pops the current error scope from the stack asynchronously and returns a possible error.

popErrorScope

Added in 1.0.0-alpha01
@FastNative
external fun popErrorScope(
    callbackExecutor: Executor,
    callback: PopErrorScopeCallback
): Unit

Pops the current error scope from the stack asynchronously and returns a possible error.

pushErrorScope

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

Pushes a new error scope onto the device's error scope stack.

Parameters
filter: Int

The type of errors to filter and capture in the new scope.

setLabel

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

Sets a debug label for the device.

Parameters
label: String

The label to assign to the device.

Public properties

handle

Added in 1.0.0-alpha01
val handleLong

queue

Added in 1.0.0-alpha01
val queueGPUQueue