Skip to content

Commit

Permalink
Merge pull request #2782 from edwloef/empty_meshes
Browse files Browse the repository at this point in the history
don't try to draw empty meshes in wgpu
  • Loading branch information
hecrj authored Feb 4, 2025
2 parents 1b01d67 + 8ca04bf commit 3f509c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 3f509c6

Please sign in to comment.