macro_rules! bind_mat {
($pass:expr, $materials:expr, $handle:expr) => { ... };
}Expand description
The “look up, then bind” chain every draw call repeats: $materials.get($handle),
then set_pipeline + set_bind_group(0, ...) on $pass. Returns from
the enclosing function (via or_return!) if the lookup isn’t ready
yet — an asset that hasn’t finished uploading is a normal, common case
(a couple frames on load), not a bug.
Evaluates to the looked-up &GPUMaterial, so callers that also need
.update(name, data) on it (e.g. a per-frame camera uniform) can still
bind that:
ⓘ
let material = bind_mat!(render_pass, materials, material_handle);