Skip to main content

spirv_webgpu_transform/
correction.rs

1use super::*;
2
3#[repr(u16)]
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub enum CorrectionType {
6    /// A combined image sampler has been split, a new `sampler` object should be inserted.
7    SplitCombined = 0,
8    /// A mixed depth texture / sampler has been duplicated, insert the same object again with a `Regular` bind type.
9    SplitDrefRegular = 1,
10    /// A mixed depth texture / sampler has been duplicated, insert the same object again with a
11    /// `Comparison` bind type.
12    SplitDrefComparison = 2,
13}
14
15#[derive(Debug, Clone, Default, PartialEq, Eq)]
16pub struct CorrectionBinding {
17    /// In order, what additional bindings have been appended to this one.
18    pub corrections: Vec<CorrectionType>,
19}
20
21#[derive(Debug, Clone, Default, PartialEq, Eq)]
22pub struct CorrectionSet {
23    pub bindings: HashMap<u32, CorrectionBinding>,
24}
25
26/// Lookup a set and a binding for a list of [`CorrectionType`].
27/// In order, insert a new variable for each, see [`CorrectionType`] for what type of object should
28/// be inserted for each variant.
29#[derive(Debug, Clone, Default, PartialEq, Eq)]
30pub struct CorrectionMap {
31    pub sets: HashMap<u32, CorrectionSet>,
32}