Update wgpu from 0.4 to 0.5 (currently it's not rendering)

This commit is contained in:
Keavon Chambers
2020-05-02 14:44:28 -07:00
parent b30ee294a6
commit 323a951362
12 changed files with 562 additions and 388 deletions

25
src/draw_command.rs Normal file
View File

@@ -0,0 +1,25 @@
use super::pipeline_cache::PipelineID;
pub struct DrawCommand {
pub pipeline_id: PipelineID,
pub bind_group: wgpu::BindGroup,
pub vertex_buffer: wgpu::Buffer,
pub index_buffer: wgpu::Buffer,
pub index_count: u32,
}
impl DrawCommand {
pub fn new(device: &wgpu::Device, pipeline_id: PipelineID, vertices: &[[f32; 2]], indices: &[u16], bind_group: wgpu::BindGroup) -> Self {
let vertex_buffer = device.create_buffer_with_data(bytemuck::cast_slice(vertices), wgpu::BufferUsage::VERTEX);
let index_buffer = device.create_buffer_with_data(bytemuck::cast_slice(indices), wgpu::BufferUsage::INDEX);
let index_count = indices.len() as u32;
Self {
pipeline_id,
bind_group,
vertex_buffer,
index_buffer,
index_count,
}
}
}