EN-001 — submit an instanced draw. Identical to `submit_draw` except the engine binds vertex slot 1 to the registered instance buffer and emits `draw_indexed(.., 0..count)`. The pipeline must have been compiled with `wants_instancing=true` (use `compile_material_instanced` on the renderer). `model` / `mvp` here are the instance-local→world fallback transform — the per-instance buffer's `instance_
(
&mut self,
device: &wgpu::Device,
queue: &wgpu::Queue,
joint_buffer: &wgpu::Buffer,
material: MaterialHandle,
mesh_handle: u64,
mesh_idx: usiz
| 1426 | /// for `model` and the camera VP for `mvp`. `tint` is multiplied |
| 1427 | /// per-draw (in addition to the per-instance tint). |
| 1428 | pub fn submit_draw_instanced( |
| 1429 | &mut self, |
| 1430 | device: &wgpu::Device, |
| 1431 | queue: &wgpu::Queue, |
| 1432 | joint_buffer: &wgpu::Buffer, |
| 1433 | material: MaterialHandle, |
| 1434 | mesh_handle: u64, |
| 1435 | mesh_idx: usize, |
| 1436 | instance_buffer: u32, |
| 1437 | instance_count: u32, |
| 1438 | mvp: [[f32; 4]; 4], |
| 1439 | model: [[f32; 4]; 4], |
| 1440 | prev_mvp: [[f32; 4]; 4], |
| 1441 | tint: [f32; 4], |
| 1442 | skin_info: [u32; 4], |
| 1443 | ) { |
| 1444 | let idx = material as usize; |
| 1445 | if material == 0 || idx > self.pipelines.len() { return; } |
| 1446 | let bucket = match self.pipelines[idx - 1].as_ref() { |
| 1447 | Some(p) => p.bucket, |
| 1448 | None => return, |
| 1449 | }; |
| 1450 | |
| 1451 | let slot = self.next_draw_slot; |
| 1452 | self.next_draw_slot += 1; |
| 1453 | self.ensure_draw_slot(device, joint_buffer, slot); |
| 1454 | |
| 1455 | let per_draw = PerDrawUniforms { mvp, model, prev_mvp, model_tint: tint, skin_info }; |
| 1456 | queue.write_buffer(&self.per_draw_buffers[slot], 0, bytemuck::bytes_of(&per_draw)); |
| 1457 | |
| 1458 | let cmd = MaterialDrawCommand { |
| 1459 | material, mesh_handle, mesh_idx, draw_slot: slot, |
| 1460 | instance: Some(InstanceDrawInfo { |
| 1461 | buffer_handle: instance_buffer, |
| 1462 | count: instance_count, |
| 1463 | }), |
| 1464 | }; |
| 1465 | if bucket.is_translucent() { |
| 1466 | self.translucent_commands.push(cmd); |
| 1467 | } else { |
| 1468 | self.commands.push(cmd); |
| 1469 | } |
| 1470 | } |
| 1471 | |
| 1472 | /// EN-001 — create a persistent instance buffer from CPU-side |
| 1473 | /// floats. The data layout matches `InstanceData3D` (9 floats per |
no test coverage detected