wde_renderer/passes/
pipeline_types.rs1use bevy::{asset::Handle, ecs::prelude::*};
2use wde_wgpu::{
3 bind_group::BindGroupLayout,
4 pipelines::BlendState,
5 render_pipeline::{DepthDescriptor, Face, RenderTopology, ShaderStages},
6 texture::TextureFormat
7};
8
9use crate::assets::Shader;
10
11#[derive(Clone)]
14pub struct PushConstantDescriptor {
15 pub stages: ShaderStages,
17 pub offset: u32,
19 pub size: u32
21}
22
23#[derive(Resource, Clone)]
25pub struct RenderPipelineDescriptor {
26 pub label: &'static str,
27 pub vert: Option<Handle<Shader>>,
28 pub frag: Option<Handle<Shader>>,
29
30 pub depth: DepthDescriptor,
32 pub render_targets: Option<Vec<TextureFormat>>,
34
35 pub bind_group_layouts: Vec<Option<BindGroupLayout>>,
37 pub push_constants: Vec<PushConstantDescriptor>,
39
40 pub topology: RenderTopology,
42 pub cull_mode: Option<Face>,
44 pub fragment_blend: Option<BlendState>,
46 pub sample_count: u32,
48 pub vertex_buffer: bool
50}
51impl Default for RenderPipelineDescriptor {
52 fn default() -> Self {
53 Self {
54 label: "Unknown Render Pipeline",
55 vert: None,
56 frag: None,
57 depth: DepthDescriptor::default(),
58 render_targets: None,
59 bind_group_layouts: vec![],
60 push_constants: vec![],
61 topology: RenderTopology::TriangleList,
62 cull_mode: Some(Face::Back),
63 fragment_blend: Some(BlendState::REPLACE),
64 sample_count: 1,
65 vertex_buffer: true
66 }
67 }
68}
69
70#[derive(Resource, Clone)]
72pub struct ComputePipelineDescriptor {
73 pub label: &'static str,
74 pub comp: Option<Handle<Shader>>,
75
76 pub bind_group_layouts: Vec<Option<BindGroupLayout>>,
78 pub push_constants: Vec<PushConstantDescriptor>
80}
81impl Default for ComputePipelineDescriptor {
82 fn default() -> Self {
83 Self {
84 label: "Unknown Compute Pipeline",
85 comp: None,
86 bind_group_layouts: vec![],
87 push_constants: vec![]
88 }
89 }
90}