rafx_api/types/
format.rs

1#[cfg(any(feature = "rafx-gles2", feature = "rafx-gles3"))]
2type GLenum = u32;
3
4#[cfg(feature = "rafx-vulkan")]
5use ash::vk;
6#[cfg(feature = "rafx-metal")]
7use metal_rs::MTLPixelFormat;
8#[cfg(feature = "rafx-metal")]
9use metal_rs::MTLVertexFormat;
10#[cfg(feature = "serde-support")]
11use serde::{Deserialize, Serialize};
12#[cfg(feature = "rafx-dx12")]
13use windows::Win32::Graphics::Dxgi::Common as DxgiCommon;
14
15//TODO: Try using Some/None instead of UNDEFINED format
16
17/// Describes the encoding of an image or buffer.
18#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
19#[cfg_attr(feature = "serde-support", derive(Serialize, Deserialize))]
20#[allow(non_camel_case_types)]
21pub enum RafxFormat {
22    UNDEFINED,
23    R4G4_UNORM_PACK8,
24    R4G4B4A4_UNORM_PACK16,
25    B4G4R4A4_UNORM_PACK16,
26    R5G6B5_UNORM_PACK16,
27    B5G6R5_UNORM_PACK16,
28    R5G5B5A1_UNORM_PACK16,
29    B5G5R5A1_UNORM_PACK16,
30    A1R5G5B5_UNORM_PACK16,
31    R8_UNORM,
32    R8_SNORM,
33    R8_USCALED,
34    R8_SSCALED,
35    R8_UINT,
36    R8_SINT,
37    R8_SRGB,
38    R8G8_UNORM,
39    R8G8_SNORM,
40    R8G8_USCALED,
41    R8G8_SSCALED,
42    R8G8_UINT,
43    R8G8_SINT,
44    R8G8_SRGB,
45    R8G8B8_UNORM,
46    R8G8B8_SNORM,
47    R8G8B8_USCALED,
48    R8G8B8_SSCALED,
49    R8G8B8_UINT,
50    R8G8B8_SINT,
51    R8G8B8_SRGB,
52    B8G8R8_UNORM,
53    B8G8R8_SNORM,
54    B8G8R8_USCALED,
55    B8G8R8_SSCALED,
56    B8G8R8_UINT,
57    B8G8R8_SINT,
58    B8G8R8_SRGB,
59    R8G8B8A8_UNORM,
60    R8G8B8A8_SNORM,
61    R8G8B8A8_USCALED,
62    R8G8B8A8_SSCALED,
63    R8G8B8A8_UINT,
64    R8G8B8A8_SINT,
65    R8G8B8A8_SRGB,
66    B8G8R8A8_UNORM,
67    B8G8R8A8_SNORM,
68    B8G8R8A8_USCALED,
69    B8G8R8A8_SSCALED,
70    B8G8R8A8_UINT,
71    B8G8R8A8_SINT,
72    B8G8R8A8_SRGB,
73    A8B8G8R8_UNORM_PACK32,
74    A8B8G8R8_SNORM_PACK32,
75    A8B8G8R8_USCALED_PACK32,
76    A8B8G8R8_SSCALED_PACK32,
77    A8B8G8R8_UINT_PACK32,
78    A8B8G8R8_SINT_PACK32,
79    A8B8G8R8_SRGB_PACK32,
80    A2R10G10B10_UNORM_PACK32,
81    A2R10G10B10_SNORM_PACK32,
82    A2R10G10B10_USCALED_PACK32,
83    A2R10G10B10_SSCALED_PACK32,
84    A2R10G10B10_UINT_PACK32,
85    A2R10G10B10_SINT_PACK32,
86    A2B10G10R10_UNORM_PACK32,
87    A2B10G10R10_SNORM_PACK32,
88    A2B10G10R10_USCALED_PACK32,
89    A2B10G10R10_SSCALED_PACK32,
90    A2B10G10R10_UINT_PACK32,
91    A2B10G10R10_SINT_PACK32,
92    R16_UNORM,
93    R16_SNORM,
94    R16_USCALED,
95    R16_SSCALED,
96    R16_UINT,
97    R16_SINT,
98    R16_SFLOAT,
99    R16G16_UNORM,
100    R16G16_SNORM,
101    R16G16_USCALED,
102    R16G16_SSCALED,
103    R16G16_UINT,
104    R16G16_SINT,
105    R16G16_SFLOAT,
106    R16G16B16_UNORM,
107    R16G16B16_SNORM,
108    R16G16B16_USCALED,
109    R16G16B16_SSCALED,
110    R16G16B16_UINT,
111    R16G16B16_SINT,
112    R16G16B16_SFLOAT,
113    R16G16B16A16_UNORM,
114    R16G16B16A16_SNORM,
115    R16G16B16A16_USCALED,
116    R16G16B16A16_SSCALED,
117    R16G16B16A16_UINT,
118    R16G16B16A16_SINT,
119    R16G16B16A16_SFLOAT,
120    R32_UINT,
121    R32_SINT,
122    R32_SFLOAT,
123    R32G32_UINT,
124    R32G32_SINT,
125    R32G32_SFLOAT,
126    R32G32B32_UINT,
127    R32G32B32_SINT,
128    R32G32B32_SFLOAT,
129    R32G32B32A32_UINT,
130    R32G32B32A32_SINT,
131    R32G32B32A32_SFLOAT,
132    R64_UINT,
133    R64_SINT,
134    R64_SFLOAT,
135    R64G64_UINT,
136    R64G64_SINT,
137    R64G64_SFLOAT,
138    R64G64B64_UINT,
139    R64G64B64_SINT,
140    R64G64B64_SFLOAT,
141    R64G64B64A64_UINT,
142    R64G64B64A64_SINT,
143    R64G64B64A64_SFLOAT,
144    B10G11R11_UFLOAT_PACK32,
145    E5B9G9R9_UFLOAT_PACK32,
146    D16_UNORM,
147    X8_D24_UNORM_PACK32,
148    D32_SFLOAT,
149    S8_UINT,
150    D16_UNORM_S8_UINT,
151    D24_UNORM_S8_UINT,
152    D32_SFLOAT_S8_UINT,
153    BC1_RGB_UNORM_BLOCK,
154    BC1_RGB_SRGB_BLOCK,
155    BC1_RGBA_UNORM_BLOCK,
156    BC1_RGBA_SRGB_BLOCK,
157    BC2_UNORM_BLOCK,
158    BC2_SRGB_BLOCK,
159    BC3_UNORM_BLOCK,
160    BC3_SRGB_BLOCK,
161    BC4_UNORM_BLOCK,
162    BC4_SNORM_BLOCK,
163    BC5_UNORM_BLOCK,
164    BC5_SNORM_BLOCK,
165    BC6H_UFLOAT_BLOCK,
166    BC6H_SFLOAT_BLOCK,
167    BC7_UNORM_BLOCK,
168    BC7_SRGB_BLOCK,
169    ETC2_R8G8B8_UNORM_BLOCK,
170    ETC2_R8G8B8_SRGB_BLOCK,
171    ETC2_R8G8B8A1_UNORM_BLOCK,
172    ETC2_R8G8B8A1_SRGB_BLOCK,
173    ETC2_R8G8B8A8_UNORM_BLOCK,
174    ETC2_R8G8B8A8_SRGB_BLOCK,
175    EAC_R11_UNORM_BLOCK,
176    EAC_R11_SNORM_BLOCK,
177    EAC_R11G11_UNORM_BLOCK,
178    EAC_R11G11_SNORM_BLOCK,
179    ASTC_4X4_UNORM_BLOCK,
180    ASTC_4X4_SRGB_BLOCK,
181    ASTC_5X4_UNORM_BLOCK,
182    ASTC_5X4_SRGB_BLOCK,
183    ASTC_5X5_UNORM_BLOCK,
184    ASTC_5X5_SRGB_BLOCK,
185    ASTC_6X5_UNORM_BLOCK,
186    ASTC_6X5_SRGB_BLOCK,
187    ASTC_6X6_UNORM_BLOCK,
188    ASTC_6X6_SRGB_BLOCK,
189    ASTC_8X5_UNORM_BLOCK,
190    ASTC_8X5_SRGB_BLOCK,
191    ASTC_8X6_UNORM_BLOCK,
192    ASTC_8X6_SRGB_BLOCK,
193    ASTC_8X8_UNORM_BLOCK,
194    ASTC_8X8_SRGB_BLOCK,
195    ASTC_10X5_UNORM_BLOCK,
196    ASTC_10X5_SRGB_BLOCK,
197    ASTC_10X6_UNORM_BLOCK,
198    ASTC_10X6_SRGB_BLOCK,
199    ASTC_10X8_UNORM_BLOCK,
200    ASTC_10X8_SRGB_BLOCK,
201    ASTC_10X10_UNORM_BLOCK,
202    ASTC_10X10_SRGB_BLOCK,
203    ASTC_12X10_UNORM_BLOCK,
204    ASTC_12X10_SRGB_BLOCK,
205    ASTC_12X12_UNORM_BLOCK,
206    ASTC_12X12_SRGB_BLOCK,
207}
208
209impl Default for RafxFormat {
210    fn default() -> Self {
211        RafxFormat::UNDEFINED
212    }
213}
214
215#[cfg(feature = "rafx-vulkan")]
216impl Into<vk::Format> for RafxFormat {
217    fn into(self) -> vk::Format {
218        match self {
219            RafxFormat::UNDEFINED => vk::Format::UNDEFINED,
220            RafxFormat::R4G4_UNORM_PACK8 => vk::Format::R4G4_UNORM_PACK8,
221            RafxFormat::R4G4B4A4_UNORM_PACK16 => vk::Format::R4G4B4A4_UNORM_PACK16,
222            RafxFormat::B4G4R4A4_UNORM_PACK16 => vk::Format::B4G4R4A4_UNORM_PACK16,
223            RafxFormat::R5G6B5_UNORM_PACK16 => vk::Format::R5G6B5_UNORM_PACK16,
224            RafxFormat::B5G6R5_UNORM_PACK16 => vk::Format::B5G6R5_UNORM_PACK16,
225            RafxFormat::R5G5B5A1_UNORM_PACK16 => vk::Format::R5G5B5A1_UNORM_PACK16,
226            RafxFormat::B5G5R5A1_UNORM_PACK16 => vk::Format::B5G5R5A1_UNORM_PACK16,
227            RafxFormat::A1R5G5B5_UNORM_PACK16 => vk::Format::A1R5G5B5_UNORM_PACK16,
228            RafxFormat::R8_UNORM => vk::Format::R8_UNORM,
229            RafxFormat::R8_SNORM => vk::Format::R8_SNORM,
230            RafxFormat::R8_USCALED => vk::Format::R8_USCALED,
231            RafxFormat::R8_SSCALED => vk::Format::R8_SSCALED,
232            RafxFormat::R8_UINT => vk::Format::R8_UINT,
233            RafxFormat::R8_SINT => vk::Format::R8_SINT,
234            RafxFormat::R8_SRGB => vk::Format::R8_SRGB,
235            RafxFormat::R8G8_UNORM => vk::Format::R8G8_UNORM,
236            RafxFormat::R8G8_SNORM => vk::Format::R8G8_SNORM,
237            RafxFormat::R8G8_USCALED => vk::Format::R8G8_USCALED,
238            RafxFormat::R8G8_SSCALED => vk::Format::R8G8_SSCALED,
239            RafxFormat::R8G8_UINT => vk::Format::R8G8_UINT,
240            RafxFormat::R8G8_SINT => vk::Format::R8G8_SINT,
241            RafxFormat::R8G8_SRGB => vk::Format::R8G8_SRGB,
242            RafxFormat::R8G8B8_UNORM => vk::Format::R8G8B8_UNORM,
243            RafxFormat::R8G8B8_SNORM => vk::Format::R8G8B8_SNORM,
244            RafxFormat::R8G8B8_USCALED => vk::Format::R8G8B8_USCALED,
245            RafxFormat::R8G8B8_SSCALED => vk::Format::R8G8B8_SSCALED,
246            RafxFormat::R8G8B8_UINT => vk::Format::R8G8B8_UINT,
247            RafxFormat::R8G8B8_SINT => vk::Format::R8G8B8_SINT,
248            RafxFormat::R8G8B8_SRGB => vk::Format::R8G8B8_SRGB,
249            RafxFormat::B8G8R8_UNORM => vk::Format::B8G8R8_UNORM,
250            RafxFormat::B8G8R8_SNORM => vk::Format::B8G8R8_SNORM,
251            RafxFormat::B8G8R8_USCALED => vk::Format::B8G8R8_USCALED,
252            RafxFormat::B8G8R8_SSCALED => vk::Format::B8G8R8_SSCALED,
253            RafxFormat::B8G8R8_UINT => vk::Format::B8G8R8_UINT,
254            RafxFormat::B8G8R8_SINT => vk::Format::B8G8R8_SINT,
255            RafxFormat::B8G8R8_SRGB => vk::Format::B8G8R8_SRGB,
256            RafxFormat::R8G8B8A8_UNORM => vk::Format::R8G8B8A8_UNORM,
257            RafxFormat::R8G8B8A8_SNORM => vk::Format::R8G8B8A8_SNORM,
258            RafxFormat::R8G8B8A8_USCALED => vk::Format::R8G8B8A8_USCALED,
259            RafxFormat::R8G8B8A8_SSCALED => vk::Format::R8G8B8A8_SSCALED,
260            RafxFormat::R8G8B8A8_UINT => vk::Format::R8G8B8A8_UINT,
261            RafxFormat::R8G8B8A8_SINT => vk::Format::R8G8B8A8_SINT,
262            RafxFormat::R8G8B8A8_SRGB => vk::Format::R8G8B8A8_SRGB,
263            RafxFormat::B8G8R8A8_UNORM => vk::Format::B8G8R8A8_UNORM,
264            RafxFormat::B8G8R8A8_SNORM => vk::Format::B8G8R8A8_SNORM,
265            RafxFormat::B8G8R8A8_USCALED => vk::Format::B8G8R8A8_USCALED,
266            RafxFormat::B8G8R8A8_SSCALED => vk::Format::B8G8R8A8_SSCALED,
267            RafxFormat::B8G8R8A8_UINT => vk::Format::B8G8R8A8_UINT,
268            RafxFormat::B8G8R8A8_SINT => vk::Format::B8G8R8A8_SINT,
269            RafxFormat::B8G8R8A8_SRGB => vk::Format::B8G8R8A8_SRGB,
270            RafxFormat::A8B8G8R8_UNORM_PACK32 => vk::Format::A8B8G8R8_UNORM_PACK32,
271            RafxFormat::A8B8G8R8_SNORM_PACK32 => vk::Format::A8B8G8R8_SNORM_PACK32,
272            RafxFormat::A8B8G8R8_USCALED_PACK32 => vk::Format::A8B8G8R8_USCALED_PACK32,
273            RafxFormat::A8B8G8R8_SSCALED_PACK32 => vk::Format::A8B8G8R8_SSCALED_PACK32,
274            RafxFormat::A8B8G8R8_UINT_PACK32 => vk::Format::A8B8G8R8_UINT_PACK32,
275            RafxFormat::A8B8G8R8_SINT_PACK32 => vk::Format::A8B8G8R8_SINT_PACK32,
276            RafxFormat::A8B8G8R8_SRGB_PACK32 => vk::Format::A8B8G8R8_SRGB_PACK32,
277            RafxFormat::A2R10G10B10_UNORM_PACK32 => vk::Format::A2R10G10B10_UNORM_PACK32,
278            RafxFormat::A2R10G10B10_SNORM_PACK32 => vk::Format::A2R10G10B10_SNORM_PACK32,
279            RafxFormat::A2R10G10B10_USCALED_PACK32 => vk::Format::A2R10G10B10_USCALED_PACK32,
280            RafxFormat::A2R10G10B10_SSCALED_PACK32 => vk::Format::A2R10G10B10_SSCALED_PACK32,
281            RafxFormat::A2R10G10B10_UINT_PACK32 => vk::Format::A2R10G10B10_UINT_PACK32,
282            RafxFormat::A2R10G10B10_SINT_PACK32 => vk::Format::A2R10G10B10_SINT_PACK32,
283            RafxFormat::A2B10G10R10_UNORM_PACK32 => vk::Format::A2B10G10R10_UNORM_PACK32,
284            RafxFormat::A2B10G10R10_SNORM_PACK32 => vk::Format::A2B10G10R10_SNORM_PACK32,
285            RafxFormat::A2B10G10R10_USCALED_PACK32 => vk::Format::A2B10G10R10_USCALED_PACK32,
286            RafxFormat::A2B10G10R10_SSCALED_PACK32 => vk::Format::A2B10G10R10_SSCALED_PACK32,
287            RafxFormat::A2B10G10R10_UINT_PACK32 => vk::Format::A2B10G10R10_UINT_PACK32,
288            RafxFormat::A2B10G10R10_SINT_PACK32 => vk::Format::A2B10G10R10_SINT_PACK32,
289            RafxFormat::R16_UNORM => vk::Format::R16_UNORM,
290            RafxFormat::R16_SNORM => vk::Format::R16_SNORM,
291            RafxFormat::R16_USCALED => vk::Format::R16_USCALED,
292            RafxFormat::R16_SSCALED => vk::Format::R16_SSCALED,
293            RafxFormat::R16_UINT => vk::Format::R16_UINT,
294            RafxFormat::R16_SINT => vk::Format::R16_SINT,
295            RafxFormat::R16_SFLOAT => vk::Format::R16_SFLOAT,
296            RafxFormat::R16G16_UNORM => vk::Format::R16G16_UNORM,
297            RafxFormat::R16G16_SNORM => vk::Format::R16G16_SNORM,
298            RafxFormat::R16G16_USCALED => vk::Format::R16G16_USCALED,
299            RafxFormat::R16G16_SSCALED => vk::Format::R16G16_SSCALED,
300            RafxFormat::R16G16_UINT => vk::Format::R16G16_UINT,
301            RafxFormat::R16G16_SINT => vk::Format::R16G16_SINT,
302            RafxFormat::R16G16_SFLOAT => vk::Format::R16G16_SFLOAT,
303            RafxFormat::R16G16B16_UNORM => vk::Format::R16G16B16_UNORM,
304            RafxFormat::R16G16B16_SNORM => vk::Format::R16G16B16_SNORM,
305            RafxFormat::R16G16B16_USCALED => vk::Format::R16G16B16_USCALED,
306            RafxFormat::R16G16B16_SSCALED => vk::Format::R16G16B16_SSCALED,
307            RafxFormat::R16G16B16_UINT => vk::Format::R16G16B16_UINT,
308            RafxFormat::R16G16B16_SINT => vk::Format::R16G16B16_SINT,
309            RafxFormat::R16G16B16_SFLOAT => vk::Format::R16G16B16_SFLOAT,
310            RafxFormat::R16G16B16A16_UNORM => vk::Format::R16G16B16A16_UNORM,
311            RafxFormat::R16G16B16A16_SNORM => vk::Format::R16G16B16A16_SNORM,
312            RafxFormat::R16G16B16A16_USCALED => vk::Format::R16G16B16A16_USCALED,
313            RafxFormat::R16G16B16A16_SSCALED => vk::Format::R16G16B16A16_SSCALED,
314            RafxFormat::R16G16B16A16_UINT => vk::Format::R16G16B16A16_UINT,
315            RafxFormat::R16G16B16A16_SINT => vk::Format::R16G16B16A16_SINT,
316            RafxFormat::R16G16B16A16_SFLOAT => vk::Format::R16G16B16A16_SFLOAT,
317            RafxFormat::R32_UINT => vk::Format::R32_UINT,
318            RafxFormat::R32_SINT => vk::Format::R32_SINT,
319            RafxFormat::R32_SFLOAT => vk::Format::R32_SFLOAT,
320            RafxFormat::R32G32_UINT => vk::Format::R32G32_UINT,
321            RafxFormat::R32G32_SINT => vk::Format::R32G32_SINT,
322            RafxFormat::R32G32_SFLOAT => vk::Format::R32G32_SFLOAT,
323            RafxFormat::R32G32B32_UINT => vk::Format::R32G32B32_UINT,
324            RafxFormat::R32G32B32_SINT => vk::Format::R32G32B32_SINT,
325            RafxFormat::R32G32B32_SFLOAT => vk::Format::R32G32B32_SFLOAT,
326            RafxFormat::R32G32B32A32_UINT => vk::Format::R32G32B32A32_UINT,
327            RafxFormat::R32G32B32A32_SINT => vk::Format::R32G32B32A32_SINT,
328            RafxFormat::R32G32B32A32_SFLOAT => vk::Format::R32G32B32A32_SFLOAT,
329            RafxFormat::R64_UINT => vk::Format::R64_UINT,
330            RafxFormat::R64_SINT => vk::Format::R64_SINT,
331            RafxFormat::R64_SFLOAT => vk::Format::R64_SFLOAT,
332            RafxFormat::R64G64_UINT => vk::Format::R64G64_UINT,
333            RafxFormat::R64G64_SINT => vk::Format::R64G64_SINT,
334            RafxFormat::R64G64_SFLOAT => vk::Format::R64G64_SFLOAT,
335            RafxFormat::R64G64B64_UINT => vk::Format::R64G64B64_UINT,
336            RafxFormat::R64G64B64_SINT => vk::Format::R64G64B64_SINT,
337            RafxFormat::R64G64B64_SFLOAT => vk::Format::R64G64B64_SFLOAT,
338            RafxFormat::R64G64B64A64_UINT => vk::Format::R64G64B64A64_UINT,
339            RafxFormat::R64G64B64A64_SINT => vk::Format::R64G64B64A64_SINT,
340            RafxFormat::R64G64B64A64_SFLOAT => vk::Format::R64G64B64A64_SFLOAT,
341            RafxFormat::B10G11R11_UFLOAT_PACK32 => vk::Format::B10G11R11_UFLOAT_PACK32,
342            RafxFormat::E5B9G9R9_UFLOAT_PACK32 => vk::Format::E5B9G9R9_UFLOAT_PACK32,
343            RafxFormat::D16_UNORM => vk::Format::D16_UNORM,
344            RafxFormat::X8_D24_UNORM_PACK32 => vk::Format::X8_D24_UNORM_PACK32,
345            RafxFormat::D32_SFLOAT => vk::Format::D32_SFLOAT,
346            RafxFormat::S8_UINT => vk::Format::S8_UINT,
347            RafxFormat::D16_UNORM_S8_UINT => vk::Format::D16_UNORM_S8_UINT,
348            RafxFormat::D24_UNORM_S8_UINT => vk::Format::D24_UNORM_S8_UINT,
349            RafxFormat::D32_SFLOAT_S8_UINT => vk::Format::D32_SFLOAT_S8_UINT,
350            RafxFormat::BC1_RGB_UNORM_BLOCK => vk::Format::BC1_RGB_UNORM_BLOCK,
351            RafxFormat::BC1_RGB_SRGB_BLOCK => vk::Format::BC1_RGB_SRGB_BLOCK,
352            RafxFormat::BC1_RGBA_UNORM_BLOCK => vk::Format::BC1_RGBA_UNORM_BLOCK,
353            RafxFormat::BC1_RGBA_SRGB_BLOCK => vk::Format::BC1_RGBA_SRGB_BLOCK,
354            RafxFormat::BC2_UNORM_BLOCK => vk::Format::BC2_UNORM_BLOCK,
355            RafxFormat::BC2_SRGB_BLOCK => vk::Format::BC2_SRGB_BLOCK,
356            RafxFormat::BC3_UNORM_BLOCK => vk::Format::BC3_UNORM_BLOCK,
357            RafxFormat::BC3_SRGB_BLOCK => vk::Format::BC3_SRGB_BLOCK,
358            RafxFormat::BC4_UNORM_BLOCK => vk::Format::BC4_UNORM_BLOCK,
359            RafxFormat::BC4_SNORM_BLOCK => vk::Format::BC4_SNORM_BLOCK,
360            RafxFormat::BC5_UNORM_BLOCK => vk::Format::BC5_UNORM_BLOCK,
361            RafxFormat::BC5_SNORM_BLOCK => vk::Format::BC5_SNORM_BLOCK,
362            RafxFormat::BC6H_UFLOAT_BLOCK => vk::Format::BC6H_UFLOAT_BLOCK,
363            RafxFormat::BC6H_SFLOAT_BLOCK => vk::Format::BC6H_SFLOAT_BLOCK,
364            RafxFormat::BC7_UNORM_BLOCK => vk::Format::BC7_UNORM_BLOCK,
365            RafxFormat::BC7_SRGB_BLOCK => vk::Format::BC7_SRGB_BLOCK,
366            RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => vk::Format::ETC2_R8G8B8_UNORM_BLOCK,
367            RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => vk::Format::ETC2_R8G8B8_SRGB_BLOCK,
368            RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => vk::Format::ETC2_R8G8B8A1_UNORM_BLOCK,
369            RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => vk::Format::ETC2_R8G8B8A1_SRGB_BLOCK,
370            RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => vk::Format::ETC2_R8G8B8A8_UNORM_BLOCK,
371            RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => vk::Format::ETC2_R8G8B8A8_SRGB_BLOCK,
372            RafxFormat::EAC_R11_UNORM_BLOCK => vk::Format::EAC_R11_UNORM_BLOCK,
373            RafxFormat::EAC_R11_SNORM_BLOCK => vk::Format::EAC_R11_SNORM_BLOCK,
374            RafxFormat::EAC_R11G11_UNORM_BLOCK => vk::Format::EAC_R11G11_UNORM_BLOCK,
375            RafxFormat::EAC_R11G11_SNORM_BLOCK => vk::Format::EAC_R11G11_SNORM_BLOCK,
376            RafxFormat::ASTC_4X4_UNORM_BLOCK => vk::Format::ASTC_4X4_UNORM_BLOCK,
377            RafxFormat::ASTC_4X4_SRGB_BLOCK => vk::Format::ASTC_4X4_SRGB_BLOCK,
378            RafxFormat::ASTC_5X4_UNORM_BLOCK => vk::Format::ASTC_5X4_UNORM_BLOCK,
379            RafxFormat::ASTC_5X4_SRGB_BLOCK => vk::Format::ASTC_5X4_SRGB_BLOCK,
380            RafxFormat::ASTC_5X5_UNORM_BLOCK => vk::Format::ASTC_5X5_UNORM_BLOCK,
381            RafxFormat::ASTC_5X5_SRGB_BLOCK => vk::Format::ASTC_5X5_SRGB_BLOCK,
382            RafxFormat::ASTC_6X5_UNORM_BLOCK => vk::Format::ASTC_6X5_UNORM_BLOCK,
383            RafxFormat::ASTC_6X5_SRGB_BLOCK => vk::Format::ASTC_6X5_SRGB_BLOCK,
384            RafxFormat::ASTC_6X6_UNORM_BLOCK => vk::Format::ASTC_6X6_UNORM_BLOCK,
385            RafxFormat::ASTC_6X6_SRGB_BLOCK => vk::Format::ASTC_6X6_SRGB_BLOCK,
386            RafxFormat::ASTC_8X5_UNORM_BLOCK => vk::Format::ASTC_8X5_UNORM_BLOCK,
387            RafxFormat::ASTC_8X5_SRGB_BLOCK => vk::Format::ASTC_8X5_SRGB_BLOCK,
388            RafxFormat::ASTC_8X6_UNORM_BLOCK => vk::Format::ASTC_8X6_UNORM_BLOCK,
389            RafxFormat::ASTC_8X6_SRGB_BLOCK => vk::Format::ASTC_8X6_SRGB_BLOCK,
390            RafxFormat::ASTC_8X8_UNORM_BLOCK => vk::Format::ASTC_8X8_UNORM_BLOCK,
391            RafxFormat::ASTC_8X8_SRGB_BLOCK => vk::Format::ASTC_8X8_SRGB_BLOCK,
392            RafxFormat::ASTC_10X5_UNORM_BLOCK => vk::Format::ASTC_10X5_UNORM_BLOCK,
393            RafxFormat::ASTC_10X5_SRGB_BLOCK => vk::Format::ASTC_10X5_SRGB_BLOCK,
394            RafxFormat::ASTC_10X6_UNORM_BLOCK => vk::Format::ASTC_10X6_UNORM_BLOCK,
395            RafxFormat::ASTC_10X6_SRGB_BLOCK => vk::Format::ASTC_10X6_SRGB_BLOCK,
396            RafxFormat::ASTC_10X8_UNORM_BLOCK => vk::Format::ASTC_10X8_UNORM_BLOCK,
397            RafxFormat::ASTC_10X8_SRGB_BLOCK => vk::Format::ASTC_10X8_SRGB_BLOCK,
398            RafxFormat::ASTC_10X10_UNORM_BLOCK => vk::Format::ASTC_10X10_UNORM_BLOCK,
399            RafxFormat::ASTC_10X10_SRGB_BLOCK => vk::Format::ASTC_10X10_SRGB_BLOCK,
400            RafxFormat::ASTC_12X10_UNORM_BLOCK => vk::Format::ASTC_12X10_UNORM_BLOCK,
401            RafxFormat::ASTC_12X10_SRGB_BLOCK => vk::Format::ASTC_12X10_SRGB_BLOCK,
402            RafxFormat::ASTC_12X12_UNORM_BLOCK => vk::Format::ASTC_12X12_UNORM_BLOCK,
403            RafxFormat::ASTC_12X12_SRGB_BLOCK => vk::Format::ASTC_12X12_SRGB_BLOCK,
404        }
405    }
406}
407
408#[cfg(feature = "rafx-vulkan")]
409impl From<vk::Format> for RafxFormat {
410    fn from(format: vk::Format) -> RafxFormat {
411        match format {
412            vk::Format::UNDEFINED => RafxFormat::UNDEFINED,
413            vk::Format::R4G4_UNORM_PACK8 => RafxFormat::R4G4_UNORM_PACK8,
414            vk::Format::R4G4B4A4_UNORM_PACK16 => RafxFormat::R4G4B4A4_UNORM_PACK16,
415            vk::Format::B4G4R4A4_UNORM_PACK16 => RafxFormat::B4G4R4A4_UNORM_PACK16,
416            vk::Format::R5G6B5_UNORM_PACK16 => RafxFormat::R5G6B5_UNORM_PACK16,
417            vk::Format::B5G6R5_UNORM_PACK16 => RafxFormat::B5G6R5_UNORM_PACK16,
418            vk::Format::R5G5B5A1_UNORM_PACK16 => RafxFormat::R5G5B5A1_UNORM_PACK16,
419            vk::Format::B5G5R5A1_UNORM_PACK16 => RafxFormat::B5G5R5A1_UNORM_PACK16,
420            vk::Format::A1R5G5B5_UNORM_PACK16 => RafxFormat::A1R5G5B5_UNORM_PACK16,
421            vk::Format::R8_UNORM => RafxFormat::R8_UNORM,
422            vk::Format::R8_SNORM => RafxFormat::R8_SNORM,
423            vk::Format::R8_USCALED => RafxFormat::R8_USCALED,
424            vk::Format::R8_SSCALED => RafxFormat::R8_SSCALED,
425            vk::Format::R8_UINT => RafxFormat::R8_UINT,
426            vk::Format::R8_SINT => RafxFormat::R8_SINT,
427            vk::Format::R8_SRGB => RafxFormat::R8_SRGB,
428            vk::Format::R8G8_UNORM => RafxFormat::R8G8_UNORM,
429            vk::Format::R8G8_SNORM => RafxFormat::R8G8_SNORM,
430            vk::Format::R8G8_USCALED => RafxFormat::R8G8_USCALED,
431            vk::Format::R8G8_SSCALED => RafxFormat::R8G8_SSCALED,
432            vk::Format::R8G8_UINT => RafxFormat::R8G8_UINT,
433            vk::Format::R8G8_SINT => RafxFormat::R8G8_SINT,
434            vk::Format::R8G8_SRGB => RafxFormat::R8G8_SRGB,
435            vk::Format::R8G8B8_UNORM => RafxFormat::R8G8B8_UNORM,
436            vk::Format::R8G8B8_SNORM => RafxFormat::R8G8B8_SNORM,
437            vk::Format::R8G8B8_USCALED => RafxFormat::R8G8B8_USCALED,
438            vk::Format::R8G8B8_SSCALED => RafxFormat::R8G8B8_SSCALED,
439            vk::Format::R8G8B8_UINT => RafxFormat::R8G8B8_UINT,
440            vk::Format::R8G8B8_SINT => RafxFormat::R8G8B8_SINT,
441            vk::Format::R8G8B8_SRGB => RafxFormat::R8G8B8_SRGB,
442            vk::Format::B8G8R8_UNORM => RafxFormat::B8G8R8_UNORM,
443            vk::Format::B8G8R8_SNORM => RafxFormat::B8G8R8_SNORM,
444            vk::Format::B8G8R8_USCALED => RafxFormat::B8G8R8_USCALED,
445            vk::Format::B8G8R8_SSCALED => RafxFormat::B8G8R8_SSCALED,
446            vk::Format::B8G8R8_UINT => RafxFormat::B8G8R8_UINT,
447            vk::Format::B8G8R8_SINT => RafxFormat::B8G8R8_SINT,
448            vk::Format::B8G8R8_SRGB => RafxFormat::B8G8R8_SRGB,
449            vk::Format::R8G8B8A8_UNORM => RafxFormat::R8G8B8A8_UNORM,
450            vk::Format::R8G8B8A8_SNORM => RafxFormat::R8G8B8A8_SNORM,
451            vk::Format::R8G8B8A8_USCALED => RafxFormat::R8G8B8A8_USCALED,
452            vk::Format::R8G8B8A8_SSCALED => RafxFormat::R8G8B8A8_SSCALED,
453            vk::Format::R8G8B8A8_UINT => RafxFormat::R8G8B8A8_UINT,
454            vk::Format::R8G8B8A8_SINT => RafxFormat::R8G8B8A8_SINT,
455            vk::Format::R8G8B8A8_SRGB => RafxFormat::R8G8B8A8_SRGB,
456            vk::Format::B8G8R8A8_UNORM => RafxFormat::B8G8R8A8_UNORM,
457            vk::Format::B8G8R8A8_SNORM => RafxFormat::B8G8R8A8_SNORM,
458            vk::Format::B8G8R8A8_USCALED => RafxFormat::B8G8R8A8_USCALED,
459            vk::Format::B8G8R8A8_SSCALED => RafxFormat::B8G8R8A8_SSCALED,
460            vk::Format::B8G8R8A8_UINT => RafxFormat::B8G8R8A8_UINT,
461            vk::Format::B8G8R8A8_SINT => RafxFormat::B8G8R8A8_SINT,
462            vk::Format::B8G8R8A8_SRGB => RafxFormat::B8G8R8A8_SRGB,
463            vk::Format::A8B8G8R8_UNORM_PACK32 => RafxFormat::A8B8G8R8_UNORM_PACK32,
464            vk::Format::A8B8G8R8_SNORM_PACK32 => RafxFormat::A8B8G8R8_SNORM_PACK32,
465            vk::Format::A8B8G8R8_USCALED_PACK32 => RafxFormat::A8B8G8R8_USCALED_PACK32,
466            vk::Format::A8B8G8R8_SSCALED_PACK32 => RafxFormat::A8B8G8R8_SSCALED_PACK32,
467            vk::Format::A8B8G8R8_UINT_PACK32 => RafxFormat::A8B8G8R8_UINT_PACK32,
468            vk::Format::A8B8G8R8_SINT_PACK32 => RafxFormat::A8B8G8R8_SINT_PACK32,
469            vk::Format::A8B8G8R8_SRGB_PACK32 => RafxFormat::A8B8G8R8_SRGB_PACK32,
470            vk::Format::A2R10G10B10_UNORM_PACK32 => RafxFormat::A2R10G10B10_UNORM_PACK32,
471            vk::Format::A2R10G10B10_SNORM_PACK32 => RafxFormat::A2R10G10B10_SNORM_PACK32,
472            vk::Format::A2R10G10B10_USCALED_PACK32 => RafxFormat::A2R10G10B10_USCALED_PACK32,
473            vk::Format::A2R10G10B10_SSCALED_PACK32 => RafxFormat::A2R10G10B10_SSCALED_PACK32,
474            vk::Format::A2R10G10B10_UINT_PACK32 => RafxFormat::A2R10G10B10_UINT_PACK32,
475            vk::Format::A2R10G10B10_SINT_PACK32 => RafxFormat::A2R10G10B10_SINT_PACK32,
476            vk::Format::A2B10G10R10_UNORM_PACK32 => RafxFormat::A2B10G10R10_UNORM_PACK32,
477            vk::Format::A2B10G10R10_SNORM_PACK32 => RafxFormat::A2B10G10R10_SNORM_PACK32,
478            vk::Format::A2B10G10R10_USCALED_PACK32 => RafxFormat::A2B10G10R10_USCALED_PACK32,
479            vk::Format::A2B10G10R10_SSCALED_PACK32 => RafxFormat::A2B10G10R10_SSCALED_PACK32,
480            vk::Format::A2B10G10R10_UINT_PACK32 => RafxFormat::A2B10G10R10_UINT_PACK32,
481            vk::Format::A2B10G10R10_SINT_PACK32 => RafxFormat::A2B10G10R10_SINT_PACK32,
482            vk::Format::R16_UNORM => RafxFormat::R16_UNORM,
483            vk::Format::R16_SNORM => RafxFormat::R16_SNORM,
484            vk::Format::R16_USCALED => RafxFormat::R16_USCALED,
485            vk::Format::R16_SSCALED => RafxFormat::R16_SSCALED,
486            vk::Format::R16_UINT => RafxFormat::R16_UINT,
487            vk::Format::R16_SINT => RafxFormat::R16_SINT,
488            vk::Format::R16_SFLOAT => RafxFormat::R16_SFLOAT,
489            vk::Format::R16G16_UNORM => RafxFormat::R16G16_UNORM,
490            vk::Format::R16G16_SNORM => RafxFormat::R16G16_SNORM,
491            vk::Format::R16G16_USCALED => RafxFormat::R16G16_USCALED,
492            vk::Format::R16G16_SSCALED => RafxFormat::R16G16_SSCALED,
493            vk::Format::R16G16_UINT => RafxFormat::R16G16_UINT,
494            vk::Format::R16G16_SINT => RafxFormat::R16G16_SINT,
495            vk::Format::R16G16_SFLOAT => RafxFormat::R16G16_SFLOAT,
496            vk::Format::R16G16B16_UNORM => RafxFormat::R16G16B16_UNORM,
497            vk::Format::R16G16B16_SNORM => RafxFormat::R16G16B16_SNORM,
498            vk::Format::R16G16B16_USCALED => RafxFormat::R16G16B16_USCALED,
499            vk::Format::R16G16B16_SSCALED => RafxFormat::R16G16B16_SSCALED,
500            vk::Format::R16G16B16_UINT => RafxFormat::R16G16B16_UINT,
501            vk::Format::R16G16B16_SINT => RafxFormat::R16G16B16_SINT,
502            vk::Format::R16G16B16_SFLOAT => RafxFormat::R16G16B16_SFLOAT,
503            vk::Format::R16G16B16A16_UNORM => RafxFormat::R16G16B16A16_UNORM,
504            vk::Format::R16G16B16A16_SNORM => RafxFormat::R16G16B16A16_SNORM,
505            vk::Format::R16G16B16A16_USCALED => RafxFormat::R16G16B16A16_USCALED,
506            vk::Format::R16G16B16A16_SSCALED => RafxFormat::R16G16B16A16_SSCALED,
507            vk::Format::R16G16B16A16_UINT => RafxFormat::R16G16B16A16_UINT,
508            vk::Format::R16G16B16A16_SINT => RafxFormat::R16G16B16A16_SINT,
509            vk::Format::R16G16B16A16_SFLOAT => RafxFormat::R16G16B16A16_SFLOAT,
510            vk::Format::R32_UINT => RafxFormat::R32_UINT,
511            vk::Format::R32_SINT => RafxFormat::R32_SINT,
512            vk::Format::R32_SFLOAT => RafxFormat::R32_SFLOAT,
513            vk::Format::R32G32_UINT => RafxFormat::R32G32_UINT,
514            vk::Format::R32G32_SINT => RafxFormat::R32G32_SINT,
515            vk::Format::R32G32_SFLOAT => RafxFormat::R32G32_SFLOAT,
516            vk::Format::R32G32B32_UINT => RafxFormat::R32G32B32_UINT,
517            vk::Format::R32G32B32_SINT => RafxFormat::R32G32B32_SINT,
518            vk::Format::R32G32B32_SFLOAT => RafxFormat::R32G32B32_SFLOAT,
519            vk::Format::R32G32B32A32_UINT => RafxFormat::R32G32B32A32_UINT,
520            vk::Format::R32G32B32A32_SINT => RafxFormat::R32G32B32A32_SINT,
521            vk::Format::R32G32B32A32_SFLOAT => RafxFormat::R32G32B32A32_SFLOAT,
522            vk::Format::R64_UINT => RafxFormat::R64_UINT,
523            vk::Format::R64_SINT => RafxFormat::R64_SINT,
524            vk::Format::R64_SFLOAT => RafxFormat::R64_SFLOAT,
525            vk::Format::R64G64_UINT => RafxFormat::R64G64_UINT,
526            vk::Format::R64G64_SINT => RafxFormat::R64G64_SINT,
527            vk::Format::R64G64_SFLOAT => RafxFormat::R64G64_SFLOAT,
528            vk::Format::R64G64B64_UINT => RafxFormat::R64G64B64_UINT,
529            vk::Format::R64G64B64_SINT => RafxFormat::R64G64B64_SINT,
530            vk::Format::R64G64B64_SFLOAT => RafxFormat::R64G64B64_SFLOAT,
531            vk::Format::R64G64B64A64_UINT => RafxFormat::R64G64B64A64_UINT,
532            vk::Format::R64G64B64A64_SINT => RafxFormat::R64G64B64A64_SINT,
533            vk::Format::R64G64B64A64_SFLOAT => RafxFormat::R64G64B64A64_SFLOAT,
534            vk::Format::B10G11R11_UFLOAT_PACK32 => RafxFormat::B10G11R11_UFLOAT_PACK32,
535            vk::Format::E5B9G9R9_UFLOAT_PACK32 => RafxFormat::E5B9G9R9_UFLOAT_PACK32,
536            vk::Format::D16_UNORM => RafxFormat::D16_UNORM,
537            vk::Format::X8_D24_UNORM_PACK32 => RafxFormat::X8_D24_UNORM_PACK32,
538            vk::Format::D32_SFLOAT => RafxFormat::D32_SFLOAT,
539            vk::Format::S8_UINT => RafxFormat::S8_UINT,
540            vk::Format::D16_UNORM_S8_UINT => RafxFormat::D16_UNORM_S8_UINT,
541            vk::Format::D24_UNORM_S8_UINT => RafxFormat::D24_UNORM_S8_UINT,
542            vk::Format::D32_SFLOAT_S8_UINT => RafxFormat::D32_SFLOAT_S8_UINT,
543            vk::Format::BC1_RGB_UNORM_BLOCK => RafxFormat::BC1_RGB_UNORM_BLOCK,
544            vk::Format::BC1_RGB_SRGB_BLOCK => RafxFormat::BC1_RGB_SRGB_BLOCK,
545            vk::Format::BC1_RGBA_UNORM_BLOCK => RafxFormat::BC1_RGBA_UNORM_BLOCK,
546            vk::Format::BC1_RGBA_SRGB_BLOCK => RafxFormat::BC1_RGBA_SRGB_BLOCK,
547            vk::Format::BC2_UNORM_BLOCK => RafxFormat::BC2_UNORM_BLOCK,
548            vk::Format::BC2_SRGB_BLOCK => RafxFormat::BC2_SRGB_BLOCK,
549            vk::Format::BC3_UNORM_BLOCK => RafxFormat::BC3_UNORM_BLOCK,
550            vk::Format::BC3_SRGB_BLOCK => RafxFormat::BC3_SRGB_BLOCK,
551            vk::Format::BC4_UNORM_BLOCK => RafxFormat::BC4_UNORM_BLOCK,
552            vk::Format::BC4_SNORM_BLOCK => RafxFormat::BC4_SNORM_BLOCK,
553            vk::Format::BC5_UNORM_BLOCK => RafxFormat::BC5_UNORM_BLOCK,
554            vk::Format::BC5_SNORM_BLOCK => RafxFormat::BC5_SNORM_BLOCK,
555            vk::Format::BC6H_UFLOAT_BLOCK => RafxFormat::BC6H_UFLOAT_BLOCK,
556            vk::Format::BC6H_SFLOAT_BLOCK => RafxFormat::BC6H_SFLOAT_BLOCK,
557            vk::Format::BC7_UNORM_BLOCK => RafxFormat::BC7_UNORM_BLOCK,
558            vk::Format::BC7_SRGB_BLOCK => RafxFormat::BC7_SRGB_BLOCK,
559            vk::Format::ETC2_R8G8B8_UNORM_BLOCK => RafxFormat::ETC2_R8G8B8_UNORM_BLOCK,
560            vk::Format::ETC2_R8G8B8_SRGB_BLOCK => RafxFormat::ETC2_R8G8B8_SRGB_BLOCK,
561            vk::Format::ETC2_R8G8B8A1_UNORM_BLOCK => RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK,
562            vk::Format::ETC2_R8G8B8A1_SRGB_BLOCK => RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK,
563            vk::Format::ETC2_R8G8B8A8_UNORM_BLOCK => RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK,
564            vk::Format::ETC2_R8G8B8A8_SRGB_BLOCK => RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK,
565            vk::Format::EAC_R11_UNORM_BLOCK => RafxFormat::EAC_R11_UNORM_BLOCK,
566            vk::Format::EAC_R11_SNORM_BLOCK => RafxFormat::EAC_R11_SNORM_BLOCK,
567            vk::Format::EAC_R11G11_UNORM_BLOCK => RafxFormat::EAC_R11G11_UNORM_BLOCK,
568            vk::Format::EAC_R11G11_SNORM_BLOCK => RafxFormat::EAC_R11G11_SNORM_BLOCK,
569            vk::Format::ASTC_4X4_UNORM_BLOCK => RafxFormat::ASTC_4X4_UNORM_BLOCK,
570            vk::Format::ASTC_4X4_SRGB_BLOCK => RafxFormat::ASTC_4X4_SRGB_BLOCK,
571            vk::Format::ASTC_5X4_UNORM_BLOCK => RafxFormat::ASTC_5X4_UNORM_BLOCK,
572            vk::Format::ASTC_5X4_SRGB_BLOCK => RafxFormat::ASTC_5X4_SRGB_BLOCK,
573            vk::Format::ASTC_5X5_UNORM_BLOCK => RafxFormat::ASTC_5X5_UNORM_BLOCK,
574            vk::Format::ASTC_5X5_SRGB_BLOCK => RafxFormat::ASTC_5X5_SRGB_BLOCK,
575            vk::Format::ASTC_6X5_UNORM_BLOCK => RafxFormat::ASTC_6X5_UNORM_BLOCK,
576            vk::Format::ASTC_6X5_SRGB_BLOCK => RafxFormat::ASTC_6X5_SRGB_BLOCK,
577            vk::Format::ASTC_6X6_UNORM_BLOCK => RafxFormat::ASTC_6X6_UNORM_BLOCK,
578            vk::Format::ASTC_6X6_SRGB_BLOCK => RafxFormat::ASTC_6X6_SRGB_BLOCK,
579            vk::Format::ASTC_8X5_UNORM_BLOCK => RafxFormat::ASTC_8X5_UNORM_BLOCK,
580            vk::Format::ASTC_8X5_SRGB_BLOCK => RafxFormat::ASTC_8X5_SRGB_BLOCK,
581            vk::Format::ASTC_8X6_UNORM_BLOCK => RafxFormat::ASTC_8X6_UNORM_BLOCK,
582            vk::Format::ASTC_8X6_SRGB_BLOCK => RafxFormat::ASTC_8X6_SRGB_BLOCK,
583            vk::Format::ASTC_8X8_UNORM_BLOCK => RafxFormat::ASTC_8X8_UNORM_BLOCK,
584            vk::Format::ASTC_8X8_SRGB_BLOCK => RafxFormat::ASTC_8X8_SRGB_BLOCK,
585            vk::Format::ASTC_10X5_UNORM_BLOCK => RafxFormat::ASTC_10X5_UNORM_BLOCK,
586            vk::Format::ASTC_10X5_SRGB_BLOCK => RafxFormat::ASTC_10X5_SRGB_BLOCK,
587            vk::Format::ASTC_10X6_UNORM_BLOCK => RafxFormat::ASTC_10X6_UNORM_BLOCK,
588            vk::Format::ASTC_10X6_SRGB_BLOCK => RafxFormat::ASTC_10X6_SRGB_BLOCK,
589            vk::Format::ASTC_10X8_UNORM_BLOCK => RafxFormat::ASTC_10X8_UNORM_BLOCK,
590            vk::Format::ASTC_10X8_SRGB_BLOCK => RafxFormat::ASTC_10X8_SRGB_BLOCK,
591            vk::Format::ASTC_10X10_UNORM_BLOCK => RafxFormat::ASTC_10X10_UNORM_BLOCK,
592            vk::Format::ASTC_10X10_SRGB_BLOCK => RafxFormat::ASTC_10X10_SRGB_BLOCK,
593            vk::Format::ASTC_12X10_UNORM_BLOCK => RafxFormat::ASTC_12X10_UNORM_BLOCK,
594            vk::Format::ASTC_12X10_SRGB_BLOCK => RafxFormat::ASTC_12X10_SRGB_BLOCK,
595            vk::Format::ASTC_12X12_UNORM_BLOCK => RafxFormat::ASTC_12X12_UNORM_BLOCK,
596            vk::Format::ASTC_12X12_SRGB_BLOCK => RafxFormat::ASTC_12X12_SRGB_BLOCK,
597            _ => unimplemented!(),
598        }
599    }
600}
601
602#[cfg(feature = "rafx-dx12")]
603impl Into<DxgiCommon::DXGI_FORMAT> for RafxFormat {
604    fn into(self) -> DxgiCommon::DXGI_FORMAT {
605        match self {
606            RafxFormat::UNDEFINED => DxgiCommon::DXGI_FORMAT_UNKNOWN,
607            //RafxFormat::R4G4_UNORM_PACK8 => DxgiCommon::DXGI_FORMAT_R4G4_UNORM,
608            //RafxFormat::R4G4B4A4_UNORM_PACK16 => DxgiCommon::DXGI_FORMAT_R4G4B4A4_UNORM,
609            RafxFormat::B4G4R4A4_UNORM_PACK16 => DxgiCommon::DXGI_FORMAT_B4G4R4A4_UNORM,
610            //RafxFormat::R5G6B5_UNORM_PACK16 => DxgiCommon::DXGI_FORMAT_R5G6B5_UNORM,
611            RafxFormat::B5G6R5_UNORM_PACK16 => DxgiCommon::DXGI_FORMAT_B5G6R5_UNORM,
612            //RafxFormat::R5G5B5A1_UNORM_PACK16 => DxgiCommon::DXGI_FORMAT_R5G5B5A1_UNORM,
613            RafxFormat::B5G5R5A1_UNORM_PACK16 => DxgiCommon::DXGI_FORMAT_B5G5R5A1_UNORM,
614            //RafxFormat::A1R5G5B5_UNORM_PACK16 => DxgiCommon::DXGI_FORMAT_A1R5G5B5_UNORM,
615            RafxFormat::R8_UNORM => DxgiCommon::DXGI_FORMAT_R8_UNORM,
616            RafxFormat::R8_SNORM => DxgiCommon::DXGI_FORMAT_R8_SNORM,
617            // RafxFormat::R8_USCALED => DxgiCommon::DXGI_FORMAT_R8_USCALED,
618            // RafxFormat::R8_SSCALED => DxgiCommon::DXGI_FORMAT_R8_SSCALED,
619            RafxFormat::R8_UINT => DxgiCommon::DXGI_FORMAT_R8_UINT,
620            RafxFormat::R8_SINT => DxgiCommon::DXGI_FORMAT_R8_SINT,
621            //RafxFormat::R8_SRGB => DxgiCommon::DXGI_FORMAT_R8_SRGB,
622            RafxFormat::R8G8_UNORM => DxgiCommon::DXGI_FORMAT_R8G8_UNORM,
623            RafxFormat::R8G8_SNORM => DxgiCommon::DXGI_FORMAT_R8G8_SNORM,
624            // RafxFormat::R8G8_USCALED => DxgiCommon::DXGI_FORMAT_R8G8_USCALED,
625            // RafxFormat::R8G8_SSCALED => DxgiCommon::DXGI_FORMAT_R8G8_SSCALED,
626            RafxFormat::R8G8_UINT => DxgiCommon::DXGI_FORMAT_R8G8_UINT,
627            RafxFormat::R8G8_SINT => DxgiCommon::DXGI_FORMAT_R8G8_SINT,
628            // RafxFormat::R8G8_SRGB => DxgiCommon::DXGI_FORMAT_R8G8_SRGB,
629            // RafxFormat::R8G8B8_UNORM => DxgiCommon::DXGI_FORMAT_R8G8B8_UNORM,
630            // RafxFormat::R8G8B8_SNORM => DxgiCommon::DXGI_FORMAT_R8G8B8_SNORM,
631            // RafxFormat::R8G8B8_USCALED => DxgiCommon::DXGI_FORMAT_R8G8B8_USCALED,
632            // RafxFormat::R8G8B8_SSCALED => DxgiCommon::DXGI_FORMAT_R8G8B8_SSCALED,
633            // RafxFormat::R8G8B8_UINT => DxgiCommon::DXGI_FORMAT_R8G8B8_UINT,
634            // RafxFormat::R8G8B8_SINT => DxgiCommon::DXGI_FORMAT_R8G8B8_SINT,
635            // RafxFormat::R8G8B8_SRGB => DxgiCommon::DXGI_FORMAT_R8G8B8_SRGB,
636            // RafxFormat::B8G8R8_UNORM => DxgiCommon::DXGI_FORMAT_B8G8R8_UNORM,
637            // RafxFormat::B8G8R8_SNORM => DxgiCommon::DXGI_FORMAT_B8G8R8_SNORM,
638            // RafxFormat::B8G8R8_USCALED => DxgiCommon::DXGI_FORMAT_B8G8R8_USCALED,
639            // RafxFormat::B8G8R8_SSCALED => DxgiCommon::DXGI_FORMAT_B8G8R8_SSCALED,
640            // RafxFormat::B8G8R8_UINT => DxgiCommon::DXGI_FORMAT_B8G8R8_UINT,
641            // RafxFormat::B8G8R8_SINT => DxgiCommon::DXGI_FORMAT_B8G8R8_SINT,
642            // RafxFormat::B8G8R8_SRGB => DxgiCommon::DXGI_FORMAT_B8G8R8_SRGB,
643            RafxFormat::R8G8B8A8_UNORM => DxgiCommon::DXGI_FORMAT_R8G8B8A8_UNORM,
644            RafxFormat::R8G8B8A8_SNORM => DxgiCommon::DXGI_FORMAT_R8G8B8A8_SNORM,
645            //RafxFormat::R8G8B8A8_USCALED => DxgiCommon::DXGI_FORMAT_R8G8B8A8_USCALED,
646            //RafxFormat::R8G8B8A8_SSCALED => DxgiCommon::DXGI_FORMAT_R8G8B8A8_SSCALED,
647            RafxFormat::R8G8B8A8_UINT => DxgiCommon::DXGI_FORMAT_R8G8B8A8_UINT,
648            RafxFormat::R8G8B8A8_SINT => DxgiCommon::DXGI_FORMAT_R8G8B8A8_SINT,
649            RafxFormat::R8G8B8A8_SRGB => DxgiCommon::DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
650            RafxFormat::B8G8R8A8_UNORM => DxgiCommon::DXGI_FORMAT_B8G8R8A8_UNORM,
651            // RafxFormat::B8G8R8A8_SNORM => DxgiCommon::DXGI_FORMAT_B8G8R8A8_SNORM,
652            // RafxFormat::B8G8R8A8_USCALED => DxgiCommon::DXGI_FORMAT_B8G8R8A8_USCALED,
653            // RafxFormat::B8G8R8A8_SSCALED => DxgiCommon::DXGI_FORMAT_B8G8R8A8_SSCALED,
654            // RafxFormat::B8G8R8A8_UINT => DxgiCommon::DXGI_FORMAT_B8G8R8A8_UINT,
655            // RafxFormat::B8G8R8A8_SINT => DxgiCommon::DXGI_FORMAT_B8G8R8A8_SINT,
656            RafxFormat::B8G8R8A8_SRGB => DxgiCommon::DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
657            // RafxFormat::A8B8G8R8_UNORM_PACK32 => DxgiCommon::DXGI_FORMAT_A8B8G8R8_UNORM_PACK32,
658            // RafxFormat::A8B8G8R8_SNORM_PACK32 => DxgiCommon::DXGI_FORMAT_A8B8G8R8_SNORM_PACK32,
659            // RafxFormat::A8B8G8R8_USCALED_PACK32 => DxgiCommon::DXGI_FORMAT_A8B8G8R8_USCALED_PACK32,
660            // RafxFormat::A8B8G8R8_SSCALED_PACK32 => DxgiCommon::DXGI_FORMAT_A8B8G8R8_SSCALED_PACK32,
661            // RafxFormat::A8B8G8R8_UINT_PACK32 => DxgiCommon::DXGI_FORMAT_A8B8G8R8_UINT_PACK32,
662            // RafxFormat::A8B8G8R8_SINT_PACK32 => DxgiCommon::DXGI_FORMAT_A8B8G8R8_SINT_PACK32,
663            // RafxFormat::A8B8G8R8_SRGB_PACK32 => DxgiCommon::DXGI_FORMAT_A8B8G8R8_SRGB_PACK32,
664            RafxFormat::A2R10G10B10_UNORM_PACK32 => DxgiCommon::DXGI_FORMAT_R10G10B10A2_UNORM,
665            // RafxFormat::A2R10G10B10_SNORM_PACK32 => DxgiCommon::DXGI_FORMAT_A2R10G10B10_SNORM_PACK32,
666            // RafxFormat::A2R10G10B10_USCALED_PACK32 => DxgiCommon::DXGI_FORMAT_A2R10G10B10_USCALED_PACK32,
667            // RafxFormat::A2R10G10B10_SSCALED_PACK32 => DxgiCommon::DXGI_FORMAT_A2R10G10B10_SSCALED_PACK32,
668            RafxFormat::A2R10G10B10_UINT_PACK32 => DxgiCommon::DXGI_FORMAT_R10G10B10A2_UINT,
669            // RafxFormat::A2R10G10B10_SINT_PACK32 => DxgiCommon::DXGI_FORMAT_A2R10G10B10_SINT_PACK32,
670            // RafxFormat::A2B10G10R10_UNORM_PACK32 => DxgiCommon::DXGI_FORMAT_A2B10G10R10_UNORM_PACK32,
671            // RafxFormat::A2B10G10R10_SNORM_PACK32 => DxgiCommon::DXGI_FORMAT_A2B10G10R10_SNORM_PACK32,
672            // RafxFormat::A2B10G10R10_USCALED_PACK32 => DxgiCommon::DXGI_FORMAT_A2B10G10R10_USCALED_PACK32,
673            // RafxFormat::A2B10G10R10_SSCALED_PACK32 => DxgiCommon::DXGI_FORMAT_A2B10G10R10_SSCALED_PACK32,
674            // RafxFormat::A2B10G10R10_UINT_PACK32 => DxgiCommon::DXGI_FORMAT_A2B10G10R10_UINT_PACK32,
675            // RafxFormat::A2B10G10R10_SINT_PACK32 => DxgiCommon::DXGI_FORMAT_A2B10G10R10_SINT_PACK32,
676            RafxFormat::R16_UNORM => DxgiCommon::DXGI_FORMAT_R16_UNORM,
677            RafxFormat::R16_SNORM => DxgiCommon::DXGI_FORMAT_R16_SNORM,
678            // RafxFormat::R16_USCALED => DxgiCommon::DXGI_FORMAT_R16_USCALED,
679            // RafxFormat::R16_SSCALED => DxgiCommon::DXGI_FORMAT_R16_SSCALED,
680            RafxFormat::R16_UINT => DxgiCommon::DXGI_FORMAT_R16_UINT,
681            RafxFormat::R16_SINT => DxgiCommon::DXGI_FORMAT_R16_SINT,
682            RafxFormat::R16_SFLOAT => DxgiCommon::DXGI_FORMAT_R16_FLOAT,
683            RafxFormat::R16G16_UNORM => DxgiCommon::DXGI_FORMAT_R16G16_UNORM,
684            RafxFormat::R16G16_SNORM => DxgiCommon::DXGI_FORMAT_R16G16_SNORM,
685            // RafxFormat::R16G16_USCALED => DxgiCommon::DXGI_FORMAT_R16G16_USCALED,
686            // RafxFormat::R16G16_SSCALED => DxgiCommon::DXGI_FORMAT_R16G16_SSCALED,
687            RafxFormat::R16G16_UINT => DxgiCommon::DXGI_FORMAT_R16G16_UINT,
688            RafxFormat::R16G16_SINT => DxgiCommon::DXGI_FORMAT_R16G16_SINT,
689            RafxFormat::R16G16_SFLOAT => DxgiCommon::DXGI_FORMAT_R16G16_FLOAT,
690            // RafxFormat::R16G16B16_UNORM => DxgiCommon::DXGI_FORMAT_R16G16B16_UNORM,
691            // RafxFormat::R16G16B16_SNORM => DxgiCommon::DXGI_FORMAT_R16G16B16_SNORM,
692            // RafxFormat::R16G16B16_USCALED => DxgiCommon::DXGI_FORMAT_R16G16B16_USCALED,
693            // RafxFormat::R16G16B16_SSCALED => DxgiCommon::DXGI_FORMAT_R16G16B16_SSCALED,
694            // RafxFormat::R16G16B16_UINT => DxgiCommon::DXGI_FORMAT_R16G16B16_UINT,
695            // RafxFormat::R16G16B16_SINT => DxgiCommon::DXGI_FORMAT_R16G16B16_SINT,
696            // RafxFormat::R16G16B16_SFLOAT => DxgiCommon::DXGI_FORMAT_R16G16B16_SFLOAT,
697            RafxFormat::R16G16B16A16_UNORM => DxgiCommon::DXGI_FORMAT_R16G16B16A16_UNORM,
698            RafxFormat::R16G16B16A16_SNORM => DxgiCommon::DXGI_FORMAT_R16G16B16A16_SNORM,
699            //RafxFormat::R16G16B16A16_USCALED => DxgiCommon::DXGI_FORMAT_R16G16B16A16_USCALED,
700            //RafxFormat::R16G16B16A16_SSCALED => DxgiCommon::DXGI_FORMAT_R16G16B16A16_SSCALED,
701            RafxFormat::R16G16B16A16_UINT => DxgiCommon::DXGI_FORMAT_R16G16B16A16_UINT,
702            RafxFormat::R16G16B16A16_SINT => DxgiCommon::DXGI_FORMAT_R16G16B16A16_SINT,
703            RafxFormat::R16G16B16A16_SFLOAT => DxgiCommon::DXGI_FORMAT_R16G16B16A16_FLOAT,
704            RafxFormat::R32_UINT => DxgiCommon::DXGI_FORMAT_R32_UINT,
705            RafxFormat::R32_SINT => DxgiCommon::DXGI_FORMAT_R32_SINT,
706            RafxFormat::R32_SFLOAT => DxgiCommon::DXGI_FORMAT_R32_FLOAT,
707            RafxFormat::R32G32_UINT => DxgiCommon::DXGI_FORMAT_R32G32_UINT,
708            RafxFormat::R32G32_SINT => DxgiCommon::DXGI_FORMAT_R32G32_SINT,
709            RafxFormat::R32G32_SFLOAT => DxgiCommon::DXGI_FORMAT_R32G32_FLOAT,
710            RafxFormat::R32G32B32_UINT => DxgiCommon::DXGI_FORMAT_R32G32B32_UINT,
711            RafxFormat::R32G32B32_SINT => DxgiCommon::DXGI_FORMAT_R32G32B32_SINT,
712            RafxFormat::R32G32B32_SFLOAT => DxgiCommon::DXGI_FORMAT_R32G32B32_FLOAT,
713            RafxFormat::R32G32B32A32_UINT => DxgiCommon::DXGI_FORMAT_R32G32B32A32_UINT,
714            RafxFormat::R32G32B32A32_SINT => DxgiCommon::DXGI_FORMAT_R32G32B32A32_SINT,
715            RafxFormat::R32G32B32A32_SFLOAT => DxgiCommon::DXGI_FORMAT_R32G32B32A32_FLOAT,
716            // RafxFormat::R64_UINT => DxgiCommon::DXGI_FORMAT_R64_UINT,
717            // RafxFormat::R64_SINT => DxgiCommon::DXGI_FORMAT_R64_SINT,
718            // RafxFormat::R64_SFLOAT => DxgiCommon::DXGI_FORMAT_R64_SFLOAT,
719            // RafxFormat::R64G64_UINT => DxgiCommon::DXGI_FORMAT_R64G64_UINT,
720            // RafxFormat::R64G64_SINT => DxgiCommon::DXGI_FORMAT_R64G64_SINT,
721            // RafxFormat::R64G64_SFLOAT => DxgiCommon::DXGI_FORMAT_R64G64_SFLOAT,
722            // RafxFormat::R64G64B64_UINT => DxgiCommon::DXGI_FORMAT_R64G64B64_UINT,
723            // RafxFormat::R64G64B64_SINT => DxgiCommon::DXGI_FORMAT_R64G64B64_SINT,
724            // RafxFormat::R64G64B64_SFLOAT => DxgiCommon::DXGI_FORMAT_R64G64B64_SFLOAT,
725            // RafxFormat::R64G64B64A64_UINT => DxgiCommon::DXGI_FORMAT_R64G64B64A64_UINT,
726            // RafxFormat::R64G64B64A64_SINT => DxgiCommon::DXGI_FORMAT_R64G64B64A64_SINT,
727            // RafxFormat::R64G64B64A64_SFLOAT => DxgiCommon::DXGI_FORMAT_R64G64B64A64_SFLOAT,
728            //RafxFormat::B10G11R11_UFLOAT_PACK32 => DxgiCommon::DXGI_FORMAT_B10G11R11_UFLOAT,
729            //RafxFormat::E5B9G9R9_UFLOAT_PACK32 => DxgiCommon::DXGI_FORMAT_E5B9G9R9_UFLOAT,
730            RafxFormat::D16_UNORM => DxgiCommon::DXGI_FORMAT_D16_UNORM,
731            RafxFormat::X8_D24_UNORM_PACK32 => DxgiCommon::DXGI_FORMAT_D24_UNORM_S8_UINT,
732            RafxFormat::D32_SFLOAT => DxgiCommon::DXGI_FORMAT_D32_FLOAT,
733            //RafxFormat::S8_UINT => DxgiCommon::DXGI_FORMAT_S8_UINT,
734            //RafxFormat::D16_UNORM_S8_UINT => DxgiCommon::DXGI_FORMAT_D16_UNORM_S8_UINT,
735            RafxFormat::D24_UNORM_S8_UINT => DxgiCommon::DXGI_FORMAT_D24_UNORM_S8_UINT,
736            RafxFormat::D32_SFLOAT_S8_UINT => DxgiCommon::DXGI_FORMAT_D32_FLOAT_S8X24_UINT,
737            RafxFormat::BC1_RGB_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_BC1_UNORM,
738            RafxFormat::BC1_RGB_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_BC1_UNORM_SRGB,
739            RafxFormat::BC1_RGBA_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_BC1_UNORM,
740            RafxFormat::BC1_RGBA_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_BC1_UNORM_SRGB,
741            RafxFormat::BC2_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_BC2_UNORM,
742            RafxFormat::BC2_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_BC2_UNORM_SRGB,
743            RafxFormat::BC3_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_BC3_UNORM,
744            RafxFormat::BC3_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_BC3_UNORM_SRGB,
745            RafxFormat::BC4_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_BC4_UNORM,
746            RafxFormat::BC4_SNORM_BLOCK => DxgiCommon::DXGI_FORMAT_BC4_SNORM,
747            RafxFormat::BC5_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_BC5_UNORM,
748            RafxFormat::BC5_SNORM_BLOCK => DxgiCommon::DXGI_FORMAT_BC5_SNORM,
749            RafxFormat::BC6H_UFLOAT_BLOCK => DxgiCommon::DXGI_FORMAT_BC6H_UF16,
750            RafxFormat::BC6H_SFLOAT_BLOCK => DxgiCommon::DXGI_FORMAT_BC6H_SF16,
751            RafxFormat::BC7_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_BC7_UNORM,
752            RafxFormat::BC7_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_BC7_UNORM_SRGB,
753            // RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
754            // RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,
755            // RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
756            // RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,
757            // RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,
758            // RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,
759            // RafxFormat::EAC_R11_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_EAC_R11_UNORM_BLOCK,
760            // RafxFormat::EAC_R11_SNORM_BLOCK => DxgiCommon::DXGI_FORMAT_EAC_R11_SNORM_BLOCK,
761            // RafxFormat::EAC_R11G11_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_EAC_R11G11_UNORM_BLOCK,
762            // RafxFormat::EAC_R11G11_SNORM_BLOCK => DxgiCommon::DXGI_FORMAT_EAC_R11G11_SNORM_BLOCK,
763            // RafxFormat::ASTC_4X4_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_4X4_UNORM_BLOCK,
764            // RafxFormat::ASTC_4X4_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_4X4_SRGB_BLOCK,
765            // RafxFormat::ASTC_5X4_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_5X4_UNORM_BLOCK,
766            // RafxFormat::ASTC_5X4_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_5X4_SRGB_BLOCK,
767            // RafxFormat::ASTC_5X5_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_5X5_UNORM_BLOCK,
768            // RafxFormat::ASTC_5X5_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_5X5_SRGB_BLOCK,
769            // RafxFormat::ASTC_6X5_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_6X5_UNORM_BLOCK,
770            // RafxFormat::ASTC_6X5_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_6X5_SRGB_BLOCK,
771            // RafxFormat::ASTC_6X6_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_6X6_UNORM_BLOCK,
772            // RafxFormat::ASTC_6X6_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_6X6_SRGB_BLOCK,
773            // RafxFormat::ASTC_8X5_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_8X5_UNORM_BLOCK,
774            // RafxFormat::ASTC_8X5_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_8X5_SRGB_BLOCK,
775            // RafxFormat::ASTC_8X6_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_8X6_UNORM_BLOCK,
776            // RafxFormat::ASTC_8X6_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_8X6_SRGB_BLOCK,
777            // RafxFormat::ASTC_8X8_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_8X8_UNORM_BLOCK,
778            // RafxFormat::ASTC_8X8_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_8X8_SRGB_BLOCK,
779            // RafxFormat::ASTC_10X5_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_10X5_UNORM_BLOCK,
780            // RafxFormat::ASTC_10X5_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_10X5_SRGB_BLOCK,
781            // RafxFormat::ASTC_10X6_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_10X6_UNORM_BLOCK,
782            // RafxFormat::ASTC_10X6_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_10X6_SRGB_BLOCK,
783            // RafxFormat::ASTC_10X8_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_10X8_UNORM_BLOCK,
784            // RafxFormat::ASTC_10X8_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_10X8_SRGB_BLOCK,
785            // RafxFormat::ASTC_10X10_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_10X10_UNORM_BLOCK,
786            // RafxFormat::ASTC_10X10_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_10X10_SRGB_BLOCK,
787            // RafxFormat::ASTC_12X10_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_12X10_UNORM_BLOCK,
788            // RafxFormat::ASTC_12X10_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_12X10_SRGB_BLOCK,
789            // RafxFormat::ASTC_12X12_UNORM_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_12X12_UNORM_BLOCK,
790            // RafxFormat::ASTC_12X12_SRGB_BLOCK => DxgiCommon::DXGI_FORMAT_ASTC_12X12_SRGB_BLOCK,
791            _ => unimplemented!(),
792        }
793    }
794}
795
796#[cfg(feature = "rafx-dx12")]
797impl From<DxgiCommon::DXGI_FORMAT> for RafxFormat {
798    fn from(format: DxgiCommon::DXGI_FORMAT) -> RafxFormat {
799        match format {
800            DxgiCommon::DXGI_FORMAT_UNKNOWN => RafxFormat::UNDEFINED,
801            // DxgiCommon::DXGI_FORMAT_R4G4_UNORM_PACK8 => RafxFormat::R4G4_UNORM_PACK8,
802            // DxgiCommon::DXGI_FORMAT_R4G4B4A4_UNORM_PACK16 => RafxFormat::R4G4B4A4_UNORM_PACK16,
803            DxgiCommon::DXGI_FORMAT_B4G4R4A4_UNORM => RafxFormat::B4G4R4A4_UNORM_PACK16,
804            // DxgiCommon::DXGI_FORMAT_R5G6B5_UNORM => RafxFormat::R5G6B5_UNORM_PACK16,
805            DxgiCommon::DXGI_FORMAT_B5G6R5_UNORM => RafxFormat::B5G6R5_UNORM_PACK16,
806            // DxgiCommon::DXGI_FORMAT_R5G5B5A1_UNORM => RafxFormat::R5G5B5A1_UNORM_PACK16,
807            DxgiCommon::DXGI_FORMAT_B5G5R5A1_UNORM => RafxFormat::B5G5R5A1_UNORM_PACK16,
808            // DxgiCommon::DXGI_FORMAT_A1R5G5B5_UNORM => RafxFormat::A1R5G5B5_UNORM_PACK16,
809            DxgiCommon::DXGI_FORMAT_R8_UNORM => RafxFormat::R8_UNORM,
810            DxgiCommon::DXGI_FORMAT_R8_SNORM => RafxFormat::R8_SNORM,
811            // DxgiCommon::DXGI_FORMAT_R8_USCALED => RafxFormat::R8_USCALED,
812            // DxgiCommon::DXGI_FORMAT_R8_SSCALED => RafxFormat::R8_SSCALED,
813            DxgiCommon::DXGI_FORMAT_R8_UINT => RafxFormat::R8_UINT,
814            DxgiCommon::DXGI_FORMAT_R8_SINT => RafxFormat::R8_SINT,
815            // DxgiCommon::DXGI_FORMAT_R8_SRGB => RafxFormat::R8_SRGB,
816            DxgiCommon::DXGI_FORMAT_R8G8_UNORM => RafxFormat::R8G8_UNORM,
817            DxgiCommon::DXGI_FORMAT_R8G8_SNORM => RafxFormat::R8G8_SNORM,
818            // DxgiCommon::DXGI_FORMAT_R8G8_USCALED => RafxFormat::R8G8_USCALED,
819            // DxgiCommon::DXGI_FORMAT_R8G8_SSCALED => RafxFormat::R8G8_SSCALED,
820            DxgiCommon::DXGI_FORMAT_R8G8_UINT => RafxFormat::R8G8_UINT,
821            DxgiCommon::DXGI_FORMAT_R8G8_SINT => RafxFormat::R8G8_SINT,
822            // DxgiCommon::DXGI_FORMAT_R8G8_SRGB => RafxFormat::R8G8_SRGB,
823            // DxgiCommon::DXGI_FORMAT_R8G8B8_UNORM => RafxFormat::R8G8B8_UNORM,
824            // DxgiCommon::DXGI_FORMAT_R8G8B8_SNORM => RafxFormat::R8G8B8_SNORM,
825            // DxgiCommon::DXGI_FORMAT_R8G8B8_USCALED => RafxFormat::R8G8B8_USCALED,
826            // DxgiCommon::DXGI_FORMAT_R8G8B8_SSCALED => RafxFormat::R8G8B8_SSCALED,
827            // DxgiCommon::DXGI_FORMAT_R8G8B8_UINT => RafxFormat::R8G8B8_UINT,
828            // DxgiCommon::DXGI_FORMAT_R8G8B8_SINT => RafxFormat::R8G8B8_SINT,
829            // DxgiCommon::DXGI_FORMAT_R8G8B8_SRGB => RafxFormat::R8G8B8_SRGB,
830            // DxgiCommon::DXGI_FORMAT_B8G8R8_UNORM => RafxFormat::B8G8R8_UNORM,
831            // DxgiCommon::DXGI_FORMAT_B8G8R8_SNORM => RafxFormat::B8G8R8_SNORM,
832            // DxgiCommon::DXGI_FORMAT_B8G8R8_USCALED => RafxFormat::B8G8R8_USCALED,
833            // DxgiCommon::DXGI_FORMAT_B8G8R8_SSCALED => RafxFormat::B8G8R8_SSCALED,
834            // DxgiCommon::DXGI_FORMAT_B8G8R8_UINT => RafxFormat::B8G8R8_UINT,
835            // DxgiCommon::DXGI_FORMAT_B8G8R8_SINT => RafxFormat::B8G8R8_SINT,
836            // DxgiCommon::DXGI_FORMAT_B8G8R8_SRGB => RafxFormat::B8G8R8_SRGB,
837            DxgiCommon::DXGI_FORMAT_R8G8B8A8_UNORM => RafxFormat::R8G8B8A8_UNORM,
838            DxgiCommon::DXGI_FORMAT_R8G8B8A8_SNORM => RafxFormat::R8G8B8A8_SNORM,
839            // DxgiCommon::DXGI_FORMAT_R8G8B8A8_USCALED => RafxFormat::R8G8B8A8_USCALED,
840            // DxgiCommon::DXGI_FORMAT_R8G8B8A8_SSCALED => RafxFormat::R8G8B8A8_SSCALED,
841            DxgiCommon::DXGI_FORMAT_R8G8B8A8_UINT => RafxFormat::R8G8B8A8_UINT,
842            DxgiCommon::DXGI_FORMAT_R8G8B8A8_SINT => RafxFormat::R8G8B8A8_SINT,
843            DxgiCommon::DXGI_FORMAT_R8G8B8A8_UNORM_SRGB => RafxFormat::R8G8B8A8_SRGB,
844            DxgiCommon::DXGI_FORMAT_B8G8R8A8_UNORM => RafxFormat::B8G8R8A8_UNORM,
845            // DxgiCommon::DXGI_FORMAT_B8G8R8A8_SNORM => RafxFormat::B8G8R8A8_SNORM,
846            // DxgiCommon::DXGI_FORMAT_B8G8R8A8_USCALED => RafxFormat::B8G8R8A8_USCALED,
847            // DxgiCommon::DXGI_FORMAT_B8G8R8A8_SSCALED => RafxFormat::B8G8R8A8_SSCALED,
848            // DxgiCommon::DXGI_FORMAT_B8G8R8A8_UINT => RafxFormat::B8G8R8A8_UINT,
849            // DxgiCommon::DXGI_FORMAT_B8G8R8A8_SINT => RafxFormat::B8G8R8A8_SINT,
850            DxgiCommon::DXGI_FORMAT_B8G8R8A8_UNORM_SRGB => RafxFormat::B8G8R8A8_SRGB,
851            // DxgiCommon::DXGI_FORMAT_A8B8G8R8_UNORM => RafxFormat::A8B8G8R8_UNORM_PACK32,
852            // DxgiCommon::DXGI_FORMAT_A8B8G8R8_SNORM => RafxFormat::A8B8G8R8_SNORM_PACK32,
853            // DxgiCommon::DXGI_FORMAT_A8B8G8R8_USCALED => RafxFormat::A8B8G8R8_USCALED_PACK32,
854            // DxgiCommon::DXGI_FORMAT_A8B8G8R8_SSCALED => RafxFormat::A8B8G8R8_SSCALED_PACK32,
855            // DxgiCommon::DXGI_FORMAT_A8B8G8R8_UINT => RafxFormat::A8B8G8R8_UINT_PACK32,
856            // DxgiCommon::DXGI_FORMAT_A8B8G8R8_SINT => RafxFormat::A8B8G8R8_SINT_PACK32,
857            // DxgiCommon::DXGI_FORMAT_A8B8G8R8_SRGB => RafxFormat::A8B8G8R8_SRGB_PACK32,
858            DxgiCommon::DXGI_FORMAT_R10G10B10A2_UNORM => RafxFormat::A2R10G10B10_UNORM_PACK32,
859            // DxgiCommon::DXGI_FORMAT_A2R10G10B10_SNORM_PACK32 => RafxFormat::A2R10G10B10_SNORM_PACK32,
860            // DxgiCommon::DXGI_FORMAT_A2R10G10B10_USCALED_PACK32 => RafxFormat::A2R10G10B10_USCALED_PACK32,
861            // DxgiCommon::DXGI_FORMAT_A2R10G10B10_SSCALED_PACK32 => RafxFormat::A2R10G10B10_SSCALED_PACK32,
862            DxgiCommon::DXGI_FORMAT_R10G10B10A2_UINT => RafxFormat::A2R10G10B10_UINT_PACK32,
863            // DxgiCommon::DXGI_FORMAT_A2R10G10B10_SINT_PACK32 => RafxFormat::A2R10G10B10_SINT_PACK32,
864            // DxgiCommon::DXGI_FORMAT_A2B10G10R10_UNORM_PACK32 => RafxFormat::A2B10G10R10_UNORM_PACK32,
865            // DxgiCommon::DXGI_FORMAT_A2B10G10R10_SNORM_PACK32 => RafxFormat::A2B10G10R10_SNORM_PACK32,
866            // DxgiCommon::DXGI_FORMAT_A2B10G10R10_USCALED_PACK32 => RafxFormat::A2B10G10R10_USCALED_PACK32,
867            // DxgiCommon::DXGI_FORMAT_A2B10G10R10_SSCALED_PACK32 => RafxFormat::A2B10G10R10_SSCALED_PACK32,
868            // DxgiCommon::DXGI_FORMAT_A2B10G10R10_UINT_PACK32 => RafxFormat::A2B10G10R10_UINT_PACK32,
869            // DxgiCommon::DXGI_FORMAT_A2B10G10R10_SINT_PACK32 => RafxFormat::A2B10G10R10_SINT_PACK32,
870            DxgiCommon::DXGI_FORMAT_R16_UNORM => RafxFormat::R16_UNORM,
871            DxgiCommon::DXGI_FORMAT_R16_SNORM => RafxFormat::R16_SNORM,
872            // DxgiCommon::DXGI_FORMAT_R16_USCALED => RafxFormat::R16_USCALED,
873            // DxgiCommon::DXGI_FORMAT_R16_SSCALED => RafxFormat::R16_SSCALED,
874            DxgiCommon::DXGI_FORMAT_R16_UINT => RafxFormat::R16_UINT,
875            DxgiCommon::DXGI_FORMAT_R16_SINT => RafxFormat::R16_SINT,
876            DxgiCommon::DXGI_FORMAT_R16_FLOAT => RafxFormat::R16_SFLOAT,
877            DxgiCommon::DXGI_FORMAT_R16G16_UNORM => RafxFormat::R16G16_UNORM,
878            DxgiCommon::DXGI_FORMAT_R16G16_SNORM => RafxFormat::R16G16_SNORM,
879            // DxgiCommon::DXGI_FORMAT_R16G16_USCALED => RafxFormat::R16G16_USCALED,
880            // DxgiCommon::DXGI_FORMAT_R16G16_SSCALED => RafxFormat::R16G16_SSCALED,
881            DxgiCommon::DXGI_FORMAT_R16G16_UINT => RafxFormat::R16G16_UINT,
882            DxgiCommon::DXGI_FORMAT_R16G16_SINT => RafxFormat::R16G16_SINT,
883            DxgiCommon::DXGI_FORMAT_R16G16_FLOAT => RafxFormat::R16G16_SFLOAT,
884            // DxgiCommon::R16G16B16_UNORM => RafxFormat::R16G16B16_UNORM,
885            // DxgiCommon::R16G16B16_SNORM => RafxFormat::R16G16B16_SNORM,
886            // DxgiCommon::R16G16B16_USCALED => RafxFormat::R16G16B16_USCALED,
887            // DxgiCommon::R16G16B16_SSCALED => RafxFormat::R16G16B16_SSCALED,
888            // DxgiCommon::R16G16B16_UINT => RafxFormat::R16G16B16_UINT,
889            // DxgiCommon::R16G16B16_SINT => RafxFormat::R16G16B16_SINT,
890            // DxgiCommon::R16G16B16_SFLOAT => RafxFormat::R16G16B16_SFLOAT,
891            DxgiCommon::DXGI_FORMAT_R16G16B16A16_UNORM => RafxFormat::R16G16B16A16_UNORM,
892            DxgiCommon::DXGI_FORMAT_R16G16B16A16_SNORM => RafxFormat::R16G16B16A16_SNORM,
893            // DxgiCommon::DXGI_FORMAT_R16G16B16A16_USCALED => RafxFormat::R16G16B16A16_USCALED,
894            // DxgiCommon::DXGI_FORMAT_R16G16B16A16_SSCALED => RafxFormat::R16G16B16A16_SSCALED,
895            DxgiCommon::DXGI_FORMAT_R16G16B16A16_UINT => RafxFormat::R16G16B16A16_UINT,
896            DxgiCommon::DXGI_FORMAT_R16G16B16A16_SINT => RafxFormat::R16G16B16A16_SINT,
897            DxgiCommon::DXGI_FORMAT_R16G16B16A16_FLOAT => RafxFormat::R16G16B16A16_SFLOAT,
898            DxgiCommon::DXGI_FORMAT_R32_UINT => RafxFormat::R32_UINT,
899            DxgiCommon::DXGI_FORMAT_R32_SINT => RafxFormat::R32_SINT,
900            DxgiCommon::DXGI_FORMAT_R32_FLOAT => RafxFormat::R32_SFLOAT,
901            DxgiCommon::DXGI_FORMAT_R32G32_UINT => RafxFormat::R32G32_UINT,
902            DxgiCommon::DXGI_FORMAT_R32G32_SINT => RafxFormat::R32G32_SINT,
903            DxgiCommon::DXGI_FORMAT_R32G32_FLOAT => RafxFormat::R32G32_SFLOAT,
904            DxgiCommon::DXGI_FORMAT_R32G32B32_UINT => RafxFormat::R32G32B32_UINT,
905            DxgiCommon::DXGI_FORMAT_R32G32B32_SINT => RafxFormat::R32G32B32_SINT,
906            DxgiCommon::DXGI_FORMAT_R32G32B32_FLOAT => RafxFormat::R32G32B32_SFLOAT,
907            DxgiCommon::DXGI_FORMAT_R32G32B32A32_UINT => RafxFormat::R32G32B32A32_UINT,
908            DxgiCommon::DXGI_FORMAT_R32G32B32A32_SINT => RafxFormat::R32G32B32A32_SINT,
909            DxgiCommon::DXGI_FORMAT_R32G32B32A32_FLOAT => RafxFormat::R32G32B32A32_SFLOAT,
910            // DxgiCommon::R64_UINT => RafxFormat::R64_UINT,
911            // DxgiCommon::R64_SINT => RafxFormat::R64_SINT,
912            // DxgiCommon::R64_SFLOAT => RafxFormat::R64_SFLOAT,
913            // DxgiCommon::R64G64_UINT => RafxFormat::R64G64_UINT,
914            // DxgiCommon::R64G64_SINT => RafxFormat::R64G64_SINT,
915            // DxgiCommon::R64G64_SFLOAT => RafxFormat::R64G64_SFLOAT,
916            // DxgiCommon::R64G64B64_UINT => RafxFormat::R64G64B64_UINT,
917            // DxgiCommon::R64G64B64_SINT => RafxFormat::R64G64B64_SINT,
918            // DxgiCommon::R64G64B64_SFLOAT => RafxFormat::R64G64B64_SFLOAT,
919            // DxgiCommon::R64G64B64A64_UINT => RafxFormat::R64G64B64A64_UINT,
920            // DxgiCommon::R64G64B64A64_SINT => RafxFormat::R64G64B64A64_SINT,
921            // DxgiCommon::R64G64B64A64_SFLOAT => RafxFormat::R64G64B64A64_SFLOAT,
922            // DxgiCommon::B10G11R11_UFLOAT_PACK32 => RafxFormat::B10G11R11_UFLOAT_PACK32,
923            // DxgiCommon::E5B9G9R9_UFLOAT_PACK32 => RafxFormat::E5B9G9R9_UFLOAT_PACK32,
924            DxgiCommon::DXGI_FORMAT_D16_UNORM => RafxFormat::D16_UNORM,
925            DxgiCommon::DXGI_FORMAT_D24_UNORM_S8_UINT => RafxFormat::X8_D24_UNORM_PACK32,
926            DxgiCommon::DXGI_FORMAT_D32_FLOAT => RafxFormat::D32_SFLOAT,
927            // DxgiCommon::S8_UINT => RafxFormat::S8_UINT,
928            // DxgiCommon::D16_UNORM_S8_UINT => RafxFormat::D16_UNORM_S8_UINT,
929            DxgiCommon::DXGI_FORMAT_D24_UNORM_S8_UINT => RafxFormat::D24_UNORM_S8_UINT,
930            DxgiCommon::DXGI_FORMAT_D32_FLOAT_S8X24_UINT => RafxFormat::D32_SFLOAT_S8_UINT,
931            DxgiCommon::DXGI_FORMAT_BC1_UNORM => RafxFormat::BC1_RGB_UNORM_BLOCK,
932            DxgiCommon::DXGI_FORMAT_BC1_UNORM_SRGB => RafxFormat::BC1_RGB_SRGB_BLOCK,
933            DxgiCommon::DXGI_FORMAT_BC1_UNORM => RafxFormat::BC1_RGBA_UNORM_BLOCK,
934            DxgiCommon::DXGI_FORMAT_BC1_UNORM_SRGB => RafxFormat::BC1_RGBA_SRGB_BLOCK,
935            DxgiCommon::DXGI_FORMAT_BC2_UNORM => RafxFormat::BC2_UNORM_BLOCK,
936            DxgiCommon::DXGI_FORMAT_BC2_UNORM_SRGB => RafxFormat::BC2_SRGB_BLOCK,
937            DxgiCommon::DXGI_FORMAT_BC3_UNORM => RafxFormat::BC3_UNORM_BLOCK,
938            DxgiCommon::DXGI_FORMAT_BC3_UNORM_SRGB => RafxFormat::BC3_SRGB_BLOCK,
939            DxgiCommon::DXGI_FORMAT_BC4_UNORM => RafxFormat::BC4_UNORM_BLOCK,
940            DxgiCommon::DXGI_FORMAT_BC4_SNORM => RafxFormat::BC4_SNORM_BLOCK,
941            DxgiCommon::DXGI_FORMAT_BC5_UNORM => RafxFormat::BC5_UNORM_BLOCK,
942            DxgiCommon::DXGI_FORMAT_BC5_SNORM => RafxFormat::BC5_SNORM_BLOCK,
943            DxgiCommon::DXGI_FORMAT_BC6H_UF16 => RafxFormat::BC6H_UFLOAT_BLOCK,
944            DxgiCommon::DXGI_FORMAT_BC6H_SF16 => RafxFormat::BC6H_SFLOAT_BLOCK,
945            DxgiCommon::DXGI_FORMAT_BC7_UNORM => RafxFormat::BC7_UNORM_BLOCK,
946            DxgiCommon::DXGI_FORMAT_BC7_UNORM_SRGB => RafxFormat::BC7_SRGB_BLOCK,
947            // DxgiCommon::ETC2_R8G8B8_UNORM_BLOCK => RafxFormat::ETC2_R8G8B8_UNORM_BLOCK,
948            // DxgiCommon::ETC2_R8G8B8_SRGB_BLOCK => RafxFormat::ETC2_R8G8B8_SRGB_BLOCK,
949            // DxgiCommon::ETC2_R8G8B8A1_UNORM_BLOCK => RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK,
950            // DxgiCommon::ETC2_R8G8B8A1_SRGB_BLOCK => RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK,
951            // DxgiCommon::ETC2_R8G8B8A8_UNORM_BLOCK => RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK,
952            // DxgiCommon::ETC2_R8G8B8A8_SRGB_BLOCK => RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK,
953            // DxgiCommon::EAC_R11_UNORM_BLOCK => RafxFormat::EAC_R11_UNORM_BLOCK,
954            // DxgiCommon::EAC_R11_SNORM_BLOCK => RafxFormat::EAC_R11_SNORM_BLOCK,
955            // DxgiCommon::EAC_R11G11_UNORM_BLOCK => RafxFormat::EAC_R11G11_UNORM_BLOCK,
956            // DxgiCommon::EAC_R11G11_SNORM_BLOCK => RafxFormat::EAC_R11G11_SNORM_BLOCK,
957            // DxgiCommon::ASTC_4X4_UNORM_BLOCK => RafxFormat::ASTC_4X4_UNORM_BLOCK,
958            // DxgiCommon::ASTC_4X4_SRGB_BLOCK => RafxFormat::ASTC_4X4_SRGB_BLOCK,
959            // DxgiCommon::ASTC_5X4_UNORM_BLOCK => RafxFormat::ASTC_5X4_UNORM_BLOCK,
960            // DxgiCommon::ASTC_5X4_SRGB_BLOCK => RafxFormat::ASTC_5X4_SRGB_BLOCK,
961            // DxgiCommon::ASTC_5X5_UNORM_BLOCK => RafxFormat::ASTC_5X5_UNORM_BLOCK,
962            // DxgiCommon::ASTC_5X5_SRGB_BLOCK => RafxFormat::ASTC_5X5_SRGB_BLOCK,
963            // DxgiCommon::ASTC_6X5_UNORM_BLOCK => RafxFormat::ASTC_6X5_UNORM_BLOCK,
964            // DxgiCommon::ASTC_6X5_SRGB_BLOCK => RafxFormat::ASTC_6X5_SRGB_BLOCK,
965            // DxgiCommon::ASTC_6X6_UNORM_BLOCK => RafxFormat::ASTC_6X6_UNORM_BLOCK,
966            // DxgiCommon::ASTC_6X6_SRGB_BLOCK => RafxFormat::ASTC_6X6_SRGB_BLOCK,
967            // DxgiCommon::ASTC_8X5_UNORM_BLOCK => RafxFormat::ASTC_8X5_UNORM_BLOCK,
968            // DxgiCommon::ASTC_8X5_SRGB_BLOCK => RafxFormat::ASTC_8X5_SRGB_BLOCK,
969            // DxgiCommon::ASTC_8X6_UNORM_BLOCK => RafxFormat::ASTC_8X6_UNORM_BLOCK,
970            // DxgiCommon::ASTC_8X6_SRGB_BLOCK => RafxFormat::ASTC_8X6_SRGB_BLOCK,
971            // DxgiCommon::ASTC_8X8_UNORM_BLOCK => RafxFormat::ASTC_8X8_UNORM_BLOCK,
972            // DxgiCommon::ASTC_8X8_SRGB_BLOCK => RafxFormat::ASTC_8X8_SRGB_BLOCK,
973            // DxgiCommon::ASTC_10X5_UNORM_BLOCK => RafxFormat::ASTC_10X5_UNORM_BLOCK,
974            // DxgiCommon::ASTC_10X5_SRGB_BLOCK => RafxFormat::ASTC_10X5_SRGB_BLOCK,
975            // DxgiCommon::ASTC_10X6_UNORM_BLOCK => RafxFormat::ASTC_10X6_UNORM_BLOCK,
976            // DxgiCommon::ASTC_10X6_SRGB_BLOCK => RafxFormat::ASTC_10X6_SRGB_BLOCK,
977            // DxgiCommon::ASTC_10X8_UNORM_BLOCK => RafxFormat::ASTC_10X8_UNORM_BLOCK,
978            // DxgiCommon::ASTC_10X8_SRGB_BLOCK => RafxFormat::ASTC_10X8_SRGB_BLOCK,
979            // DxgiCommon::ASTC_10X10_UNORM_BLOCK => RafxFormat::ASTC_10X10_UNORM_BLOCK,
980            // DxgiCommon::ASTC_10X10_SRGB_BLOCK => RafxFormat::ASTC_10X10_SRGB_BLOCK,
981            // DxgiCommon::ASTC_12X10_UNORM_BLOCK => RafxFormat::ASTC_12X10_UNORM_BLOCK,
982            // DxgiCommon::ASTC_12X10_SRGB_BLOCK => RafxFormat::ASTC_12X10_SRGB_BLOCK,
983            // DxgiCommon::ASTC_12X12_UNORM_BLOCK => RafxFormat::ASTC_12X12_UNORM_BLOCK,
984            // DxgiCommon::ASTC_12X12_SRGB_BLOCK => RafxFormat::ASTC_12X12_SRGB_BLOCK,
985            _ => unimplemented!(),
986        }
987    }
988}
989
990#[cfg(feature = "rafx-metal")]
991impl Into<MTLPixelFormat> for RafxFormat {
992    fn into(self) -> MTLPixelFormat {
993        match self {
994            RafxFormat::UNDEFINED => MTLPixelFormat::Invalid,
995            // RafxFormat::R4G4_UNORM_PACK8 => MTLPixelFormat::R4G4_UNORM_PACK8,
996            // RafxFormat::R4G4B4A4_UNORM_PACK16 => MTLPixelFormat::R4G4B4A4_UNORM_PACK16,
997            // RafxFormat::B4G4R4A4_UNORM_PACK16 => MTLPixelFormat::B4G4R4A4_UNORM_PACK16,
998            // RafxFormat::R5G6B5_UNORM_PACK16 => MTLPixelFormat::R5G6B5_UNORM_PACK16,
999            RafxFormat::B5G6R5_UNORM_PACK16 => MTLPixelFormat::B5G6R5Unorm,
1000            // RafxFormat::R5G5B5A1_UNORM_PACK16 => MTLPixelFormat::R5G5B5A1_UNORM_PACK16,
1001            RafxFormat::B5G5R5A1_UNORM_PACK16 => MTLPixelFormat::BGR5A1Unorm,
1002            // RafxFormat::A1R5G5B5_UNORM_PACK16 => MTLPixelFormat::A1R5G5B5_UNORM_PACK16,
1003            RafxFormat::R8_UNORM => MTLPixelFormat::R8Unorm,
1004            RafxFormat::R8_SNORM => MTLPixelFormat::R8Snorm,
1005            //RafxFormat::R8_USCALED => MTLPixelFormat::R8_USCALED,
1006            //RafxFormat::R8_SSCALED => MTLPixelFormat::R8_SSCALED,
1007            RafxFormat::R8_UINT => MTLPixelFormat::R8Uint,
1008            RafxFormat::R8_SINT => MTLPixelFormat::R8Sint,
1009            RafxFormat::R8_SRGB => MTLPixelFormat::R8Unorm_sRGB,
1010            RafxFormat::R8G8_UNORM => MTLPixelFormat::RG8Unorm,
1011            RafxFormat::R8G8_SNORM => MTLPixelFormat::RG8Snorm,
1012            //RafxFormat::R8G8_USCALED => MTLPixelFormat::R8G8_USCALED,
1013            //RafxFormat::R8G8_SSCALED => MTLPixelFormat::R8G8_SSCALED,
1014            RafxFormat::R8G8_UINT => MTLPixelFormat::RG8Uint,
1015            RafxFormat::R8G8_SINT => MTLPixelFormat::RG8Sint,
1016            RafxFormat::R8G8_SRGB => MTLPixelFormat::RG8Unorm_sRGB,
1017            // RafxFormat::R8G8B8_UNORM => MTLPixelFormat::R8G8B8_UNORM,
1018            // RafxFormat::R8G8B8_SNORM => MTLPixelFormat::R8G8B8_SNORM,
1019            // RafxFormat::R8G8B8_USCALED => MTLPixelFormat::R8G8B8_USCALED,
1020            // RafxFormat::R8G8B8_SSCALED => MTLPixelFormat::R8G8B8_SSCALED,
1021            // RafxFormat::R8G8B8_UINT => MTLPixelFormat::R8G8B8_UINT,
1022            // RafxFormat::R8G8B8_SINT => MTLPixelFormat::R8G8B8_SINT,
1023            // RafxFormat::R8G8B8_SRGB => MTLPixelFormat::R8G8B8_SRGB,
1024            // RafxFormat::B8G8R8_UNORM => MTLPixelFormat::B8G8R8_UNORM,
1025            // RafxFormat::B8G8R8_SNORM => MTLPixelFormat::B8G8R8_SNORM,
1026            // RafxFormat::B8G8R8_USCALED => MTLPixelFormat::B8G8R8_USCALED,
1027            // RafxFormat::B8G8R8_SSCALED => MTLPixelFormat::B8G8R8_SSCALED,
1028            // RafxFormat::B8G8R8_UINT => MTLPixelFormat::B8G8R8_UINT,
1029            // RafxFormat::B8G8R8_SINT => MTLPixelFormat::B8G8R8_SINT,
1030            // RafxFormat::B8G8R8_SRGB => MTLPixelFormat::B8G8R8_SRGB,
1031            RafxFormat::R8G8B8A8_UNORM => MTLPixelFormat::RGBA8Unorm,
1032            RafxFormat::R8G8B8A8_SNORM => MTLPixelFormat::RGBA8Snorm,
1033            // RafxFormat::R8G8B8A8_USCALED => MTLPixelFormat::R8G8B8A8_USCALED,
1034            // RafxFormat::R8G8B8A8_SSCALED => MTLPixelFormat::R8G8B8A8_SSCALED,
1035            RafxFormat::R8G8B8A8_UINT => MTLPixelFormat::RGBA8Uint,
1036            RafxFormat::R8G8B8A8_SINT => MTLPixelFormat::RGBA8Sint,
1037            RafxFormat::R8G8B8A8_SRGB => MTLPixelFormat::RGBA8Unorm_sRGB,
1038            RafxFormat::B8G8R8A8_UNORM => MTLPixelFormat::BGRA8Unorm,
1039            // RafxFormat::B8G8R8A8_SNORM => MTLPixelFormat::B8G8R8A8_SNORM,
1040            // RafxFormat::B8G8R8A8_USCALED => MTLPixelFormat::B8G8R8A8_USCALED,
1041            // RafxFormat::B8G8R8A8_SSCALED => MTLPixelFormat::B8G8R8A8_SSCALED,
1042            //RafxFormat::B8G8R8A8_UINT => MTLPixelFormat::B8G8R8A8_UINT,
1043            //RafxFormat::B8G8R8A8_SINT => MTLPixelFormat::B8G8R8A8_SINT,
1044            RafxFormat::B8G8R8A8_SRGB => MTLPixelFormat::BGRA8Unorm_sRGB,
1045            // RafxFormat::A8B8G8R8_UNORM_PACK32 => MTLPixelFormat::A8B8G8R8_UNORM_PACK32,
1046            // RafxFormat::A8B8G8R8_SNORM_PACK32 => MTLPixelFormat::A8B8G8R8_SNORM_PACK32,
1047            // RafxFormat::A8B8G8R8_USCALED_PACK32 => MTLPixelFormat::A8B8G8R8_USCALED_PACK32,
1048            // RafxFormat::A8B8G8R8_SSCALED_PACK32 => MTLPixelFormat::A8B8G8R8_SSCALED_PACK32,
1049            // RafxFormat::A8B8G8R8_UINT_PACK32 => MTLPixelFormat::A8B8G8R8_UINT_PACK32,
1050            // RafxFormat::A8B8G8R8_SINT_PACK32 => MTLPixelFormat::A8B8G8R8_SINT_PACK32,
1051            // RafxFormat::A8B8G8R8_SRGB_PACK32 => MTLPixelFormat::A8B8G8R8_SRGB_PACK32,
1052            // RafxFormat::A2R10G10B10_UNORM_PACK32 => MTLPixelFormat::A2R10G10B10_UNORM_PACK32,
1053            // RafxFormat::A2R10G10B10_SNORM_PACK32 => MTLPixelFormat::A2R10G10B10_SNORM_PACK32,
1054            // RafxFormat::A2R10G10B10_USCALED_PACK32 => MTLPixelFormat::A2R10G10B10_USCALED_PACK32,
1055            // RafxFormat::A2R10G10B10_SSCALED_PACK32 => MTLPixelFormat::A2R10G10B10_SSCALED_PACK32,
1056            // RafxFormat::A2R10G10B10_UINT_PACK32 => MTLPixelFormat::A2R10G10B10_UINT_PACK32,
1057            // RafxFormat::A2R10G10B10_SINT_PACK32 => MTLPixelFormat::A2R10G10B10_SINT_PACK32,
1058            // RafxFormat::A2B10G10R10_UNORM_PACK32 => MTLPixelFormat::A2B10G10R10_UNORM_PACK32,
1059            // RafxFormat::A2B10G10R10_SNORM_PACK32 => MTLPixelFormat::A2B10G10R10_SNORM_PACK32,
1060            // RafxFormat::A2B10G10R10_USCALED_PACK32 => MTLPixelFormat::A2B10G10R10_USCALED_PACK32,
1061            // RafxFormat::A2B10G10R10_SSCALED_PACK32 => MTLPixelFormat::A2B10G10R10_SSCALED_PACK32,
1062            // RafxFormat::A2B10G10R10_UINT_PACK32 => MTLPixelFormat::A2B10G10R10_UINT_PACK32,
1063            // RafxFormat::A2B10G10R10_SINT_PACK32 => MTLPixelFormat::A2B10G10R10_SINT_PACK32,
1064            RafxFormat::R16_UNORM => MTLPixelFormat::R16Unorm,
1065            RafxFormat::R16_SNORM => MTLPixelFormat::R16Snorm,
1066            // RafxFormat::R16_USCALED => MTLPixelFormat::R16_USCALED,
1067            // RafxFormat::R16_SSCALED => MTLPixelFormat::R16_SSCALED,
1068            RafxFormat::R16_UINT => MTLPixelFormat::R16Uint,
1069            RafxFormat::R16_SINT => MTLPixelFormat::R16Sint,
1070            RafxFormat::R16_SFLOAT => MTLPixelFormat::R16Float,
1071            RafxFormat::R16G16_UNORM => MTLPixelFormat::RG16Float,
1072            RafxFormat::R16G16_SNORM => MTLPixelFormat::RG16Snorm,
1073            // RafxFormat::R16G16_USCALED => MTLPixelFormat::R16G16_USCALED,
1074            // RafxFormat::R16G16_SSCALED => MTLPixelFormat::R16G16_SSCALED,
1075            RafxFormat::R16G16_UINT => MTLPixelFormat::RG16Uint,
1076            RafxFormat::R16G16_SINT => MTLPixelFormat::RG16Sint,
1077            RafxFormat::R16G16_SFLOAT => MTLPixelFormat::RG16Float,
1078            // RafxFormat::R16G16B16_UNORM => MTLPixelFormat::R16G16B16_UNORM,
1079            // RafxFormat::R16G16B16_SNORM => MTLPixelFormat::R16G16B16_SNORM,
1080            // RafxFormat::R16G16B16_USCALED => MTLPixelFormat::R16G16B16_USCALED,
1081            // RafxFormat::R16G16B16_SSCALED => MTLPixelFormat::R16G16B16_SSCALED,
1082            // RafxFormat::R16G16B16_UINT => MTLPixelFormat::R16G16B16_UINT,
1083            // RafxFormat::R16G16B16_SINT => MTLPixelFormat::R16G16B16_SINT,
1084            // RafxFormat::R16G16B16_SFLOAT => MTLPixelFormat::R16G16B16_SFLOAT,
1085            RafxFormat::R16G16B16A16_UNORM => MTLPixelFormat::RGBA16Unorm,
1086            RafxFormat::R16G16B16A16_SNORM => MTLPixelFormat::RGBA16Snorm,
1087            // RafxFormat::R16G16B16A16_USCALED => MTLPixelFormat::R16G16B16A16_USCALED,
1088            // RafxFormat::R16G16B16A16_SSCALED => MTLPixelFormat::R16G16B16A16_SSCALED,
1089            RafxFormat::R16G16B16A16_UINT => MTLPixelFormat::RGBA16Uint,
1090            RafxFormat::R16G16B16A16_SINT => MTLPixelFormat::RGBA16Sint,
1091            RafxFormat::R16G16B16A16_SFLOAT => MTLPixelFormat::RGBA16Float,
1092            RafxFormat::R32_UINT => MTLPixelFormat::R32Uint,
1093            RafxFormat::R32_SINT => MTLPixelFormat::R32Sint,
1094            RafxFormat::R32_SFLOAT => MTLPixelFormat::R32Float,
1095            RafxFormat::R32G32_UINT => MTLPixelFormat::RG32Uint,
1096            RafxFormat::R32G32_SINT => MTLPixelFormat::RG32Sint,
1097            RafxFormat::R32G32_SFLOAT => MTLPixelFormat::RG32Float,
1098            // RafxFormat::R32G32B32_UINT => MTLPixelFormat::R32G32B32_UINT,
1099            // RafxFormat::R32G32B32_SINT => MTLPixelFormat::R32G32B32_SINT,
1100            // RafxFormat::R32G32B32_SFLOAT => MTLPixelFormat::R32G32B32_SFLOAT,
1101            RafxFormat::R32G32B32A32_UINT => MTLPixelFormat::RGBA32Uint,
1102            RafxFormat::R32G32B32A32_SINT => MTLPixelFormat::RGBA32Sint,
1103            RafxFormat::R32G32B32A32_SFLOAT => MTLPixelFormat::RGBA32Float,
1104            // RafxFormat::R64_UINT => MTLPixelFormat::R64_UINT,
1105            // RafxFormat::R64_SINT => MTLPixelFormat::R64_SINT,
1106            // RafxFormat::R64_SFLOAT => MTLPixelFormat::R64_SFLOAT,
1107            // RafxFormat::R64G64_UINT => MTLPixelFormat::R64G64_UINT,
1108            // RafxFormat::R64G64_SINT => MTLPixelFormat::R64G64_SINT,
1109            // RafxFormat::R64G64_SFLOAT => MTLPixelFormat::R64G64_SFLOAT,
1110            // RafxFormat::R64G64B64_UINT => MTLPixelFormat::R64G64B64_UINT,
1111            // RafxFormat::R64G64B64_SINT => MTLPixelFormat::R64G64B64_SINT,
1112            // RafxFormat::R64G64B64_SFLOAT => MTLPixelFormat::R64G64B64_SFLOAT,
1113            // RafxFormat::R64G64B64A64_UINT => MTLPixelFormat::R64G64B64A64_UINT,
1114            // RafxFormat::R64G64B64A64_SINT => MTLPixelFormat::R64G64B64A64_SINT,
1115            // RafxFormat::R64G64B64A64_SFLOAT => MTLPixelFormat::R64G64B64A64_SFLOAT,
1116            //RafxFormat::B10G11R11_UFLOAT_PACK32 => MTLPixelFormat::B10G11R11_UFLOAT_PACK32,
1117            //RafxFormat::E5B9G9R9_UFLOAT_PACK32 => MTLPixelFormat::E5B9G9R9_UFLOAT_PACK32,
1118            RafxFormat::D16_UNORM => MTLPixelFormat::Depth16Unorm,
1119            // RafxFormat::X8_D24_UNORM_PACK32 => MTLPixelFormat::X8_D24_UNORM_PACK32,
1120            RafxFormat::D32_SFLOAT => MTLPixelFormat::Depth32Float,
1121            RafxFormat::S8_UINT => MTLPixelFormat::Stencil8,
1122            // RafxFormat::D16_UNORM_S8_UINT => MTLPixelFormat::D16_UNORM_S8_UINT,
1123            RafxFormat::D24_UNORM_S8_UINT => MTLPixelFormat::Depth24Unorm_Stencil8,
1124            RafxFormat::D32_SFLOAT_S8_UINT => MTLPixelFormat::Depth32Float_Stencil8,
1125            // RafxFormat::BC1_RGB_UNORM_BLOCK => MTLPixelFormat::BC1_RGB_UNORM_BLOCK,
1126            // RafxFormat::BC1_RGB_SRGB_BLOCK => MTLPixelFormat::BC1_RGB_SRGB_BLOCK,
1127            RafxFormat::BC1_RGBA_UNORM_BLOCK => MTLPixelFormat::BC1_RGBA,
1128            RafxFormat::BC1_RGBA_SRGB_BLOCK => MTLPixelFormat::BC1_RGBA_sRGB,
1129            RafxFormat::BC2_UNORM_BLOCK => MTLPixelFormat::BC2_RGBA,
1130            RafxFormat::BC2_SRGB_BLOCK => MTLPixelFormat::BC2_RGBA_sRGB,
1131            RafxFormat::BC3_UNORM_BLOCK => MTLPixelFormat::BC3_RGBA,
1132            RafxFormat::BC3_SRGB_BLOCK => MTLPixelFormat::BC3_RGBA_sRGB,
1133            RafxFormat::BC4_UNORM_BLOCK => MTLPixelFormat::BC4_RUnorm,
1134            RafxFormat::BC4_SNORM_BLOCK => MTLPixelFormat::BC4_RSnorm,
1135            RafxFormat::BC5_UNORM_BLOCK => MTLPixelFormat::BC5_RGUnorm,
1136            RafxFormat::BC5_SNORM_BLOCK => MTLPixelFormat::BC5_RGSnorm,
1137            RafxFormat::BC6H_UFLOAT_BLOCK => MTLPixelFormat::BC6H_RGBUfloat,
1138            RafxFormat::BC6H_SFLOAT_BLOCK => MTLPixelFormat::BC6H_RGBFloat,
1139            RafxFormat::BC7_UNORM_BLOCK => MTLPixelFormat::BC7_RGBAUnorm,
1140            RafxFormat::BC7_SRGB_BLOCK => MTLPixelFormat::BC7_RGBAUnorm_sRGB,
1141            RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => MTLPixelFormat::ETC2_RGB8,
1142            RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => MTLPixelFormat::ETC2_RGB8_sRGB,
1143            RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => MTLPixelFormat::ETC2_RGB8A1,
1144            RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => MTLPixelFormat::ETC2_RGB8A1_sRGB,
1145            // RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => MTLPixelFormat::ETC2_R8G8B8A8_UNORM_BLOCK,
1146            // RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => MTLPixelFormat::ETC2_R8G8B8A8_SRGB_BLOCK,
1147            RafxFormat::EAC_R11_UNORM_BLOCK => MTLPixelFormat::EAC_R11Unorm,
1148            RafxFormat::EAC_R11_SNORM_BLOCK => MTLPixelFormat::EAC_R11Snorm,
1149            RafxFormat::EAC_R11G11_UNORM_BLOCK => MTLPixelFormat::EAC_RG11Unorm,
1150            RafxFormat::EAC_R11G11_SNORM_BLOCK => MTLPixelFormat::EAC_RG11Snorm,
1151            RafxFormat::ASTC_4X4_UNORM_BLOCK => MTLPixelFormat::ASTC_4x4_LDR,
1152            RafxFormat::ASTC_4X4_SRGB_BLOCK => MTLPixelFormat::ASTC_4x4_sRGB,
1153            RafxFormat::ASTC_5X4_UNORM_BLOCK => MTLPixelFormat::ASTC_5x4_LDR,
1154            RafxFormat::ASTC_5X4_SRGB_BLOCK => MTLPixelFormat::ASTC_5x4_sRGB,
1155            RafxFormat::ASTC_5X5_UNORM_BLOCK => MTLPixelFormat::ASTC_5x5_LDR,
1156            RafxFormat::ASTC_5X5_SRGB_BLOCK => MTLPixelFormat::ASTC_5x5_sRGB,
1157            RafxFormat::ASTC_6X5_UNORM_BLOCK => MTLPixelFormat::ASTC_6x5_LDR,
1158            RafxFormat::ASTC_6X5_SRGB_BLOCK => MTLPixelFormat::ASTC_6x5_sRGB,
1159            RafxFormat::ASTC_6X6_UNORM_BLOCK => MTLPixelFormat::ASTC_6x6_LDR,
1160            RafxFormat::ASTC_6X6_SRGB_BLOCK => MTLPixelFormat::ASTC_6x6_sRGB,
1161            RafxFormat::ASTC_8X5_UNORM_BLOCK => MTLPixelFormat::ASTC_8x5_LDR,
1162            RafxFormat::ASTC_8X5_SRGB_BLOCK => MTLPixelFormat::ASTC_8x5_sRGB,
1163            RafxFormat::ASTC_8X6_UNORM_BLOCK => MTLPixelFormat::ASTC_8x6_LDR,
1164            RafxFormat::ASTC_8X6_SRGB_BLOCK => MTLPixelFormat::ASTC_8x6_sRGB,
1165            RafxFormat::ASTC_8X8_UNORM_BLOCK => MTLPixelFormat::ASTC_8x8_LDR,
1166            RafxFormat::ASTC_8X8_SRGB_BLOCK => MTLPixelFormat::ASTC_8x8_sRGB,
1167            RafxFormat::ASTC_10X5_UNORM_BLOCK => MTLPixelFormat::ASTC_10x5_LDR,
1168            RafxFormat::ASTC_10X5_SRGB_BLOCK => MTLPixelFormat::ASTC_10x5_sRGB,
1169            RafxFormat::ASTC_10X6_UNORM_BLOCK => MTLPixelFormat::ASTC_10x6_LDR,
1170            RafxFormat::ASTC_10X6_SRGB_BLOCK => MTLPixelFormat::ASTC_10x6_sRGB,
1171            RafxFormat::ASTC_10X8_UNORM_BLOCK => MTLPixelFormat::ASTC_10x8_LDR,
1172            RafxFormat::ASTC_10X8_SRGB_BLOCK => MTLPixelFormat::ASTC_10x8_sRGB,
1173            RafxFormat::ASTC_10X10_UNORM_BLOCK => MTLPixelFormat::ASTC_10x10_LDR,
1174            RafxFormat::ASTC_10X10_SRGB_BLOCK => MTLPixelFormat::ASTC_10x10_sRGB,
1175            RafxFormat::ASTC_12X10_UNORM_BLOCK => MTLPixelFormat::ASTC_12x10_LDR,
1176            RafxFormat::ASTC_12X10_SRGB_BLOCK => MTLPixelFormat::ASTC_12x10_sRGB,
1177            RafxFormat::ASTC_12X12_UNORM_BLOCK => MTLPixelFormat::ASTC_12x12_LDR,
1178            RafxFormat::ASTC_12X12_SRGB_BLOCK => MTLPixelFormat::ASTC_12x12_sRGB,
1179            _ => unimplemented!(),
1180        }
1181    }
1182}
1183
1184#[cfg(feature = "rafx-metal")]
1185impl Into<MTLVertexFormat> for RafxFormat {
1186    fn into(self) -> MTLVertexFormat {
1187        match self {
1188            RafxFormat::R8_UNORM => MTLVertexFormat::UCharNormalized,
1189            RafxFormat::R8_SNORM => MTLVertexFormat::CharNormalized,
1190            RafxFormat::R8_UINT => MTLVertexFormat::UChar,
1191            RafxFormat::R8_SINT => MTLVertexFormat::Char,
1192            RafxFormat::R8G8_UNORM => MTLVertexFormat::UChar2Normalized,
1193            RafxFormat::R8G8_SNORM => MTLVertexFormat::Char2Normalized,
1194            RafxFormat::R8G8_UINT => MTLVertexFormat::UChar2,
1195            RafxFormat::R8G8_SINT => MTLVertexFormat::Char2,
1196            RafxFormat::R8G8B8_UNORM => MTLVertexFormat::UChar3Normalized,
1197            RafxFormat::R8G8B8_SNORM => MTLVertexFormat::Char3Normalized,
1198            RafxFormat::R8G8B8_UINT => MTLVertexFormat::UChar3,
1199            RafxFormat::R8G8B8_SINT => MTLVertexFormat::Char3,
1200            RafxFormat::R8G8B8A8_UNORM => MTLVertexFormat::UChar4Normalized,
1201            RafxFormat::R8G8B8A8_SNORM => MTLVertexFormat::Char4Normalized,
1202            RafxFormat::R8G8B8A8_UINT => MTLVertexFormat::UChar4,
1203            RafxFormat::R8G8B8A8_SINT => MTLVertexFormat::Char4,
1204            RafxFormat::B8G8R8A8_UNORM => MTLVertexFormat::UChar4Normalized_BGRA,
1205            RafxFormat::R16_UNORM => MTLVertexFormat::UShortNormalized,
1206            RafxFormat::R16_SNORM => MTLVertexFormat::ShortNormalized,
1207            RafxFormat::R16_UINT => MTLVertexFormat::UShort,
1208            RafxFormat::R16_SINT => MTLVertexFormat::Short,
1209            RafxFormat::R16_SFLOAT => MTLVertexFormat::Half,
1210            RafxFormat::R16G16_UNORM => MTLVertexFormat::UShort2Normalized,
1211            RafxFormat::R16G16_SNORM => MTLVertexFormat::Short2Normalized,
1212            RafxFormat::R16G16_UINT => MTLVertexFormat::UShort2,
1213            RafxFormat::R16G16_SINT => MTLVertexFormat::Short2,
1214            RafxFormat::R16G16_SFLOAT => MTLVertexFormat::Half2,
1215            RafxFormat::R16G16B16_UNORM => MTLVertexFormat::UShort3Normalized,
1216            RafxFormat::R16G16B16_SNORM => MTLVertexFormat::Short3Normalized,
1217            RafxFormat::R16G16B16_UINT => MTLVertexFormat::UShort3,
1218            RafxFormat::R16G16B16_SINT => MTLVertexFormat::Short3,
1219            RafxFormat::R16G16B16_SFLOAT => MTLVertexFormat::Half3,
1220            RafxFormat::R16G16B16A16_UNORM => MTLVertexFormat::UShort4Normalized,
1221            RafxFormat::R16G16B16A16_SNORM => MTLVertexFormat::Short4Normalized,
1222            RafxFormat::R16G16B16A16_UINT => MTLVertexFormat::UShort4,
1223            RafxFormat::R16G16B16A16_SINT => MTLVertexFormat::Short4,
1224            RafxFormat::R16G16B16A16_SFLOAT => MTLVertexFormat::Half4,
1225            RafxFormat::R32_UINT => MTLVertexFormat::UInt,
1226            RafxFormat::R32_SINT => MTLVertexFormat::Int,
1227            RafxFormat::R32_SFLOAT => MTLVertexFormat::Float,
1228            RafxFormat::R32G32_UINT => MTLVertexFormat::UInt2,
1229            RafxFormat::R32G32_SINT => MTLVertexFormat::Int2,
1230            RafxFormat::R32G32_SFLOAT => MTLVertexFormat::Float2,
1231            RafxFormat::R32G32B32_UINT => MTLVertexFormat::UInt3,
1232            RafxFormat::R32G32B32_SINT => MTLVertexFormat::Int3,
1233            RafxFormat::R32G32B32_SFLOAT => MTLVertexFormat::Float3,
1234            RafxFormat::R32G32B32A32_UINT => MTLVertexFormat::UInt4,
1235            RafxFormat::R32G32B32A32_SINT => MTLVertexFormat::Int4,
1236            RafxFormat::R32G32B32A32_SFLOAT => MTLVertexFormat::Float4,
1237            _ => unimplemented!("into MTLVertexFormat unimplemented for {:?}", self),
1238        }
1239    }
1240}
1241
1242#[cfg(any(feature = "rafx-gles2", feature = "rafx-gles3"))]
1243#[derive(Debug)]
1244pub struct GlTextureFormatInfo {
1245    pub gl_format: GLenum,
1246    pub gl_type: GLenum,
1247    pub gl_internal_format: i32,
1248}
1249
1250//TODO: Really not sure about this or what GL ES 2.0 supports
1251// format (source/cpu format): GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, or GL_RGBA
1252// type:
1253// internal (gpu format): GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_RGB, or GL_RGBA
1254
1255#[rustfmt::skip]
1256#[cfg(feature = "rafx-gles2")]
1257impl RafxFormat {
1258    pub fn gles2_type(self) -> Option<GLenum> {
1259        use crate::gles2::gles2_bindings as gl;
1260        match self {
1261            RafxFormat::R4G4_UNORM_PACK8 => Some(gl::UNSIGNED_SHORT_4_4_4_4),
1262            RafxFormat::R4G4B4A4_UNORM_PACK16 => Some(gl::UNSIGNED_SHORT_4_4_4_4),
1263            //RafxFormat::B4G4R4A4_UNORM_PACK16 => None,
1264            RafxFormat::R5G6B5_UNORM_PACK16 => Some(gl::UNSIGNED_SHORT_5_6_5),
1265            //RafxFormat::B5G6R5_UNORM_PACK16 => None,
1266            RafxFormat::R5G5B5A1_UNORM_PACK16 => Some(gl::UNSIGNED_SHORT_5_5_5_1),
1267            //RafxFormat::B5G5R5A1_UNORM_PACK16 => None,
1268            //RafxFormat::A1R5G5B5_UNORM_PACK16 => None,
1269            RafxFormat::R8_UNORM => Some(gl::UNSIGNED_BYTE),
1270            RafxFormat::R8_SNORM => Some(gl::BYTE),
1271            //RafxFormat::R8_USCALED => None,
1272            //RafxFormat::R8_SSCALED => None,
1273            RafxFormat::R8_UINT => Some(gl::UNSIGNED_BYTE),
1274            RafxFormat::R8_SINT => Some(gl::BYTE),
1275            RafxFormat::R8_SRGB => Some(gl::UNSIGNED_BYTE),
1276            RafxFormat::R8G8_UNORM => Some(gl::UNSIGNED_BYTE),
1277            RafxFormat::R8G8_SNORM => Some(gl::BYTE),
1278            //RafxFormat::R8G8_USCALED => None,
1279            //RafxFormat::R8G8_SSCALED => None,
1280            RafxFormat::R8G8_UINT => Some(gl::UNSIGNED_BYTE),
1281            RafxFormat::R8G8_SINT => Some(gl::BYTE),
1282            RafxFormat::R8G8_SRGB => Some(gl::UNSIGNED_BYTE),
1283            RafxFormat::R8G8B8_UNORM => Some(gl::UNSIGNED_BYTE),
1284            RafxFormat::R8G8B8_SNORM => Some(gl::BYTE),
1285            //RafxFormat::R8G8B8_USCALED => None,
1286            //RafxFormat::R8G8B8_SSCALED => None,
1287            RafxFormat::R8G8B8_UINT => Some(gl::UNSIGNED_BYTE),
1288            RafxFormat::R8G8B8_SINT => Some(gl::BYTE),
1289            RafxFormat::R8G8B8_SRGB => Some(gl::UNSIGNED_BYTE),
1290            RafxFormat::B8G8R8_UNORM => Some(gl::UNSIGNED_BYTE),
1291            RafxFormat::B8G8R8_SNORM => Some(gl::BYTE),
1292            //RafxFormat::B8G8R8_USCALED => None,
1293            //RafxFormat::B8G8R8_SSCALED => None,
1294            RafxFormat::B8G8R8_UINT => Some(gl::UNSIGNED_BYTE),
1295            RafxFormat::B8G8R8_SINT => Some(gl::BYTE),
1296            RafxFormat::B8G8R8_SRGB => Some(gl::UNSIGNED_BYTE),
1297            RafxFormat::R8G8B8A8_UNORM => Some(gl::UNSIGNED_BYTE),
1298            RafxFormat::R8G8B8A8_SNORM => Some(gl::BYTE),
1299            //RafxFormat::R8G8B8A8_USCALED => None,
1300            //RafxFormat::R8G8B8A8_SSCALED => None,
1301            RafxFormat::R8G8B8A8_UINT => Some(gl::UNSIGNED_BYTE),
1302            RafxFormat::R8G8B8A8_SINT => Some(gl::BYTE),
1303            RafxFormat::R8G8B8A8_SRGB => Some(gl::UNSIGNED_BYTE),
1304            RafxFormat::B8G8R8A8_UNORM => Some(gl::UNSIGNED_BYTE),
1305            RafxFormat::B8G8R8A8_SNORM => Some(gl::BYTE),
1306            //RafxFormat::B8G8R8A8_USCALED => None,
1307            //RafxFormat::B8G8R8A8_SSCALED => None,
1308            RafxFormat::B8G8R8A8_UINT => Some(gl::UNSIGNED_BYTE),
1309            RafxFormat::B8G8R8A8_SINT => Some(gl::BYTE),
1310            RafxFormat::B8G8R8A8_SRGB => Some(gl::UNSIGNED_BYTE),
1311            //RafxFormat::A8B8G8R8_UNORM_PACK32 => None,
1312            //RafxFormat::A8B8G8R8_SNORM_PACK32 => None,
1313            //RafxFormat::A8B8G8R8_USCALED_PACK32 => None,
1314            //RafxFormat::A8B8G8R8_SSCALED_PACK32 => None,
1315            //RafxFormat::A8B8G8R8_UINT_PACK32 => None,
1316            //RafxFormat::A8B8G8R8_SINT_PACK32 => None,
1317            //RafxFormat::A8B8G8R8_SRGB_PACK32 => None,
1318            //RafxFormat::A2R10G10B10_UNORM_PACK32 => None,
1319            //RafxFormat::A2R10G10B10_SNORM_PACK32 => None,
1320            //RafxFormat::A2R10G10B10_USCALED_PACK32 => None,
1321            //RafxFormat::A2R10G10B10_SSCALED_PACK32 => None,
1322            //RafxFormat::A2R10G10B10_UINT_PACK32 => None,
1323            //RafxFormat::A2R10G10B10_SINT_PACK32 => None,
1324            //RafxFormat::A2B10G10R10_UNORM_PACK32 => None,
1325            //RafxFormat::A2B10G10R10_SNORM_PACK32 => None,
1326            //RafxFormat::A2B10G10R10_USCALED_PACK32 => None,
1327            //RafxFormat::A2B10G10R10_SSCALED_PACK32 => None,
1328            //RafxFormat::A2B10G10R10_UINT_PACK32 => None,
1329            //RafxFormat::A2B10G10R10_SINT_PACK32 => None,
1330            RafxFormat::R16_UNORM => Some(gl::UNSIGNED_SHORT),
1331            RafxFormat::R16_SNORM => Some(gl::SHORT),
1332            //RafxFormat::R16_USCALED => None,
1333            //RafxFormat::R16_SSCALED => None,
1334            RafxFormat::R16_UINT => Some(gl::UNSIGNED_SHORT),
1335            RafxFormat::R16_SINT => Some(gl::SHORT),
1336            //RafxFormat::R16_SFLOAT => None,
1337            RafxFormat::R16G16_UNORM => Some(gl::UNSIGNED_SHORT),
1338            RafxFormat::R16G16_SNORM => Some(gl::SHORT),
1339            //RafxFormat::R16G16_USCALED => None,
1340            //RafxFormat::R16G16_SSCALED => None,
1341            RafxFormat::R16G16_UINT => Some(gl::UNSIGNED_SHORT),
1342            RafxFormat::R16G16_SINT => Some(gl::SHORT),
1343            //RafxFormat::R16G16_SFLOAT => None,
1344            RafxFormat::R16G16B16_UNORM => Some(gl::UNSIGNED_SHORT),
1345            RafxFormat::R16G16B16_SNORM => Some(gl::SHORT),
1346            //RafxFormat::R16G16B16_USCALED => None,
1347            //RafxFormat::R16G16B16_SSCALED => None,
1348            RafxFormat::R16G16B16_UINT => Some(gl::UNSIGNED_SHORT),
1349            RafxFormat::R16G16B16_SINT => Some(gl::SHORT),
1350            //RafxFormat::R16G16B16_SFLOAT => None,
1351            RafxFormat::R16G16B16A16_UNORM => Some(gl::UNSIGNED_SHORT),
1352            RafxFormat::R16G16B16A16_SNORM => Some(gl::SHORT),
1353            //RafxFormat::R16G16B16A16_USCALED => None,
1354            //RafxFormat::R16G16B16A16_SSCALED => None,
1355            RafxFormat::R16G16B16A16_UINT => Some(gl::UNSIGNED_SHORT),
1356            RafxFormat::R16G16B16A16_SINT => Some(gl::SHORT),
1357            //RafxFormat::R16G16B16A16_SFLOAT => None,
1358            RafxFormat::R32_UINT => Some(gl::UNSIGNED_INT),
1359            RafxFormat::R32_SINT => Some(gl::INT),
1360            RafxFormat::R32_SFLOAT => Some(gl::FLOAT),
1361            RafxFormat::R32G32_UINT => Some(gl::UNSIGNED_INT),
1362            RafxFormat::R32G32_SINT => Some(gl::INT),
1363            RafxFormat::R32G32_SFLOAT => Some(gl::FLOAT),
1364            RafxFormat::R32G32B32_UINT => Some(gl::UNSIGNED_INT),
1365            RafxFormat::R32G32B32_SINT => Some(gl::INT),
1366            RafxFormat::R32G32B32_SFLOAT => Some(gl::FLOAT),
1367            RafxFormat::R32G32B32A32_UINT => Some(gl::UNSIGNED_INT),
1368            RafxFormat::R32G32B32A32_SINT => Some(gl::INT),
1369            RafxFormat::R32G32B32A32_SFLOAT => Some(gl::FLOAT),
1370            // RafxFormat::R64_UINT => None,
1371            // RafxFormat::R64_SINT => None,
1372            // RafxFormat::R64_SFLOAT => None,
1373            // RafxFormat::R64G64_UINT => None,
1374            // RafxFormat::R64G64_SINT => None,
1375            // RafxFormat::R64G64_SFLOAT => None,
1376            // RafxFormat::R64G64B64_UINT => None,
1377            // RafxFormat::R64G64B64_SINT => None,
1378            // RafxFormat::R64G64B64_SFLOAT => None,
1379            // RafxFormat::R64G64B64A64_UINT => None,
1380            // RafxFormat::R64G64B64A64_SINT => None,
1381            // RafxFormat::R64G64B64A64_SFLOAT => None,
1382            // RafxFormat::B10G11R11_UFLOAT_PACK32 => None,
1383            // RafxFormat::E5B9G9R9_UFLOAT_PACK32 => None,
1384            RafxFormat::D16_UNORM => Some(gl::UNSIGNED_SHORT),
1385            // RafxFormat::X8_D24_UNORM_PACK32 => None,
1386            RafxFormat::D32_SFLOAT => Some(gl::FLOAT),
1387            RafxFormat::S8_UINT => Some(gl::UNSIGNED_BYTE),
1388            // RafxFormat::D16_UNORM_S8_UINT => None,
1389            // RafxFormat::D24_UNORM_S8_UINT => None,
1390            // RafxFormat::D32_SFLOAT_S8_UINT => None,
1391            // RafxFormat::BC1_RGB_UNORM_BLOCK => None,
1392            // RafxFormat::BC1_RGB_SRGB_BLOCK => None,
1393            // RafxFormat::BC1_RGBA_UNORM_BLOCK => None,
1394            // RafxFormat::BC1_RGBA_SRGB_BLOCK => None,
1395            // RafxFormat::BC2_UNORM_BLOCK => None,
1396            // RafxFormat::BC2_SRGB_BLOCK => None,
1397            // RafxFormat::BC3_UNORM_BLOCK => None,
1398            // RafxFormat::BC3_SRGB_BLOCK => None,
1399            // RafxFormat::BC4_UNORM_BLOCK => None,
1400            // RafxFormat::BC4_SNORM_BLOCK => None,
1401            // RafxFormat::BC5_UNORM_BLOCK => None,
1402            // RafxFormat::BC5_SNORM_BLOCK => None,
1403            // RafxFormat::BC6H_UFLOAT_BLOCK => None,
1404            // RafxFormat::BC6H_SFLOAT_BLOCK => None,
1405            // RafxFormat::BC7_UNORM_BLOCK => None,
1406            // RafxFormat::BC7_SRGB_BLOCK => None,
1407            // RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => None,
1408            // RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => None,
1409            // RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => None,
1410            // RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => None,
1411            // RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => None,
1412            // RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => None,
1413            // RafxFormat::EAC_R11_UNORM_BLOCK => None,
1414            // RafxFormat::EAC_R11_SNORM_BLOCK => None,
1415            // RafxFormat::EAC_R11G11_UNORM_BLOCK => None,
1416            // RafxFormat::EAC_R11G11_SNORM_BLOCK => None,
1417            // RafxFormat::ASTC_4X4_UNORM_BLOCK => None,
1418            // RafxFormat::ASTC_4X4_SRGB_BLOCK => None,
1419            // RafxFormat::ASTC_5X4_UNORM_BLOCK => None,
1420            // RafxFormat::ASTC_5X4_SRGB_BLOCK => None,
1421            // RafxFormat::ASTC_5X5_UNORM_BLOCK => None,
1422            // RafxFormat::ASTC_5X5_SRGB_BLOCK => None,
1423            // RafxFormat::ASTC_6X5_UNORM_BLOCK => None,
1424            // RafxFormat::ASTC_6X5_SRGB_BLOCK => None,
1425            // RafxFormat::ASTC_6X6_UNORM_BLOCK => None,
1426            // RafxFormat::ASTC_6X6_SRGB_BLOCK => None,
1427            // RafxFormat::ASTC_8X5_UNORM_BLOCK => None,
1428            // RafxFormat::ASTC_8X5_SRGB_BLOCK => None,
1429            // RafxFormat::ASTC_8X6_UNORM_BLOCK => None,
1430            // RafxFormat::ASTC_8X6_SRGB_BLOCK => None,
1431            // RafxFormat::ASTC_8X8_UNORM_BLOCK => None,
1432            // RafxFormat::ASTC_8X8_SRGB_BLOCK => None,
1433            // RafxFormat::ASTC_10X5_UNORM_BLOCK => None,
1434            // RafxFormat::ASTC_10X5_SRGB_BLOCK => None,
1435            // RafxFormat::ASTC_10X6_UNORM_BLOCK => None,
1436            // RafxFormat::ASTC_10X6_SRGB_BLOCK => None,
1437            // RafxFormat::ASTC_10X8_UNORM_BLOCK => None,
1438            // RafxFormat::ASTC_10X8_SRGB_BLOCK => None,
1439            // RafxFormat::ASTC_10X10_UNORM_BLOCK => None,
1440            // RafxFormat::ASTC_10X10_SRGB_BLOCK => None,
1441            // RafxFormat::ASTC_12X10_UNORM_BLOCK => None,
1442            // RafxFormat::ASTC_12X10_SRGB_BLOCK => None,
1443            // RafxFormat::ASTC_12X12_UNORM_BLOCK => None,
1444            // RafxFormat::ASTC_12X12_SRGB_BLOCK => None,
1445            _ => None,
1446        }
1447    }
1448
1449    pub fn gles2_texture_format_info(self) -> Option<GlTextureFormatInfo> {
1450        use crate::gles2::gles2_bindings as gl;
1451        #[rustfmt::skip]
1452        let formats = match self {
1453            // RafxFormat::UNDEFINED => None,
1454            // RafxFormat::R4G4_UNORM_PACK8 => None,
1455            RafxFormat::R4G4B4A4_UNORM_PACK16 => Some((gl::RGBA, gl::RGBA)),
1456            // RafxFormat::B4G4R4A4_UNORM_PACK16 => None,
1457            RafxFormat::R5G6B5_UNORM_PACK16 => Some((gl::RGB, gl::RGB)),
1458            // RafxFormat::B5G6R5_UNORM_PACK16 => None,
1459            RafxFormat::R5G5B5A1_UNORM_PACK16 => Some((gl::RGBA, gl::RGBA)),
1460            // RafxFormat::B5G5R5A1_UNORM_PACK16 => None,
1461            // RafxFormat::A1R5G5B5_UNORM_PACK16 => None,
1462            RafxFormat::R8_UNORM => Some((gl::LUMINANCE, gl::LUMINANCE)),
1463            // RafxFormat::R8_SNORM => Some((gl::LUMINANCE, gl::LUMINANCE)),
1464            // RafxFormat::R8_USCALED => None,
1465            // RafxFormat::R8_SSCALED => None,
1466            // RafxFormat::R8_UINT => None,
1467            // RafxFormat::R8_SINT => None,
1468            // RafxFormat::R8_SRGB => None,
1469            // RafxFormat::R8G8_UNORM => None,
1470            // RafxFormat::R8G8_SNORM => None,
1471            // RafxFormat::R8G8_USCALED => None,
1472            // RafxFormat::R8G8_SSCALED => None,
1473            // RafxFormat::R8G8_UINT => None,
1474            // RafxFormat::R8G8_SINT => None,
1475            // RafxFormat::R8G8_SRGB => None,
1476            RafxFormat::R8G8B8_UNORM => Some((gl::RGB, gl::RGB)),
1477            // RafxFormat::R8G8B8_SNORM => Some((gl::RGB, gl::RGB)),
1478            // RafxFormat::R8G8B8_USCALED => None,
1479            // RafxFormat::R8G8B8_SSCALED => None,
1480            // RafxFormat::R8G8B8_UINT => None,
1481            // RafxFormat::R8G8B8_SINT => None,
1482            // RafxFormat::R8G8B8_SRGB => None,
1483            // RafxFormat::B8G8R8_UNORM => None,
1484            // RafxFormat::B8G8R8_SNORM => None,
1485            // RafxFormat::B8G8R8_USCALED => None,
1486            // RafxFormat::B8G8R8_SSCALED => None,
1487            // RafxFormat::B8G8R8_UINT => None,
1488            // RafxFormat::B8G8R8_SINT => None,
1489            // RafxFormat::B8G8R8_SRGB => None,
1490            RafxFormat::R8G8B8A8_UNORM => Some((gl::RGBA, gl::RGBA)),
1491            // //RafxFormat::R8G8B8A8_SNORM => None,
1492            // RafxFormat::R8G8B8A8_USCALED => None,
1493            // RafxFormat::R8G8B8A8_SSCALED => None,
1494            // RafxFormat::R8G8B8A8_UINT => None,
1495            // RafxFormat::R8G8B8A8_SINT => None,
1496            // RafxFormat::R8G8B8A8_SRGB => None,
1497            // RafxFormat::B8G8R8A8_UNORM => None,
1498            // RafxFormat::B8G8R8A8_SNORM => None,
1499            // RafxFormat::B8G8R8A8_USCALED => None,
1500            // RafxFormat::B8G8R8A8_SSCALED => None,
1501            // RafxFormat::B8G8R8A8_UINT => None,
1502            // RafxFormat::B8G8R8A8_SINT => None,
1503            // RafxFormat::B8G8R8A8_SRGB => None,
1504            // RafxFormat::A8B8G8R8_UNORM_PACK32 => None,
1505            // RafxFormat::A8B8G8R8_SNORM_PACK32 => None,
1506            // RafxFormat::A8B8G8R8_USCALED_PACK32 => None,
1507            // RafxFormat::A8B8G8R8_SSCALED_PACK32 => None,
1508            // RafxFormat::A8B8G8R8_UINT_PACK32 => None,
1509            // RafxFormat::A8B8G8R8_SINT_PACK32 => None,
1510            // RafxFormat::A8B8G8R8_SRGB_PACK32 => None,
1511            // RafxFormat::A2R10G10B10_UNORM_PACK32 => None,
1512            // RafxFormat::A2R10G10B10_SNORM_PACK32 => None,
1513            // RafxFormat::A2R10G10B10_USCALED_PACK32 => None,
1514            // RafxFormat::A2R10G10B10_SSCALED_PACK32 => None,
1515            // RafxFormat::A2R10G10B10_UINT_PACK32 => None,
1516            // RafxFormat::A2R10G10B10_SINT_PACK32 => None,
1517            // RafxFormat::A2B10G10R10_UNORM_PACK32 => None,
1518            // RafxFormat::A2B10G10R10_SNORM_PACK32 => None,
1519            // RafxFormat::A2B10G10R10_USCALED_PACK32 => None,
1520            // RafxFormat::A2B10G10R10_SSCALED_PACK32 => None,
1521            // RafxFormat::A2B10G10R10_UINT_PACK32 => None,
1522            // RafxFormat::A2B10G10R10_SINT_PACK32 => None,
1523            // RafxFormat::R16_UNORM => None,
1524            // RafxFormat::R16_SNORM => None,
1525            // RafxFormat::R16_USCALED => None,
1526            // RafxFormat::R16_SSCALED => None,
1527            // RafxFormat::R16_UINT => None,
1528            // RafxFormat::R16_SINT => None,
1529            // RafxFormat::R16_SFLOAT => None,
1530            // RafxFormat::R16G16_UNORM => None,
1531            // RafxFormat::R16G16_SNORM => None,
1532            // RafxFormat::R16G16_USCALED => None,
1533            // RafxFormat::R16G16_SSCALED => None,
1534            // RafxFormat::R16G16_UINT => None,
1535            // RafxFormat::R16G16_SINT => None,
1536            // RafxFormat::R16G16_SFLOAT => None,
1537            // RafxFormat::R16G16B16_UNORM => None,
1538            // RafxFormat::R16G16B16_SNORM => None,
1539            // RafxFormat::R16G16B16_USCALED => None,
1540            // RafxFormat::R16G16B16_SSCALED => None,
1541            // RafxFormat::R16G16B16_UINT => None,
1542            // RafxFormat::R16G16B16_SINT => None,
1543            // RafxFormat::R16G16B16_SFLOAT => None,
1544            // RafxFormat::R16G16B16A16_UNORM => None,
1545            // RafxFormat::R16G16B16A16_SNORM => None,
1546            // RafxFormat::R16G16B16A16_USCALED => None,
1547            // RafxFormat::R16G16B16A16_SSCALED => None,
1548            // RafxFormat::R16G16B16A16_UINT => None,
1549            // RafxFormat::R16G16B16A16_SINT => None,
1550            // RafxFormat::R16G16B16A16_SFLOAT => None,
1551            // RafxFormat::R32_UINT => None,
1552            // RafxFormat::R32_SINT => None,
1553            // RafxFormat::R32_SFLOAT => None,
1554            // RafxFormat::R32G32_UINT => None,
1555            // RafxFormat::R32G32_SINT => None,
1556            // RafxFormat::R32G32_SFLOAT => None,
1557            // RafxFormat::R32G32B32_UINT => None,
1558            // RafxFormat::R32G32B32_SINT => None,
1559            // RafxFormat::R32G32B32_SFLOAT => None,
1560            // RafxFormat::R32G32B32A32_UINT => None,
1561            // RafxFormat::R32G32B32A32_SINT => None,
1562            // RafxFormat::R32G32B32A32_SFLOAT => None,
1563            // RafxFormat::R64_UINT => None,
1564            // RafxFormat::R64_SINT => None,
1565            // RafxFormat::R64_SFLOAT => None,
1566            // RafxFormat::R64G64_UINT => None,
1567            // RafxFormat::R64G64_SINT => None,
1568            // RafxFormat::R64G64_SFLOAT => None,
1569            // RafxFormat::R64G64B64_UINT => None,
1570            // RafxFormat::R64G64B64_SINT => None,
1571            // RafxFormat::R64G64B64_SFLOAT => None,
1572            // RafxFormat::R64G64B64A64_UINT => None,
1573            // RafxFormat::R64G64B64A64_SINT => None,
1574            // RafxFormat::R64G64B64A64_SFLOAT => None,
1575            // RafxFormat::B10G11R11_UFLOAT_PACK32 => None,
1576            // RafxFormat::E5B9G9R9_UFLOAT_PACK32 => None,
1577            // RafxFormat::D16_UNORM => None,
1578            // RafxFormat::X8_D24_UNORM_PACK32 => None,
1579            // RafxFormat::D32_SFLOAT => None,
1580            // RafxFormat::S8_UINT => None,
1581            // RafxFormat::D16_UNORM_S8_UINT => None,
1582            // RafxFormat::D24_UNORM_S8_UINT => None,
1583            // RafxFormat::D32_SFLOAT_S8_UINT => None,
1584            // RafxFormat::BC1_RGB_UNORM_BLOCK => None,
1585            // RafxFormat::BC1_RGB_SRGB_BLOCK => None,
1586            // RafxFormat::BC1_RGBA_UNORM_BLOCK => None,
1587            // RafxFormat::BC1_RGBA_SRGB_BLOCK => None,
1588            // RafxFormat::BC2_UNORM_BLOCK => None,
1589            // RafxFormat::BC2_SRGB_BLOCK => None,
1590            // RafxFormat::BC3_UNORM_BLOCK => None,
1591            // RafxFormat::BC3_SRGB_BLOCK => None,
1592            // RafxFormat::BC4_UNORM_BLOCK => None,
1593            // RafxFormat::BC4_SNORM_BLOCK => None,
1594            // RafxFormat::BC5_UNORM_BLOCK => None,
1595            // RafxFormat::BC5_SNORM_BLOCK => None,
1596            // RafxFormat::BC6H_UFLOAT_BLOCK => None,
1597            // RafxFormat::BC6H_SFLOAT_BLOCK => None,
1598            // RafxFormat::BC7_UNORM_BLOCK => None,
1599            // RafxFormat::BC7_SRGB_BLOCK => None,
1600            // RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => None,
1601            // RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => None,
1602            // RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => None,
1603            // RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => None,
1604            // RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => None,
1605            // RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => None,
1606            // RafxFormat::EAC_R11_UNORM_BLOCK => None,
1607            // RafxFormat::EAC_R11_SNORM_BLOCK => None,
1608            // RafxFormat::EAC_R11G11_UNORM_BLOCK => None,
1609            // RafxFormat::EAC_R11G11_SNORM_BLOCK => None,
1610            // RafxFormat::ASTC_4X4_UNORM_BLOCK => None,
1611            // RafxFormat::ASTC_4X4_SRGB_BLOCK => None,
1612            // RafxFormat::ASTC_5X4_UNORM_BLOCK => None,
1613            // RafxFormat::ASTC_5X4_SRGB_BLOCK => None,
1614            // RafxFormat::ASTC_5X5_UNORM_BLOCK => None,
1615            // RafxFormat::ASTC_5X5_SRGB_BLOCK => None,
1616            // RafxFormat::ASTC_6X5_UNORM_BLOCK => None,
1617            // RafxFormat::ASTC_6X5_SRGB_BLOCK => None,
1618            // RafxFormat::ASTC_6X6_UNORM_BLOCK => None,
1619            // RafxFormat::ASTC_6X6_SRGB_BLOCK => None,
1620            // RafxFormat::ASTC_8X5_UNORM_BLOCK => None,
1621            // RafxFormat::ASTC_8X5_SRGB_BLOCK => None,
1622            // RafxFormat::ASTC_8X6_UNORM_BLOCK => None,
1623            // RafxFormat::ASTC_8X6_SRGB_BLOCK => None,
1624            // RafxFormat::ASTC_8X8_UNORM_BLOCK => None,
1625            // RafxFormat::ASTC_8X8_SRGB_BLOCK => None,
1626            // RafxFormat::ASTC_10X5_UNORM_BLOCK => None,
1627            // RafxFormat::ASTC_10X5_SRGB_BLOCK => None,
1628            // RafxFormat::ASTC_10X6_UNORM_BLOCK => None,
1629            // RafxFormat::ASTC_10X6_SRGB_BLOCK => None,
1630            // RafxFormat::ASTC_10X8_UNORM_BLOCK => None,
1631            // RafxFormat::ASTC_10X8_SRGB_BLOCK => None,
1632            // RafxFormat::ASTC_10X10_UNORM_BLOCK => None,
1633            // RafxFormat::ASTC_10X10_SRGB_BLOCK => None,
1634            // RafxFormat::ASTC_12X10_UNORM_BLOCK => None,
1635            // RafxFormat::ASTC_12X10_SRGB_BLOCK => None,
1636            // RafxFormat::ASTC_12X12_UNORM_BLOCK => None,
1637            // RafxFormat::ASTC_12X12_SRGB_BLOCK => None,
1638            _ => None,
1639        };
1640
1641        let gl_type = self.gles2_type()?;
1642        formats.map(|(gl_format, gl_internal_format)| GlTextureFormatInfo {
1643            gl_format,
1644            gl_type,
1645            gl_internal_format: gl_internal_format as i32
1646        })
1647    }
1648}
1649
1650#[rustfmt::skip]
1651#[cfg(feature = "rafx-gles3")]
1652impl RafxFormat {
1653    pub fn gles3_type(self) -> Option<GLenum> {
1654        use crate::gles3::gles3_bindings as gl;
1655        match self {
1656            RafxFormat::R4G4_UNORM_PACK8 => Some(gl::UNSIGNED_SHORT_4_4_4_4),
1657            RafxFormat::R4G4B4A4_UNORM_PACK16 => Some(gl::UNSIGNED_SHORT_4_4_4_4),
1658            //RafxFormat::B4G4R4A4_UNORM_PACK16 => None,
1659            RafxFormat::R5G6B5_UNORM_PACK16 => Some(gl::UNSIGNED_SHORT_5_6_5),
1660            //RafxFormat::B5G6R5_UNORM_PACK16 => None,
1661            RafxFormat::R5G5B5A1_UNORM_PACK16 => Some(gl::UNSIGNED_SHORT_5_5_5_1),
1662            //RafxFormat::B5G5R5A1_UNORM_PACK16 => None,
1663            //RafxFormat::A1R5G5B5_UNORM_PACK16 => None,
1664            RafxFormat::R8_UNORM => Some(gl::UNSIGNED_BYTE),
1665            RafxFormat::R8_SNORM => Some(gl::BYTE),
1666            //RafxFormat::R8_USCALED => None,
1667            //RafxFormat::R8_SSCALED => None,
1668            RafxFormat::R8_UINT => Some(gl::UNSIGNED_BYTE),
1669            RafxFormat::R8_SINT => Some(gl::BYTE),
1670            RafxFormat::R8_SRGB => Some(gl::UNSIGNED_BYTE),
1671            RafxFormat::R8G8_UNORM => Some(gl::UNSIGNED_BYTE),
1672            RafxFormat::R8G8_SNORM => Some(gl::BYTE),
1673            //RafxFormat::R8G8_USCALED => None,
1674            //RafxFormat::R8G8_SSCALED => None,
1675            RafxFormat::R8G8_UINT => Some(gl::UNSIGNED_BYTE),
1676            RafxFormat::R8G8_SINT => Some(gl::BYTE),
1677            RafxFormat::R8G8_SRGB => Some(gl::UNSIGNED_BYTE),
1678            RafxFormat::R8G8B8_UNORM => Some(gl::UNSIGNED_BYTE),
1679            RafxFormat::R8G8B8_SNORM => Some(gl::BYTE),
1680            //RafxFormat::R8G8B8_USCALED => None,
1681            //RafxFormat::R8G8B8_SSCALED => None,
1682            RafxFormat::R8G8B8_UINT => Some(gl::UNSIGNED_BYTE),
1683            RafxFormat::R8G8B8_SINT => Some(gl::BYTE),
1684            RafxFormat::R8G8B8_SRGB => Some(gl::UNSIGNED_BYTE),
1685            RafxFormat::B8G8R8_UNORM => Some(gl::UNSIGNED_BYTE),
1686            RafxFormat::B8G8R8_SNORM => Some(gl::BYTE),
1687            //RafxFormat::B8G8R8_USCALED => None,
1688            //RafxFormat::B8G8R8_SSCALED => None,
1689            RafxFormat::B8G8R8_UINT => Some(gl::UNSIGNED_BYTE),
1690            RafxFormat::B8G8R8_SINT => Some(gl::BYTE),
1691            RafxFormat::B8G8R8_SRGB => Some(gl::UNSIGNED_BYTE),
1692            RafxFormat::R8G8B8A8_UNORM => Some(gl::UNSIGNED_BYTE),
1693            RafxFormat::R8G8B8A8_SNORM => Some(gl::BYTE),
1694            //RafxFormat::R8G8B8A8_USCALED => None,
1695            //RafxFormat::R8G8B8A8_SSCALED => None,
1696            RafxFormat::R8G8B8A8_UINT => Some(gl::UNSIGNED_BYTE),
1697            RafxFormat::R8G8B8A8_SINT => Some(gl::BYTE),
1698            RafxFormat::R8G8B8A8_SRGB => Some(gl::UNSIGNED_BYTE),
1699            RafxFormat::B8G8R8A8_UNORM => Some(gl::UNSIGNED_BYTE),
1700            RafxFormat::B8G8R8A8_SNORM => Some(gl::BYTE),
1701            //RafxFormat::B8G8R8A8_USCALED => None,
1702            //RafxFormat::B8G8R8A8_SSCALED => None,
1703            RafxFormat::B8G8R8A8_UINT => Some(gl::UNSIGNED_BYTE),
1704            RafxFormat::B8G8R8A8_SINT => Some(gl::BYTE),
1705            RafxFormat::B8G8R8A8_SRGB => Some(gl::UNSIGNED_BYTE),
1706            //RafxFormat::A8B8G8R8_UNORM_PACK32 => None,
1707            //RafxFormat::A8B8G8R8_SNORM_PACK32 => None,
1708            //RafxFormat::A8B8G8R8_USCALED_PACK32 => None,
1709            //RafxFormat::A8B8G8R8_SSCALED_PACK32 => None,
1710            //RafxFormat::A8B8G8R8_UINT_PACK32 => None,
1711            //RafxFormat::A8B8G8R8_SINT_PACK32 => None,
1712            //RafxFormat::A8B8G8R8_SRGB_PACK32 => None,
1713            //RafxFormat::A2R10G10B10_UNORM_PACK32 => None,
1714            //RafxFormat::A2R10G10B10_SNORM_PACK32 => None,
1715            //RafxFormat::A2R10G10B10_USCALED_PACK32 => None,
1716            //RafxFormat::A2R10G10B10_SSCALED_PACK32 => None,
1717            //RafxFormat::A2R10G10B10_UINT_PACK32 => None,
1718            //RafxFormat::A2R10G10B10_SINT_PACK32 => None,
1719            //RafxFormat::A2B10G10R10_UNORM_PACK32 => None,
1720            //RafxFormat::A2B10G10R10_SNORM_PACK32 => None,
1721            //RafxFormat::A2B10G10R10_USCALED_PACK32 => None,
1722            //RafxFormat::A2B10G10R10_SSCALED_PACK32 => None,
1723            //RafxFormat::A2B10G10R10_UINT_PACK32 => None,
1724            //RafxFormat::A2B10G10R10_SINT_PACK32 => None,
1725            RafxFormat::R16_UNORM => Some(gl::UNSIGNED_SHORT),
1726            RafxFormat::R16_SNORM => Some(gl::SHORT),
1727            //RafxFormat::R16_USCALED => None,
1728            //RafxFormat::R16_SSCALED => None,
1729            RafxFormat::R16_UINT => Some(gl::UNSIGNED_SHORT),
1730            RafxFormat::R16_SINT => Some(gl::SHORT),
1731            //RafxFormat::R16_SFLOAT => None,
1732            RafxFormat::R16G16_UNORM => Some(gl::UNSIGNED_SHORT),
1733            RafxFormat::R16G16_SNORM => Some(gl::SHORT),
1734            //RafxFormat::R16G16_USCALED => None,
1735            //RafxFormat::R16G16_SSCALED => None,
1736            RafxFormat::R16G16_UINT => Some(gl::UNSIGNED_SHORT),
1737            RafxFormat::R16G16_SINT => Some(gl::SHORT),
1738            //RafxFormat::R16G16_SFLOAT => None,
1739            RafxFormat::R16G16B16_UNORM => Some(gl::UNSIGNED_SHORT),
1740            RafxFormat::R16G16B16_SNORM => Some(gl::SHORT),
1741            //RafxFormat::R16G16B16_USCALED => None,
1742            //RafxFormat::R16G16B16_SSCALED => None,
1743            RafxFormat::R16G16B16_UINT => Some(gl::UNSIGNED_SHORT),
1744            RafxFormat::R16G16B16_SINT => Some(gl::SHORT),
1745            //RafxFormat::R16G16B16_SFLOAT => None,
1746            RafxFormat::R16G16B16A16_UNORM => Some(gl::UNSIGNED_SHORT),
1747            RafxFormat::R16G16B16A16_SNORM => Some(gl::SHORT),
1748            //RafxFormat::R16G16B16A16_USCALED => None,
1749            //RafxFormat::R16G16B16A16_SSCALED => None,
1750            RafxFormat::R16G16B16A16_UINT => Some(gl::UNSIGNED_SHORT),
1751            RafxFormat::R16G16B16A16_SINT => Some(gl::SHORT),
1752            //RafxFormat::R16G16B16A16_SFLOAT => None,
1753            RafxFormat::R32_UINT => Some(gl::UNSIGNED_INT),
1754            RafxFormat::R32_SINT => Some(gl::INT),
1755            RafxFormat::R32_SFLOAT => Some(gl::FLOAT),
1756            RafxFormat::R32G32_UINT => Some(gl::UNSIGNED_INT),
1757            RafxFormat::R32G32_SINT => Some(gl::INT),
1758            RafxFormat::R32G32_SFLOAT => Some(gl::FLOAT),
1759            RafxFormat::R32G32B32_UINT => Some(gl::UNSIGNED_INT),
1760            RafxFormat::R32G32B32_SINT => Some(gl::INT),
1761            RafxFormat::R32G32B32_SFLOAT => Some(gl::FLOAT),
1762            RafxFormat::R32G32B32A32_UINT => Some(gl::UNSIGNED_INT),
1763            RafxFormat::R32G32B32A32_SINT => Some(gl::INT),
1764            RafxFormat::R32G32B32A32_SFLOAT => Some(gl::FLOAT),
1765            // RafxFormat::R64_UINT => None,
1766            // RafxFormat::R64_SINT => None,
1767            // RafxFormat::R64_SFLOAT => None,
1768            // RafxFormat::R64G64_UINT => None,
1769            // RafxFormat::R64G64_SINT => None,
1770            // RafxFormat::R64G64_SFLOAT => None,
1771            // RafxFormat::R64G64B64_UINT => None,
1772            // RafxFormat::R64G64B64_SINT => None,
1773            // RafxFormat::R64G64B64_SFLOAT => None,
1774            // RafxFormat::R64G64B64A64_UINT => None,
1775            // RafxFormat::R64G64B64A64_SINT => None,
1776            // RafxFormat::R64G64B64A64_SFLOAT => None,
1777            // RafxFormat::B10G11R11_UFLOAT_PACK32 => None,
1778            // RafxFormat::E5B9G9R9_UFLOAT_PACK32 => None,
1779            RafxFormat::D16_UNORM => Some(gl::UNSIGNED_SHORT),
1780            // RafxFormat::X8_D24_UNORM_PACK32 => None,
1781            RafxFormat::D32_SFLOAT => Some(gl::FLOAT),
1782            RafxFormat::S8_UINT => Some(gl::UNSIGNED_BYTE),
1783            RafxFormat::D16_UNORM_S8_UINT => Some(gl::UNSIGNED_INT_24_8),
1784            RafxFormat::D24_UNORM_S8_UINT => Some(gl::FLOAT_32_UNSIGNED_INT_24_8_REV),
1785            // RafxFormat::D32_SFLOAT_S8_UINT => None,
1786            // RafxFormat::BC1_RGB_UNORM_BLOCK => None,
1787            // RafxFormat::BC1_RGB_SRGB_BLOCK => None,
1788            // RafxFormat::BC1_RGBA_UNORM_BLOCK => None,
1789            // RafxFormat::BC1_RGBA_SRGB_BLOCK => None,
1790            // RafxFormat::BC2_UNORM_BLOCK => None,
1791            // RafxFormat::BC2_SRGB_BLOCK => None,
1792            // RafxFormat::BC3_UNORM_BLOCK => None,
1793            // RafxFormat::BC3_SRGB_BLOCK => None,
1794            // RafxFormat::BC4_UNORM_BLOCK => None,
1795            // RafxFormat::BC4_SNORM_BLOCK => None,
1796            // RafxFormat::BC5_UNORM_BLOCK => None,
1797            // RafxFormat::BC5_SNORM_BLOCK => None,
1798            // RafxFormat::BC6H_UFLOAT_BLOCK => None,
1799            // RafxFormat::BC6H_SFLOAT_BLOCK => None,
1800            // RafxFormat::BC7_UNORM_BLOCK => None,
1801            // RafxFormat::BC7_SRGB_BLOCK => None,
1802            // RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => None,
1803            // RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => None,
1804            // RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => None,
1805            // RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => None,
1806            // RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => None,
1807            // RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => None,
1808            // RafxFormat::EAC_R11_UNORM_BLOCK => None,
1809            // RafxFormat::EAC_R11_SNORM_BLOCK => None,
1810            // RafxFormat::EAC_R11G11_UNORM_BLOCK => None,
1811            // RafxFormat::EAC_R11G11_SNORM_BLOCK => None,
1812            // RafxFormat::ASTC_4X4_UNORM_BLOCK => None,
1813            // RafxFormat::ASTC_4X4_SRGB_BLOCK => None,
1814            // RafxFormat::ASTC_5X4_UNORM_BLOCK => None,
1815            // RafxFormat::ASTC_5X4_SRGB_BLOCK => None,
1816            // RafxFormat::ASTC_5X5_UNORM_BLOCK => None,
1817            // RafxFormat::ASTC_5X5_SRGB_BLOCK => None,
1818            // RafxFormat::ASTC_6X5_UNORM_BLOCK => None,
1819            // RafxFormat::ASTC_6X5_SRGB_BLOCK => None,
1820            // RafxFormat::ASTC_6X6_UNORM_BLOCK => None,
1821            // RafxFormat::ASTC_6X6_SRGB_BLOCK => None,
1822            // RafxFormat::ASTC_8X5_UNORM_BLOCK => None,
1823            // RafxFormat::ASTC_8X5_SRGB_BLOCK => None,
1824            // RafxFormat::ASTC_8X6_UNORM_BLOCK => None,
1825            // RafxFormat::ASTC_8X6_SRGB_BLOCK => None,
1826            // RafxFormat::ASTC_8X8_UNORM_BLOCK => None,
1827            // RafxFormat::ASTC_8X8_SRGB_BLOCK => None,
1828            // RafxFormat::ASTC_10X5_UNORM_BLOCK => None,
1829            // RafxFormat::ASTC_10X5_SRGB_BLOCK => None,
1830            // RafxFormat::ASTC_10X6_UNORM_BLOCK => None,
1831            // RafxFormat::ASTC_10X6_SRGB_BLOCK => None,
1832            // RafxFormat::ASTC_10X8_UNORM_BLOCK => None,
1833            // RafxFormat::ASTC_10X8_SRGB_BLOCK => None,
1834            // RafxFormat::ASTC_10X10_UNORM_BLOCK => None,
1835            // RafxFormat::ASTC_10X10_SRGB_BLOCK => None,
1836            // RafxFormat::ASTC_12X10_UNORM_BLOCK => None,
1837            // RafxFormat::ASTC_12X10_SRGB_BLOCK => None,
1838            // RafxFormat::ASTC_12X12_UNORM_BLOCK => None,
1839            // RafxFormat::ASTC_12X12_SRGB_BLOCK => None,
1840            _ => None,
1841        }
1842    }
1843
1844    pub fn gles3_texture_format_info(self) -> Option<GlTextureFormatInfo> {
1845        use crate::gles3::gles3_bindings as gl;
1846        #[rustfmt::skip]
1847        let formats = match self {
1848            // RafxFormat::UNDEFINED => None,
1849            // RafxFormat::R4G4_UNORM_PACK8 => None,
1850            RafxFormat::R4G4B4A4_UNORM_PACK16 => Some((gl::RGBA, gl::RGBA)),
1851            // RafxFormat::B4G4R4A4_UNORM_PACK16 => None,
1852            RafxFormat::R5G6B5_UNORM_PACK16 => Some((gl::RGB, gl::RGB)),
1853            // RafxFormat::B5G6R5_UNORM_PACK16 => None,
1854            RafxFormat::R5G5B5A1_UNORM_PACK16 => Some((gl::RGBA, gl::RGBA)),
1855            // RafxFormat::B5G5R5A1_UNORM_PACK16 => None,
1856            // RafxFormat::A1R5G5B5_UNORM_PACK16 => None,
1857            RafxFormat::R8_UNORM => Some((gl::RED, gl::R8)),
1858            // RafxFormat::R8_SNORM => Some((gl::LUMINANCE, gl::LUMINANCE)),
1859            // RafxFormat::R8_USCALED => None,
1860            // RafxFormat::R8_SSCALED => None,
1861            // RafxFormat::R8_UINT => None,
1862            // RafxFormat::R8_SINT => None,
1863            // RafxFormat::R8_SRGB => None,
1864            // RafxFormat::R8G8_UNORM => None,
1865            // RafxFormat::R8G8_SNORM => None,
1866            // RafxFormat::R8G8_USCALED => None,
1867            // RafxFormat::R8G8_SSCALED => None,
1868            // RafxFormat::R8G8_UINT => None,
1869            // RafxFormat::R8G8_SINT => None,
1870            // RafxFormat::R8G8_SRGB => None,
1871            RafxFormat::R8G8B8_UNORM => Some((gl::RGB, gl::RGB)),
1872            // RafxFormat::R8G8B8_SNORM => Some((gl::RGB, gl::RGB)),
1873            // RafxFormat::R8G8B8_USCALED => None,
1874            // RafxFormat::R8G8B8_SSCALED => None,
1875            // RafxFormat::R8G8B8_UINT => None,
1876            // RafxFormat::R8G8B8_SINT => None,
1877            RafxFormat::R8G8B8_SRGB => Some((gl::RGB, gl::SRGB8)),
1878            // RafxFormat::B8G8R8_UNORM => None,
1879            // RafxFormat::B8G8R8_SNORM => None,
1880            // RafxFormat::B8G8R8_USCALED => None,
1881            // RafxFormat::B8G8R8_SSCALED => None,
1882            // RafxFormat::B8G8R8_UINT => None,
1883            // RafxFormat::B8G8R8_SINT => None,
1884            // RafxFormat::B8G8R8_SRGB => None,
1885            RafxFormat::R8G8B8A8_UNORM => Some((gl::RGBA, gl::RGBA)),
1886            // //RafxFormat::R8G8B8A8_SNORM => None,
1887            // RafxFormat::R8G8B8A8_USCALED => None,
1888            // RafxFormat::R8G8B8A8_SSCALED => None,
1889            // RafxFormat::R8G8B8A8_UINT => None,
1890            // RafxFormat::R8G8B8A8_SINT => None,
1891            RafxFormat::R8G8B8A8_SRGB => Some((gl::RGBA, gl::SRGB8_ALPHA8)),
1892            // RafxFormat::B8G8R8A8_UNORM => None,
1893            // RafxFormat::B8G8R8A8_SNORM => None,
1894            // RafxFormat::B8G8R8A8_USCALED => None,
1895            // RafxFormat::B8G8R8A8_SSCALED => None,
1896            // RafxFormat::B8G8R8A8_UINT => None,
1897            // RafxFormat::B8G8R8A8_SINT => None,
1898            // RafxFormat::B8G8R8A8_SRGB => None,
1899            // RafxFormat::A8B8G8R8_UNORM_PACK32 => None,
1900            // RafxFormat::A8B8G8R8_SNORM_PACK32 => None,
1901            // RafxFormat::A8B8G8R8_USCALED_PACK32 => None,
1902            // RafxFormat::A8B8G8R8_SSCALED_PACK32 => None,
1903            // RafxFormat::A8B8G8R8_UINT_PACK32 => None,
1904            // RafxFormat::A8B8G8R8_SINT_PACK32 => None,
1905            // RafxFormat::A8B8G8R8_SRGB_PACK32 => None,
1906            // RafxFormat::A2R10G10B10_UNORM_PACK32 => None,
1907            // RafxFormat::A2R10G10B10_SNORM_PACK32 => None,
1908            // RafxFormat::A2R10G10B10_USCALED_PACK32 => None,
1909            // RafxFormat::A2R10G10B10_SSCALED_PACK32 => None,
1910            // RafxFormat::A2R10G10B10_UINT_PACK32 => None,
1911            // RafxFormat::A2R10G10B10_SINT_PACK32 => None,
1912            // RafxFormat::A2B10G10R10_UNORM_PACK32 => None,
1913            // RafxFormat::A2B10G10R10_SNORM_PACK32 => None,
1914            // RafxFormat::A2B10G10R10_USCALED_PACK32 => None,
1915            // RafxFormat::A2B10G10R10_SSCALED_PACK32 => None,
1916            // RafxFormat::A2B10G10R10_UINT_PACK32 => None,
1917            // RafxFormat::A2B10G10R10_SINT_PACK32 => None,
1918            // RafxFormat::R16_UNORM => None,
1919            // RafxFormat::R16_SNORM => None,
1920            // RafxFormat::R16_USCALED => None,
1921            // RafxFormat::R16_SSCALED => None,
1922            // RafxFormat::R16_UINT => None,
1923            // RafxFormat::R16_SINT => None,
1924            // RafxFormat::R16_SFLOAT => None,
1925            // RafxFormat::R16G16_UNORM => None,
1926            // RafxFormat::R16G16_SNORM => None,
1927            // RafxFormat::R16G16_USCALED => None,
1928            // RafxFormat::R16G16_SSCALED => None,
1929            // RafxFormat::R16G16_UINT => None,
1930            // RafxFormat::R16G16_SINT => None,
1931            // RafxFormat::R16G16_SFLOAT => None,
1932            // RafxFormat::R16G16B16_UNORM => None,
1933            // RafxFormat::R16G16B16_SNORM => None,
1934            // RafxFormat::R16G16B16_USCALED => None,
1935            // RafxFormat::R16G16B16_SSCALED => None,
1936            // RafxFormat::R16G16B16_UINT => None,
1937            // RafxFormat::R16G16B16_SINT => None,
1938            // RafxFormat::R16G16B16_SFLOAT => None,
1939            // RafxFormat::R16G16B16A16_UNORM => None,
1940            // RafxFormat::R16G16B16A16_SNORM => None,
1941            // RafxFormat::R16G16B16A16_USCALED => None,
1942            // RafxFormat::R16G16B16A16_SSCALED => None,
1943            // RafxFormat::R16G16B16A16_UINT => None,
1944            // RafxFormat::R16G16B16A16_SINT => None,
1945            // RafxFormat::R16G16B16A16_SFLOAT => None,
1946            // RafxFormat::R32_UINT => None,
1947            // RafxFormat::R32_SINT => None,
1948            // RafxFormat::R32_SFLOAT => None,
1949            // RafxFormat::R32G32_UINT => None,
1950            // RafxFormat::R32G32_SINT => None,
1951            // RafxFormat::R32G32_SFLOAT => None,
1952            // RafxFormat::R32G32B32_UINT => None,
1953            // RafxFormat::R32G32B32_SINT => None,
1954            // RafxFormat::R32G32B32_SFLOAT => None,
1955            // RafxFormat::R32G32B32A32_UINT => None,
1956            // RafxFormat::R32G32B32A32_SINT => None,
1957            RafxFormat::R32G32B32A32_SFLOAT => Some((gl::RGBA, gl::RGBA32F)),
1958            // RafxFormat::R64_UINT => None,
1959            // RafxFormat::R64_SINT => None,
1960            // RafxFormat::R64_SFLOAT => None,
1961            // RafxFormat::R64G64_UINT => None,
1962            // RafxFormat::R64G64_SINT => None,
1963            // RafxFormat::R64G64_SFLOAT => None,
1964            // RafxFormat::R64G64B64_UINT => None,
1965            // RafxFormat::R64G64B64_SINT => None,
1966            // RafxFormat::R64G64B64_SFLOAT => None,
1967            // RafxFormat::R64G64B64A64_UINT => None,
1968            // RafxFormat::R64G64B64A64_SINT => None,
1969            // RafxFormat::R64G64B64A64_SFLOAT => None,
1970            // RafxFormat::B10G11R11_UFLOAT_PACK32 => None,
1971            // RafxFormat::E5B9G9R9_UFLOAT_PACK32 => None,
1972            RafxFormat::D16_UNORM => Some((gl::DEPTH_COMPONENT, gl::DEPTH_COMPONENT16)),
1973            // RafxFormat::X8_D24_UNORM_PACK32 => None,
1974            RafxFormat::D32_SFLOAT => Some((gl::DEPTH_COMPONENT, gl::DEPTH_COMPONENT32F)),
1975            // RafxFormat::S8_UINT => None,
1976            //RafxFormat::D16_UNORM_S8_UINT => None,
1977            RafxFormat::D24_UNORM_S8_UINT => Some((gl::DEPTH_STENCIL, gl::DEPTH24_STENCIL8)),
1978            RafxFormat::D32_SFLOAT_S8_UINT => Some((gl::DEPTH_STENCIL, gl::DEPTH32F_STENCIL8)),
1979            // RafxFormat::BC1_RGB_UNORM_BLOCK => None,
1980            // RafxFormat::BC1_RGB_SRGB_BLOCK => None,
1981            // RafxFormat::BC1_RGBA_UNORM_BLOCK => None,
1982            // RafxFormat::BC1_RGBA_SRGB_BLOCK => None,
1983            // RafxFormat::BC2_UNORM_BLOCK => None,
1984            // RafxFormat::BC2_SRGB_BLOCK => None,
1985            // RafxFormat::BC3_UNORM_BLOCK => None,
1986            // RafxFormat::BC3_SRGB_BLOCK => None,
1987            // RafxFormat::BC4_UNORM_BLOCK => None,
1988            // RafxFormat::BC4_SNORM_BLOCK => None,
1989            // RafxFormat::BC5_UNORM_BLOCK => None,
1990            // RafxFormat::BC5_SNORM_BLOCK => None,
1991            // RafxFormat::BC6H_UFLOAT_BLOCK => None,
1992            // RafxFormat::BC6H_SFLOAT_BLOCK => None,
1993            // RafxFormat::BC7_UNORM_BLOCK => None,
1994            // RafxFormat::BC7_SRGB_BLOCK => None,
1995            // RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => None,
1996            // RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => None,
1997            // RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => None,
1998            // RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => None,
1999            // RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => None,
2000            // RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => None,
2001            // RafxFormat::EAC_R11_UNORM_BLOCK => None,
2002            // RafxFormat::EAC_R11_SNORM_BLOCK => None,
2003            // RafxFormat::EAC_R11G11_UNORM_BLOCK => None,
2004            // RafxFormat::EAC_R11G11_SNORM_BLOCK => None,
2005            // RafxFormat::ASTC_4X4_UNORM_BLOCK => None,
2006            // RafxFormat::ASTC_4X4_SRGB_BLOCK => None,
2007            // RafxFormat::ASTC_5X4_UNORM_BLOCK => None,
2008            // RafxFormat::ASTC_5X4_SRGB_BLOCK => None,
2009            // RafxFormat::ASTC_5X5_UNORM_BLOCK => None,
2010            // RafxFormat::ASTC_5X5_SRGB_BLOCK => None,
2011            // RafxFormat::ASTC_6X5_UNORM_BLOCK => None,
2012            // RafxFormat::ASTC_6X5_SRGB_BLOCK => None,
2013            // RafxFormat::ASTC_6X6_UNORM_BLOCK => None,
2014            // RafxFormat::ASTC_6X6_SRGB_BLOCK => None,
2015            // RafxFormat::ASTC_8X5_UNORM_BLOCK => None,
2016            // RafxFormat::ASTC_8X5_SRGB_BLOCK => None,
2017            // RafxFormat::ASTC_8X6_UNORM_BLOCK => None,
2018            // RafxFormat::ASTC_8X6_SRGB_BLOCK => None,
2019            // RafxFormat::ASTC_8X8_UNORM_BLOCK => None,
2020            // RafxFormat::ASTC_8X8_SRGB_BLOCK => None,
2021            // RafxFormat::ASTC_10X5_UNORM_BLOCK => None,
2022            // RafxFormat::ASTC_10X5_SRGB_BLOCK => None,
2023            // RafxFormat::ASTC_10X6_UNORM_BLOCK => None,
2024            // RafxFormat::ASTC_10X6_SRGB_BLOCK => None,
2025            // RafxFormat::ASTC_10X8_UNORM_BLOCK => None,
2026            // RafxFormat::ASTC_10X8_SRGB_BLOCK => None,
2027            // RafxFormat::ASTC_10X10_UNORM_BLOCK => None,
2028            // RafxFormat::ASTC_10X10_SRGB_BLOCK => None,
2029            // RafxFormat::ASTC_12X10_UNORM_BLOCK => None,
2030            // RafxFormat::ASTC_12X10_SRGB_BLOCK => None,
2031            // RafxFormat::ASTC_12X12_UNORM_BLOCK => None,
2032            // RafxFormat::ASTC_12X12_SRGB_BLOCK => None,
2033            _ => None,
2034        };
2035
2036        let gl_type = self.gles3_type()?;
2037        formats.map(|(gl_format, gl_internal_format)| GlTextureFormatInfo {
2038            gl_format,
2039            gl_type,
2040            gl_internal_format: gl_internal_format as i32
2041        })
2042    }
2043}
2044
2045// Returns None for formats unlikely to be used for vertices (like ATSC blocks) or undefined
2046impl RafxFormat {
2047    pub fn is_depth_only(self) -> bool {
2048        match self {
2049            RafxFormat::D16_UNORM | RafxFormat::X8_D24_UNORM_PACK32 | RafxFormat::D32_SFLOAT => {
2050                true
2051            }
2052            _ => false,
2053        }
2054    }
2055
2056    pub fn is_stencil_only(self) -> bool {
2057        self == RafxFormat::S8_UINT
2058    }
2059
2060    pub fn is_depth_and_stencil(self) -> bool {
2061        match self {
2062            RafxFormat::D16_UNORM_S8_UINT
2063            | RafxFormat::D24_UNORM_S8_UINT
2064            | RafxFormat::D32_SFLOAT_S8_UINT => true,
2065            _ => false,
2066        }
2067    }
2068
2069    pub fn has_depth(self) -> bool {
2070        self.is_depth_and_stencil() || self.is_depth_only()
2071    }
2072
2073    pub fn has_stencil(self) -> bool {
2074        self.is_depth_and_stencil() || self.is_stencil_only()
2075    }
2076
2077    pub fn has_depth_or_stencil(self) -> bool {
2078        self.is_depth_and_stencil() || self.is_stencil_only() || self.is_depth_only()
2079    }
2080
2081    pub fn is_undefined(self) -> bool {
2082        self == RafxFormat::UNDEFINED
2083    }
2084
2085    pub fn is_srgb(self) -> bool {
2086        match self {
2087            RafxFormat::UNDEFINED => false,
2088            RafxFormat::R4G4_UNORM_PACK8 => false,
2089            RafxFormat::R4G4B4A4_UNORM_PACK16 => false,
2090            RafxFormat::B4G4R4A4_UNORM_PACK16 => false,
2091            RafxFormat::R5G6B5_UNORM_PACK16 => false,
2092            RafxFormat::B5G6R5_UNORM_PACK16 => false,
2093            RafxFormat::R5G5B5A1_UNORM_PACK16 => false,
2094            RafxFormat::B5G5R5A1_UNORM_PACK16 => false,
2095            RafxFormat::A1R5G5B5_UNORM_PACK16 => false,
2096            RafxFormat::R8_UNORM => false,
2097            RafxFormat::R8_SNORM => false,
2098            RafxFormat::R8_USCALED => false,
2099            RafxFormat::R8_SSCALED => false,
2100            RafxFormat::R8_UINT => false,
2101            RafxFormat::R8_SINT => false,
2102            RafxFormat::R8_SRGB => true,
2103            RafxFormat::R8G8_UNORM => false,
2104            RafxFormat::R8G8_SNORM => false,
2105            RafxFormat::R8G8_USCALED => false,
2106            RafxFormat::R8G8_SSCALED => false,
2107            RafxFormat::R8G8_UINT => false,
2108            RafxFormat::R8G8_SINT => false,
2109            RafxFormat::R8G8_SRGB => true,
2110            RafxFormat::R8G8B8_UNORM => false,
2111            RafxFormat::R8G8B8_SNORM => false,
2112            RafxFormat::R8G8B8_USCALED => false,
2113            RafxFormat::R8G8B8_SSCALED => false,
2114            RafxFormat::R8G8B8_UINT => false,
2115            RafxFormat::R8G8B8_SINT => false,
2116            RafxFormat::R8G8B8_SRGB => true,
2117            RafxFormat::B8G8R8_UNORM => false,
2118            RafxFormat::B8G8R8_SNORM => false,
2119            RafxFormat::B8G8R8_USCALED => false,
2120            RafxFormat::B8G8R8_SSCALED => false,
2121            RafxFormat::B8G8R8_UINT => false,
2122            RafxFormat::B8G8R8_SINT => false,
2123            RafxFormat::B8G8R8_SRGB => true,
2124            RafxFormat::R8G8B8A8_UNORM => false,
2125            RafxFormat::R8G8B8A8_SNORM => false,
2126            RafxFormat::R8G8B8A8_USCALED => false,
2127            RafxFormat::R8G8B8A8_SSCALED => false,
2128            RafxFormat::R8G8B8A8_UINT => false,
2129            RafxFormat::R8G8B8A8_SINT => false,
2130            RafxFormat::R8G8B8A8_SRGB => true,
2131            RafxFormat::B8G8R8A8_UNORM => false,
2132            RafxFormat::B8G8R8A8_SNORM => false,
2133            RafxFormat::B8G8R8A8_USCALED => false,
2134            RafxFormat::B8G8R8A8_SSCALED => false,
2135            RafxFormat::B8G8R8A8_UINT => false,
2136            RafxFormat::B8G8R8A8_SINT => false,
2137            RafxFormat::B8G8R8A8_SRGB => true,
2138            RafxFormat::A8B8G8R8_UNORM_PACK32 => false,
2139            RafxFormat::A8B8G8R8_SNORM_PACK32 => false,
2140            RafxFormat::A8B8G8R8_USCALED_PACK32 => false,
2141            RafxFormat::A8B8G8R8_SSCALED_PACK32 => false,
2142            RafxFormat::A8B8G8R8_UINT_PACK32 => false,
2143            RafxFormat::A8B8G8R8_SINT_PACK32 => false,
2144            RafxFormat::A8B8G8R8_SRGB_PACK32 => true,
2145            RafxFormat::A2R10G10B10_UNORM_PACK32 => false,
2146            RafxFormat::A2R10G10B10_SNORM_PACK32 => false,
2147            RafxFormat::A2R10G10B10_USCALED_PACK32 => false,
2148            RafxFormat::A2R10G10B10_SSCALED_PACK32 => false,
2149            RafxFormat::A2R10G10B10_UINT_PACK32 => false,
2150            RafxFormat::A2R10G10B10_SINT_PACK32 => false,
2151            RafxFormat::A2B10G10R10_UNORM_PACK32 => false,
2152            RafxFormat::A2B10G10R10_SNORM_PACK32 => false,
2153            RafxFormat::A2B10G10R10_USCALED_PACK32 => false,
2154            RafxFormat::A2B10G10R10_SSCALED_PACK32 => false,
2155            RafxFormat::A2B10G10R10_UINT_PACK32 => false,
2156            RafxFormat::A2B10G10R10_SINT_PACK32 => false,
2157            RafxFormat::R16_UNORM => false,
2158            RafxFormat::R16_SNORM => false,
2159            RafxFormat::R16_USCALED => false,
2160            RafxFormat::R16_SSCALED => false,
2161            RafxFormat::R16_UINT => false,
2162            RafxFormat::R16_SINT => false,
2163            RafxFormat::R16_SFLOAT => false,
2164            RafxFormat::R16G16_UNORM => false,
2165            RafxFormat::R16G16_SNORM => false,
2166            RafxFormat::R16G16_USCALED => false,
2167            RafxFormat::R16G16_SSCALED => false,
2168            RafxFormat::R16G16_UINT => false,
2169            RafxFormat::R16G16_SINT => false,
2170            RafxFormat::R16G16_SFLOAT => false,
2171            RafxFormat::R16G16B16_UNORM => false,
2172            RafxFormat::R16G16B16_SNORM => false,
2173            RafxFormat::R16G16B16_USCALED => false,
2174            RafxFormat::R16G16B16_SSCALED => false,
2175            RafxFormat::R16G16B16_UINT => false,
2176            RafxFormat::R16G16B16_SINT => false,
2177            RafxFormat::R16G16B16_SFLOAT => false,
2178            RafxFormat::R16G16B16A16_UNORM => false,
2179            RafxFormat::R16G16B16A16_SNORM => false,
2180            RafxFormat::R16G16B16A16_USCALED => false,
2181            RafxFormat::R16G16B16A16_SSCALED => false,
2182            RafxFormat::R16G16B16A16_UINT => false,
2183            RafxFormat::R16G16B16A16_SINT => false,
2184            RafxFormat::R16G16B16A16_SFLOAT => false,
2185            RafxFormat::R32_UINT => false,
2186            RafxFormat::R32_SINT => false,
2187            RafxFormat::R32_SFLOAT => false,
2188            RafxFormat::R32G32_UINT => false,
2189            RafxFormat::R32G32_SINT => false,
2190            RafxFormat::R32G32_SFLOAT => false,
2191            RafxFormat::R32G32B32_UINT => false,
2192            RafxFormat::R32G32B32_SINT => false,
2193            RafxFormat::R32G32B32_SFLOAT => false,
2194            RafxFormat::R32G32B32A32_UINT => false,
2195            RafxFormat::R32G32B32A32_SINT => false,
2196            RafxFormat::R32G32B32A32_SFLOAT => false,
2197            RafxFormat::R64_UINT => false,
2198            RafxFormat::R64_SINT => false,
2199            RafxFormat::R64_SFLOAT => false,
2200            RafxFormat::R64G64_UINT => false,
2201            RafxFormat::R64G64_SINT => false,
2202            RafxFormat::R64G64_SFLOAT => false,
2203            RafxFormat::R64G64B64_UINT => false,
2204            RafxFormat::R64G64B64_SINT => false,
2205            RafxFormat::R64G64B64_SFLOAT => false,
2206            RafxFormat::R64G64B64A64_UINT => false,
2207            RafxFormat::R64G64B64A64_SINT => false,
2208            RafxFormat::R64G64B64A64_SFLOAT => false,
2209            RafxFormat::B10G11R11_UFLOAT_PACK32 => false,
2210            RafxFormat::E5B9G9R9_UFLOAT_PACK32 => false,
2211            RafxFormat::D16_UNORM => false,
2212            RafxFormat::X8_D24_UNORM_PACK32 => false,
2213            RafxFormat::D32_SFLOAT => false,
2214            RafxFormat::S8_UINT => false,
2215            RafxFormat::D16_UNORM_S8_UINT => false,
2216            RafxFormat::D24_UNORM_S8_UINT => false,
2217            RafxFormat::D32_SFLOAT_S8_UINT => false,
2218            RafxFormat::BC1_RGB_UNORM_BLOCK => false,
2219            RafxFormat::BC1_RGB_SRGB_BLOCK => true,
2220            RafxFormat::BC1_RGBA_UNORM_BLOCK => false,
2221            RafxFormat::BC1_RGBA_SRGB_BLOCK => true,
2222            RafxFormat::BC2_UNORM_BLOCK => false,
2223            RafxFormat::BC2_SRGB_BLOCK => true,
2224            RafxFormat::BC3_UNORM_BLOCK => false,
2225            RafxFormat::BC3_SRGB_BLOCK => true,
2226            RafxFormat::BC4_UNORM_BLOCK => false,
2227            RafxFormat::BC4_SNORM_BLOCK => false,
2228            RafxFormat::BC5_UNORM_BLOCK => false,
2229            RafxFormat::BC5_SNORM_BLOCK => false,
2230            RafxFormat::BC6H_UFLOAT_BLOCK => false,
2231            RafxFormat::BC6H_SFLOAT_BLOCK => false,
2232            RafxFormat::BC7_UNORM_BLOCK => false,
2233            RafxFormat::BC7_SRGB_BLOCK => true,
2234            RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => false,
2235            RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => true,
2236            RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => false,
2237            RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => true,
2238            RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => false,
2239            RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => true,
2240            RafxFormat::EAC_R11_UNORM_BLOCK => false,
2241            RafxFormat::EAC_R11_SNORM_BLOCK => false,
2242            RafxFormat::EAC_R11G11_UNORM_BLOCK => false,
2243            RafxFormat::EAC_R11G11_SNORM_BLOCK => false,
2244            RafxFormat::ASTC_4X4_UNORM_BLOCK => false,
2245            RafxFormat::ASTC_4X4_SRGB_BLOCK => true,
2246            RafxFormat::ASTC_5X4_UNORM_BLOCK => false,
2247            RafxFormat::ASTC_5X4_SRGB_BLOCK => true,
2248            RafxFormat::ASTC_5X5_UNORM_BLOCK => false,
2249            RafxFormat::ASTC_5X5_SRGB_BLOCK => true,
2250            RafxFormat::ASTC_6X5_UNORM_BLOCK => false,
2251            RafxFormat::ASTC_6X5_SRGB_BLOCK => true,
2252            RafxFormat::ASTC_6X6_UNORM_BLOCK => false,
2253            RafxFormat::ASTC_6X6_SRGB_BLOCK => true,
2254            RafxFormat::ASTC_8X5_UNORM_BLOCK => false,
2255            RafxFormat::ASTC_8X5_SRGB_BLOCK => true,
2256            RafxFormat::ASTC_8X6_UNORM_BLOCK => false,
2257            RafxFormat::ASTC_8X6_SRGB_BLOCK => true,
2258            RafxFormat::ASTC_8X8_UNORM_BLOCK => false,
2259            RafxFormat::ASTC_8X8_SRGB_BLOCK => true,
2260            RafxFormat::ASTC_10X5_UNORM_BLOCK => false,
2261            RafxFormat::ASTC_10X5_SRGB_BLOCK => true,
2262            RafxFormat::ASTC_10X6_UNORM_BLOCK => false,
2263            RafxFormat::ASTC_10X6_SRGB_BLOCK => true,
2264            RafxFormat::ASTC_10X8_UNORM_BLOCK => false,
2265            RafxFormat::ASTC_10X8_SRGB_BLOCK => true,
2266            RafxFormat::ASTC_10X10_UNORM_BLOCK => false,
2267            RafxFormat::ASTC_10X10_SRGB_BLOCK => true,
2268            RafxFormat::ASTC_12X10_UNORM_BLOCK => false,
2269            RafxFormat::ASTC_12X10_SRGB_BLOCK => true,
2270            RafxFormat::ASTC_12X12_UNORM_BLOCK => false,
2271            RafxFormat::ASTC_12X12_SRGB_BLOCK => true,
2272        }
2273    }
2274
2275    pub fn is_compressed(self) -> bool {
2276        match self {
2277            RafxFormat::BC1_RGB_UNORM_BLOCK
2278            | RafxFormat::BC1_RGB_SRGB_BLOCK
2279            | RafxFormat::BC1_RGBA_UNORM_BLOCK
2280            | RafxFormat::BC1_RGBA_SRGB_BLOCK
2281            | RafxFormat::BC2_UNORM_BLOCK
2282            | RafxFormat::BC2_SRGB_BLOCK
2283            | RafxFormat::BC3_UNORM_BLOCK
2284            | RafxFormat::BC3_SRGB_BLOCK
2285            | RafxFormat::BC4_UNORM_BLOCK
2286            | RafxFormat::BC4_SNORM_BLOCK
2287            | RafxFormat::BC5_UNORM_BLOCK
2288            | RafxFormat::BC5_SNORM_BLOCK
2289            | RafxFormat::BC6H_UFLOAT_BLOCK
2290            | RafxFormat::BC6H_SFLOAT_BLOCK
2291            | RafxFormat::BC7_UNORM_BLOCK
2292            | RafxFormat::BC7_SRGB_BLOCK
2293            | RafxFormat::ETC2_R8G8B8_UNORM_BLOCK
2294            | RafxFormat::ETC2_R8G8B8_SRGB_BLOCK
2295            | RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK
2296            | RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK
2297            | RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK
2298            | RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK
2299            | RafxFormat::EAC_R11_UNORM_BLOCK
2300            | RafxFormat::EAC_R11_SNORM_BLOCK
2301            | RafxFormat::EAC_R11G11_UNORM_BLOCK
2302            | RafxFormat::EAC_R11G11_SNORM_BLOCK
2303            | RafxFormat::ASTC_4X4_UNORM_BLOCK
2304            | RafxFormat::ASTC_4X4_SRGB_BLOCK
2305            | RafxFormat::ASTC_5X4_UNORM_BLOCK
2306            | RafxFormat::ASTC_5X4_SRGB_BLOCK
2307            | RafxFormat::ASTC_5X5_UNORM_BLOCK
2308            | RafxFormat::ASTC_5X5_SRGB_BLOCK
2309            | RafxFormat::ASTC_6X5_UNORM_BLOCK
2310            | RafxFormat::ASTC_6X5_SRGB_BLOCK
2311            | RafxFormat::ASTC_6X6_UNORM_BLOCK
2312            | RafxFormat::ASTC_6X6_SRGB_BLOCK
2313            | RafxFormat::ASTC_8X5_UNORM_BLOCK
2314            | RafxFormat::ASTC_8X5_SRGB_BLOCK
2315            | RafxFormat::ASTC_8X6_UNORM_BLOCK
2316            | RafxFormat::ASTC_8X6_SRGB_BLOCK
2317            | RafxFormat::ASTC_8X8_UNORM_BLOCK
2318            | RafxFormat::ASTC_8X8_SRGB_BLOCK
2319            | RafxFormat::ASTC_10X5_UNORM_BLOCK
2320            | RafxFormat::ASTC_10X5_SRGB_BLOCK
2321            | RafxFormat::ASTC_10X6_UNORM_BLOCK
2322            | RafxFormat::ASTC_10X6_SRGB_BLOCK
2323            | RafxFormat::ASTC_10X8_UNORM_BLOCK
2324            | RafxFormat::ASTC_10X8_SRGB_BLOCK
2325            | RafxFormat::ASTC_10X10_UNORM_BLOCK
2326            | RafxFormat::ASTC_10X10_SRGB_BLOCK
2327            | RafxFormat::ASTC_12X10_UNORM_BLOCK
2328            | RafxFormat::ASTC_12X10_SRGB_BLOCK
2329            | RafxFormat::ASTC_12X12_UNORM_BLOCK
2330            | RafxFormat::ASTC_12X12_SRGB_BLOCK => true,
2331            _ => false,
2332        }
2333    }
2334
2335    pub fn block_or_pixel_size_in_bytes(self) -> u32 {
2336        match self {
2337            RafxFormat::UNDEFINED => unimplemented!(),
2338
2339            // Pixel-based
2340            RafxFormat::R4G4_UNORM_PACK8 => 1,
2341            RafxFormat::R4G4B4A4_UNORM_PACK16 => 2,
2342            RafxFormat::B4G4R4A4_UNORM_PACK16 => 2,
2343            RafxFormat::R5G6B5_UNORM_PACK16 => 2,
2344            RafxFormat::B5G6R5_UNORM_PACK16 => 2,
2345            RafxFormat::R5G5B5A1_UNORM_PACK16 => 2,
2346            RafxFormat::B5G5R5A1_UNORM_PACK16 => 2,
2347            RafxFormat::A1R5G5B5_UNORM_PACK16 => 2,
2348            RafxFormat::R8_UNORM => 1,
2349            RafxFormat::R8_SNORM => 1,
2350            RafxFormat::R8_USCALED => 1,
2351            RafxFormat::R8_SSCALED => 1,
2352            RafxFormat::R8_UINT => 1,
2353            RafxFormat::R8_SINT => 1,
2354            RafxFormat::R8_SRGB => 1,
2355            RafxFormat::R8G8_UNORM => 2,
2356            RafxFormat::R8G8_SNORM => 2,
2357            RafxFormat::R8G8_USCALED => 2,
2358            RafxFormat::R8G8_SSCALED => 2,
2359            RafxFormat::R8G8_UINT => 2,
2360            RafxFormat::R8G8_SINT => 2,
2361            RafxFormat::R8G8_SRGB => 2,
2362            RafxFormat::R8G8B8_UNORM => 3,
2363            RafxFormat::R8G8B8_SNORM => 3,
2364            RafxFormat::R8G8B8_USCALED => 3,
2365            RafxFormat::R8G8B8_SSCALED => 3,
2366            RafxFormat::R8G8B8_UINT => 3,
2367            RafxFormat::R8G8B8_SINT => 3,
2368            RafxFormat::R8G8B8_SRGB => 3,
2369            RafxFormat::B8G8R8_UNORM => 3,
2370            RafxFormat::B8G8R8_SNORM => 3,
2371            RafxFormat::B8G8R8_USCALED => 3,
2372            RafxFormat::B8G8R8_SSCALED => 3,
2373            RafxFormat::B8G8R8_UINT => 3,
2374            RafxFormat::B8G8R8_SINT => 3,
2375            RafxFormat::B8G8R8_SRGB => 3,
2376            RafxFormat::R8G8B8A8_UNORM => 4,
2377            RafxFormat::R8G8B8A8_SNORM => 4,
2378            RafxFormat::R8G8B8A8_USCALED => 4,
2379            RafxFormat::R8G8B8A8_SSCALED => 4,
2380            RafxFormat::R8G8B8A8_UINT => 4,
2381            RafxFormat::R8G8B8A8_SINT => 4,
2382            RafxFormat::R8G8B8A8_SRGB => 4,
2383            RafxFormat::B8G8R8A8_UNORM => 4,
2384            RafxFormat::B8G8R8A8_SNORM => 4,
2385            RafxFormat::B8G8R8A8_USCALED => 4,
2386            RafxFormat::B8G8R8A8_SSCALED => 4,
2387            RafxFormat::B8G8R8A8_UINT => 4,
2388            RafxFormat::B8G8R8A8_SINT => 4,
2389            RafxFormat::B8G8R8A8_SRGB => 4,
2390            RafxFormat::A8B8G8R8_UNORM_PACK32 => 4,
2391            RafxFormat::A8B8G8R8_SNORM_PACK32 => 4,
2392            RafxFormat::A8B8G8R8_USCALED_PACK32 => 4,
2393            RafxFormat::A8B8G8R8_SSCALED_PACK32 => 4,
2394            RafxFormat::A8B8G8R8_UINT_PACK32 => 4,
2395            RafxFormat::A8B8G8R8_SINT_PACK32 => 4,
2396            RafxFormat::A8B8G8R8_SRGB_PACK32 => 4,
2397            RafxFormat::A2R10G10B10_UNORM_PACK32 => 4,
2398            RafxFormat::A2R10G10B10_SNORM_PACK32 => 4,
2399            RafxFormat::A2R10G10B10_USCALED_PACK32 => 4,
2400            RafxFormat::A2R10G10B10_SSCALED_PACK32 => 4,
2401            RafxFormat::A2R10G10B10_UINT_PACK32 => 4,
2402            RafxFormat::A2R10G10B10_SINT_PACK32 => 4,
2403            RafxFormat::A2B10G10R10_UNORM_PACK32 => 4,
2404            RafxFormat::A2B10G10R10_SNORM_PACK32 => 4,
2405            RafxFormat::A2B10G10R10_USCALED_PACK32 => 4,
2406            RafxFormat::A2B10G10R10_SSCALED_PACK32 => 4,
2407            RafxFormat::A2B10G10R10_UINT_PACK32 => 4,
2408            RafxFormat::A2B10G10R10_SINT_PACK32 => 4,
2409            RafxFormat::R16_UNORM => 2,
2410            RafxFormat::R16_SNORM => 2,
2411            RafxFormat::R16_USCALED => 2,
2412            RafxFormat::R16_SSCALED => 2,
2413            RafxFormat::R16_UINT => 2,
2414            RafxFormat::R16_SINT => 2,
2415            RafxFormat::R16_SFLOAT => 2,
2416            RafxFormat::R16G16_UNORM => 4,
2417            RafxFormat::R16G16_SNORM => 4,
2418            RafxFormat::R16G16_USCALED => 4,
2419            RafxFormat::R16G16_SSCALED => 4,
2420            RafxFormat::R16G16_UINT => 4,
2421            RafxFormat::R16G16_SINT => 4,
2422            RafxFormat::R16G16_SFLOAT => 4,
2423            RafxFormat::R16G16B16_UNORM => 6,
2424            RafxFormat::R16G16B16_SNORM => 6,
2425            RafxFormat::R16G16B16_USCALED => 6,
2426            RafxFormat::R16G16B16_SSCALED => 6,
2427            RafxFormat::R16G16B16_UINT => 6,
2428            RafxFormat::R16G16B16_SINT => 6,
2429            RafxFormat::R16G16B16_SFLOAT => 6,
2430            RafxFormat::R16G16B16A16_UNORM => 8,
2431            RafxFormat::R16G16B16A16_SNORM => 8,
2432            RafxFormat::R16G16B16A16_USCALED => 8,
2433            RafxFormat::R16G16B16A16_SSCALED => 8,
2434            RafxFormat::R16G16B16A16_UINT => 8,
2435            RafxFormat::R16G16B16A16_SINT => 8,
2436            RafxFormat::R16G16B16A16_SFLOAT => 8,
2437            RafxFormat::R32_UINT => 4,
2438            RafxFormat::R32_SINT => 4,
2439            RafxFormat::R32_SFLOAT => 4,
2440            RafxFormat::R32G32_UINT => 8,
2441            RafxFormat::R32G32_SINT => 8,
2442            RafxFormat::R32G32_SFLOAT => 8,
2443            RafxFormat::R32G32B32_UINT => 12,
2444            RafxFormat::R32G32B32_SINT => 12,
2445            RafxFormat::R32G32B32_SFLOAT => 12,
2446            RafxFormat::R32G32B32A32_UINT => 16,
2447            RafxFormat::R32G32B32A32_SINT => 16,
2448            RafxFormat::R32G32B32A32_SFLOAT => 16,
2449            RafxFormat::R64_UINT => 8,
2450            RafxFormat::R64_SINT => 8,
2451            RafxFormat::R64_SFLOAT => 8,
2452            RafxFormat::R64G64_UINT => 16,
2453            RafxFormat::R64G64_SINT => 16,
2454            RafxFormat::R64G64_SFLOAT => 16,
2455            RafxFormat::R64G64B64_UINT => 24,
2456            RafxFormat::R64G64B64_SINT => 24,
2457            RafxFormat::R64G64B64_SFLOAT => 24,
2458            RafxFormat::R64G64B64A64_UINT => 32,
2459            RafxFormat::R64G64B64A64_SINT => 32,
2460            RafxFormat::R64G64B64A64_SFLOAT => 32,
2461            RafxFormat::B10G11R11_UFLOAT_PACK32 => 4,
2462            RafxFormat::E5B9G9R9_UFLOAT_PACK32 => 4,
2463            RafxFormat::D16_UNORM => 2,
2464            RafxFormat::X8_D24_UNORM_PACK32 => 4,
2465            RafxFormat::D32_SFLOAT => 4,
2466            RafxFormat::S8_UINT => 1,
2467            RafxFormat::D16_UNORM_S8_UINT => 3,
2468            RafxFormat::D24_UNORM_S8_UINT => 4,
2469            RafxFormat::D32_SFLOAT_S8_UINT => 5,
2470
2471            // Block-based
2472            RafxFormat::BC1_RGB_UNORM_BLOCK => 8,
2473            RafxFormat::BC1_RGB_SRGB_BLOCK => 8,
2474            RafxFormat::BC1_RGBA_UNORM_BLOCK => 8,
2475            RafxFormat::BC1_RGBA_SRGB_BLOCK => 8,
2476            RafxFormat::BC2_UNORM_BLOCK => 16,
2477            RafxFormat::BC2_SRGB_BLOCK => 16,
2478            RafxFormat::BC3_UNORM_BLOCK => 16,
2479            RafxFormat::BC3_SRGB_BLOCK => 16,
2480            RafxFormat::BC4_UNORM_BLOCK => 8,
2481            RafxFormat::BC4_SNORM_BLOCK => 8,
2482            RafxFormat::BC5_UNORM_BLOCK => 16,
2483            RafxFormat::BC5_SNORM_BLOCK => 16,
2484            RafxFormat::BC6H_UFLOAT_BLOCK => 16,
2485            RafxFormat::BC6H_SFLOAT_BLOCK => 16,
2486            RafxFormat::BC7_UNORM_BLOCK => 16,
2487            RafxFormat::BC7_SRGB_BLOCK => 16,
2488            RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => 8,
2489            RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => 8,
2490            RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => 8,
2491            RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => 8,
2492            RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => 8,
2493            RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => 8,
2494            RafxFormat::EAC_R11_UNORM_BLOCK => 8,
2495            RafxFormat::EAC_R11_SNORM_BLOCK => 8,
2496            RafxFormat::EAC_R11G11_UNORM_BLOCK => 8,
2497            RafxFormat::EAC_R11G11_SNORM_BLOCK => 8,
2498            RafxFormat::ASTC_4X4_UNORM_BLOCK => 16,
2499            RafxFormat::ASTC_4X4_SRGB_BLOCK => 16,
2500            RafxFormat::ASTC_5X4_UNORM_BLOCK => 16,
2501            RafxFormat::ASTC_5X4_SRGB_BLOCK => 16,
2502            RafxFormat::ASTC_5X5_UNORM_BLOCK => 16,
2503            RafxFormat::ASTC_5X5_SRGB_BLOCK => 16,
2504            RafxFormat::ASTC_6X5_UNORM_BLOCK => 16,
2505            RafxFormat::ASTC_6X5_SRGB_BLOCK => 16,
2506            RafxFormat::ASTC_6X6_UNORM_BLOCK => 16,
2507            RafxFormat::ASTC_6X6_SRGB_BLOCK => 16,
2508            RafxFormat::ASTC_8X5_UNORM_BLOCK => 16,
2509            RafxFormat::ASTC_8X5_SRGB_BLOCK => 16,
2510            RafxFormat::ASTC_8X6_UNORM_BLOCK => 16,
2511            RafxFormat::ASTC_8X6_SRGB_BLOCK => 16,
2512            RafxFormat::ASTC_8X8_UNORM_BLOCK => 16,
2513            RafxFormat::ASTC_8X8_SRGB_BLOCK => 16,
2514            RafxFormat::ASTC_10X5_UNORM_BLOCK => 16,
2515            RafxFormat::ASTC_10X5_SRGB_BLOCK => 16,
2516            RafxFormat::ASTC_10X6_UNORM_BLOCK => 16,
2517            RafxFormat::ASTC_10X6_SRGB_BLOCK => 16,
2518            RafxFormat::ASTC_10X8_UNORM_BLOCK => 16,
2519            RafxFormat::ASTC_10X8_SRGB_BLOCK => 16,
2520            RafxFormat::ASTC_10X10_UNORM_BLOCK => 16,
2521            RafxFormat::ASTC_10X10_SRGB_BLOCK => 16,
2522            RafxFormat::ASTC_12X10_UNORM_BLOCK => 16,
2523            RafxFormat::ASTC_12X10_SRGB_BLOCK => 16,
2524            RafxFormat::ASTC_12X12_UNORM_BLOCK => 16,
2525            RafxFormat::ASTC_12X12_SRGB_BLOCK => 16,
2526        }
2527    }
2528
2529    pub fn block_width_in_pixels(self) -> u32 {
2530        match self {
2531            RafxFormat::UNDEFINED => unimplemented!(),
2532
2533            RafxFormat::BC1_RGB_UNORM_BLOCK => 4,
2534            RafxFormat::BC1_RGB_SRGB_BLOCK => 4,
2535            RafxFormat::BC1_RGBA_UNORM_BLOCK => 4,
2536            RafxFormat::BC1_RGBA_SRGB_BLOCK => 4,
2537            RafxFormat::BC2_UNORM_BLOCK => 4,
2538            RafxFormat::BC2_SRGB_BLOCK => 4,
2539            RafxFormat::BC3_UNORM_BLOCK => 4,
2540            RafxFormat::BC3_SRGB_BLOCK => 4,
2541            RafxFormat::BC4_UNORM_BLOCK => 4,
2542            RafxFormat::BC4_SNORM_BLOCK => 4,
2543            RafxFormat::BC5_UNORM_BLOCK => 4,
2544            RafxFormat::BC5_SNORM_BLOCK => 4,
2545            RafxFormat::BC6H_UFLOAT_BLOCK => 4,
2546            RafxFormat::BC6H_SFLOAT_BLOCK => 4,
2547            RafxFormat::BC7_UNORM_BLOCK => 4,
2548            RafxFormat::BC7_SRGB_BLOCK => 4,
2549            RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => 4,
2550            RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => 4,
2551            RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => 4,
2552            RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => 4,
2553            RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => 4,
2554            RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => 4,
2555            RafxFormat::EAC_R11_UNORM_BLOCK => 4,
2556            RafxFormat::EAC_R11_SNORM_BLOCK => 4,
2557            RafxFormat::EAC_R11G11_UNORM_BLOCK => 4,
2558            RafxFormat::EAC_R11G11_SNORM_BLOCK => 4,
2559            RafxFormat::ASTC_4X4_UNORM_BLOCK => 4,
2560            RafxFormat::ASTC_4X4_SRGB_BLOCK => 4,
2561            RafxFormat::ASTC_5X4_UNORM_BLOCK => 5,
2562            RafxFormat::ASTC_5X4_SRGB_BLOCK => 5,
2563            RafxFormat::ASTC_5X5_UNORM_BLOCK => 5,
2564            RafxFormat::ASTC_5X5_SRGB_BLOCK => 5,
2565            RafxFormat::ASTC_6X5_UNORM_BLOCK => 6,
2566            RafxFormat::ASTC_6X5_SRGB_BLOCK => 6,
2567            RafxFormat::ASTC_6X6_UNORM_BLOCK => 6,
2568            RafxFormat::ASTC_6X6_SRGB_BLOCK => 6,
2569            RafxFormat::ASTC_8X5_UNORM_BLOCK => 8,
2570            RafxFormat::ASTC_8X5_SRGB_BLOCK => 8,
2571            RafxFormat::ASTC_8X6_UNORM_BLOCK => 8,
2572            RafxFormat::ASTC_8X6_SRGB_BLOCK => 8,
2573            RafxFormat::ASTC_8X8_UNORM_BLOCK => 8,
2574            RafxFormat::ASTC_8X8_SRGB_BLOCK => 8,
2575            RafxFormat::ASTC_10X5_UNORM_BLOCK => 10,
2576            RafxFormat::ASTC_10X5_SRGB_BLOCK => 10,
2577            RafxFormat::ASTC_10X6_UNORM_BLOCK => 10,
2578            RafxFormat::ASTC_10X6_SRGB_BLOCK => 10,
2579            RafxFormat::ASTC_10X8_UNORM_BLOCK => 10,
2580            RafxFormat::ASTC_10X8_SRGB_BLOCK => 10,
2581            RafxFormat::ASTC_10X10_UNORM_BLOCK => 10,
2582            RafxFormat::ASTC_10X10_SRGB_BLOCK => 10,
2583            RafxFormat::ASTC_12X10_UNORM_BLOCK => 12,
2584            RafxFormat::ASTC_12X10_SRGB_BLOCK => 12,
2585            RafxFormat::ASTC_12X12_UNORM_BLOCK => 12,
2586            RafxFormat::ASTC_12X12_SRGB_BLOCK => 12,
2587
2588            _ => 1,
2589        }
2590    }
2591
2592    pub fn block_height_in_pixels(self) -> u32 {
2593        match self {
2594            RafxFormat::UNDEFINED => unimplemented!(),
2595
2596            RafxFormat::BC1_RGB_UNORM_BLOCK => 4,
2597            RafxFormat::BC1_RGB_SRGB_BLOCK => 4,
2598            RafxFormat::BC1_RGBA_UNORM_BLOCK => 4,
2599            RafxFormat::BC1_RGBA_SRGB_BLOCK => 4,
2600            RafxFormat::BC2_UNORM_BLOCK => 4,
2601            RafxFormat::BC2_SRGB_BLOCK => 4,
2602            RafxFormat::BC3_UNORM_BLOCK => 4,
2603            RafxFormat::BC3_SRGB_BLOCK => 4,
2604            RafxFormat::BC4_UNORM_BLOCK => 4,
2605            RafxFormat::BC4_SNORM_BLOCK => 4,
2606            RafxFormat::BC5_UNORM_BLOCK => 4,
2607            RafxFormat::BC5_SNORM_BLOCK => 4,
2608            RafxFormat::BC6H_UFLOAT_BLOCK => 4,
2609            RafxFormat::BC6H_SFLOAT_BLOCK => 4,
2610            RafxFormat::BC7_UNORM_BLOCK => 4,
2611            RafxFormat::BC7_SRGB_BLOCK => 4,
2612            RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => 4,
2613            RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => 4,
2614            RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => 4,
2615            RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => 4,
2616            RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => 4,
2617            RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => 4,
2618            RafxFormat::EAC_R11_UNORM_BLOCK => 4,
2619            RafxFormat::EAC_R11_SNORM_BLOCK => 4,
2620            RafxFormat::EAC_R11G11_UNORM_BLOCK => 4,
2621            RafxFormat::EAC_R11G11_SNORM_BLOCK => 4,
2622            RafxFormat::ASTC_4X4_UNORM_BLOCK => 4,
2623            RafxFormat::ASTC_4X4_SRGB_BLOCK => 4,
2624            RafxFormat::ASTC_5X4_UNORM_BLOCK => 4,
2625            RafxFormat::ASTC_5X4_SRGB_BLOCK => 4,
2626            RafxFormat::ASTC_5X5_UNORM_BLOCK => 5,
2627            RafxFormat::ASTC_5X5_SRGB_BLOCK => 5,
2628            RafxFormat::ASTC_6X5_UNORM_BLOCK => 5,
2629            RafxFormat::ASTC_6X5_SRGB_BLOCK => 5,
2630            RafxFormat::ASTC_6X6_UNORM_BLOCK => 6,
2631            RafxFormat::ASTC_6X6_SRGB_BLOCK => 6,
2632            RafxFormat::ASTC_8X5_UNORM_BLOCK => 5,
2633            RafxFormat::ASTC_8X5_SRGB_BLOCK => 5,
2634            RafxFormat::ASTC_8X6_UNORM_BLOCK => 6,
2635            RafxFormat::ASTC_8X6_SRGB_BLOCK => 6,
2636            RafxFormat::ASTC_8X8_UNORM_BLOCK => 8,
2637            RafxFormat::ASTC_8X8_SRGB_BLOCK => 8,
2638            RafxFormat::ASTC_10X5_UNORM_BLOCK => 5,
2639            RafxFormat::ASTC_10X5_SRGB_BLOCK => 5,
2640            RafxFormat::ASTC_10X6_UNORM_BLOCK => 6,
2641            RafxFormat::ASTC_10X6_SRGB_BLOCK => 6,
2642            RafxFormat::ASTC_10X8_UNORM_BLOCK => 8,
2643            RafxFormat::ASTC_10X8_SRGB_BLOCK => 8,
2644            RafxFormat::ASTC_10X10_UNORM_BLOCK => 10,
2645            RafxFormat::ASTC_10X10_SRGB_BLOCK => 10,
2646            RafxFormat::ASTC_12X10_UNORM_BLOCK => 10,
2647            RafxFormat::ASTC_12X10_SRGB_BLOCK => 10,
2648            RafxFormat::ASTC_12X12_UNORM_BLOCK => 12,
2649            RafxFormat::ASTC_12X12_SRGB_BLOCK => 12,
2650            _ => 1,
2651        }
2652    }
2653
2654    pub fn channel_count(self) -> u32 {
2655        match self {
2656            RafxFormat::UNDEFINED => unimplemented!(),
2657
2658            // Pixel-based
2659            RafxFormat::R4G4_UNORM_PACK8 => 2,
2660            RafxFormat::R4G4B4A4_UNORM_PACK16 => 4,
2661            RafxFormat::B4G4R4A4_UNORM_PACK16 => 4,
2662            RafxFormat::R5G6B5_UNORM_PACK16 => 3,
2663            RafxFormat::B5G6R5_UNORM_PACK16 => 3,
2664            RafxFormat::R5G5B5A1_UNORM_PACK16 => 4,
2665            RafxFormat::B5G5R5A1_UNORM_PACK16 => 4,
2666            RafxFormat::A1R5G5B5_UNORM_PACK16 => 4,
2667            RafxFormat::R8_UNORM => 1,
2668            RafxFormat::R8_SNORM => 1,
2669            RafxFormat::R8_USCALED => 1,
2670            RafxFormat::R8_SSCALED => 1,
2671            RafxFormat::R8_UINT => 1,
2672            RafxFormat::R8_SINT => 1,
2673            RafxFormat::R8_SRGB => 1,
2674            RafxFormat::R8G8_UNORM => 2,
2675            RafxFormat::R8G8_SNORM => 2,
2676            RafxFormat::R8G8_USCALED => 2,
2677            RafxFormat::R8G8_SSCALED => 2,
2678            RafxFormat::R8G8_UINT => 2,
2679            RafxFormat::R8G8_SINT => 2,
2680            RafxFormat::R8G8_SRGB => 2,
2681            RafxFormat::R8G8B8_UNORM => 3,
2682            RafxFormat::R8G8B8_SNORM => 3,
2683            RafxFormat::R8G8B8_USCALED => 3,
2684            RafxFormat::R8G8B8_SSCALED => 3,
2685            RafxFormat::R8G8B8_UINT => 3,
2686            RafxFormat::R8G8B8_SINT => 3,
2687            RafxFormat::R8G8B8_SRGB => 3,
2688            RafxFormat::B8G8R8_UNORM => 3,
2689            RafxFormat::B8G8R8_SNORM => 3,
2690            RafxFormat::B8G8R8_USCALED => 3,
2691            RafxFormat::B8G8R8_SSCALED => 3,
2692            RafxFormat::B8G8R8_UINT => 3,
2693            RafxFormat::B8G8R8_SINT => 3,
2694            RafxFormat::B8G8R8_SRGB => 3,
2695            RafxFormat::R8G8B8A8_UNORM => 4,
2696            RafxFormat::R8G8B8A8_SNORM => 4,
2697            RafxFormat::R8G8B8A8_USCALED => 4,
2698            RafxFormat::R8G8B8A8_SSCALED => 4,
2699            RafxFormat::R8G8B8A8_UINT => 4,
2700            RafxFormat::R8G8B8A8_SINT => 4,
2701            RafxFormat::R8G8B8A8_SRGB => 4,
2702            RafxFormat::B8G8R8A8_UNORM => 4,
2703            RafxFormat::B8G8R8A8_SNORM => 4,
2704            RafxFormat::B8G8R8A8_USCALED => 4,
2705            RafxFormat::B8G8R8A8_SSCALED => 4,
2706            RafxFormat::B8G8R8A8_UINT => 4,
2707            RafxFormat::B8G8R8A8_SINT => 4,
2708            RafxFormat::B8G8R8A8_SRGB => 4,
2709            RafxFormat::A8B8G8R8_UNORM_PACK32 => 4,
2710            RafxFormat::A8B8G8R8_SNORM_PACK32 => 4,
2711            RafxFormat::A8B8G8R8_USCALED_PACK32 => 4,
2712            RafxFormat::A8B8G8R8_SSCALED_PACK32 => 4,
2713            RafxFormat::A8B8G8R8_UINT_PACK32 => 4,
2714            RafxFormat::A8B8G8R8_SINT_PACK32 => 4,
2715            RafxFormat::A8B8G8R8_SRGB_PACK32 => 4,
2716            RafxFormat::A2R10G10B10_UNORM_PACK32 => 4,
2717            RafxFormat::A2R10G10B10_SNORM_PACK32 => 4,
2718            RafxFormat::A2R10G10B10_USCALED_PACK32 => 4,
2719            RafxFormat::A2R10G10B10_SSCALED_PACK32 => 4,
2720            RafxFormat::A2R10G10B10_UINT_PACK32 => 4,
2721            RafxFormat::A2R10G10B10_SINT_PACK32 => 4,
2722            RafxFormat::A2B10G10R10_UNORM_PACK32 => 4,
2723            RafxFormat::A2B10G10R10_SNORM_PACK32 => 4,
2724            RafxFormat::A2B10G10R10_USCALED_PACK32 => 4,
2725            RafxFormat::A2B10G10R10_SSCALED_PACK32 => 4,
2726            RafxFormat::A2B10G10R10_UINT_PACK32 => 4,
2727            RafxFormat::A2B10G10R10_SINT_PACK32 => 4,
2728            RafxFormat::R16_UNORM => 1,
2729            RafxFormat::R16_SNORM => 1,
2730            RafxFormat::R16_USCALED => 1,
2731            RafxFormat::R16_SSCALED => 1,
2732            RafxFormat::R16_UINT => 1,
2733            RafxFormat::R16_SINT => 1,
2734            RafxFormat::R16_SFLOAT => 1,
2735            RafxFormat::R16G16_UNORM => 2,
2736            RafxFormat::R16G16_SNORM => 2,
2737            RafxFormat::R16G16_USCALED => 2,
2738            RafxFormat::R16G16_SSCALED => 2,
2739            RafxFormat::R16G16_UINT => 2,
2740            RafxFormat::R16G16_SINT => 2,
2741            RafxFormat::R16G16_SFLOAT => 2,
2742            RafxFormat::R16G16B16_UNORM => 3,
2743            RafxFormat::R16G16B16_SNORM => 3,
2744            RafxFormat::R16G16B16_USCALED => 3,
2745            RafxFormat::R16G16B16_SSCALED => 3,
2746            RafxFormat::R16G16B16_UINT => 3,
2747            RafxFormat::R16G16B16_SINT => 3,
2748            RafxFormat::R16G16B16_SFLOAT => 3,
2749            RafxFormat::R16G16B16A16_UNORM => 4,
2750            RafxFormat::R16G16B16A16_SNORM => 4,
2751            RafxFormat::R16G16B16A16_USCALED => 4,
2752            RafxFormat::R16G16B16A16_SSCALED => 4,
2753            RafxFormat::R16G16B16A16_UINT => 4,
2754            RafxFormat::R16G16B16A16_SINT => 4,
2755            RafxFormat::R16G16B16A16_SFLOAT => 4,
2756            RafxFormat::R32_UINT => 1,
2757            RafxFormat::R32_SINT => 1,
2758            RafxFormat::R32_SFLOAT => 1,
2759            RafxFormat::R32G32_UINT => 2,
2760            RafxFormat::R32G32_SINT => 2,
2761            RafxFormat::R32G32_SFLOAT => 2,
2762            RafxFormat::R32G32B32_UINT => 3,
2763            RafxFormat::R32G32B32_SINT => 3,
2764            RafxFormat::R32G32B32_SFLOAT => 3,
2765            RafxFormat::R32G32B32A32_UINT => 4,
2766            RafxFormat::R32G32B32A32_SINT => 4,
2767            RafxFormat::R32G32B32A32_SFLOAT => 4,
2768            RafxFormat::R64_UINT => 1,
2769            RafxFormat::R64_SINT => 1,
2770            RafxFormat::R64_SFLOAT => 1,
2771            RafxFormat::R64G64_UINT => 2,
2772            RafxFormat::R64G64_SINT => 2,
2773            RafxFormat::R64G64_SFLOAT => 2,
2774            RafxFormat::R64G64B64_UINT => 3,
2775            RafxFormat::R64G64B64_SINT => 3,
2776            RafxFormat::R64G64B64_SFLOAT => 3,
2777            RafxFormat::R64G64B64A64_UINT => 4,
2778            RafxFormat::R64G64B64A64_SINT => 4,
2779            RafxFormat::R64G64B64A64_SFLOAT => 4,
2780            RafxFormat::B10G11R11_UFLOAT_PACK32 => 3,
2781            RafxFormat::E5B9G9R9_UFLOAT_PACK32 => 4,
2782            RafxFormat::D16_UNORM => 1,
2783            RafxFormat::X8_D24_UNORM_PACK32 => 2,
2784            RafxFormat::D32_SFLOAT => 1,
2785            RafxFormat::S8_UINT => 1,
2786            RafxFormat::D16_UNORM_S8_UINT => 2,
2787            RafxFormat::D24_UNORM_S8_UINT => 2,
2788            RafxFormat::D32_SFLOAT_S8_UINT => 2,
2789
2790            // Block-based
2791            RafxFormat::BC1_RGB_UNORM_BLOCK => 3,
2792            RafxFormat::BC1_RGB_SRGB_BLOCK => 3,
2793            RafxFormat::BC1_RGBA_UNORM_BLOCK => 4,
2794            RafxFormat::BC1_RGBA_SRGB_BLOCK => 4,
2795            RafxFormat::BC2_UNORM_BLOCK => 4,
2796            RafxFormat::BC2_SRGB_BLOCK => 4,
2797            RafxFormat::BC3_UNORM_BLOCK => 4,
2798            RafxFormat::BC3_SRGB_BLOCK => 4,
2799            RafxFormat::BC4_UNORM_BLOCK => 1,
2800            RafxFormat::BC4_SNORM_BLOCK => 1,
2801            RafxFormat::BC5_UNORM_BLOCK => 2,
2802            RafxFormat::BC5_SNORM_BLOCK => 2,
2803            RafxFormat::BC6H_UFLOAT_BLOCK => 3,
2804            RafxFormat::BC6H_SFLOAT_BLOCK => 3,
2805            RafxFormat::BC7_UNORM_BLOCK => 4,
2806            RafxFormat::BC7_SRGB_BLOCK => 4,
2807            RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => 3,
2808            RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => 3,
2809            RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => 4,
2810            RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => 4,
2811            RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => 4,
2812            RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => 4,
2813            RafxFormat::EAC_R11_UNORM_BLOCK => 1,
2814            RafxFormat::EAC_R11_SNORM_BLOCK => 1,
2815            RafxFormat::EAC_R11G11_UNORM_BLOCK => 2,
2816            RafxFormat::EAC_R11G11_SNORM_BLOCK => 2,
2817            RafxFormat::ASTC_4X4_UNORM_BLOCK => 4,
2818            RafxFormat::ASTC_4X4_SRGB_BLOCK => 4,
2819            RafxFormat::ASTC_5X4_UNORM_BLOCK => 4,
2820            RafxFormat::ASTC_5X4_SRGB_BLOCK => 4,
2821            RafxFormat::ASTC_5X5_UNORM_BLOCK => 4,
2822            RafxFormat::ASTC_5X5_SRGB_BLOCK => 4,
2823            RafxFormat::ASTC_6X5_UNORM_BLOCK => 4,
2824            RafxFormat::ASTC_6X5_SRGB_BLOCK => 4,
2825            RafxFormat::ASTC_6X6_UNORM_BLOCK => 4,
2826            RafxFormat::ASTC_6X6_SRGB_BLOCK => 4,
2827            RafxFormat::ASTC_8X5_UNORM_BLOCK => 4,
2828            RafxFormat::ASTC_8X5_SRGB_BLOCK => 4,
2829            RafxFormat::ASTC_8X6_UNORM_BLOCK => 4,
2830            RafxFormat::ASTC_8X6_SRGB_BLOCK => 4,
2831            RafxFormat::ASTC_8X8_UNORM_BLOCK => 4,
2832            RafxFormat::ASTC_8X8_SRGB_BLOCK => 4,
2833            RafxFormat::ASTC_10X5_UNORM_BLOCK => 4,
2834            RafxFormat::ASTC_10X5_SRGB_BLOCK => 4,
2835            RafxFormat::ASTC_10X6_UNORM_BLOCK => 4,
2836            RafxFormat::ASTC_10X6_SRGB_BLOCK => 4,
2837            RafxFormat::ASTC_10X8_UNORM_BLOCK => 4,
2838            RafxFormat::ASTC_10X8_SRGB_BLOCK => 4,
2839            RafxFormat::ASTC_10X10_UNORM_BLOCK => 4,
2840            RafxFormat::ASTC_10X10_SRGB_BLOCK => 4,
2841            RafxFormat::ASTC_12X10_UNORM_BLOCK => 4,
2842            RafxFormat::ASTC_12X10_SRGB_BLOCK => 4,
2843            RafxFormat::ASTC_12X12_UNORM_BLOCK => 4,
2844            RafxFormat::ASTC_12X12_SRGB_BLOCK => 4,
2845        }
2846    }
2847
2848    pub fn is_normalized(self) -> bool {
2849        match self {
2850            RafxFormat::UNDEFINED => unimplemented!(),
2851
2852            // Pixel-based
2853            RafxFormat::R4G4_UNORM_PACK8 => true,
2854            RafxFormat::R4G4B4A4_UNORM_PACK16 => true,
2855            RafxFormat::B4G4R4A4_UNORM_PACK16 => true,
2856            RafxFormat::R5G6B5_UNORM_PACK16 => true,
2857            RafxFormat::B5G6R5_UNORM_PACK16 => true,
2858            RafxFormat::R5G5B5A1_UNORM_PACK16 => true,
2859            RafxFormat::B5G5R5A1_UNORM_PACK16 => true,
2860            RafxFormat::A1R5G5B5_UNORM_PACK16 => true,
2861            RafxFormat::R8_UNORM => true,
2862            RafxFormat::R8_SNORM => true,
2863            RafxFormat::R8_SRGB => true,
2864            RafxFormat::R8G8_UNORM => true,
2865            RafxFormat::R8G8_SNORM => true,
2866            RafxFormat::R8G8_SRGB => true,
2867            RafxFormat::R8G8B8_UNORM => true,
2868            RafxFormat::R8G8B8_SNORM => true,
2869            RafxFormat::R8G8B8_SRGB => true,
2870            RafxFormat::B8G8R8_UNORM => true,
2871            RafxFormat::B8G8R8_SNORM => true,
2872            RafxFormat::B8G8R8_SRGB => true,
2873            RafxFormat::R8G8B8A8_UNORM => true,
2874            RafxFormat::R8G8B8A8_SNORM => true,
2875            RafxFormat::R8G8B8A8_SRGB => true,
2876            RafxFormat::B8G8R8A8_UNORM => true,
2877            RafxFormat::B8G8R8A8_SNORM => true,
2878            RafxFormat::B8G8R8A8_SRGB => true,
2879            RafxFormat::A8B8G8R8_UNORM_PACK32 => true,
2880            RafxFormat::A8B8G8R8_SNORM_PACK32 => true,
2881            RafxFormat::A8B8G8R8_SRGB_PACK32 => true,
2882            RafxFormat::A2R10G10B10_UNORM_PACK32 => true,
2883            RafxFormat::A2R10G10B10_SNORM_PACK32 => true,
2884            RafxFormat::A2B10G10R10_UNORM_PACK32 => true,
2885            RafxFormat::A2B10G10R10_SNORM_PACK32 => true,
2886            RafxFormat::R16_UNORM => true,
2887            RafxFormat::R16_SNORM => true,
2888            RafxFormat::R16G16_UNORM => true,
2889            RafxFormat::R16G16_SNORM => true,
2890            RafxFormat::R16G16B16_UNORM => true,
2891            RafxFormat::R16G16B16_SNORM => true,
2892            RafxFormat::R16G16B16A16_UNORM => true,
2893            RafxFormat::R16G16B16A16_SNORM => true,
2894            RafxFormat::D16_UNORM => true,
2895            RafxFormat::X8_D24_UNORM_PACK32 => true,
2896            RafxFormat::D16_UNORM_S8_UINT => true,
2897            RafxFormat::D24_UNORM_S8_UINT => true,
2898
2899            // Block-based
2900            RafxFormat::BC1_RGB_UNORM_BLOCK => true,
2901            RafxFormat::BC1_RGB_SRGB_BLOCK => true,
2902            RafxFormat::BC1_RGBA_UNORM_BLOCK => true,
2903            RafxFormat::BC1_RGBA_SRGB_BLOCK => true,
2904            RafxFormat::BC2_UNORM_BLOCK => true,
2905            RafxFormat::BC2_SRGB_BLOCK => true,
2906            RafxFormat::BC3_UNORM_BLOCK => true,
2907            RafxFormat::BC3_SRGB_BLOCK => true,
2908            RafxFormat::BC4_UNORM_BLOCK => true,
2909            RafxFormat::BC4_SNORM_BLOCK => true,
2910            RafxFormat::BC5_UNORM_BLOCK => true,
2911            RafxFormat::BC5_SNORM_BLOCK => true,
2912            RafxFormat::BC7_UNORM_BLOCK => true,
2913            RafxFormat::BC7_SRGB_BLOCK => true,
2914            RafxFormat::ETC2_R8G8B8_UNORM_BLOCK => true,
2915            RafxFormat::ETC2_R8G8B8_SRGB_BLOCK => true,
2916            RafxFormat::ETC2_R8G8B8A1_UNORM_BLOCK => true,
2917            RafxFormat::ETC2_R8G8B8A1_SRGB_BLOCK => true,
2918            RafxFormat::ETC2_R8G8B8A8_UNORM_BLOCK => true,
2919            RafxFormat::ETC2_R8G8B8A8_SRGB_BLOCK => true,
2920            RafxFormat::EAC_R11_UNORM_BLOCK => true,
2921            RafxFormat::EAC_R11_SNORM_BLOCK => true,
2922            RafxFormat::EAC_R11G11_UNORM_BLOCK => true,
2923            RafxFormat::EAC_R11G11_SNORM_BLOCK => true,
2924            RafxFormat::ASTC_4X4_UNORM_BLOCK => true,
2925            RafxFormat::ASTC_4X4_SRGB_BLOCK => true,
2926            RafxFormat::ASTC_5X4_UNORM_BLOCK => true,
2927            RafxFormat::ASTC_5X4_SRGB_BLOCK => true,
2928            RafxFormat::ASTC_5X5_UNORM_BLOCK => true,
2929            RafxFormat::ASTC_5X5_SRGB_BLOCK => true,
2930            RafxFormat::ASTC_6X5_UNORM_BLOCK => true,
2931            RafxFormat::ASTC_6X5_SRGB_BLOCK => true,
2932            RafxFormat::ASTC_6X6_UNORM_BLOCK => true,
2933            RafxFormat::ASTC_6X6_SRGB_BLOCK => true,
2934            RafxFormat::ASTC_8X5_UNORM_BLOCK => true,
2935            RafxFormat::ASTC_8X5_SRGB_BLOCK => true,
2936            RafxFormat::ASTC_8X6_UNORM_BLOCK => true,
2937            RafxFormat::ASTC_8X6_SRGB_BLOCK => true,
2938            RafxFormat::ASTC_8X8_UNORM_BLOCK => true,
2939            RafxFormat::ASTC_8X8_SRGB_BLOCK => true,
2940            RafxFormat::ASTC_10X5_UNORM_BLOCK => true,
2941            RafxFormat::ASTC_10X5_SRGB_BLOCK => true,
2942            RafxFormat::ASTC_10X6_UNORM_BLOCK => true,
2943            RafxFormat::ASTC_10X6_SRGB_BLOCK => true,
2944            RafxFormat::ASTC_10X8_UNORM_BLOCK => true,
2945            RafxFormat::ASTC_10X8_SRGB_BLOCK => true,
2946            RafxFormat::ASTC_10X10_UNORM_BLOCK => true,
2947            RafxFormat::ASTC_10X10_SRGB_BLOCK => true,
2948            RafxFormat::ASTC_12X10_UNORM_BLOCK => true,
2949            RafxFormat::ASTC_12X10_SRGB_BLOCK => true,
2950            RafxFormat::ASTC_12X12_UNORM_BLOCK => true,
2951            RafxFormat::ASTC_12X12_SRGB_BLOCK => true,
2952
2953            _ => false,
2954        }
2955    }
2956}
2957
2958//
2959// The following represent reasonable defaults with broad hardware support. These lists work well
2960// with RafxDeviceContext::find_supported_format()
2961//
2962pub mod recommended_formats {
2963    use super::RafxFormat;
2964
2965    // If using an SDR format, consider using the swapchain surface format!
2966    pub const COLOR_FORMATS_SDR: [RafxFormat; 1] = [
2967        RafxFormat::R8G8B8A8_SNORM, // vulkan: 100% coverage with optimal
2968    ];
2969
2970    pub const COLOR_FORMATS_HDR: [RafxFormat; 2] = [
2971        RafxFormat::R16G16B16A16_SFLOAT, // vulkan: near 100% coverage with optimal
2972        RafxFormat::R32G32B32A32_SFLOAT, // vulkan: near 100% coverage with optimal
2973    ];
2974
2975    pub const DEPTH_FORMATS: [RafxFormat; 4] = [
2976        RafxFormat::D32_SFLOAT,         // vulkan: 100% coverage with optimal
2977        RafxFormat::D32_SFLOAT_S8_UINT, // vulkan: 100% coverage with optimal
2978        RafxFormat::D24_UNORM_S8_UINT,
2979        RafxFormat::D16_UNORM, // Most likely to be used by GL ES 2.0
2980    ];
2981}