Function createBufferWithData

  • This function creats a GPU buffer with data to initialize it. If the input data is a type of Float32Array or Float64Array, it returns a vertex, uniform, or storage buffer specified by the enum bufferType. Otherwise, if the input data has a Uint16Array or Uint32Array, this function will return an index buffer.

    Parameters

    • device: GPUDevice

      GPU device

    • data: any

      Input data that should be one of four data types: Float32Array, Float64Array, Uint16Array, and Uint32Array

    • bufferType: BufferType = BufferType.Vertex

      Type of enum BufferType. It is used to specify the type of the returned buffer. The default is vertex buffer

    Returns GPUBuffer

Generated using TypeDoc