GPUDevice¶
interface GPUDevice : GPUObjectBase, AutoCloseable
Properties¶
adapterInfo¶
abstract val adapterInfo: GPUAdapterInfo
Information about the physical adapter which created the device that this GPUDevice refers to. For a given GPUDevice, the GPUAdapterInfo values exposed are constant over time.
features¶
abstract val features: GPUSupportedFeatures
A set containing the GPUFeatureName values of the features supported by the device ([device].[[`features`](index.md#features)]).
label¶
A developer-provided label which is used in an implementation-defined way. It can be used by the browser, OS, or other tools to help identify the underlying internal object to the developer. Examples include displaying the label in GPUError messages, console warnings, browser developer tools, and platform debugging utilities.
limits¶
abstract val limits: GPUSupportedLimits
The limits supported by the device ([device].[[`limits`](index.md#limits)]).
queue¶
The primary GPUQueue for this device.
See [GPUDevice.queue in the WebGPU specification](https://www.w3.org/TR/webgpu/#dom-gpudevice-queue).
Functions¶
awaitLost¶
abstract suspend fun awaitLost(): Result<GPUDeviceLostInfo>
Waits until this device is lost and resolves with the loss information.
The loss is a successful result: it carries a [`GPUDeviceLostReason`](../-g-p-u-device-lost-reason/index.md) and an implementation-provided message, it is not a failure of the returned [`Result`](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-result/index.html). Several observers may wait at the same time and all of them observe the same loss; an observer that starts waiting after the loss resolves immediately. Cancelling one observer neither cancels the other observers nor destroys the device. Closing the device explicitly notifies the loss with the destruction reason when the backend provides one.
close¶
expect abstract fun close()
createBindGroup¶
abstract fun createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup
Creates a GPUBindGroup.
**Parameters**
- descriptor: Description of the GPUBindGroup to create.
createBindGroupLayout¶
abstract fun createBindGroupLayout(descriptor: GPUBindGroupLayoutDescriptor): GPUBindGroupLayout
Creates a GPUBindGroupLayout.
**Parameters**
- descriptor: Description of the GPUBindGroupLayout to create.
createBuffer¶
abstract fun createBuffer(descriptor: GPUBufferDescriptor): GPUBuffer
Creates a GPUBuffer.
**Parameters**
- descriptor: Description of the GPUBuffer to create.
createCommandEncoder¶
abstract fun createCommandEncoder(descriptor: GPUCommandEncoderDescriptor? = null): GPUCommandEncoder
Creates a GPUCommandEncoder.
**Parameters**
- descriptor: Description of the GPUCommandEncoder to create.
createComputePipeline¶
abstract fun createComputePipeline(descriptor: GPUComputePipelineDescriptor): GPUComputePipeline
Creates a GPUComputePipeline using immediate pipeline creation.
**Parameters**
- descriptor: Description of the GPUComputePipeline to create.
createComputePipelineAsync¶
abstract suspend fun createComputePipelineAsync(descriptor: GPUComputePipelineDescriptor): Result<GPUComputePipeline>
Creates a GPUComputePipeline using async pipeline creation. The returned Promise resolves when the created pipeline is ready to be used without additional delay. If pipeline creation fails, the returned Promise rejects with an GPUPipelineError. (A GPUError is not dispatched to the device.)
**Parameters**
- descriptor: Description of the GPUComputePipeline to create.
createPipelineLayout¶
abstract fun createPipelineLayout(descriptor: GPUPipelineLayoutDescriptor): GPUPipelineLayout
Creates a GPUPipelineLayout.
**Parameters**
- descriptor: Description of the GPUPipelineLayout to create.
createQuerySet¶
abstract fun createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet
Creates a GPUQuerySet.
**Parameters**
- descriptor: Description of the GPUQuerySet to create.
createRenderBundleEncoder¶
abstract fun createRenderBundleEncoder(descriptor: GPURenderBundleEncoderDescriptor): GPURenderBundleEncoder
Creates a GPURenderBundleEncoder.
**Parameters**
- descriptor: Description of the GPURenderBundleEncoder to create.
createRenderPipeline¶
abstract fun createRenderPipeline(descriptor: GPURenderPipelineDescriptor): GPURenderPipeline
Creates a GPURenderPipeline using immediate pipeline creation.
**Parameters**
- descriptor: Description of the GPURenderPipeline to create.
createRenderPipelineAsync¶
abstract suspend fun createRenderPipelineAsync(descriptor: GPURenderPipelineDescriptor): Result<GPURenderPipeline>
Creates a GPURenderPipeline using async pipeline creation. The returned Promise resolves when the created pipeline is ready to be used without additional delay. If pipeline creation fails, the returned Promise rejects with an GPUPipelineError. (A GPUError is not dispatched to the device.)
**Parameters**
- descriptor: Description of the GPURenderPipeline to create.
createSampler¶
abstract fun createSampler(descriptor: GPUSamplerDescriptor? = null): GPUSampler
Creates a GPUSampler.
**Parameters**
- descriptor: Description of the GPUSampler to create.
createShaderModule¶
abstract fun createShaderModule(descriptor: GPUShaderModuleDescriptor): GPUShaderModule
Creates a GPUShaderModule.
**Parameters**
- descriptor: Description of the GPUShaderModule to create.
createTexture¶
abstract fun createTexture(descriptor: GPUTextureDescriptor): GPUTexture
Creates a GPUTexture.
**Parameters**
- descriptor: Description of the GPUTexture to create.
popErrorScope¶
abstract suspend fun popErrorScope(): Result<GPUError?>
Pops a GPU error scope off the [errorScopeStack] for this and resolves to any GPUError observed by the error scope, or null if none. There is no guarantee of the ordering of promise resolution.
pushErrorScope¶
abstract fun pushErrorScope(filter: GPUErrorFilter)
Pushes a new GPU error scope onto the [errorScopeStack] for this.
**Parameters**
- filter: Which class of errors this error scope observes.