struct
struct<
TProps>(props):WgslStruct<TProps>
Defined in: packages/typegpu/src/data/struct.ts:22
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.
Type Parameters
Section titled “Type Parameters”• TProps extends Record<string, AnyWgslData>
Parameters
Section titled “Parameters”TProps
Record with string keys and TgpuData values,
each entry describing one struct member.
Returns
Section titled “Returns”WgslStruct<TProps>
Example
Section titled “Example”const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });