From 3062c190bbcc82f30eaabc086a4e5014e320c8b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 4 Mar 2020 22:32:23 +0100 Subject: [PATCH] Fix offsets in `triangle` pipeline Yes, again... --- wgpu/src/triangle.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wgpu/src/triangle.rs b/wgpu/src/triangle.rs index 0a118bd2..85ed4bd5 100644 --- a/wgpu/src/triangle.rs +++ b/wgpu/src/triangle.rs @@ -330,12 +330,17 @@ impl Pipeline { &[(std::mem::size_of::() * i) as u64], ); - render_pass - .set_index_buffer(&self.index_buffer.raw, index_offset); + render_pass.set_index_buffer( + &self.index_buffer.raw, + index_offset * std::mem::size_of::() as u64, + ); render_pass.set_vertex_buffers( 0, - &[(&self.vertex_buffer.raw, vertex_offset)], + &[( + &self.vertex_buffer.raw, + vertex_offset * std::mem::size_of::() as u64, + )], ); render_pass.draw_indexed(0..indices as u32, 0, 0..1);