GPUInstance


public final class GPUInstance implements AutoCloseable


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

Summary

Public methods

external void
final external @NonNull GPUSurface

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

boolean
equals(Object other)
final long
final external @NonNull SupportedWGSLLanguageFeatures

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

final external boolean

Checks if a specific WGSL language feature is supported.

int
final external void

Processes all pending WebGPU events, including invoking completed callbacks.

final @NonNull GPUAdapter

Asynchronously requests a suitable GPU adapter.

final external void
@FastNative
requestAdapter(
    @NonNull Executor callbackExecutor,
    RequestAdapterOptions options,
    @NonNull RequestAdapterCallback callback
)

Asynchronously requests a suitable GPU adapter.

Public methods

close

Added in 1.0.0-alpha01
public external void close()

createSurface

Added in 1.0.0-alpha01
@FastNative
public final external @NonNull GPUSurface createSurface(@NonNull SurfaceDescriptor descriptor)

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

Parameters
@NonNull SurfaceDescriptor descriptor

A descriptor specifying creation options for the surface.

Returns
@NonNull GPUSurface

The newly created surface.

equals

public boolean equals(Object other)

getHandle

Added in 1.0.0-alpha01
public final long getHandle()

getWGSLLanguageFeatures

Added in 1.0.0-alpha01
@FastNative
public final external @NonNull SupportedWGSLLanguageFeatures getWGSLLanguageFeatures()

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

hasWGSLLanguageFeature

Added in 1.0.0-alpha01
@FastNative
public final external boolean hasWGSLLanguageFeature(int feature)

Checks if a specific WGSL language feature is supported.

Parameters
int feature

The WGSL language feature to query.

Returns
boolean

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

hashCode

public int hashCode()

processEvents

Added in 1.0.0-alpha01
@FastNative
public final external void processEvents()

Processes all pending WebGPU events, including invoking completed callbacks.

requestAdapter

public final @NonNull GPUAdapter requestAdapter(RequestAdapterOptions options)

Asynchronously requests a suitable GPU adapter.

Parameters
RequestAdapterOptions options

Options for selecting the adapter.

requestAdapter

Added in 1.0.0-alpha01
@FastNative
public final external void requestAdapter(
    @NonNull Executor callbackExecutor,
    RequestAdapterOptions options,
    @NonNull RequestAdapterCallback callback
)

Asynchronously requests a suitable GPU adapter.