Merge pull request #2701 from edwloef/2700-fix
always increment quad, mesh, text and image layer counts in wgpu layer rendering
This commit is contained in:
commit
c0db7b8e1f
3 changed files with 34 additions and 5 deletions
|
|
@ -268,13 +268,28 @@ impl Renderer {
|
||||||
let scale = Transformation::scale(scale_factor);
|
let scale = Transformation::scale(scale_factor);
|
||||||
|
|
||||||
for layer in self.layers.iter() {
|
for layer in self.layers.iter() {
|
||||||
let Some(physical_bounds) =
|
let Some(scissor_rect) = physical_bounds
|
||||||
physical_bounds.intersection(&(layer.bounds * scale))
|
.intersection(&(layer.bounds * scale))
|
||||||
|
.and_then(Rectangle::snap)
|
||||||
else {
|
else {
|
||||||
continue;
|
if !layer.quads.is_empty() {
|
||||||
};
|
quad_layer += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if !layer.triangles.is_empty() {
|
||||||
|
mesh_layer +=
|
||||||
|
triangle::Pipeline::layer_count(&layer.triangles);
|
||||||
|
}
|
||||||
|
|
||||||
|
if !layer.text.is_empty() {
|
||||||
|
text_layer += text::Pipeline::layer_count(&layer.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "svg", feature = "image"))]
|
||||||
|
if !layer.images.is_empty() {
|
||||||
|
image_layer += 1;
|
||||||
|
}
|
||||||
|
|
||||||
let Some(scissor_rect) = physical_bounds.snap() else {
|
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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