1use mtl_foundation::UInteger;
6
7#[repr(transparent)]
11#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
12pub struct SamplerMinMagFilter(pub UInteger);
13
14impl SamplerMinMagFilter {
15 pub const NEAREST: Self = Self(0);
16 pub const LINEAR: Self = Self(1);
17}
18
19#[repr(transparent)]
23#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
24pub struct SamplerMipFilter(pub UInteger);
25
26impl SamplerMipFilter {
27 pub const NOT_MIPMAPPED: Self = Self(0);
28 pub const NEAREST: Self = Self(1);
29 pub const LINEAR: Self = Self(2);
30}
31
32#[repr(transparent)]
36#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
37pub struct SamplerAddressMode(pub UInteger);
38
39impl SamplerAddressMode {
40 pub const CLAMP_TO_EDGE: Self = Self(0);
41 pub const MIRROR_CLAMP_TO_EDGE: Self = Self(1);
42 pub const REPEAT: Self = Self(2);
43 pub const MIRROR_REPEAT: Self = Self(3);
44 pub const CLAMP_TO_ZERO: Self = Self(4);
45 pub const CLAMP_TO_BORDER_COLOR: Self = Self(5);
46}
47
48#[repr(transparent)]
52#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
53pub struct SamplerBorderColor(pub UInteger);
54
55impl SamplerBorderColor {
56 pub const TRANSPARENT_BLACK: Self = Self(0);
57 pub const OPAQUE_BLACK: Self = Self(1);
58 pub const OPAQUE_WHITE: Self = Self(2);
59}
60
61#[repr(transparent)]
65#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
66pub struct SamplerReductionMode(pub UInteger);
67
68impl SamplerReductionMode {
69 pub const WEIGHTED_AVERAGE: Self = Self(0);
70 pub const MINIMUM: Self = Self(1);
71 pub const MAXIMUM: Self = Self(2);
72}
73
74#[cfg(test)]
75mod tests {
76 use super::*;
77
78 #[test]
79 fn test_sampler_filter_values() {
80 assert_eq!(SamplerMinMagFilter::NEAREST.0, 0);
81 assert_eq!(SamplerMinMagFilter::LINEAR.0, 1);
82 }
83
84 #[test]
85 fn test_sampler_address_mode_values() {
86 assert_eq!(SamplerAddressMode::CLAMP_TO_EDGE.0, 0);
87 assert_eq!(SamplerAddressMode::CLAMP_TO_BORDER_COLOR.0, 5);
88 }
89}