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".

Hierarchy (view full)

Constructors

Properties

label: string

The label of the Binding

name: string

The name/key of the Binding

visibility: number

The visibility of the Binding in the shaders

shouldResetBindGroup: boolean

Flag indicating whether we should recreate the parentMesh bind group, usually when a resource has changed

shouldResetBindGroupLayout: boolean

Flag indicating whether we should recreate the parentMesh GPU bind group layout, usually when a resource layout has changed

cacheKey: string

A cache key allowing to get / set bindings from the device manager map cache. Used for BufferBinding only at the moment.

bindingType: BufferBindingType

The binding type of the BufferBinding

useStruct: boolean

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.

inputs: Record<string, BufferBindingInput>

All the BufferBinding data inputs

shouldUpdate: boolean

Flag to indicate whether one of the inputs value has changed and we need to update the GPUBuffer linked to the arrayBuffer array

bufferElements: AllowedBufferElement[]

An array describing how each corresponding inputs should be inserted into our arrayView array

arrayBufferSize: number

Total size of our arrayBuffer array in bytes

arrayBuffer: ArrayBuffer

Array buffer that will be sent to the GPUBuffer

arrayView: DataView

Data view of our array buffer

buffer: Buffer

The Buffer holding the GPUBuffer

wgslStructFragment: string

A string to append to our shaders code describing the WGSL structure representing this BufferBinding

wgslGroupFragment: string[]

An array of strings to append to our shaders code declaring all the WGSL variables representing this BufferBinding

shouldCopyResult: boolean

Flag indicating whether whe should automatically copy the GPU buffer content into our result GPU buffer

resultBuffer: Buffer

The result GPUBuffer

Options used to create this WritableBufferBinding

Accessors

  • get resourceLayout(): {
        buffer: GPUBufferBindingLayout;
    }
  • Get GPUBindGroupLayoutEntry#buffer | bind group layout entry resource

    Returns {
        buffer: GPUBufferBindingLayout;
    }

    • buffer: GPUBufferBindingLayout

      GPUBindGroupLayout | bind group layout resource

  • get resource(): {
        buffer: GPUBuffer;
    }
  • Get GPUBindGroupEntry#resource | bind group resource

    Returns {
        buffer: GPUBuffer;
    }

    • buffer: GPUBuffer

      GPUBindGroup | bind group resource

Methods