Skip to content

struct

struct<TProps>(props): WgslStruct<TProps>

Defined in: packages/typegpu/src/data/struct.ts:21

Creates a struct schema that can be used to construct GPU buffers. Ensures proper alignment and padding of properties (as opposed to a d.unstruct schema). The order of members matches the passed in properties object.

TProps extends Record<string, AnyWgslData>

TProps

Record with string keys and TgpuData values, each entry describing one struct member.

WgslStruct<TProps>

const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });