GPUInstance


class GPUInstance : AutoCloseable


The entry point for the WebGPU API; used for adapter and surface discovery/creation.

Summary

Public functions

open external Unit
external GPUSurface

Creates a surface object representing a drawing target (e.g., a window).

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

Gets the set of WGSL language features supported by the instance.

external Boolean

Checks if a specific WGSL language feature is supported.

open Int
external Unit

Processes all pending WebGPU events, including invoking completed callbacks.

suspend GPUAdapter

Asynchronously requests a suitable GPU adapter.

external Unit
@FastNative
requestAdapter(
    callbackExecutor: Executor,
    options: RequestAdapterOptions?,
    callback: RequestAdapterCallback
)

Asynchronously requests a suitable GPU adapter.

Public properties

Long

Public functions

close

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

createSurface

Added in 1.0.0-alpha01
@FastNative
external fun createSurface(descriptor: SurfaceDescriptor = SurfaceDescriptor()): GPUSurface

Creates a surface object representing a drawing target (e.g., a window).

Parameters
descriptor: SurfaceDescriptor = SurfaceDescriptor()

A descriptor specifying creation options for the surface.

Returns
GPUSurface

The newly created surface.

equals

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

getWGSLLanguageFeatures

Added in 1.0.0-alpha01
@FastNative
external fun getWGSLLanguageFeatures(): SupportedWGSLLanguageFeatures

Gets the set of WGSL language features supported by the instance.

hasWGSLLanguageFeature

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

Checks if a specific WGSL language feature is supported.

Parameters
feature: Int

The WGSL language feature to query.

Returns
Boolean

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

hashCode

open fun hashCode(): Int

processEvents

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

Processes all pending WebGPU events, including invoking completed callbacks.

requestAdapter

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

Asynchronously requests a suitable GPU adapter.

Parameters
options: RequestAdapterOptions? = null

Options for selecting the adapter.

requestAdapter

Added in 1.0.0-alpha01
@FastNative
external fun requestAdapter(
    callbackExecutor: Executor,
    options: RequestAdapterOptions? = null,
    callback: RequestAdapterCallback
): Unit

Asynchronously requests a suitable GPU adapter.

Public properties

handle

Added in 1.0.0-alpha01
val handleLong