chore: check number of instances before mapping to new type

This commit is contained in:
alphafetus committed 2026-08-08 13:47:23 -04:00
1 parent de059012f4
commit 2d8b895841
1 file changed
+5 -4
+5 -4
View File
@@ -24,6 +24,11 @@ impl RenderBatch {
.filter_map(|(id, mesh)| {
let instances = instance_registry.get_instances_for(id);
if instances.is_empty() {
// A buffer with zero size breaks the rendering pipeline, plus there's no point
return None;
}
let gpu_instances = instances.iter()
.cloned()
.map(|instance| {
@@ -31,10 +36,6 @@ impl RenderBatch {
})
.collect::<Vec<GpuInstance>>();
if gpu_instances.is_empty() {
return None;
}
// Build instances into a RenderBatch
let instance_buffer = Buffer::from_iter(
allocator.clone(),