diff --git a/wgpu/src/triangle.rs b/wgpu/src/triangle.rs index a5789a61..6ae46cba 100644 --- a/wgpu/src/triangle.rs +++ b/wgpu/src/triangle.rs @@ -379,17 +379,20 @@ impl Pipeline { &[(std::mem::size_of::() * i) as u32], ); - render_pass.set_index_buffer(self.index_buffer.raw.slice(..)); - - render_pass - .set_vertex_buffer(0, self.vertex_buffer.raw.slice(..)); - - render_pass.draw_indexed( - index_offset as u32 - ..(index_offset as usize + indices) as u32, - vertex_offset as i32, - 0..1, + render_pass.set_index_buffer( + self.index_buffer + .raw + .slice(index_offset * mem::size_of::() as u64..), ); + + render_pass.set_vertex_buffer( + 0, + self.vertex_buffer.raw.slice( + vertex_offset * mem::size_of::() as u64.., + ), + ); + + render_pass.draw_indexed(0..indices as u32, 0, 0..1); } }