mtl_gpu/enums/
data_type.rs1use mtl_foundation::UInteger;
6
7#[repr(transparent)]
11#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
12pub struct DataType(pub UInteger);
13
14impl DataType {
15 pub const NONE: Self = Self(0);
17 pub const STRUCT: Self = Self(1);
18 pub const ARRAY: Self = Self(2);
19
20 pub const FLOAT: Self = Self(3);
22 pub const FLOAT2: Self = Self(4);
23 pub const FLOAT3: Self = Self(5);
24 pub const FLOAT4: Self = Self(6);
25
26 pub const FLOAT2X2: Self = Self(7);
28 pub const FLOAT2X3: Self = Self(8);
29 pub const FLOAT2X4: Self = Self(9);
30 pub const FLOAT3X2: Self = Self(10);
31 pub const FLOAT3X3: Self = Self(11);
32 pub const FLOAT3X4: Self = Self(12);
33 pub const FLOAT4X2: Self = Self(13);
34 pub const FLOAT4X3: Self = Self(14);
35 pub const FLOAT4X4: Self = Self(15);
36
37 pub const HALF: Self = Self(16);
39 pub const HALF2: Self = Self(17);
40 pub const HALF3: Self = Self(18);
41 pub const HALF4: Self = Self(19);
42
43 pub const HALF2X2: Self = Self(20);
45 pub const HALF2X3: Self = Self(21);
46 pub const HALF2X4: Self = Self(22);
47 pub const HALF3X2: Self = Self(23);
48 pub const HALF3X3: Self = Self(24);
49 pub const HALF3X4: Self = Self(25);
50 pub const HALF4X2: Self = Self(26);
51 pub const HALF4X3: Self = Self(27);
52 pub const HALF4X4: Self = Self(28);
53
54 pub const INT: Self = Self(29);
56 pub const INT2: Self = Self(30);
57 pub const INT3: Self = Self(31);
58 pub const INT4: Self = Self(32);
59
60 pub const UINT: Self = Self(33);
62 pub const UINT2: Self = Self(34);
63 pub const UINT3: Self = Self(35);
64 pub const UINT4: Self = Self(36);
65
66 pub const SHORT: Self = Self(37);
68 pub const SHORT2: Self = Self(38);
69 pub const SHORT3: Self = Self(39);
70 pub const SHORT4: Self = Self(40);
71
72 pub const USHORT: Self = Self(41);
74 pub const USHORT2: Self = Self(42);
75 pub const USHORT3: Self = Self(43);
76 pub const USHORT4: Self = Self(44);
77
78 pub const CHAR: Self = Self(45);
80 pub const CHAR2: Self = Self(46);
81 pub const CHAR3: Self = Self(47);
82 pub const CHAR4: Self = Self(48);
83
84 pub const UCHAR: Self = Self(49);
86 pub const UCHAR2: Self = Self(50);
87 pub const UCHAR3: Self = Self(51);
88 pub const UCHAR4: Self = Self(52);
89
90 pub const BOOL: Self = Self(53);
92 pub const BOOL2: Self = Self(54);
93 pub const BOOL3: Self = Self(55);
94 pub const BOOL4: Self = Self(56);
95
96 pub const TEXTURE: Self = Self(58);
98 pub const SAMPLER: Self = Self(59);
99 pub const POINTER: Self = Self(60);
100
101 pub const R8_UNORM: Self = Self(62);
103 pub const R8_SNORM: Self = Self(63);
104 pub const R16_UNORM: Self = Self(64);
105 pub const R16_SNORM: Self = Self(65);
106 pub const RG8_UNORM: Self = Self(66);
107 pub const RG8_SNORM: Self = Self(67);
108 pub const RG16_UNORM: Self = Self(68);
109 pub const RG16_SNORM: Self = Self(69);
110 pub const RGBA8_UNORM: Self = Self(70);
111 pub const RGBA8_UNORM_SRGB: Self = Self(71);
112 pub const RGBA8_SNORM: Self = Self(72);
113 pub const RGBA16_UNORM: Self = Self(73);
114 pub const RGBA16_SNORM: Self = Self(74);
115 pub const RGB10A2_UNORM: Self = Self(75);
116 pub const RG11B10_FLOAT: Self = Self(76);
117 pub const RGB9E5_FLOAT: Self = Self(77);
118
119 pub const RENDER_PIPELINE: Self = Self(78);
121 pub const COMPUTE_PIPELINE: Self = Self(79);
122 pub const INDIRECT_COMMAND_BUFFER: Self = Self(80);
123
124 pub const LONG: Self = Self(81);
126 pub const LONG2: Self = Self(82);
127 pub const LONG3: Self = Self(83);
128 pub const LONG4: Self = Self(84);
129
130 pub const ULONG: Self = Self(85);
132 pub const ULONG2: Self = Self(86);
133 pub const ULONG3: Self = Self(87);
134 pub const ULONG4: Self = Self(88);
135
136 pub const VISIBLE_FUNCTION_TABLE: Self = Self(115);
138 pub const INTERSECTION_FUNCTION_TABLE: Self = Self(116);
139 pub const PRIMITIVE_ACCELERATION_STRUCTURE: Self = Self(117);
140 pub const INSTANCE_ACCELERATION_STRUCTURE: Self = Self(118);
141
142 pub const BFLOAT: Self = Self(121);
144 pub const BFLOAT2: Self = Self(122);
145 pub const BFLOAT3: Self = Self(123);
146 pub const BFLOAT4: Self = Self(124);
147
148 pub const DEPTH_STENCIL_STATE: Self = Self(139);
150 pub const TENSOR: Self = Self(140);
151}
152
153#[cfg(test)]
154mod tests {
155 use super::*;
156
157 #[test]
158 fn test_data_type_values() {
159 assert_eq!(DataType::NONE.0, 0);
160 assert_eq!(DataType::FLOAT.0, 3);
161 assert_eq!(DataType::FLOAT4.0, 6);
162 assert_eq!(DataType::TEXTURE.0, 58);
163 assert_eq!(DataType::TENSOR.0, 140);
164 }
165
166 #[test]
167 fn test_data_type_size() {
168 assert_eq!(
169 std::mem::size_of::<DataType>(),
170 std::mem::size_of::<UInteger>()
171 );
172 }
173}