Skip to content

Unstruct

Struct schema constructed via d.unstruct function.

Useful for defining vertex buffers, as the standard layout restrictions do not apply. Members are not aligned in respect to their byteAlignment, unless they are explicitly decorated with the custom align attribute via d.align function.

TProps extends Record<string, BaseData> = any

Unstruct(props): { [K in string | number | symbol]: InferRecord<TProps>[K] }

Struct schema constructed via d.unstruct function.

Useful for defining vertex buffers, as the standard layout restrictions do not apply. Members are not aligned in respect to their byteAlignment, unless they are explicitly decorated with the custom align attribute via d.align function.

{ [K in string | number | symbol]: InferRecord<TProps>[K] }

{ [K in string | number | symbol]: InferRecord<TProps>[K] }

packages/typegpu/src/data/dataTypes.ts:72

Unstruct(): { [K in string | number | symbol]: InferRecord<TProps>[K] }

Struct schema constructed via d.unstruct function.

Useful for defining vertex buffers, as the standard layout restrictions do not apply. Members are not aligned in respect to their byteAlignment, unless they are explicitly decorated with the custom align attribute via d.align function.

{ [K in string | number | symbol]: InferRecord<TProps>[K] }

packages/typegpu/src/data/dataTypes.ts:73

readonly [$gpuRepr]: { [K in string | number | symbol]: InferGPURecord<TProps>[K] }

packages/typegpu/src/data/dataTypes.ts:79


readonly [$internal]: true | Record<string, any>

BaseData.[$internal]

packages/typegpu/src/data/wgslTypes.ts:41


readonly [$invalidSchemaReason]: "Unstructs are not host-shareable, use structs instead"

packages/typegpu/src/data/dataTypes.ts:87


readonly [$memIdent]: Unstruct<{ [K in string | number | symbol]: MemIdentityRecord<TProps>[K] }>

packages/typegpu/src/data/dataTypes.ts:80


readonly [$repr]: { [K in string | number | symbol]: InferRecord<TProps>[K] }

BaseData.[$repr]

packages/typegpu/src/data/dataTypes.ts:78


readonly [$reprPartial]: undefined | { [K in string | number | symbol]: Partial<InferPartialRecord<TProps>>[K] }

packages/typegpu/src/data/dataTypes.ts:81


readonly [$validVertexSchema]: { [K in string | number | symbol]: IsValidVertexSchema<TProps[K]> }[keyof TProps] extends true ? true : false

packages/typegpu/src/data/dataTypes.ts:84


readonly propTypes: TProps

packages/typegpu/src/data/dataTypes.ts:75


readonly type: "unstruct"

BaseData.type

packages/typegpu/src/data/dataTypes.ts:74

$name(label): this

string

this

TgpuNamable.$name

packages/typegpu/src/shared/meta.ts:87