GPUInstance
public final class GPUInstance implements AutoCloseable
A top-level object representing a WebGPU instance.
Summary
Public methods |
|
|---|---|
external void |
close()Decrements the reference count of the object and frees resources when the count reaches zero. |
final external @NonNull GPUSurface |
@FastNativeCreates a new surface. |
boolean |
|
final long |
|
final external @NonNull GPUSupportedWGSLLanguageFeatures |
Retrieves the list of WGSL language features supported by the instance. |
final external boolean |
@FastNativeChecks if a specific WGSL language feature is supported. |
int |
hashCode() |
final external void |
Processes pending asynchronous events and invokes their callbacks. |
final @NonNull GPUAdapter |
requestAdapter(GPURequestAdapterOptions options)Asynchronously requests a graphics adapter. |
final external void |
@FastNativeAsynchronously requests a graphics adapter. |
Public methods
close
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
@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. |
getWGSLLanguageFeatures
@FastNative
public final external @NonNull GPUSupportedWGSLLanguageFeatures getWGSLLanguageFeatures()
Retrieves the list of WGSL language features supported by the instance.
hasWGSLLanguageFeature
@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. |
processEvents
@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
@FastNative
public final external void requestAdapter(
@NonNull Executor callbackExecutor,
GPURequestAdapterOptions options,
@NonNull GPURequestCallback<@NonNull GPUAdapter> callback
)
Asynchronously requests a graphics adapter.