Delegate layer_count logic to primitive pipelines
This commit is contained in:
parent
c90d153976
commit
2c733d96ac
3 changed files with 17 additions and 12 deletions
|
|
@ -277,21 +277,12 @@ impl Renderer {
|
|||
}
|
||||
|
||||
if !layer.triangles.is_empty() {
|
||||
mesh_layer += layer
|
||||
.triangles
|
||||
.iter()
|
||||
.filter(|item| {
|
||||
matches!(item, triangle::Item::Group { .. })
|
||||
})
|
||||
.count();
|
||||
mesh_layer +=
|
||||
triangle::Pipeline::layer_count(&layer.triangles);
|
||||
}
|
||||
|
||||
if !layer.text.is_empty() {
|
||||
text_layer += layer
|
||||
.text
|
||||
.iter()
|
||||
.filter(|item| matches!(item, text::Item::Group { .. }))
|
||||
.count();
|
||||
text_layer += text::Pipeline::layer_count(&layer.text);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "svg", feature = "image"))]
|
||||
|
|
|
|||
|
|
@ -302,6 +302,13 @@ impl Pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn layer_count(batch: &Batch) -> usize {
|
||||
batch
|
||||
.iter()
|
||||
.filter(|item| matches!(item, Item::Group { .. }))
|
||||
.count()
|
||||
}
|
||||
|
||||
pub fn prepare(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
|
|
|
|||
|
|
@ -177,6 +177,13 @@ impl Pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn layer_count(items: &[Item]) -> usize {
|
||||
items
|
||||
.iter()
|
||||
.filter(|item| matches!(item, Item::Group { .. }))
|
||||
.count()
|
||||
}
|
||||
|
||||
pub fn prepare(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue