summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu')
-rw-r--r--wgpu/src/lib.rs34
1 files changed, 29 insertions, 5 deletions
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs
index d79f0dc8..a138ed15 100644
--- a/wgpu/src/lib.rs
+++ b/wgpu/src/lib.rs
@@ -268,13 +268,37 @@ impl Renderer {
let scale = Transformation::scale(scale_factor);
for layer in self.layers.iter() {
- let Some(physical_bounds) =
- physical_bounds.intersection(&(layer.bounds * scale))
+ let Some(scissor_rect) = physical_bounds
+ .intersection(&(layer.bounds * scale))
+ .and_then(Rectangle::snap)
else {
- continue;
- };
+ if !layer.quads.is_empty() {
+ quad_layer += 1;
+ }
+
+ if !layer.triangles.is_empty() {
+ mesh_layer += layer
+ .triangles
+ .iter()
+ .filter(|item| {
+ matches!(item, triangle::Item::Group { .. })
+ })
+ .count();
+ }
+
+ if !layer.text.is_empty() {
+ text_layer += layer
+ .text
+ .iter()
+ .filter(|item| matches!(item, text::Item::Group { .. }))
+ .count();
+ }
+
+ #[cfg(any(feature = "svg", feature = "image"))]
+ if !layer.images.is_empty() {
+ image_layer += 1;
+ }
- let Some(scissor_rect) = physical_bounds.snap() else {
continue;
};