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