diff options
Diffstat (limited to 'wgpu/src/lib.rs')
-rw-r--r-- | wgpu/src/lib.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 2283cf71..b1998da7 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -280,13 +280,16 @@ impl Renderer { let scale = Transformation::scale(scale_factor); for layer in self.layers.iter() { - let Some(scissor_rect) = physical_bounds - .intersection(&(layer.bounds * scale_factor)) - .and_then(Rectangle::snap) + let Some(physical_bounds) = + physical_bounds.intersection(&(layer.bounds * scale_factor)) else { continue; }; + let Some(scissor_rect) = physical_bounds.snap() else { + continue; + }; + if !layer.quads.is_empty() { engine.quad_pipeline.render( quad_layer, @@ -557,6 +560,16 @@ impl core::svg::Renderer for Renderer { impl graphics::mesh::Renderer for Renderer { fn draw_mesh(&mut self, mesh: graphics::Mesh) { + debug_assert!( + !mesh.indices().is_empty(), + "Mesh must not have empty indices" + ); + + debug_assert!( + mesh.indices().len() % 3 == 0, + "Mesh indices length must be a multiple of 3" + ); + let (layer, transformation) = self.layers.current_mut(); layer.draw_mesh(mesh, transformation); } |