API

Function CreateAlignedTypedArray

  • Creates a typed array suitable for GPU buffer operations, as some engines require CPU buffer sizes to be aligned to specific boundaries (e.g., 4 bytes). The use of non-aligned arrays still works but may result in a performance penalty.

    Type Parameters

    Parameters

    • type: TypedArrayConstructor<T>

      The type of the array. For instance, Float32Array or Uint8Array

    • elementCount: number

      The number of elements to store in the array

    Returns T

    The aligned typed array