MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / bind_instance_buffer

Method bind_instance_buffer

native/shared/src/renderer/material_system.rs:1635–1654  ·  view source on GitHub ↗

EN-001 — resolve an instanced draw command's vertex slot 1 binding and return the instance range. For non-instanced draws (`info` is None) this is a no-op and returns `0..1`. For instanced draws with a missing/destroyed buffer slot we return an empty range so the caller skips the draw rather than crashing on a stale handle.

(
        &'pass self,
        pass: &mut wgpu::RenderPass<'pass>,
        info: &Option<InstanceDrawInfo>,
    )

Source from the content-addressed store, hash-verified

1633 /// so the caller skips the draw rather than crashing on a stale
1634 /// handle.
1635 fn bind_instance_buffer<'pass>(
1636 &'pass self,
1637 pass: &mut wgpu::RenderPass<'pass>,
1638 info: &Option<InstanceDrawInfo>,
1639 ) -> std::ops::Range<u32> {
1640 match info {
1641 None => 0..1,
1642 Some(inst) => {
1643 if inst.buffer_handle == 0 { return 0..1; }
1644 let slot_idx = inst.buffer_handle as usize - 1;
1645 match self.instance_buffers.get(slot_idx).and_then(|s| s.as_ref()) {
1646 Some(ib_slot) => {
1647 pass.set_vertex_buffer(1, ib_slot.buffer.slice(..));
1648 0..inst.count
1649 }
1650 None => 0..0,
1651 }
1652 }
1653 }
1654 }
1655
1656 /// Phase 4b — rebuild the SceneInputs (group 4) bind group with
1657 /// the current frame's snapshot textures. Called by the Renderer

Callers 2

dispatch_with_viewMethod · 0.80
dispatch_translucentMethod · 0.80

Calls 3

sliceMethod · 0.80
getMethod · 0.45
set_vertex_bufferMethod · 0.45

Tested by

no test coverage detected