Skip to content

GPUBufferDescriptor

Describes a GPUBuffer's size, usage, and optional mapped-at-creation state.

Properties

label

abstract val label: String
The initial value of GPUObjectBase.label. See [GPUObjectDescriptorBase.label in the WebGPU specification](https://www.w3.org/TR/webgpu/#dom-gpuobjectdescriptorbase-label).

mappedAtCreation

abstract val mappedAtCreation: Boolean
If true creates the buffer in an already mapped state, allowing getMappedRange() to be called immediately. It is valid to set mappedAtCreation to true even if usage does not contain MAP_READ or MAP_WRITE. This can be used to set the buffer’s initial data. Guarantees that even if the buffer creation eventually fails, it will still appear as if the mapped range can be written/read to until it is unmapped.

size

abstract val size: GPUSize64
The size of the buffer in bytes. See [GPUBufferDescriptor.size in the WebGPU specification](https://www.w3.org/TR/webgpu/#dom-gpubufferdescriptor-size).

usage

abstract val usage: GPUBufferUsage
The allowed usages for the buffer. See [GPUBufferDescriptor.usage in the WebGPU specification](https://www.w3.org/TR/webgpu/#dom-gpubufferdescriptor-usage).