diff options
author | 2025-02-03 11:53:45 +0100 | |
---|---|---|
committer | 2025-02-04 01:21:10 +0100 | |
commit | 8ca04bf69d0aa45e67297d82ae069815dd7c0043 (patch) | |
tree | b2c880f1d33f2e2a2442a434c94f293dcac8605e /wgpu | |
parent | 0c0651de5b1722194d48c19cd645e747fb72ccb6 (diff) | |
download | iced-8ca04bf69d0aa45e67297d82ae069815dd7c0043.tar.gz iced-8ca04bf69d0aa45e67297d82ae069815dd7c0043.tar.bz2 iced-8ca04bf69d0aa45e67297d82ae069815dd7c0043.zip |
Add debug assertions to `draw_mesh` in `wgpu` renderer
Diffstat (limited to 'wgpu')
-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); } |