Refactor resource caches and use it with textures now

This commit is contained in:
Keavon Chambers
2020-05-02 22:34:23 -07:00
parent 2ab74f7ba1
commit f4900dd919
8 changed files with 192 additions and 77 deletions

View File

@@ -1,7 +1,5 @@
use super::pipeline_cache::PipelineID;
pub struct DrawCommand {
pub pipeline_id: PipelineID,
pub pipeline_name: String,
pub bind_group: wgpu::BindGroup,
pub vertex_buffer: wgpu::Buffer,
pub index_buffer: wgpu::Buffer,
@@ -9,13 +7,13 @@ pub struct DrawCommand {
}
impl DrawCommand {
pub fn new(device: &wgpu::Device, pipeline_id: PipelineID, vertices: &[[f32; 2]], indices: &[u16], bind_group: wgpu::BindGroup) -> Self {
pub fn new(device: &wgpu::Device, pipeline_name: &str, 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,
pipeline_name: String::from(pipeline_name),
bind_group,
vertex_buffer,
index_buffer,