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