Interface: BufferOptions

BufferOptions

Options for creating a buffer

Properties:
Name Type Default Description
data TypedArray | number[]

the data to initialize the buffer with, this can be a typed array, or a regular number array. If it is a number array, it will be converted to a Float32Array

label string

a label for the buffer, this is useful for debugging

shrinkToFit boolean true

should the GPU buffer be shrunk when the data becomes smaller? changing this will cause the buffer to be destroyed and a new one created on the GPU this can be expensive, especially if the buffer is already big enough! setting this to false will prevent the buffer from being shrunk. This will yield better performance if you are constantly setting data that is changing size often.

size number

the size of the buffer in bytes, if not supplied, it will be inferred from the data

usage number

the usage of the buffer, see BufferUsage

Members

data TypedArray | number[]

the data to initialize the buffer with, this can be a typed array, or a regular number array. If it is a number array, it will be converted to a Float32Array

label string

a label for the buffer, this is useful for debugging

shrinkToFit boolean

should the GPU buffer be shrunk when the data becomes smaller? changing this will cause the buffer to be destroyed and a new one created on the GPU this can be expensive, especially if the buffer is already big enough! setting this to false will prevent the buffer from being shrunk. This will yield better performance if you are constantly setting data that is changing size often.

Default Value:
  • true

size number

the size of the buffer in bytes, if not supplied, it will be inferred from the data

usage number

the usage of the buffer, see BufferUsage