UniformBuffer
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>. |
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 vtkWebGPUUniformBuffer 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 | IWebGPUUniformBufferInitialValues | 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.
getBinding
Get the binding index.
getDevice
Get the device the buffer was last sent to.
getLabel
Get the WGSL name of the uniform buffer.
getSendTime
Get the time of the last sendIfNeeded call.
getShaderCode
Get the WGSL declaration of this uniform buffer.
| Argument | Type | Required | Description |
|---|---|---|---|
binding | Yes | The binding index. | |
group | Yes | The bind group index. |
getSizeInBytes
Get the size of the struct in bytes.
newInstance
Method used to create a new instance of vtkWebGPUUniformBuffer.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IWebGPUUniformBufferInitialValues | No | for pre-setting some of its content |
releaseGraphicsResources
Release the GPU buffer, forcing it to be recreated and resent on the next sendIfNeeded call.
sendIfNeeded
Create the GPU buffer if needed and write the contents when they changed.
| Argument | Type | Required | Description |
|---|---|---|---|
device | Yes | The device to send the data to. |
setArray
Set a vector or matrix entry.
| Argument | Type | Required | Description |
|---|---|---|---|
name | Yes | The entry name. | |
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 uniform buffer.
setSizeInBytes
Set the size of the struct in bytes.
setValue
Set a scalar entry.
| Argument | Type | Required | Description |
|---|---|---|---|
name | Yes | The entry name. | |
val | Yes | The value to store. |
sortBufferEntries
Reorder and pack the entries if they changed since the last sort, and recompute the size of the struct.