mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-04 18:08:26 +00:00
Inline redundant constructors
This commit is contained in:
parent
6d35aed162
commit
ed81321bac
@ -15,8 +15,18 @@ impl Pipelines {
|
||||
config: &wgpu::SurfaceConfiguration,
|
||||
uniforms: &wgpu::Buffer,
|
||||
) -> Self {
|
||||
let vertices = Pipeline::vertices(device, config, uniforms);
|
||||
let triangles = Pipeline::triangles(device, config, uniforms);
|
||||
let vertices = Pipeline::<VerticesVertex>::new(
|
||||
device,
|
||||
config,
|
||||
wgpu::include_wgsl!("../shaders/vertices.wgsl"),
|
||||
uniforms,
|
||||
);
|
||||
let triangles = Pipeline::<TrianglesVertex>::new(
|
||||
device,
|
||||
config,
|
||||
wgpu::include_wgsl!("../shaders/triangles.wgsl"),
|
||||
uniforms,
|
||||
);
|
||||
|
||||
Self {
|
||||
vertices,
|
||||
|
@ -1,9 +1,6 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::render::{
|
||||
geometry::Geometry,
|
||||
shaders::{TrianglesVertex, Vertex, VerticesVertex},
|
||||
};
|
||||
use crate::render::{geometry::Geometry, shaders::Vertex};
|
||||
|
||||
pub struct Pipeline<V> {
|
||||
render_pipeline: wgpu::RenderPipeline,
|
||||
@ -11,36 +8,6 @@ pub struct Pipeline<V> {
|
||||
_vertex: PhantomData<V>,
|
||||
}
|
||||
|
||||
impl Pipeline<VerticesVertex> {
|
||||
pub fn vertices(
|
||||
device: &wgpu::Device,
|
||||
config: &wgpu::SurfaceConfiguration,
|
||||
uniforms: &wgpu::Buffer,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
device,
|
||||
config,
|
||||
wgpu::include_wgsl!("../shaders/vertices.wgsl"),
|
||||
uniforms,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Pipeline<TrianglesVertex> {
|
||||
pub fn triangles(
|
||||
device: &wgpu::Device,
|
||||
config: &wgpu::SurfaceConfiguration,
|
||||
uniforms: &wgpu::Buffer,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
device,
|
||||
config,
|
||||
wgpu::include_wgsl!("../shaders/triangles.wgsl"),
|
||||
uniforms,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<V> Pipeline<V> {
|
||||
pub fn new(
|
||||
device: &wgpu::Device,
|
||||
|
Loading…
Reference in New Issue
Block a user