Add Pipelines

This commit is contained in:
Hanno Braun 2024-11-22 18:53:47 +01:00
parent d2a4d60b52
commit ccd9b7d472
2 changed files with 13 additions and 7 deletions

View File

@ -3,6 +3,11 @@ use super::{
shaders::{Shaders, Vertex},
};
pub struct Pipelines {
pub vertices: Pipeline,
pub triangles: Pipeline,
}
pub struct Pipeline {
render_pipeline: wgpu::RenderPipeline,
bind_group: wgpu::BindGroup,

View File

@ -9,7 +9,7 @@ use crate::geometry::Operation;
use super::{
geometry::Geometry,
pipelines::Pipeline,
pipelines::{Pipeline, Pipelines},
shaders::{Shaders, Uniforms},
};
@ -17,8 +17,7 @@ pub struct Renderer {
pub surface: wgpu::Surface<'static>,
pub device: wgpu::Device,
pub queue: wgpu::Queue,
pub vertices_pipeline: Pipeline,
pub triangles_pipeline: Pipeline,
pub pipelines: Pipelines,
pub depth_view: wgpu::TextureView,
}
@ -94,8 +93,10 @@ impl Renderer {
surface,
device,
queue,
vertices_pipeline,
triangles_pipeline,
pipelines: Pipelines {
vertices: vertices_pipeline,
triangles: triangles_pipeline,
},
depth_view,
})
}
@ -140,13 +141,13 @@ impl Renderer {
});
}
self.vertices_pipeline.draw(
self.pipelines.vertices.draw(
&mut encoder,
&color_view,
&self.depth_view,
&vertices,
);
self.triangles_pipeline.draw(
self.pipelines.triangles.draw(
&mut encoder,
&color_view,
&self.depth_view,