1use mtl_foundation::UInteger;
6
7#[repr(transparent)]
11#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
12pub struct VertexFormat(pub UInteger);
13
14impl VertexFormat {
15 pub const INVALID: Self = Self(0);
16 pub const UCHAR2: Self = Self(1);
17 pub const UCHAR3: Self = Self(2);
18 pub const UCHAR4: Self = Self(3);
19 pub const CHAR2: Self = Self(4);
20 pub const CHAR3: Self = Self(5);
21 pub const CHAR4: Self = Self(6);
22 pub const UCHAR2_NORMALIZED: Self = Self(7);
23 pub const UCHAR3_NORMALIZED: Self = Self(8);
24 pub const UCHAR4_NORMALIZED: Self = Self(9);
25 pub const CHAR2_NORMALIZED: Self = Self(10);
26 pub const CHAR3_NORMALIZED: Self = Self(11);
27 pub const CHAR4_NORMALIZED: Self = Self(12);
28 pub const USHORT2: Self = Self(13);
29 pub const USHORT3: Self = Self(14);
30 pub const USHORT4: Self = Self(15);
31 pub const SHORT2: Self = Self(16);
32 pub const SHORT3: Self = Self(17);
33 pub const SHORT4: Self = Self(18);
34 pub const USHORT2_NORMALIZED: Self = Self(19);
35 pub const USHORT3_NORMALIZED: Self = Self(20);
36 pub const USHORT4_NORMALIZED: Self = Self(21);
37 pub const SHORT2_NORMALIZED: Self = Self(22);
38 pub const SHORT3_NORMALIZED: Self = Self(23);
39 pub const SHORT4_NORMALIZED: Self = Self(24);
40 pub const HALF2: Self = Self(25);
41 pub const HALF3: Self = Self(26);
42 pub const HALF4: Self = Self(27);
43 pub const FLOAT: Self = Self(28);
44 pub const FLOAT2: Self = Self(29);
45 pub const FLOAT3: Self = Self(30);
46 pub const FLOAT4: Self = Self(31);
47 pub const INT: Self = Self(32);
48 pub const INT2: Self = Self(33);
49 pub const INT3: Self = Self(34);
50 pub const INT4: Self = Self(35);
51 pub const UINT: Self = Self(36);
52 pub const UINT2: Self = Self(37);
53 pub const UINT3: Self = Self(38);
54 pub const UINT4: Self = Self(39);
55 pub const INT1010102_NORMALIZED: Self = Self(40);
56 pub const UINT1010102_NORMALIZED: Self = Self(41);
57 pub const UCHAR4_NORMALIZED_BGRA: Self = Self(42);
58 pub const UCHAR: Self = Self(45);
59 pub const CHAR: Self = Self(46);
60 pub const UCHAR_NORMALIZED: Self = Self(47);
61 pub const CHAR_NORMALIZED: Self = Self(48);
62 pub const USHORT: Self = Self(49);
63 pub const SHORT: Self = Self(50);
64 pub const USHORT_NORMALIZED: Self = Self(51);
65 pub const SHORT_NORMALIZED: Self = Self(52);
66 pub const HALF: Self = Self(53);
67 pub const FLOAT_RG11B10: Self = Self(54);
68 pub const FLOAT_RGB9E5: Self = Self(55);
69}
70
71#[repr(transparent)]
75#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
76pub struct VertexStepFunction(pub UInteger);
77
78impl VertexStepFunction {
79 pub const CONSTANT: Self = Self(0);
80 pub const PER_VERTEX: Self = Self(1);
81 pub const PER_INSTANCE: Self = Self(2);
82 pub const PER_PATCH: Self = Self(3);
83 pub const PER_PATCH_CONTROL_POINT: Self = Self(4);
84}
85
86#[repr(transparent)]
92#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
93pub struct AttributeFormat(pub UInteger);
94
95impl AttributeFormat {
96 pub const INVALID: Self = Self(0);
97 pub const UCHAR2: Self = Self(1);
98 pub const UCHAR3: Self = Self(2);
99 pub const UCHAR4: Self = Self(3);
100 pub const CHAR2: Self = Self(4);
101 pub const CHAR3: Self = Self(5);
102 pub const CHAR4: Self = Self(6);
103 pub const UCHAR2_NORMALIZED: Self = Self(7);
104 pub const UCHAR3_NORMALIZED: Self = Self(8);
105 pub const UCHAR4_NORMALIZED: Self = Self(9);
106 pub const CHAR2_NORMALIZED: Self = Self(10);
107 pub const CHAR3_NORMALIZED: Self = Self(11);
108 pub const CHAR4_NORMALIZED: Self = Self(12);
109 pub const USHORT2: Self = Self(13);
110 pub const USHORT3: Self = Self(14);
111 pub const USHORT4: Self = Self(15);
112 pub const SHORT2: Self = Self(16);
113 pub const SHORT3: Self = Self(17);
114 pub const SHORT4: Self = Self(18);
115 pub const USHORT2_NORMALIZED: Self = Self(19);
116 pub const USHORT3_NORMALIZED: Self = Self(20);
117 pub const USHORT4_NORMALIZED: Self = Self(21);
118 pub const SHORT2_NORMALIZED: Self = Self(22);
119 pub const SHORT3_NORMALIZED: Self = Self(23);
120 pub const SHORT4_NORMALIZED: Self = Self(24);
121 pub const HALF2: Self = Self(25);
122 pub const HALF3: Self = Self(26);
123 pub const HALF4: Self = Self(27);
124 pub const FLOAT: Self = Self(28);
125 pub const FLOAT2: Self = Self(29);
126 pub const FLOAT3: Self = Self(30);
127 pub const FLOAT4: Self = Self(31);
128 pub const INT: Self = Self(32);
129 pub const INT2: Self = Self(33);
130 pub const INT3: Self = Self(34);
131 pub const INT4: Self = Self(35);
132 pub const UINT: Self = Self(36);
133 pub const UINT2: Self = Self(37);
134 pub const UINT3: Self = Self(38);
135 pub const UINT4: Self = Self(39);
136 pub const INT1010102_NORMALIZED: Self = Self(40);
137 pub const UINT1010102_NORMALIZED: Self = Self(41);
138 pub const UCHAR4_NORMALIZED_BGRA: Self = Self(42);
139 pub const UCHAR: Self = Self(45);
140 pub const CHAR: Self = Self(46);
141 pub const UCHAR_NORMALIZED: Self = Self(47);
142 pub const CHAR_NORMALIZED: Self = Self(48);
143 pub const USHORT: Self = Self(49);
144 pub const SHORT: Self = Self(50);
145 pub const USHORT_NORMALIZED: Self = Self(51);
146 pub const SHORT_NORMALIZED: Self = Self(52);
147 pub const HALF: Self = Self(53);
148 pub const FLOAT_RG11B10: Self = Self(54);
149 pub const FLOAT_RGB9E5: Self = Self(55);
150}
151
152#[repr(transparent)]
156#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
157pub struct StepFunction(pub UInteger);
158
159impl StepFunction {
160 pub const CONSTANT: Self = Self(0);
161 pub const PER_VERTEX: Self = Self(1);
162 pub const PER_INSTANCE: Self = Self(2);
163 pub const PER_PATCH: Self = Self(3);
164 pub const PER_PATCH_CONTROL_POINT: Self = Self(4);
165 pub const THREAD_POSITION_IN_GRID_X: Self = Self(5);
166 pub const THREAD_POSITION_IN_GRID_Y: Self = Self(6);
167 pub const THREAD_POSITION_IN_GRID_X_INDEXED: Self = Self(7);
168 pub const THREAD_POSITION_IN_GRID_Y_INDEXED: Self = Self(8);
169}
170
171#[cfg(test)]
172mod tests {
173 use super::*;
174
175 #[test]
176 fn test_vertex_format_values() {
177 assert_eq!(VertexFormat::INVALID.0, 0);
178 assert_eq!(VertexFormat::FLOAT.0, 28);
179 assert_eq!(VertexFormat::FLOAT4.0, 31);
180 assert_eq!(VertexFormat::FLOAT_RGB9E5.0, 55);
181 }
182
183 #[test]
184 fn test_vertex_step_function_values() {
185 assert_eq!(VertexStepFunction::CONSTANT.0, 0);
186 assert_eq!(VertexStepFunction::PER_VERTEX.0, 1);
187 assert_eq!(VertexStepFunction::PER_PATCH_CONTROL_POINT.0, 4);
188 }
189
190 #[test]
191 fn test_step_function_values() {
192 assert_eq!(StepFunction::CONSTANT.0, 0);
193 assert_eq!(StepFunction::THREAD_POSITION_IN_GRID_Y_INDEXED.0, 8);
194 }
195}