The initial data to put into the Buffer. The length of the Buffer will be determined by the contents of the table. The contents can be a mix of tables, numbers, and vectors, but the length calculation requires each field to consistently use one type of data.
The stride of the Buffer, in bytes. When nil, the stride will be automatically computed based on the fields. The stride can not be zero or smaller than the max byte occupied by one of the fields. The layout of the Buffer may adjust the stride.
The initial data to put into the Buffer. The length of the Buffer will be determined by the contents of the table. The contents can be a mix of tables, numbers, and vectors, but the length calculation requires each field to consistently use one type of data.
format
table
nil
A list of fields in the Buffer (see notes). nil is a valid format, but means only Blobs can be written to the Buffer from Lua.
The stride of the Buffer, in bytes. When nil, the stride will be automatically computed based on the fields. The stride can not be zero or smaller than the max byte occupied by one of the fields. The layout of the Buffer may adjust the stride.
The stride of the Buffer, in bytes. When nil, the stride will be automatically computed based on the fields. The stride can not be zero or smaller than the max byte occupied by one of the fields. The layout of the Buffer may adjust the stride.
The format table can contain a list of FieldTypes or a list of tables to provide extra information about each field. Each inner table has the following keys:
type is the FieldType of the field and is required.
offset is the byte offset of the field. Any fields with a nil offset will be placed next
to each other sequentially in memory, subject to any padding required by the Buffer's layout.
In practice this means that you probably want to provide an offset for either all of the
fields or none of them.
location is the vertex attribute location of each field. This is used to match up each
field with an attribute declared in a shader, and doesn't have any purpose when binding the
buffer as a uniform or storage buffer. Any fields with a nil location will use an
autoincrementing location starting at zero. Named locations are not currently supported, but
may be added in the future.
If no table or Blob is used to define the initial Buffer contents, its data will be undefined.