mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-09 20:38:30 +00:00
Inline redundant constructors
This commit is contained in:
parent
c710e63479
commit
bae966fa63
@ -1,6 +1,6 @@
|
|||||||
use super::{
|
use super::{
|
||||||
geometry::Geometry,
|
geometry::Geometry,
|
||||||
shaders::{Shaders, Vertex},
|
shaders::{Shaders, TrianglesVertex, Vertex, VerticesVertex},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Pipelines {
|
pub struct Pipelines {
|
||||||
@ -35,7 +35,10 @@ impl Pipeline {
|
|||||||
config: &wgpu::SurfaceConfiguration,
|
config: &wgpu::SurfaceConfiguration,
|
||||||
uniforms: &wgpu::Buffer,
|
uniforms: &wgpu::Buffer,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let vertices_shaders = Shaders::vertices(device, config);
|
let shader_module = device
|
||||||
|
.create_shader_module(wgpu::include_wgsl!("shaders/vertices.wgsl"));
|
||||||
|
let vertices_shaders =
|
||||||
|
Shaders::<VerticesVertex>::new(device, config, shader_module);
|
||||||
Self::new(device, &vertices_shaders, uniforms)
|
Self::new(device, &vertices_shaders, uniforms)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +47,11 @@ impl Pipeline {
|
|||||||
config: &wgpu::SurfaceConfiguration,
|
config: &wgpu::SurfaceConfiguration,
|
||||||
uniforms: &wgpu::Buffer,
|
uniforms: &wgpu::Buffer,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let triangles_shaders = Shaders::triangles(device, config);
|
let shader_module = device.create_shader_module(wgpu::include_wgsl!(
|
||||||
|
"shaders/triangles.wgsl"
|
||||||
|
));
|
||||||
|
let triangles_shaders =
|
||||||
|
Shaders::<TrianglesVertex>::new(device, config, shader_module);
|
||||||
Self::new(device, &triangles_shaders, uniforms)
|
Self::new(device, &triangles_shaders, uniforms)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,30 +9,6 @@ pub struct Shaders<V> {
|
|||||||
_vertex: PhantomData<V>,
|
_vertex: PhantomData<V>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Shaders<VerticesVertex> {
|
|
||||||
pub fn vertices(
|
|
||||||
device: &wgpu::Device,
|
|
||||||
config: &wgpu::SurfaceConfiguration,
|
|
||||||
) -> Self {
|
|
||||||
let shader_module =
|
|
||||||
device.create_shader_module(wgpu::include_wgsl!("vertices.wgsl"));
|
|
||||||
|
|
||||||
Self::new(device, config, shader_module)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Shaders<TrianglesVertex> {
|
|
||||||
pub fn triangles(
|
|
||||||
device: &wgpu::Device,
|
|
||||||
config: &wgpu::SurfaceConfiguration,
|
|
||||||
) -> Self {
|
|
||||||
let shader_module =
|
|
||||||
device.create_shader_module(wgpu::include_wgsl!("triangles.wgsl"));
|
|
||||||
|
|
||||||
Self::new(device, config, shader_module)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<V> Shaders<V> {
|
impl<V> Shaders<V> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
device: &wgpu::Device,
|
device: &wgpu::Device,
|
||||||
|
Loading…
Reference in New Issue
Block a user