pub struct Layouter { /* private fields */ }
Expand description
Helper processor that derives the sizes of all types.
Layouter
uses the default layout algorithm/table, described in
[WGSL §4.3.7, “Memory Layout”]
A Layouter
may be indexed by Handle<Type>
values: layouter[handle]
is the
layout of the type whose handle is handle
.
Implementations§
source§impl Layouter
impl Layouter
sourcepub fn update(&mut self, gctx: GlobalCtx<'_>) -> Result<(), LayoutError>
pub fn update(&mut self, gctx: GlobalCtx<'_>) -> Result<(), LayoutError>
Extend this Layouter
with layouts for any new entries in types
.
Ensure that every type in types
has a corresponding TypeLayout in
[self.layouts
].
Some front ends need to be able to compute layouts for existing types
while module construction is still in progress and new types are still
being added. This function assumes that the TypeLayout
values already
present in self.layouts
cover their corresponding entries in types
,
and extends self.layouts
as needed to cover the rest. Thus, a front
end can call this function at any time, passing its current type and
constant arenas, and then assume that layouts are available for all
types.