StructLayout
On this page

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 af54ddad5.

Syntax

interface StructLayout {
readonly name: string;
readonly emitted: 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 only string

The struct’s authored name, the one the host reads by.

emittedread only string

The struct’s name in the emitted text (Rule 11.10).

sizeread only number
alignread only number
fieldsread only readonly FieldLayout[]

See also

Source

src/core/reflect/layout.ts, line 173, at commit af54ddad5

Edit this page Report a problem