GPUDevice
public final class GPUDevice implements AutoCloseable
The primary interface for interacting with the GPU, used to create most resources.
Summary
Public methods |
|
|---|---|
external void |
close() |
final external @NonNull GPUBindGroup |
@FastNativeCreates a new bind group. |
final external @NonNull GPUBindGroupLayout |
@FastNativeCreates a new bind group layout. |
final external @NonNull GPUBuffer |
@FastNativeCreates a new GPU buffer. |
final external @NonNull GPUCommandEncoder |
@FastNativeCreates a new command encoder to record command buffers. |
final external @NonNull GPUComputePipeline |
@FastNativeCreates a new compute pipeline synchronously. |
final @NonNull GPUComputePipeline |
createComputePipelineAndAwait(Creates a new compute pipeline asynchronously. |
final external void |
@FastNativeCreates a new compute pipeline asynchronously. |
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 to record render bundles. |
final external @NonNull GPURenderPipeline |
@FastNativeCreates a new render pipeline synchronously. |
final @NonNull GPURenderPipeline |
createRenderPipelineAndAwait(Creates a new render pipeline asynchronously. |
final external void |
@FastNativeCreates a new render pipeline asynchronously. |
final external @NonNull GPUSampler |
@FastNativeCreates a new sampler. |
final external @NonNull GPUShaderModule |
@FastNativeCreates a new shader module. |
final external @NonNull GPUTexture |
@FastNativeCreates a new GPU texture. |
final external void |
Destroys the device and frees its resources. |
boolean |
|
final external @NonNull AdapterInfo |
Gets information about the adapter that was used to create this device. |
final external @NonNull SupportedFeatures |
Gets the set of features supported by the device. |
final long |
|
final external @NonNull Limits |
Gets the limits supported by the device. |
final external @NonNull GPUQueue |
Gets the queue object for submitting commands to the GPU. |
final external boolean |
@FastNativeChecks if a specific feature is enabled on the device. |
int |
hashCode() |
final int |
Pops the current error scope from the stack asynchronously and returns a possible error. |
final external void |
@FastNativePops the current error scope from the stack asynchronously and returns a possible error. |
final external void |
@FastNativePushes a new error scope onto the device's error scope stack. |
final @NonNull GPUQueue |
queue() |
final external void |
@FastNativeSets a debug label for the device. |
Public methods
createBindGroup
@FastNative
public final external @NonNull GPUBindGroup createBindGroup(@NonNull BindGroupDescriptor descriptor)
Creates a new bind group.
| Parameters | |
|---|---|
@NonNull BindGroupDescriptor descriptor |
The descriptor for the bind group. |
| Returns | |
|---|---|
@NonNull GPUBindGroup |
The newly created bind group. |
createBindGroupLayout
@FastNative
public final external @NonNull GPUBindGroupLayout createBindGroupLayout(@NonNull BindGroupLayoutDescriptor descriptor)
Creates a new bind group layout.
| Parameters | |
|---|---|
@NonNull BindGroupLayoutDescriptor descriptor |
The descriptor for the bind group layout. |
| Returns | |
|---|---|
@NonNull GPUBindGroupLayout |
The newly created bind group layout. |
createBuffer
@FastNative
public final external @NonNull GPUBuffer createBuffer(@NonNull BufferDescriptor descriptor)
Creates a new GPU buffer.
| Parameters | |
|---|---|
@NonNull BufferDescriptor descriptor |
The descriptor for the buffer. |
createCommandEncoder
@FastNative
public final external @NonNull GPUCommandEncoder createCommandEncoder(CommandEncoderDescriptor descriptor)
Creates a new command encoder to record command buffers.
| Parameters | |
|---|---|
CommandEncoderDescriptor descriptor |
The descriptor for the command encoder. |
| Returns | |
|---|---|
@NonNull GPUCommandEncoder |
The newly created command encoder. |
createComputePipeline
@FastNative
public final external @NonNull GPUComputePipeline createComputePipeline(@NonNull ComputePipelineDescriptor descriptor)
Creates a new compute pipeline synchronously.
| Parameters | |
|---|---|
@NonNull ComputePipelineDescriptor descriptor |
The descriptor for the compute pipeline. |
| Returns | |
|---|---|
@NonNull GPUComputePipeline |
The newly created compute pipeline. |
createComputePipelineAndAwait
public final @NonNull GPUComputePipeline createComputePipelineAndAwait(
@NonNull ComputePipelineDescriptor descriptor
)
Creates a new compute pipeline asynchronously.
| Parameters | |
|---|---|
@NonNull ComputePipelineDescriptor descriptor |
The descriptor for the compute pipeline. |
createComputePipelineAsync
@FastNative
public final external void createComputePipelineAsync(
@NonNull ComputePipelineDescriptor descriptor,
@NonNull Executor callbackExecutor,
@NonNull CreateComputePipelineAsyncCallback callback
)
Creates a new compute pipeline asynchronously.
createPipelineLayout
@FastNative
public final external @NonNull GPUPipelineLayout createPipelineLayout(@NonNull PipelineLayoutDescriptor descriptor)
Creates a new pipeline layout.
| Parameters | |
|---|---|
@NonNull PipelineLayoutDescriptor descriptor |
The descriptor for the pipeline layout. |
| Returns | |
|---|---|
@NonNull GPUPipelineLayout |
The newly created pipeline layout. |
createQuerySet
@FastNative
public final external @NonNull GPUQuerySet createQuerySet(@NonNull QuerySetDescriptor descriptor)
Creates a new query set.
| Parameters | |
|---|---|
@NonNull QuerySetDescriptor descriptor |
The descriptor for the query set. |
| Returns | |
|---|---|
@NonNull GPUQuerySet |
The newly created query set. |
createRenderBundleEncoder
@FastNative
public final external @NonNull GPURenderBundleEncoder createRenderBundleEncoder(
@NonNull RenderBundleEncoderDescriptor descriptor
)
Creates a new render bundle encoder to record render bundles.
| Parameters | |
|---|---|
@NonNull RenderBundleEncoderDescriptor descriptor |
The descriptor for the render bundle encoder. |
| Returns | |
|---|---|
@NonNull GPURenderBundleEncoder |
The newly created render bundle encoder. |
createRenderPipeline
@FastNative
public final external @NonNull GPURenderPipeline createRenderPipeline(@NonNull RenderPipelineDescriptor descriptor)
Creates a new render pipeline synchronously.
| Parameters | |
|---|---|
@NonNull RenderPipelineDescriptor descriptor |
The descriptor for the render pipeline. |
| Returns | |
|---|---|
@NonNull GPURenderPipeline |
The newly created render pipeline. |
createRenderPipelineAndAwait
public final @NonNull GPURenderPipeline createRenderPipelineAndAwait(
@NonNull RenderPipelineDescriptor descriptor
)
Creates a new render pipeline asynchronously.
| Parameters | |
|---|---|
@NonNull RenderPipelineDescriptor descriptor |
The descriptor for the render pipeline. |
createRenderPipelineAsync
@FastNative
public final external void createRenderPipelineAsync(
@NonNull RenderPipelineDescriptor descriptor,
@NonNull Executor callbackExecutor,
@NonNull CreateRenderPipelineAsyncCallback callback
)
Creates a new render pipeline asynchronously.
createSampler
@FastNative
public final external @NonNull GPUSampler createSampler(SamplerDescriptor descriptor)
Creates a new sampler.
| Parameters | |
|---|---|
SamplerDescriptor descriptor |
The descriptor for the sampler. |
| Returns | |
|---|---|
@NonNull GPUSampler |
The newly created sampler. |
createShaderModule
@FastNative
public final external @NonNull GPUShaderModule createShaderModule(@NonNull ShaderModuleDescriptor descriptor)
Creates a new shader module.
| Parameters | |
|---|---|
@NonNull ShaderModuleDescriptor descriptor |
The descriptor for the shader module. |
| Returns | |
|---|---|
@NonNull GPUShaderModule |
The newly created shader module. |
createTexture
@FastNative
public final external @NonNull GPUTexture createTexture(@NonNull TextureDescriptor descriptor)
Creates a new GPU texture.
| Parameters | |
|---|---|
@NonNull TextureDescriptor descriptor |
The descriptor for the texture. |
| Returns | |
|---|---|
@NonNull GPUTexture |
The newly created texture. |
destroy
@FastNative
public final external void destroy()
Destroys the device and frees its resources. The device becomes lost.
getAdapterInfo
@FastNative
public final external @NonNull AdapterInfo getAdapterInfo()
Gets information about the adapter that was used to create this device.
| Returns | |
|---|---|
@NonNull AdapterInfo |
Status code of the operation. |
getFeatures
@FastNative
public final external @NonNull SupportedFeatures getFeatures()
Gets the set of features supported by the device.
getLimits
@FastNative
public final external @NonNull Limits getLimits()
Gets the limits supported by the device.
getQueue
@FastNative
public final external @NonNull GPUQueue getQueue()
Gets the queue object for submitting commands to the GPU.
hasFeature
@FastNative
public final external boolean hasFeature(int feature)
Checks if a specific feature is enabled on the device.
| Parameters | |
|---|---|
int feature |
The feature to check for support. |
| Returns | |
|---|---|
boolean |
True if the feature is enabled, {@code false} otherwise. |
popErrorScope
public final int popErrorScope()
Pops the current error scope from the stack asynchronously and returns a possible error.
popErrorScope
@FastNative
public final external void popErrorScope(
@NonNull Executor callbackExecutor,
@NonNull PopErrorScopeCallback callback
)
Pops the current error scope from the stack asynchronously and returns a possible error.
pushErrorScope
@FastNative
public final external void pushErrorScope(int filter)
Pushes a new error scope onto the device's error scope stack.
| Parameters | |
|---|---|
int filter |
The type of errors to filter and capture in the new scope. |
setLabel
@FastNative
public final external void setLabel(@NonNull String label)
Sets a debug label for the device.