From 7559e4fb30a282271717f700cb6e420cdf6123f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Thu, 27 Aug 2020 19:35:24 +0200 Subject: [PATCH] Set offsets in buffer slices in `iced_wgpu` --- wgpu/src/triangle.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) 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); } }