BufferUsage class final

What a general buffer may be used for, fixed when it is made.

A promise the caller makes, which a backend may hold it to. Every backend checks the usages a call needs where its API would otherwise fail late — mapping needs hostReadable or hostWritable, an indirect draw indirect — and refuses with an ArgumentError. A backend whose API does not care (WebGL2 copies any buffer) need not check the copy usages; a caller that relies on that is relying on one backend.

Annotations
  • @immutable

Properties

bits → int
final
hashCode → int
The hash code for this object.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

contains(BufferUsage other) → bool
Whether every usage in other is in this one.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override
operator |(BufferUsage other) → BufferUsage

Constants

copyDestination → const BufferUsage
copySource → const BufferUsage
hostReadable → const BufferUsage
GraphicsDevice.readBuffer may read it back — what StorageBuffer.hostReadable records.
hostWritable → const BufferUsage
GraphicsDevice.mapBuffer may map it with MapMode.write — a staging buffer the host fills and a transfer pass copies onward. WebGPU's MAP_WRITE.
index → const BufferUsage
Holds indices. A backend may refuse index combined with vertex or uniform with an ArgumentError: WebGL2 binds a buffer to the element array target for its life and cannot bind it anywhere else.
indirect → const BufferUsage
Holds the arguments of an indirect draw or dispatch.
standardStorage → const BufferUsage
Storage, copied either way: what a compute pass reads and writes, and what createStorageBuffer made before 1.0 folded it into GraphicsDevice.createBuffer.
storage → const BufferUsage
Needs DeviceFeature.compute or DeviceFeature.renderStageStorage.
uniform → const BufferUsage
vertex → const BufferUsage