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
use super::*;
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct StencilState {
/// Front-facing fragment tests.
pub front: StencilFaceState,
/// Back-facing fragment tests.
pub back: StencilFaceState,
/// Specifies the reference value for the stencil test. Default is 0.
pub reference: i32,
/// Specifies a mask that is `&`ed with both the reference value and the stored stencil value
/// when the test is done. The initial value is all 1's.
pub read_mask: u32,
/// Specifies a bit mask to enable and disable writing of individual bits in the stencil planes.
/// Initially, the mask is all 1's.
pub write_mask: u32,
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct StencilFaceState {
/// Used to determine if the stencil test passes or fails.
pub compare: Comparison,
/// Operation to use when stencil test fails.
pub fail_op: StencilOp,
/// Operation to use when stencil test passes, but depth test fails.
pub depth_fail_op: StencilOp,
/// Operation to use when both stencil and depth test pass,
/// or when stencil pass and no depth or depth is disabled.
pub pass_op: StencilOp,
}
/// Stencil operations performed on value after comparison.
#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)]
pub enum StencilOp {
#[default]
Keep,
Zero,
Replace,
IncrementClamp,
DecrementClamp,
Invert,
IncrementWrap,
DecrementWrap,
}