1use crate::pso;
2use std::fmt;
3
4#[repr(C)]
6#[derive(Clone, Copy)]
7pub union ClearColor {
8 pub float32: [f32; 4],
10 pub sint32: [i32; 4],
12 pub uint32: [u32; 4],
14}
15
16impl fmt::Debug for ClearColor {
17 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18 writeln![f, "ClearColor"]
19 }
20}
21
22#[repr(C)]
24#[derive(Clone, Copy, Debug)]
25#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
26pub struct ClearDepthStencil {
27 pub depth: f32,
29 pub stencil: u32,
31}
32
33#[repr(C)]
38#[derive(Clone, Copy)]
39pub union ClearValue {
40 pub color: ClearColor,
42 pub depth_stencil: ClearDepthStencil,
44 _align: [u32; 4],
45}
46
47impl fmt::Debug for ClearValue {
48 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
49 f.debug_struct("ClearValue")
50 .field("color", unsafe { &self.color.uint32 })
51 .field("depth_stencil", unsafe { &self.depth_stencil })
52 .finish()
53 }
54}
55
56impl Default for ClearValue {
57 fn default() -> Self {
58 ClearValue { _align: [0; 4] }
59 }
60}
61
62#[derive(Clone, Copy, Debug)]
64pub enum AttachmentClear {
65 Color {
67 index: usize,
69 value: ClearColor,
71 },
72 DepthStencil {
74 depth: Option<pso::DepthValue>,
76 stencil: Option<pso::StencilValue>,
78 },
79}