chore: check number of instances before mapping to new type
This commit is contained in:
1 parent
de059012f4
commit
2d8b895841
1 file changed
+5
-4
@@ -24,6 +24,11 @@ impl RenderBatch {
|
|||||||
.filter_map(|(id, mesh)| {
|
.filter_map(|(id, mesh)| {
|
||||||
let instances = instance_registry.get_instances_for(id);
|
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()
|
let gpu_instances = instances.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.map(|instance| {
|
.map(|instance| {
|
||||||
@@ -31,10 +36,6 @@ impl RenderBatch {
|
|||||||
})
|
})
|
||||||
.collect::<Vec<GpuInstance>>();
|
.collect::<Vec<GpuInstance>>();
|
||||||
|
|
||||||
if gpu_instances.is_empty() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build instances into a RenderBatch
|
// Build instances into a RenderBatch
|
||||||
let instance_buffer = Buffer::from_iter(
|
let instance_buffer = Buffer::from_iter(
|
||||||
allocator.clone(),
|
allocator.clone(),
|
||||||
|
|||||||
Reference in new issue
Block a user