WritableBufferBinding constructor
parameters used to create our WritableBufferBinding
The label of the Binding
The name/key of the Binding
The visibility of the Binding in the shaders
Flag indicating whether we should recreate the parentMesh bind group, usually when a resource has changed
Flag indicating whether we should recreate the parentMesh GPU bind group layout, usually when a resource layout has changed
A cache key allowing to get / set bindings from the device manager map cache. Used for BufferBinding only at the moment.
The binding type of the BufferBinding
Flag to indicate whether this BufferBinding buffer elements should be packed in a single structured object or if each one of them should be a separate binding.
All the BufferBinding data inputs
Array of children BufferBinding used as struct children.
Flag to indicate whether one of the inputs value has changed and we need to update the GPUBuffer linked to the arrayBuffer array
Total size of our arrayBuffer array in bytes
Array buffer that will be sent to the GPUBuffer
Data view of our array buffer
DataView inside the parent arrayBuffer if set.
Array of bufferElements and according view set functions to use if the parent is set.
Corresponding bufferElement.
Corresponding view set function.
The Buffer holding the GPUBuffer
A string to append to our shaders code describing the WGSL structure representing this BufferBinding
An array of strings to append to our shaders code declaring all the WGSL variables representing this BufferBinding
Flag indicating whether whe should automatically copy the GPU buffer content into our result GPU buffer
The result GPUBuffer
Options used to create this WritableBufferBinding
Get the BufferBinding parent if any.
Get this BufferBinding offset in bytes inside the parent arrayBuffer.
Get GPUBindGroupLayoutEntry#buffer | bind group layout entry resource.
Get the resource cache key
Get GPUBindGroupEntry#resource | bind group resource.
Static
cloneClone a struct object width new default values.
New cloned struct object.
Clone this BufferBinding into a new one. Allows to skip buffer layout alignment computations.
params to use for cloning
Set this BufferBinding optional childrenBindings.
Array of BufferBindingChildrenBinding to use as childrenBindings.
Set the buffer alignments from inputs.
Set our buffer attributes: Takes all the inputs and adds them to the bufferElements array with the correct start and end offsets (padded), then fill our arrayBuffer typed array accordingly.
Set a binding shouldUpdate flag to true
to update our arrayBuffer array during next render.
the binding name/key to update
Executed at the beginning of a Material render call.
If any of the inputs has changed, run its onBeforeUpdate
callback then updates our arrayBuffer array.
Also sets the shouldUpdate property to true so the BindGroup knows it will need to update the GPUBuffer.
Extract the data corresponding to a specific BufferElement from a Float32Array holding the GPU buffer data of this BufferBinding
parameters used to extract the data
Float32Array holding GPUBuffer data
name of the BufferElement to use to extract the data
Used to create a BufferBinding that can hold read/write storage bindings along with a result GPU buffer that can be used to get data back from the GPU.
Note that it is automatically created by the BindGroup when a storages input has its access property set to
"read_write"
.