Used to handle specific array BufferBinding types.

Hierarchy (View Summary)

Constructors

Properties

arrayLength: number

Initial length of the input BufferBinding arrayBuffer.

numElements: number

Total number of elements (i.e. arrayLength divided by buffer layout number of elements.

arrayStride: number

Number of bytes in the ArrayBuffer between two elements startOffset.

name: string

The name of the BufferElement.

type: string

The WGSL variable type of the BufferElement (stripped of array).

baseType: string

The WGSL base variable type of the BufferElement (stripped of array and atomic).

key: string

The key of the BufferElement.

bufferLayout: BufferLayout

BufferLayout used to fill the BufferBinding arrayBuffer at the right offsets.

Object defining exactly at which place a binding should be inserted into the BufferBinding arrayBuffer.

view?: TypedArray

Array containing the BufferElement values.

setValue: (value: InputValue) => void

Function assigned to set the view values.

Accessors

Methods

  • Set the alignment. To compute how arrays are packed, we get the second item alignment as well and use it to calculate the arrayStride between two array elements. Using the arrayStride and the total number of elements, we can easily get the end alignment position.

    Parameters

    • startOffset: number = 0

      Offset at which to start inserting the values in the BufferBinding arrayBuffer.

    • minStride: number = 0

      Minimum stride to use for the values in the parent BufferBinding arrayBuffer. Uniform buffers array elements have a minimum stride of 16.

    Returns void