1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use super::Operations;
use crate::{renderer::TextureId, Color};
#[derive(Debug, Clone)]
pub enum TextureAttachment {
Id(TextureId),
Name(String),
Input(String),
}
impl TextureAttachment {
pub fn get_texture_id(&self) -> Option<TextureId> {
if let TextureAttachment::Id(texture_id) = self {
Some(*texture_id)
} else {
None
}
}
}
#[derive(Clone, Debug)]
pub struct ClearColor(pub Color);
impl Default for ClearColor {
fn default() -> Self {
Self(Color::rgb(0.1, 0.1, 0.1))
}
}
#[derive(Debug, Clone)]
pub struct RenderPassColorAttachmentDescriptor {
pub attachment: TextureAttachment,
pub resolve_target: Option<TextureAttachment>,
pub ops: Operations<Color>,
}
#[derive(Debug, Clone)]
pub struct RenderPassDepthStencilAttachmentDescriptor {
pub attachment: TextureAttachment,
pub depth_ops: Option<Operations<f32>>,
pub stencil_ops: Option<Operations<u32>>,
}
#[derive(Debug, Clone)]
pub struct PassDescriptor {
pub color_attachments: Vec<RenderPassColorAttachmentDescriptor>,
pub depth_stencil_attachment: Option<RenderPassDepthStencilAttachmentDescriptor>,
pub sample_count: u32,
}