Skip to main content

Module metal

Module metal 

Source
Expand description

GPU-free host-side layout contract for the Metal backend’s shader structs (uniform structs, math, shader-layout asserts). Metal-specific but device-free, so it is compiled unconditionally and its layout tests run on every platform’s CI. The Metal backend (concinnity-device) re-exports it under its own metal.

Modules§

shader_layout
The engine’s buffer-binding contract for user-authored Metal shaders, plus the pure comparison that catches CPU/GPU struct-layout mismatches. A custom Shader is linked into the engine’s standard pipeline and inherits the engine’s buffer bindings (per-frame view uniforms, per-object data, lights, shadow cascades). If the user declares one of those structs with a different layout than the engine’s #[repr(C)] struct, the GPU reads the engine’s bytes through the wrong offsets: garbage, and a GPU fault when a wrong stride walks a binding off the end of its buffer (the RtGeomEntry failure mode).
uniforms
repr(C) uniform structs only the Metal frame encoder and its passes bind. Each layout must match the corresponding struct in an .metal shader under metal/shaders/.