Skip to content

StorageBuffer ​

Methods ​

addEntry ​

Append an entry to the struct.

ArgumentTypeRequiredDescription
nameYesThe WGSL member name.
typeYesThe WGSL type, e.g. vec4<f32>.

clearData ​

Drop every entry and the GPU buffer, leaving an empty storage buffer.

createView ​

Make sure a typed array view of the given type exists over the backing array buffer.

ArgumentTypeRequiredDescription
typeYesThe typed array constructor name, e.g. 'Float32Array'.

extend ​

Method used to decorate a given object (publicAPI+model) with vtkWebGPUStorageBuffer characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIWebGPUStorageBufferInitialValuesNo(default: {})

getBindGroupEntry ​

Get the bind group entry for this buffer, creating the GPU buffer if needed. The binding index is filled in by the bind group.

getBindGroupLayoutEntry ​

Get the bind group layout entry describing this buffer.

getBindGroupTime ​

Get the object whose modified time changes when the bind group entry becomes stale.

getDevice ​

Get the device the buffer was last sent to.

getLabel ​

Get the WGSL name of the storage buffer.

getNumberOfInstances ​

Get the number of struct instances held by the buffer.

getSendTime ​

Get the time of the last send.

getShaderCode ​

Get the WGSL declaration of this storage buffer.

ArgumentTypeRequiredDescription
bindingYesThe binding index.
groupYesThe bind group index.

getSizeInBytes ​

Get the size of a single struct instance in bytes.

newInstance ​

Method used to create a new instance of vtkWebGPUStorageBuffer.

ArgumentTypeRequiredDescription
initialValuesIWebGPUStorageBufferInitialValuesNofor pre-setting some of its content

releaseGraphicsResources ​

Release the GPU buffer, forcing it to be recreated on the next send.

send ​

Create the GPU buffer if needed and write the current contents to it.

ArgumentTypeRequiredDescription
deviceYesThe device to send the data to.

setAllInstancesFromArray ​

Set an entry for every instance from a single flat array.

ArgumentTypeRequiredDescription
nameYesThe entry name.
arrYesnumberOfInstances contiguous blocks of values.

setAllInstancesFromArray3x3To4x4 ​

Set a mat4x4 entry for every instance from a flat array of 3x3 matrices.

ArgumentTypeRequiredDescription
nameYesThe entry name.
arrYesnumberOfInstances blocks of nine values.

setAllInstancesFromArrayColorToFloat ​

Set an entry for every instance from a single flat array of unsigned char colors, dividing each component by 255.

ArgumentTypeRequiredDescription
nameYesThe entry name.
arrYesnumberOfInstances contiguous blocks of values.

setArray ​

Set a vector or matrix entry for one instance.

ArgumentTypeRequiredDescription
nameYesThe entry name.
instanceYesThe instance index.
arrYesThe values to store.

setBindGroupLayoutEntry ​

Set the bind group layout entry describing this buffer.

setDevice ​

Set the device the buffer belongs to.

setLabel ​

Set the WGSL name of the storage buffer.

setNumberOfInstances ​

Set the number of struct instances held by the buffer.

setSizeInBytes ​

Set the size of a single struct instance in bytes.

setValue ​

Set a scalar entry for one instance.

ArgumentTypeRequiredDescription
nameYesThe entry name.
instanceYesThe instance index.
valYesThe value to store.