mtl_gpu/enums/
argument.rs1use mtl_foundation::{Integer, UInteger};
6
7#[repr(transparent)]
11#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
12pub struct IndexType(pub UInteger);
13
14impl IndexType {
15 pub const UINT16: Self = Self(0);
16 pub const UINT32: Self = Self(1);
17}
18
19#[repr(transparent)]
23#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
24pub struct BindingType(pub Integer);
25
26impl BindingType {
27 pub const BUFFER: Self = Self(0);
28 pub const THREADGROUP_MEMORY: Self = Self(1);
29 pub const TEXTURE: Self = Self(2);
30 pub const SAMPLER: Self = Self(3);
31 pub const IMAGEBLOCK_DATA: Self = Self(16);
32 pub const IMAGEBLOCK: Self = Self(17);
33 pub const VISIBLE_FUNCTION_TABLE: Self = Self(24);
34 pub const PRIMITIVE_ACCELERATION_STRUCTURE: Self = Self(25);
35 pub const INSTANCE_ACCELERATION_STRUCTURE: Self = Self(26);
36 pub const INTERSECTION_FUNCTION_TABLE: Self = Self(27);
37 pub const OBJECT_PAYLOAD: Self = Self(34);
38 pub const TENSOR: Self = Self(37);
39}
40
41#[repr(transparent)]
45#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
46pub struct ArgumentType(pub UInteger);
47
48impl ArgumentType {
49 pub const BUFFER: Self = Self(0);
50 pub const THREADGROUP_MEMORY: Self = Self(1);
51 pub const TEXTURE: Self = Self(2);
52 pub const SAMPLER: Self = Self(3);
53 pub const IMAGEBLOCK_DATA: Self = Self(16);
54 pub const IMAGEBLOCK: Self = Self(17);
55 pub const VISIBLE_FUNCTION_TABLE: Self = Self(24);
56 pub const PRIMITIVE_ACCELERATION_STRUCTURE: Self = Self(25);
57 pub const INSTANCE_ACCELERATION_STRUCTURE: Self = Self(26);
58 pub const INTERSECTION_FUNCTION_TABLE: Self = Self(27);
59}
60
61#[repr(transparent)]
67#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
68pub struct BindingAccess(pub UInteger);
69
70impl BindingAccess {
71 pub const READ_ONLY: Self = Self(0);
72 pub const READ_WRITE: Self = Self(1);
73 pub const WRITE_ONLY: Self = Self(2);
74}
75
76pub type ArgumentAccess = BindingAccess;
80
81impl BindingAccess {
83 pub const ARGUMENT_ACCESS_READ_ONLY: Self = Self::READ_ONLY;
85 pub const ARGUMENT_ACCESS_READ_WRITE: Self = Self::READ_WRITE;
87 pub const ARGUMENT_ACCESS_WRITE_ONLY: Self = Self::WRITE_ONLY;
89}
90
91#[cfg(test)]
92mod tests {
93 use super::*;
94
95 #[test]
96 fn test_index_type_values() {
97 assert_eq!(IndexType::UINT16.0, 0);
98 assert_eq!(IndexType::UINT32.0, 1);
99 }
100
101 #[test]
102 fn test_binding_type_values() {
103 assert_eq!(BindingType::BUFFER.0, 0);
104 assert_eq!(BindingType::TEXTURE.0, 2);
105 assert_eq!(BindingType::TENSOR.0, 37);
106 }
107
108 #[test]
109 fn test_binding_access_values() {
110 assert_eq!(BindingAccess::READ_ONLY.0, 0);
111 assert_eq!(BindingAccess::READ_WRITE.0, 1);
112 assert_eq!(BindingAccess::WRITE_ONLY.0, 2);
113 }
114}