StorageBuffer
Methods
addEntry
Append an entry to the struct.
| Argument | Type | Required | Description |
|---|---|---|---|
name | Yes | The WGSL member name. | |
type | Yes | The 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.
| Argument | Type | Required | Description |
|---|---|---|---|
type | Yes | The typed array constructor name, e.g. 'Float32Array'. |
extend
Method used to decorate a given object (publicAPI+model) with vtkWebGPUStorageBuffer characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IWebGPUStorageBufferInitialValues | No | (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.
| Argument | Type | Required | Description |
|---|---|---|---|
binding | Yes | The binding index. | |
group | Yes | The bind group index. |
getSizeInBytes
Get the size of a single struct instance in bytes.
newInstance
Method used to create a new instance of vtkWebGPUStorageBuffer.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IWebGPUStorageBufferInitialValues | No | for 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.
| Argument | Type | Required | Description |
|---|---|---|---|
device | Yes | The device to send the data to. |
setAllInstancesFromArray
Set an entry for every instance from a single flat array.
| Argument | Type | Required | Description |
|---|---|---|---|
name | Yes | The entry name. | |
arr | Yes | numberOfInstances contiguous blocks of values. |
setAllInstancesFromArray3x3To4x4
Set a mat4x4 entry for every instance from a flat array of 3x3 matrices.
| Argument | Type | Required | Description |
|---|---|---|---|
name | Yes | The entry name. | |
arr | Yes | numberOfInstances 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.
| Argument | Type | Required | Description |
|---|---|---|---|
name | Yes | The entry name. | |
arr | Yes | numberOfInstances contiguous blocks of values. |
setArray
Set a vector or matrix entry for one instance.
| Argument | Type | Required | Description |
|---|---|---|---|
name | Yes | The entry name. | |
instance | Yes | The instance index. | |
arr | Yes | The 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.
| Argument | Type | Required | Description |
|---|---|---|---|
name | Yes | The entry name. | |
instance | Yes | The instance index. | |
val | Yes | The value to store. |