pub struct Layouter {
layouts: HandleVec<Type, TypeLayout>,
}
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
.
Fields§
§layouts: HandleVec<Type, TypeLayout>
Layouts for types in an arena.
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 gctx.types
.
Ensure that every type in gctx.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.