Aller au contenu

BufferDescriptor

data class BufferDescriptor(
    val size: GPUSize64, 
    val usage: GPUBufferUsage, 
    val mappedAtCreation: Boolean = false, 
    val label: String = ""
) : GPUBufferDescriptor
Describes a GPUBuffer's size, usage, and optional mapped-at-creation state.

Constructors

BufferDescriptor

constructor(
    size: GPUSize64, 
    usage: GPUBufferUsage, 
    mappedAtCreation: Boolean = false, 
    label: String = ""
)

Properties

label

open override val label: String

mappedAtCreation

open override 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

open override 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

open override 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).