StructLayout
Interface in Reflection
A struct's complete byte layout: its total size and align plus one FieldLayout per field, in declaration order.
import type { StructLayout } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
interface StructLayout { readonly name: string; readonly size: number; readonly align: number; readonly fields: readonly FieldLayout[];}Description
wgslLayout produces one for a standalone struct;
reflect produces one for every struct bound in a module, under std140 for a
uniform binding and std430 for a storage binding (see LayoutKind). size is
already rounded up to align, which under std140 is itself rounded to 16, so it is also
the element stride of an array of this struct.
Instance properties
nameread onlystringsizeread onlynumberalignread onlynumberfieldsread onlyreadonly FieldLayout[]
See also
Source
src/core/reflect.ts, line 242, at commit 26de7be8