GPUInstance


class GPUInstance : AutoCloseable


A top-level object representing a WebGPU instance.

Summary

Public functions

open external Unit

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

external GPUSurface

Creates a new surface.

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

Retrieves the list of WGSL language features supported by the instance.

external Boolean

Checks if a specific WGSL language feature is supported.

open Int
external Unit

Processes pending asynchronous events and invokes their callbacks.

suspend GPUAdapter

Asynchronously requests a graphics adapter.

external Unit
@FastNative
requestAdapter(
    callbackExecutor: Executor,
    options: GPURequestAdapterOptions?,
    callback: GPURequestCallback<GPUAdapter>
)

Asynchronously requests a graphics adapter.

Public properties

Long

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.

createSurface

Added in 1.0.0-alpha04
@FastNative
external fun createSurface(descriptor: GPUSurfaceDescriptor = GPUSurfaceDescriptor()): GPUSurface

Creates a new surface.

Parameters
descriptor: GPUSurfaceDescriptor = GPUSurfaceDescriptor()

The descriptor for the surface.

Returns
GPUSurface

The created surface.

equals

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

getWGSLLanguageFeatures

Added in 1.0.0-alpha04
@FastNative
external fun getWGSLLanguageFeatures(): GPUSupportedWGSLLanguageFeatures

Retrieves the list of WGSL language features supported by the instance.

hasWGSLLanguageFeature

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

Checks if a specific WGSL language feature is supported.

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

processEvents

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

Processes pending asynchronous events and invokes their callbacks.

requestAdapter

suspend fun requestAdapter(options: GPURequestAdapterOptions? = null): GPUAdapter

Asynchronously requests a graphics adapter.

Parameters
options: GPURequestAdapterOptions? = null

The options for the adapter request.

requestAdapter

Added in 1.0.0-alpha04
@FastNative
external fun requestAdapter(
    callbackExecutor: Executor,
    options: GPURequestAdapterOptions? = null,
    callback: GPURequestCallback<GPUAdapter>
): Unit

Asynchronously requests a graphics adapter.

Public properties

handle

Added in 1.0.0-alpha04
val handleLong