macro_rules! bind_mat {
($pass:expr, $materials:expr, $instances:expr, $handle:expr) => { ... };
}Expand description
The “material instance → material” chain every draw call repeats: look up
$instances.get($handle), then its material via the instance’s own
target handle, then set_pipeline + set_bind_group(0, ...) on
$pass. Returns from the enclosing function (via or_return!) if
either 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 &GPUMaterialInstance, so callers that also
need .update(name, data) on it (e.g. a per-frame camera uniform) can
still bind that:
ⓘ
let instance = bind_mat!(render_pass, materials, instances, instance_handle);