Skip to content

size

size<TSize, TData>(size, data): Decorate<TData, Size<TSize>>

Defined in: packages/typegpu/src/data/attributes.ts:191

Adds padding bytes after the wrapped data-type, until the whole value takes up size bytes.

TSize extends number

TData extends AnyData

TSize

The amount of bytes that should be reserved for this data-type.

TData

The data-type to wrap.

Decorate<TData, Size<TSize>>

const Data = d.struct({
a: d.size(16, u32), // takes up 16 bytes, instead of 4
b: u32, // starts at byte 16, because `a` has a custom size
});