1use mtl_foundation::{Integer, UInteger};
6
7#[repr(transparent)]
11#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
12pub struct PatchType(pub UInteger);
13
14impl PatchType {
15 pub const NONE: Self = Self(0);
16 pub const TRIANGLE: Self = Self(1);
17 pub const QUAD: Self = Self(2);
18}
19
20#[repr(transparent)]
24#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
25pub struct FunctionType(pub UInteger);
26
27impl FunctionType {
28 pub const VERTEX: Self = Self(1);
29 pub const FRAGMENT: Self = Self(2);
30 pub const KERNEL: Self = Self(3);
31 pub const VISIBLE: Self = Self(5);
32 pub const INTERSECTION: Self = Self(6);
33 pub const MESH: Self = Self(7);
34 pub const OBJECT: Self = Self(8);
35}
36
37#[repr(transparent)]
41#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
42pub struct LanguageVersion(pub UInteger);
43
44impl LanguageVersion {
45 pub const VERSION_1_0: Self = Self(65536); pub const VERSION_1_1: Self = Self(65537); pub const VERSION_1_2: Self = Self(65538); pub const VERSION_2_0: Self = Self(131072); pub const VERSION_2_1: Self = Self(131073); pub const VERSION_2_2: Self = Self(131074); pub const VERSION_2_3: Self = Self(131075); pub const VERSION_2_4: Self = Self(131076); pub const VERSION_3_0: Self = Self(196608); pub const VERSION_3_1: Self = Self(196609); pub const VERSION_3_2: Self = Self(196610); pub const VERSION_4_0: Self = Self(262144); }
58
59#[repr(transparent)]
63#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
64pub struct LibraryType(pub Integer);
65
66impl LibraryType {
67 pub const EXECUTABLE: Self = Self(0);
68 pub const DYNAMIC: Self = Self(1);
69}
70
71#[repr(transparent)]
75#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
76pub struct LibraryOptimizationLevel(pub Integer);
77
78impl LibraryOptimizationLevel {
79 pub const DEFAULT: Self = Self(0);
80 pub const SIZE: Self = Self(1);
81}
82
83#[repr(transparent)]
87#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
88pub struct CompileSymbolVisibility(pub Integer);
89
90impl CompileSymbolVisibility {
91 pub const DEFAULT: Self = Self(0);
92 pub const HIDDEN: Self = Self(1);
93}
94
95#[repr(transparent)]
99#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
100pub struct MathMode(pub Integer);
101
102impl MathMode {
103 pub const SAFE: Self = Self(0);
104 pub const RELAXED: Self = Self(1);
105 pub const FAST: Self = Self(2);
106}
107
108#[repr(transparent)]
112#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
113pub struct MathFloatingPointFunctions(pub Integer);
114
115impl MathFloatingPointFunctions {
116 pub const FAST: Self = Self(0);
117 pub const PRECISE: Self = Self(1);
118}
119
120#[repr(transparent)]
124#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
125pub struct LibraryError(pub UInteger);
126
127impl LibraryError {
128 pub const UNSUPPORTED: Self = Self(1);
129 pub const INTERNAL: Self = Self(2);
130 pub const COMPILE_FAILURE: Self = Self(3);
131 pub const COMPILE_WARNING: Self = Self(4);
132 pub const FUNCTION_NOT_FOUND: Self = Self(5);
133 pub const FILE_NOT_FOUND: Self = Self(6);
134}
135
136#[repr(transparent)]
140#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
141pub struct DynamicLibraryError(pub UInteger);
142
143impl DynamicLibraryError {
144 pub const NONE: Self = Self(0);
145 pub const INVALID_FILE: Self = Self(1);
146 pub const COMPILATION_FAILURE: Self = Self(2);
147 pub const UNRESOLVED_INSTALL_NAME: Self = Self(3);
148 pub const DEPENDENCY_LOAD_FAILURE: Self = Self(4);
149 pub const UNSUPPORTED: Self = Self(5);
150}
151
152#[cfg(test)]
153mod tests {
154 use super::*;
155
156 #[test]
157 fn test_function_type_values() {
158 assert_eq!(FunctionType::VERTEX.0, 1);
159 assert_eq!(FunctionType::FRAGMENT.0, 2);
160 assert_eq!(FunctionType::KERNEL.0, 3);
161 assert_eq!(FunctionType::MESH.0, 7);
162 }
163
164 #[test]
165 fn test_language_version_values() {
166 assert_eq!(LanguageVersion::VERSION_1_0.0, 65536);
167 assert_eq!(LanguageVersion::VERSION_2_0.0, 131072);
168 assert_eq!(LanguageVersion::VERSION_3_0.0, 196608);
169 assert_eq!(LanguageVersion::VERSION_4_0.0, 262144);
170 }
171
172 #[test]
173 fn test_library_error_values() {
174 assert_eq!(LibraryError::UNSUPPORTED.0, 1);
175 assert_eq!(LibraryError::COMPILE_FAILURE.0, 3);
176 }
177
178 #[test]
179 fn test_patch_type_values() {
180 assert_eq!(PatchType::NONE.0, 0);
181 assert_eq!(PatchType::TRIANGLE.0, 1);
182 assert_eq!(PatchType::QUAD.0, 2);
183 }
184
185 #[test]
186 fn test_dynamic_library_error_values() {
187 assert_eq!(DynamicLibraryError::NONE.0, 0);
188 assert_eq!(DynamicLibraryError::INVALID_FILE.0, 1);
189 assert_eq!(DynamicLibraryError::COMPILATION_FAILURE.0, 2);
190 assert_eq!(DynamicLibraryError::UNRESOLVED_INSTALL_NAME.0, 3);
191 assert_eq!(DynamicLibraryError::DEPENDENCY_LOAD_FAILURE.0, 4);
192 assert_eq!(DynamicLibraryError::UNSUPPORTED.0, 5);
193 }
194}