diff options
-rw-r--r-- | wgpu/src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 2283cf71..9c9fcb31 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -557,6 +557,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); } |