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() {
|
if !layer.triangles.is_empty() {
|
||||||
mesh_layer += layer
|
mesh_layer +=
|
||||||
.triangles
|
triangle::Pipeline::layer_count(&layer.triangles);
|
||||||
.iter()
|
|
||||||
.filter(|item| {
|
|
||||||
matches!(item, triangle::Item::Group { .. })
|
|
||||||
})
|
|
||||||
.count();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !layer.text.is_empty() {
|
if !layer.text.is_empty() {
|
||||||
text_layer += layer
|
text_layer += text::Pipeline::layer_count(&layer.text);
|
||||||
.text
|
|
||||||
.iter()
|
|
||||||
.filter(|item| matches!(item, text::Item::Group { .. }))
|
|
||||||
.count();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "svg", feature = "image"))]
|
#[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(
|
pub fn prepare(
|
||||||
&mut self,
|
&mut self,
|
||||||
device: &wgpu::Device,
|
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(
|
pub fn prepare(
|
||||||
&mut self,
|
&mut self,
|
||||||
device: &wgpu::Device,
|
device: &wgpu::Device,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue