Skip to content

arrayOf

const arrayOf: TgpuComptime<WgslArrayConstructor>

Defined in: packages/typegpu/src/data/array.ts:35

Creates an array schema that can be used to construct gpu buffers. Describes arrays with fixed-size length, storing elements of the same type.

const LENGTH = 3;
const array = d.arrayOf(d.u32, LENGTH);
If `elementCount` is not specified, a partially applied function is returned.
const array = d.arrayOf(d.vec3f);
// ^? (n: number) => WgslArray<d.Vec3f>

The type of elements in the array.

The number of elements in the array.