GPUDevice
public final class GPUDevice implements AutoCloseable
A logical graphics device.
Summary
Public methods |
|
|---|---|
external void |
close()Decrements the reference count of the object and frees resources when the count reaches zero. |
final external @NonNull GPUBindGroup |
@FastNativeCreates a new bind group. |
final external @NonNull GPUBindGroupLayout |
Creates a new bind group layout. |
final external @NonNull GPUBuffer |
@FastNativeCreates a new buffer. |
final external @NonNull GPUCommandEncoder |
Creates a new command encoder. |
final external @NonNull GPUComputePipeline |
Creates a new compute pipeline. |
final @NonNull GPUComputePipeline |
createComputePipelineAndAwait(Asynchronously creates a new compute pipeline. |
final external void |
@FastNativeAsynchronously creates a new compute pipeline. |
final external @NonNull GPUPipelineLayout |
@FastNativeCreates a new pipeline layout. |
final external @NonNull GPUQuerySet |
@FastNativeCreates a new query set. |
final external @NonNull GPURenderBundleEncoder |
Creates a new render bundle encoder. |
final external @NonNull GPURenderPipeline |
@FastNativeCreates a new render pipeline. |
final @NonNull GPURenderPipeline |
createRenderPipelineAndAwait(Asynchronously creates a new render pipeline. |
final external void |
@FastNativeAsynchronously creates a new render pipeline. |
final external @NonNull GPUSampler |
@FastNativeCreates a new sampler. |
final external @NonNull GPUShaderModule |
@FastNativeCreates a new shader module. |
final external @NonNull GPUTexture |
@FastNativeCreates a new texture. |
final external void |
Destroys the device and releases its resources. |
boolean |
|
final external @NonNull GPUAdapterInfo |
Retrieves information about the adapter that created this device. |
final external @NonNull GPUSupportedFeatures |
Retrieves the list of features supported by the device. |
final long |
|
final external @NonNull GPULimits |
Retrieves the limits supported by the device. |
final external @NonNull GPUQueue |
Gets the default queue for the device. |
final external boolean |
@FastNativeChecks if a specific feature is supported by the device. |
int |
hashCode() |
final int |
Asynchronously pops an error scope from the error scope stack. |
final external void |
@FastNativeAsynchronously pops an error scope from the error scope stack. |
final external void |
@FastNativePushes an error scope onto the error scope stack. |
final @NonNull GPUQueue |
queue() |
final external void |
@FastNativeSets a human-readable label for debugging. |
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.
createBindGroup
@FastNative
public final external @NonNull GPUBindGroup createBindGroup(@NonNull GPUBindGroupDescriptor descriptor)
Creates a new bind group.
| Parameters | |
|---|---|
@NonNull GPUBindGroupDescriptor descriptor |
The descriptor for the bind group. |
| Returns | |
|---|---|
@NonNull GPUBindGroup |
The created bind group. |
createBindGroupLayout
@FastNative
public final external @NonNull GPUBindGroupLayout createBindGroupLayout(@NonNull GPUBindGroupLayoutDescriptor descriptor)
Creates a new bind group layout.
| Parameters | |
|---|---|
@NonNull GPUBindGroupLayoutDescriptor descriptor |
The descriptor for the bind group layout. |
| Returns | |
|---|---|
@NonNull GPUBindGroupLayout |
The created bind group layout. |
createBuffer
@FastNative
public final external @NonNull GPUBuffer createBuffer(@NonNull GPUBufferDescriptor descriptor)
Creates a new buffer.
| Parameters | |
|---|---|
@NonNull GPUBufferDescriptor descriptor |
The descriptor for the buffer. |
createCommandEncoder
@FastNative
public final external @NonNull GPUCommandEncoder createCommandEncoder(GPUCommandEncoderDescriptor descriptor)
Creates a new command encoder.
| Parameters | |
|---|---|
GPUCommandEncoderDescriptor descriptor |
The descriptor for the command encoder. |
| Returns | |
|---|---|
@NonNull GPUCommandEncoder |
The created command encoder. |
createComputePipeline
@FastNative
public final external @NonNull GPUComputePipeline createComputePipeline(@NonNull GPUComputePipelineDescriptor descriptor)
Creates a new compute pipeline.
| Parameters | |
|---|---|
@NonNull GPUComputePipelineDescriptor descriptor |
The descriptor for the compute pipeline. |
| Returns | |
|---|---|
@NonNull GPUComputePipeline |
The created compute pipeline. |
createComputePipelineAndAwait
public final @NonNull GPUComputePipeline createComputePipelineAndAwait(
@NonNull GPUComputePipelineDescriptor descriptor
)
Asynchronously creates a new compute pipeline.
| Parameters | |
|---|---|
@NonNull GPUComputePipelineDescriptor descriptor |
The descriptor for the compute pipeline. |
createComputePipelineAsync
@FastNative
public final external void createComputePipelineAsync(
@NonNull GPUComputePipelineDescriptor descriptor,
@NonNull Executor callbackExecutor,
@NonNull GPURequestCallback<@NonNull GPUComputePipeline> callback
)
Asynchronously creates a new compute pipeline.
createPipelineLayout
@FastNative
public final external @NonNull GPUPipelineLayout createPipelineLayout(@NonNull GPUPipelineLayoutDescriptor descriptor)
Creates a new pipeline layout.
| Parameters | |
|---|---|
@NonNull GPUPipelineLayoutDescriptor descriptor |
The descriptor for the pipeline layout. |
| Returns | |
|---|---|
@NonNull GPUPipelineLayout |
The created pipeline layout. |
createQuerySet
@FastNative
public final external @NonNull GPUQuerySet createQuerySet(@NonNull GPUQuerySetDescriptor descriptor)
Creates a new query set.
| Parameters | |
|---|---|
@NonNull GPUQuerySetDescriptor descriptor |
The descriptor for the query set. |
| Returns | |
|---|---|
@NonNull GPUQuerySet |
The created query set. |
createRenderBundleEncoder
@FastNative
public final external @NonNull GPURenderBundleEncoder createRenderBundleEncoder(
@NonNull GPURenderBundleEncoderDescriptor descriptor
)
Creates a new render bundle encoder.
| Parameters | |
|---|---|
@NonNull GPURenderBundleEncoderDescriptor descriptor |
The descriptor for the render bundle encoder. |
| Returns | |
|---|---|
@NonNull GPURenderBundleEncoder |
The created render bundle encoder. |
createRenderPipeline
@FastNative
public final external @NonNull GPURenderPipeline createRenderPipeline(@NonNull GPURenderPipelineDescriptor descriptor)
Creates a new render pipeline.
| Parameters | |
|---|---|
@NonNull GPURenderPipelineDescriptor descriptor |
The descriptor for the render pipeline. |
| Returns | |
|---|---|
@NonNull GPURenderPipeline |
The created render pipeline. |
createRenderPipelineAndAwait
public final @NonNull GPURenderPipeline createRenderPipelineAndAwait(
@NonNull GPURenderPipelineDescriptor descriptor
)
Asynchronously creates a new render pipeline.
| Parameters | |
|---|---|
@NonNull GPURenderPipelineDescriptor descriptor |
The descriptor for the render pipeline. |
createRenderPipelineAsync
@FastNative
public final external void createRenderPipelineAsync(
@NonNull GPURenderPipelineDescriptor descriptor,
@NonNull Executor callbackExecutor,
@NonNull GPURequestCallback<@NonNull GPURenderPipeline> callback
)
Asynchronously creates a new render pipeline.
createSampler
@FastNative
public final external @NonNull GPUSampler createSampler(GPUSamplerDescriptor descriptor)
Creates a new sampler.
| Parameters | |
|---|---|
GPUSamplerDescriptor descriptor |
The descriptor for the sampler. |
| Returns | |
|---|---|
@NonNull GPUSampler |
The created sampler. |
createShaderModule
@FastNative
public final external @NonNull GPUShaderModule createShaderModule(@NonNull GPUShaderModuleDescriptor descriptor)
Creates a new shader module.
| Parameters | |
|---|---|
@NonNull GPUShaderModuleDescriptor descriptor |
The descriptor for the shader module. |
| Returns | |
|---|---|
@NonNull GPUShaderModule |
The created shader module. |
createTexture
@FastNative
public final external @NonNull GPUTexture createTexture(@NonNull GPUTextureDescriptor descriptor)
Creates a new texture.
| Parameters | |
|---|---|
@NonNull GPUTextureDescriptor descriptor |
The descriptor for the texture. |
| Returns | |
|---|---|
@NonNull GPUTexture |
The created texture. |
destroy
@FastNative
public final external void destroy()
Destroys the device and releases its resources.
getAdapterInfo
@FastNative
public final external @NonNull GPUAdapterInfo getAdapterInfo()
Retrieves information about the adapter that created this device.
| Returns | |
|---|---|
@NonNull GPUAdapterInfo |
The status of the operation. |
getFeatures
@FastNative
public final external @NonNull GPUSupportedFeatures getFeatures()
Retrieves the list of features supported by the device.
getLimits
@FastNative
public final external @NonNull GPULimits getLimits()
Retrieves the limits supported by the device.
getQueue
@FastNative
public final external @NonNull GPUQueue getQueue()
Gets the default queue for the device.
hasFeature
@FastNative
public final external boolean hasFeature(int feature)
Checks if a specific feature is supported by the device.
| Parameters | |
|---|---|
int feature |
The feature to check for. |
| Returns | |
|---|---|
boolean |
{@code true} if the feature is supported, {@code false} otherwise. |
popErrorScope
public final int popErrorScope()
Asynchronously pops an error scope from the error scope stack.
popErrorScope
@FastNative
public final external void popErrorScope(
@NonNull Executor callbackExecutor,
@NonNull GPURequestCallback<@NonNull Integer> callback
)
Asynchronously pops an error scope from the error scope stack.
pushErrorScope
@FastNative
public final external void pushErrorScope(int filter)
Pushes an error scope onto the error scope stack.
| Parameters | |
|---|---|
int filter |
The filter for the types of errors to capture. |
setLabel
@FastNative
public final external void setLabel(@NonNull String label)
Sets a human-readable label for debugging.