srs2dge_core/shader/
mod.rs1use self::builder::ShaderBuilder;
2use crate::buffer::{index::Index, vertex::Vertex};
3use std::marker::PhantomData;
4use wgpu::{BindGroup, BindGroupLayout, Device, RenderPipeline, TextureFormat};
5
6pub mod builder;
9pub mod layout;
10pub mod module;
11pub mod prelude;
12
13pub struct Shader<V, I>
16where
17 V: Vertex,
18 I: Index,
19{
20 pub(crate) pipeline: RenderPipeline,
21 pub(crate) format: TextureFormat,
22
23 _p: PhantomData<(V, I)>,
24}
25
26pub trait Layout<'a> {
29 type Bindings;
30
31 fn bind_group_layout(device: &Device) -> BindGroupLayout;
32 fn bind_group(&self, bindings: Self::Bindings) -> BindGroup;
33}
34
35impl<V, I> Shader<V, I>
38where
39 V: Vertex,
40 I: Index,
41{
42 pub fn builder<'s>() -> ShaderBuilder<'s, V, I> {
43 ShaderBuilder::<'s, V, I>::new()
44 }
45}