1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
/// A handle which can provide the texture index for a push constant.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct SamplerHandle(u32);

impl SamplerHandle {
    pub(super) fn new(index: u32) -> Self {
        SamplerHandle(index)
    }

    /// Return the raw index for this sampler listing.
    pub(super) fn index(&self) -> u32 {
        let SamplerHandle(index) = self;
        *index
    }
}

impl Default for SamplerHandle {
    /// Return a sampler handle for the texture atlas's default sampler.
    fn default() -> Self {
        SamplerHandle(0)
    }
}