GPUInstance


public final class GPUInstance implements AutoCloseable


A top-level object representing a WebGPU instance.

Summary

Public methods

external void

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

final external @NonNull GPUSurface

Creates a new surface.

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

Retrieves the list 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 pending asynchronous events and invokes their callbacks.

final @NonNull GPUAdapter

Asynchronously requests a graphics adapter.

final external void
@FastNative
requestAdapter(
    @NonNull Executor callbackExecutor,
    GPURequestAdapterOptions options,
    @NonNull GPURequestCallback<@NonNull GPUAdapter> callback
)

Asynchronously requests a graphics adapter.

Public methods

close

Added in 1.0.0-alpha04
public external void close()

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
public final external @NonNull GPUSurface createSurface(@NonNull GPUSurfaceDescriptor descriptor)

Creates a new surface.

Parameters
@NonNull GPUSurfaceDescriptor descriptor

The descriptor for the surface.

Returns
@NonNull GPUSurface

The created surface.

equals

public boolean equals(Object other)

getHandle

Added in 1.0.0-alpha04
public final long getHandle()

getWGSLLanguageFeatures

Added in 1.0.0-alpha04
@FastNative
public final external @NonNull GPUSupportedWGSLLanguageFeatures getWGSLLanguageFeatures()

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

hasWGSLLanguageFeature

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

Checks if a specific WGSL language feature is supported.

Parameters
int feature

The feature to check for.

Returns
boolean

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

hashCode

public int hashCode()

processEvents

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

Processes pending asynchronous events and invokes their callbacks.

requestAdapter

public final @NonNull GPUAdapter requestAdapter(GPURequestAdapterOptions options)

Asynchronously requests a graphics adapter.

Parameters
GPURequestAdapterOptions options

The options for the adapter request.

requestAdapter

Added in 1.0.0-alpha04
@FastNative
public final external void requestAdapter(
    @NonNull Executor callbackExecutor,
    GPURequestAdapterOptions options,
    @NonNull GPURequestCallback<@NonNull GPUAdapter> callback
)

Asynchronously requests a graphics adapter.