mtl_gpu/enums/
pixel_format.rs1use mtl_foundation::UInteger;
6
7#[repr(transparent)]
11#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
12pub struct PixelFormat(pub UInteger);
13
14impl PixelFormat {
15 pub const INVALID: Self = Self(0);
17
18 pub const A8_UNORM: Self = Self(1);
20
21 pub const R8_UNORM: Self = Self(10);
23 pub const R8_UNORM_SRGB: Self = Self(11);
24 pub const R8_SNORM: Self = Self(12);
25 pub const R8_UINT: Self = Self(13);
26 pub const R8_SINT: Self = Self(14);
27
28 pub const R16_UNORM: Self = Self(20);
30 pub const R16_SNORM: Self = Self(22);
31 pub const R16_UINT: Self = Self(23);
32 pub const R16_SINT: Self = Self(24);
33 pub const R16_FLOAT: Self = Self(25);
34
35 pub const RG8_UNORM: Self = Self(30);
37 pub const RG8_UNORM_SRGB: Self = Self(31);
38 pub const RG8_SNORM: Self = Self(32);
39 pub const RG8_UINT: Self = Self(33);
40 pub const RG8_SINT: Self = Self(34);
41
42 pub const B5G6R5_UNORM: Self = Self(40);
44 pub const A1BGR5_UNORM: Self = Self(41);
45 pub const ABGR4_UNORM: Self = Self(42);
46 pub const BGR5A1_UNORM: Self = Self(43);
47
48 pub const R32_UINT: Self = Self(53);
50 pub const R32_SINT: Self = Self(54);
51 pub const R32_FLOAT: Self = Self(55);
52
53 pub const RG16_UNORM: Self = Self(60);
55 pub const RG16_SNORM: Self = Self(62);
56 pub const RG16_UINT: Self = Self(63);
57 pub const RG16_SINT: Self = Self(64);
58 pub const RG16_FLOAT: Self = Self(65);
59
60 pub const RGBA8_UNORM: Self = Self(70);
62 pub const RGBA8_UNORM_SRGB: Self = Self(71);
63 pub const RGBA8_SNORM: Self = Self(72);
64 pub const RGBA8_UINT: Self = Self(73);
65 pub const RGBA8_SINT: Self = Self(74);
66
67 pub const BGRA8_UNORM: Self = Self(80);
69 pub const BGRA8_UNORM_SRGB: Self = Self(81);
70
71 pub const RGB10A2_UNORM: Self = Self(90);
73 pub const RGB10A2_UINT: Self = Self(91);
74 pub const RG11B10_FLOAT: Self = Self(92);
75 pub const RGB9E5_FLOAT: Self = Self(93);
76 pub const BGR10A2_UNORM: Self = Self(94);
77
78 pub const RG32_UINT: Self = Self(103);
80 pub const RG32_SINT: Self = Self(104);
81 pub const RG32_FLOAT: Self = Self(105);
82
83 pub const RGBA16_UNORM: Self = Self(110);
85 pub const RGBA16_SNORM: Self = Self(112);
86 pub const RGBA16_UINT: Self = Self(113);
87 pub const RGBA16_SINT: Self = Self(114);
88 pub const RGBA16_FLOAT: Self = Self(115);
89
90 pub const RGBA32_UINT: Self = Self(123);
92 pub const RGBA32_SINT: Self = Self(124);
93 pub const RGBA32_FLOAT: Self = Self(125);
94
95 pub const BC1_RGBA: Self = Self(130);
97 pub const BC1_RGBA_SRGB: Self = Self(131);
98 pub const BC2_RGBA: Self = Self(132);
99 pub const BC2_RGBA_SRGB: Self = Self(133);
100 pub const BC3_RGBA: Self = Self(134);
101 pub const BC3_RGBA_SRGB: Self = Self(135);
102 pub const BC4_R_UNORM: Self = Self(140);
103 pub const BC4_R_SNORM: Self = Self(141);
104 pub const BC5_RG_UNORM: Self = Self(142);
105 pub const BC5_RG_SNORM: Self = Self(143);
106 pub const BC6H_RGB_FLOAT: Self = Self(150);
107 pub const BC6H_RGB_UFLOAT: Self = Self(151);
108 pub const BC7_RGBA_UNORM: Self = Self(152);
109 pub const BC7_RGBA_UNORM_SRGB: Self = Self(153);
110
111 pub const PVRTC_RGB_2BPP: Self = Self(160);
113 pub const PVRTC_RGB_2BPP_SRGB: Self = Self(161);
114 pub const PVRTC_RGB_4BPP: Self = Self(162);
115 pub const PVRTC_RGB_4BPP_SRGB: Self = Self(163);
116 pub const PVRTC_RGBA_2BPP: Self = Self(164);
117 pub const PVRTC_RGBA_2BPP_SRGB: Self = Self(165);
118 pub const PVRTC_RGBA_4BPP: Self = Self(166);
119 pub const PVRTC_RGBA_4BPP_SRGB: Self = Self(167);
120
121 pub const EAC_R11_UNORM: Self = Self(170);
123 pub const EAC_R11_SNORM: Self = Self(172);
124 pub const EAC_RG11_UNORM: Self = Self(174);
125 pub const EAC_RG11_SNORM: Self = Self(176);
126 pub const EAC_RGBA8: Self = Self(178);
127 pub const EAC_RGBA8_SRGB: Self = Self(179);
128
129 pub const ETC2_RGB8: Self = Self(180);
131 pub const ETC2_RGB8_SRGB: Self = Self(181);
132 pub const ETC2_RGB8A1: Self = Self(182);
133 pub const ETC2_RGB8A1_SRGB: Self = Self(183);
134
135 pub const ASTC_4X4_SRGB: Self = Self(186);
137 pub const ASTC_5X4_SRGB: Self = Self(187);
138 pub const ASTC_5X5_SRGB: Self = Self(188);
139 pub const ASTC_6X5_SRGB: Self = Self(189);
140 pub const ASTC_6X6_SRGB: Self = Self(190);
141 pub const ASTC_8X5_SRGB: Self = Self(192);
142 pub const ASTC_8X6_SRGB: Self = Self(193);
143 pub const ASTC_8X8_SRGB: Self = Self(194);
144 pub const ASTC_10X5_SRGB: Self = Self(195);
145 pub const ASTC_10X6_SRGB: Self = Self(196);
146 pub const ASTC_10X8_SRGB: Self = Self(197);
147 pub const ASTC_10X10_SRGB: Self = Self(198);
148 pub const ASTC_12X10_SRGB: Self = Self(199);
149 pub const ASTC_12X12_SRGB: Self = Self(200);
150
151 pub const ASTC_4X4_LDR: Self = Self(204);
153 pub const ASTC_5X4_LDR: Self = Self(205);
154 pub const ASTC_5X5_LDR: Self = Self(206);
155 pub const ASTC_6X5_LDR: Self = Self(207);
156 pub const ASTC_6X6_LDR: Self = Self(208);
157 pub const ASTC_8X5_LDR: Self = Self(210);
158 pub const ASTC_8X6_LDR: Self = Self(211);
159 pub const ASTC_8X8_LDR: Self = Self(212);
160 pub const ASTC_10X5_LDR: Self = Self(213);
161 pub const ASTC_10X6_LDR: Self = Self(214);
162 pub const ASTC_10X8_LDR: Self = Self(215);
163 pub const ASTC_10X10_LDR: Self = Self(216);
164 pub const ASTC_12X10_LDR: Self = Self(217);
165 pub const ASTC_12X12_LDR: Self = Self(218);
166
167 pub const ASTC_4X4_HDR: Self = Self(222);
169 pub const ASTC_5X4_HDR: Self = Self(223);
170 pub const ASTC_5X5_HDR: Self = Self(224);
171 pub const ASTC_6X5_HDR: Self = Self(225);
172 pub const ASTC_6X6_HDR: Self = Self(226);
173 pub const ASTC_8X5_HDR: Self = Self(228);
174 pub const ASTC_8X6_HDR: Self = Self(229);
175 pub const ASTC_8X8_HDR: Self = Self(230);
176 pub const ASTC_10X5_HDR: Self = Self(231);
177 pub const ASTC_10X6_HDR: Self = Self(232);
178 pub const ASTC_10X8_HDR: Self = Self(233);
179 pub const ASTC_10X10_HDR: Self = Self(234);
180 pub const ASTC_12X10_HDR: Self = Self(235);
181 pub const ASTC_12X12_HDR: Self = Self(236);
182
183 pub const GBGR422: Self = Self(240);
185 pub const BGRG422: Self = Self(241);
186
187 pub const DEPTH16_UNORM: Self = Self(250);
189 pub const DEPTH32_FLOAT: Self = Self(252);
190 pub const STENCIL8: Self = Self(253);
191 pub const DEPTH24_UNORM_STENCIL8: Self = Self(255);
192 pub const DEPTH32_FLOAT_STENCIL8: Self = Self(260);
193 pub const X32_STENCIL8: Self = Self(261);
194 pub const X24_STENCIL8: Self = Self(262);
195
196 pub const BGRA10_XR: Self = Self(552);
198 pub const BGRA10_XR_SRGB: Self = Self(553);
199 pub const BGR10_XR: Self = Self(554);
200 pub const BGR10_XR_SRGB: Self = Self(555);
201
202 pub const UNSPECIALIZED: Self = Self(263);
204}
205
206#[cfg(test)]
207mod tests {
208 use super::*;
209
210 #[test]
211 fn test_pixel_format_values() {
212 assert_eq!(PixelFormat::INVALID.0, 0);
213 assert_eq!(PixelFormat::BGRA8_UNORM.0, 80);
214 assert_eq!(PixelFormat::DEPTH32_FLOAT.0, 252);
215 assert_eq!(PixelFormat::RGBA16_FLOAT.0, 115);
216 }
217
218 #[test]
219 fn test_pixel_format_size() {
220 assert_eq!(
221 std::mem::size_of::<PixelFormat>(),
222 std::mem::size_of::<UInteger>()
223 );
224 }
225}