Set offsets in buffer slices in `iced_wgpu`

This commit is contained in:
Héctor Ramón Jiménez 2020-08-27 19:35:24 +02:00
parent 8d605be4e3
commit 7559e4fb30
1 changed files with 13 additions and 10 deletions

View File

@ -379,17 +379,20 @@ impl Pipeline {
&[(std::mem::size_of::<Uniforms>() * 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::<u32>() as u64..),
);
render_pass.set_vertex_buffer(
0,
self.vertex_buffer.raw.slice(
vertex_offset * mem::size_of::<Vertex2D>() as u64..,
),
);
render_pass.draw_indexed(0..indices as u32, 0, 0..1);
}
}