|
1 | | -// Lets keep these on one line |
2 | | -#[rustfmt::skip] |
3 | | -pub const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 118] = [ |
4 | | - wgpu::TextureFormat::R8Unorm, |
5 | | - wgpu::TextureFormat::R8Snorm, |
6 | | - wgpu::TextureFormat::R8Uint, |
7 | | - wgpu::TextureFormat::R8Sint, |
8 | | - wgpu::TextureFormat::R16Uint, |
9 | | - wgpu::TextureFormat::R16Sint, |
10 | | - wgpu::TextureFormat::R16Unorm, |
11 | | - wgpu::TextureFormat::R16Snorm, |
12 | | - wgpu::TextureFormat::R16Float, |
13 | | - wgpu::TextureFormat::Rg8Unorm, |
14 | | - wgpu::TextureFormat::Rg8Snorm, |
15 | | - wgpu::TextureFormat::Rg8Uint, |
16 | | - wgpu::TextureFormat::Rg8Sint, |
17 | | - wgpu::TextureFormat::R32Uint, |
18 | | - wgpu::TextureFormat::R32Sint, |
19 | | - wgpu::TextureFormat::R32Float, |
20 | | - wgpu::TextureFormat::Rg16Uint, |
21 | | - wgpu::TextureFormat::Rg16Sint, |
22 | | - wgpu::TextureFormat::Rg16Unorm, |
23 | | - wgpu::TextureFormat::Rg16Snorm, |
24 | | - wgpu::TextureFormat::Rg16Float, |
25 | | - wgpu::TextureFormat::Rgba8Unorm, |
26 | | - wgpu::TextureFormat::Rgba8UnormSrgb, |
27 | | - wgpu::TextureFormat::Rgba8Snorm, |
28 | | - wgpu::TextureFormat::Rgba8Uint, |
29 | | - wgpu::TextureFormat::Rgba8Sint, |
30 | | - wgpu::TextureFormat::Bgra8Unorm, |
31 | | - wgpu::TextureFormat::Bgra8UnormSrgb, |
32 | | - wgpu::TextureFormat::Rgb9e5Ufloat, |
33 | | - wgpu::TextureFormat::Rgb10a2Uint, |
34 | | - wgpu::TextureFormat::Rgb10a2Unorm, |
35 | | - wgpu::TextureFormat::Rg11b10Ufloat, |
36 | | - wgpu::TextureFormat::R64Uint, |
37 | | - wgpu::TextureFormat::Rg32Uint, |
38 | | - wgpu::TextureFormat::Rg32Sint, |
39 | | - wgpu::TextureFormat::Rg32Float, |
40 | | - wgpu::TextureFormat::Rgba16Uint, |
41 | | - wgpu::TextureFormat::Rgba16Sint, |
42 | | - wgpu::TextureFormat::Rgba16Unorm, |
43 | | - wgpu::TextureFormat::Rgba16Snorm, |
44 | | - wgpu::TextureFormat::Rgba16Float, |
45 | | - wgpu::TextureFormat::Rgba32Uint, |
46 | | - wgpu::TextureFormat::Rgba32Sint, |
47 | | - wgpu::TextureFormat::Rgba32Float, |
48 | | - wgpu::TextureFormat::Stencil8, |
49 | | - wgpu::TextureFormat::Depth16Unorm, |
50 | | - wgpu::TextureFormat::Depth24Plus, |
51 | | - wgpu::TextureFormat::Depth24PlusStencil8, |
52 | | - wgpu::TextureFormat::Depth32Float, |
53 | | - wgpu::TextureFormat::Depth32FloatStencil8, |
54 | | - wgpu::TextureFormat::NV12, |
55 | | - wgpu::TextureFormat::P010, |
56 | | - wgpu::TextureFormat::Bc1RgbaUnorm, |
57 | | - wgpu::TextureFormat::Bc1RgbaUnormSrgb, |
58 | | - wgpu::TextureFormat::Bc2RgbaUnorm, |
59 | | - wgpu::TextureFormat::Bc2RgbaUnormSrgb, |
60 | | - wgpu::TextureFormat::Bc3RgbaUnorm, |
61 | | - wgpu::TextureFormat::Bc3RgbaUnormSrgb, |
62 | | - wgpu::TextureFormat::Bc4RUnorm, |
63 | | - wgpu::TextureFormat::Bc4RSnorm, |
64 | | - wgpu::TextureFormat::Bc5RgUnorm, |
65 | | - wgpu::TextureFormat::Bc5RgSnorm, |
66 | | - wgpu::TextureFormat::Bc6hRgbUfloat, |
67 | | - wgpu::TextureFormat::Bc6hRgbFloat, |
68 | | - wgpu::TextureFormat::Bc7RgbaUnorm, |
69 | | - wgpu::TextureFormat::Bc7RgbaUnormSrgb, |
70 | | - wgpu::TextureFormat::Etc2Rgb8Unorm, |
71 | | - wgpu::TextureFormat::Etc2Rgb8UnormSrgb, |
72 | | - wgpu::TextureFormat::Etc2Rgb8A1Unorm, |
73 | | - wgpu::TextureFormat::Etc2Rgb8A1UnormSrgb, |
74 | | - wgpu::TextureFormat::Etc2Rgba8Unorm, |
75 | | - wgpu::TextureFormat::Etc2Rgba8UnormSrgb, |
76 | | - wgpu::TextureFormat::EacR11Unorm, |
77 | | - wgpu::TextureFormat::EacR11Snorm, |
78 | | - wgpu::TextureFormat::EacRg11Unorm, |
79 | | - wgpu::TextureFormat::EacRg11Snorm, |
80 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B4x4, channel: wgpu::AstcChannel::Unorm }, |
81 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B4x4, channel: wgpu::AstcChannel::UnormSrgb }, |
82 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B4x4, channel: wgpu::AstcChannel::Hdr }, |
83 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x4, channel: wgpu::AstcChannel::Unorm }, |
84 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x4, channel: wgpu::AstcChannel::UnormSrgb }, |
85 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x4, channel: wgpu::AstcChannel::Hdr }, |
86 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x5, channel: wgpu::AstcChannel::Unorm }, |
87 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x5, channel: wgpu::AstcChannel::UnormSrgb }, |
88 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B5x5, channel: wgpu::AstcChannel::Hdr }, |
89 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x5, channel: wgpu::AstcChannel::Unorm }, |
90 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x5, channel: wgpu::AstcChannel::UnormSrgb }, |
91 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x5, channel: wgpu::AstcChannel::Hdr }, |
92 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x6, channel: wgpu::AstcChannel::Unorm }, |
93 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x6, channel: wgpu::AstcChannel::UnormSrgb }, |
94 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B6x6, channel: wgpu::AstcChannel::Hdr }, |
95 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x5, channel: wgpu::AstcChannel::Unorm }, |
96 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x5, channel: wgpu::AstcChannel::UnormSrgb }, |
97 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x5, channel: wgpu::AstcChannel::Hdr }, |
98 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x6, channel: wgpu::AstcChannel::Unorm }, |
99 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x6, channel: wgpu::AstcChannel::UnormSrgb }, |
100 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x6, channel: wgpu::AstcChannel::Hdr }, |
101 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x8, channel: wgpu::AstcChannel::Unorm }, |
102 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x8, channel: wgpu::AstcChannel::UnormSrgb }, |
103 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B8x8, channel: wgpu::AstcChannel::Hdr }, |
104 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x5, channel: wgpu::AstcChannel::Unorm }, |
105 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x5, channel: wgpu::AstcChannel::UnormSrgb }, |
106 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x5, channel: wgpu::AstcChannel::Hdr }, |
107 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x6, channel: wgpu::AstcChannel::Unorm }, |
108 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x6, channel: wgpu::AstcChannel::UnormSrgb }, |
109 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x6, channel: wgpu::AstcChannel::Hdr }, |
110 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x8, channel: wgpu::AstcChannel::Unorm }, |
111 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x8, channel: wgpu::AstcChannel::UnormSrgb }, |
112 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x8, channel: wgpu::AstcChannel::Hdr }, |
113 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x10, channel: wgpu::AstcChannel::Unorm }, |
114 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x10, channel: wgpu::AstcChannel::UnormSrgb }, |
115 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B10x10, channel: wgpu::AstcChannel::Hdr }, |
116 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x10, channel: wgpu::AstcChannel::Unorm }, |
117 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x10, channel: wgpu::AstcChannel::UnormSrgb }, |
118 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x10, channel: wgpu::AstcChannel::Hdr }, |
119 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x12, channel: wgpu::AstcChannel::Unorm }, |
120 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x12, channel: wgpu::AstcChannel::UnormSrgb }, |
121 | | - wgpu::TextureFormat::Astc { block: wgpu::AstcBlock::B12x12, channel: wgpu::AstcChannel::Hdr }, |
122 | | -]; |
123 | | - |
124 | | -#[test] |
125 | | -fn test_uniqueness_in_texture_format_list() { |
126 | | - use std::collections::HashSet; |
127 | | - |
128 | | - let uniq: HashSet<wgpu::TextureFormat> = TEXTURE_FORMAT_LIST.into_iter().collect(); |
129 | | - let mut duplicated = TEXTURE_FORMAT_LIST.to_vec(); |
130 | | - uniq.iter().for_each(|u| { |
131 | | - let first_occurrence = duplicated.iter().position(|el| u == el).unwrap(); |
132 | | - duplicated.remove(first_occurrence); |
133 | | - }); |
134 | | - assert_eq!(duplicated, vec![]); |
135 | | -} |
| 1 | +use exhaust::Exhaust; |
136 | 2 |
|
137 | 3 | #[test] |
138 | 4 | fn test_compute_render_extent() { |
139 | | - for format in TEXTURE_FORMAT_LIST { |
| 5 | + for format in wgpu::TextureFormat::exhaust() { |
140 | 6 | let desc = wgpu::TextureDescriptor { |
141 | 7 | label: None, |
142 | 8 | size: wgpu::Extent3d { |
@@ -211,8 +77,7 @@ fn test_compute_render_extent() { |
211 | 77 | } |
212 | 78 |
|
213 | 79 | pub fn max_texture_format_string_size() -> usize { |
214 | | - TEXTURE_FORMAT_LIST |
215 | | - .into_iter() |
| 80 | + wgpu::TextureFormat::exhaust() |
216 | 81 | .map(|f| texture_format_name(f).len()) |
217 | 82 | .max() |
218 | 83 | .unwrap() |
|
0 commit comments