1#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
8pub enum AstcBlock {
9 B4x4,
10 B5x4,
11 B5x5,
12 B6x5,
13 B6x6,
14 B8x5,
15 B8x6,
16 B8x8,
17 B10x5,
18 B10x6,
19 B10x8,
20 B10x10,
21 B12x10,
22 B12x12,
23}
24
25impl From<AstcBlock> for wgpu::AstcBlock {
26 fn from(value: AstcBlock) -> Self {
27 match value {
28 AstcBlock::B4x4 => Self::B4x4,
29 AstcBlock::B5x4 => Self::B5x4,
30 AstcBlock::B5x5 => Self::B5x5,
31 AstcBlock::B6x5 => Self::B6x5,
32 AstcBlock::B6x6 => Self::B6x6,
33 AstcBlock::B8x5 => Self::B8x5,
34 AstcBlock::B8x6 => Self::B8x6,
35 AstcBlock::B8x8 => Self::B8x8,
36 AstcBlock::B10x5 => Self::B10x5,
37 AstcBlock::B10x6 => Self::B10x6,
38 AstcBlock::B10x8 => Self::B10x8,
39 AstcBlock::B10x10 => Self::B10x10,
40 AstcBlock::B12x10 => Self::B12x10,
41 AstcBlock::B12x12 => Self::B12x12,
42 }
43 }
44}
45
46impl From<wgpu::AstcBlock> for AstcBlock {
47 fn from(value: wgpu::AstcBlock) -> Self {
48 match value {
49 wgpu::AstcBlock::B4x4 => Self::B4x4,
50 wgpu::AstcBlock::B5x4 => Self::B5x4,
51 wgpu::AstcBlock::B5x5 => Self::B5x5,
52 wgpu::AstcBlock::B6x5 => Self::B6x5,
53 wgpu::AstcBlock::B6x6 => Self::B6x6,
54 wgpu::AstcBlock::B8x5 => Self::B8x5,
55 wgpu::AstcBlock::B8x6 => Self::B8x6,
56 wgpu::AstcBlock::B8x8 => Self::B8x8,
57 wgpu::AstcBlock::B10x5 => Self::B10x5,
58 wgpu::AstcBlock::B10x6 => Self::B10x6,
59 wgpu::AstcBlock::B10x8 => Self::B10x8,
60 wgpu::AstcBlock::B10x10 => Self::B10x10,
61 wgpu::AstcBlock::B12x10 => Self::B12x10,
62 wgpu::AstcBlock::B12x12 => Self::B12x12,
63 }
64 }
65}
66
67#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
69pub enum AstcChannel {
70 Unorm,
71 UnormSrgb,
72 Hdr,
73}
74
75impl From<AstcChannel> for wgpu::AstcChannel {
76 fn from(value: AstcChannel) -> Self {
77 match value {
78 AstcChannel::Unorm => Self::Unorm,
79 AstcChannel::UnormSrgb => Self::UnormSrgb,
80 AstcChannel::Hdr => Self::Hdr,
81 }
82 }
83}
84
85impl From<wgpu::AstcChannel> for AstcChannel {
86 fn from(value: wgpu::AstcChannel) -> Self {
87 match value {
88 wgpu::AstcChannel::Unorm => Self::Unorm,
89 wgpu::AstcChannel::UnormSrgb => Self::UnormSrgb,
90 wgpu::AstcChannel::Hdr => Self::Hdr,
91 }
92 }
93}
94
95#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
98pub enum TextureFormat {
99 R8Unorm,
100 R8Snorm,
101 R8Uint,
102 R8Sint,
103 R16Uint,
104 R16Sint,
105 R16Unorm,
106 R16Snorm,
107 R16Float,
108 Rg8Unorm,
109 Rg8Snorm,
110 Rg8Uint,
111 Rg8Sint,
112 R32Uint,
113 R32Sint,
114 R32Float,
115 Rg16Uint,
116 Rg16Sint,
117 Rg16Unorm,
118 Rg16Snorm,
119 Rg16Float,
120 Rgba8Unorm,
121 Rgba8UnormSrgb,
122 Rgba8Snorm,
123 Rgba8Uint,
124 Rgba8Sint,
125 Bgra8Unorm,
126 Bgra8UnormSrgb,
127 Rgb9e5Ufloat,
128 Rgb10a2Uint,
129 Rgb10a2Unorm,
130 Rg11b10Ufloat,
131 R64Uint,
132 Rg32Uint,
133 Rg32Sint,
134 Rg32Float,
135 Rgba16Uint,
136 Rgba16Sint,
137 Rgba16Unorm,
138 Rgba16Snorm,
139 Rgba16Float,
140 Rgba32Uint,
141 Rgba32Sint,
142 Rgba32Float,
143 Stencil8,
144 Depth16Unorm,
145 Depth24Plus,
146 Depth24PlusStencil8,
147 Depth32Float,
148 Depth32FloatStencil8,
149 NV12,
150 P010,
151 Bc1RgbaUnorm,
152 Bc1RgbaUnormSrgb,
153 Bc2RgbaUnorm,
154 Bc2RgbaUnormSrgb,
155 Bc3RgbaUnorm,
156 Bc3RgbaUnormSrgb,
157 Bc4RUnorm,
158 Bc4RSnorm,
159 Bc5RgUnorm,
160 Bc5RgSnorm,
161 Bc6hRgbUfloat,
162 Bc6hRgbFloat,
163 Bc7RgbaUnorm,
164 Bc7RgbaUnormSrgb,
165 Etc2Rgb8Unorm,
166 Etc2Rgb8UnormSrgb,
167 Etc2Rgb8A1Unorm,
168 Etc2Rgb8A1UnormSrgb,
169 Etc2Rgba8Unorm,
170 Etc2Rgba8UnormSrgb,
171 EacR11Unorm,
172 EacR11Snorm,
173 EacRg11Unorm,
174 EacRg11Snorm,
175 Astc { block: AstcBlock, channel: AstcChannel },
176}
177
178impl From<TextureFormat> for wgpu::TextureFormat {
179 fn from(format: TextureFormat) -> Self {
180 match format {
181 TextureFormat::R8Unorm => Self::R8Unorm,
182 TextureFormat::R8Snorm => Self::R8Snorm,
183 TextureFormat::R8Uint => Self::R8Uint,
184 TextureFormat::R8Sint => Self::R8Sint,
185 TextureFormat::R16Uint => Self::R16Uint,
186 TextureFormat::R16Sint => Self::R16Sint,
187 TextureFormat::R16Unorm => Self::R16Unorm,
188 TextureFormat::R16Snorm => Self::R16Snorm,
189 TextureFormat::R16Float => Self::R16Float,
190 TextureFormat::Rg8Unorm => Self::Rg8Unorm,
191 TextureFormat::Rg8Snorm => Self::Rg8Snorm,
192 TextureFormat::Rg8Uint => Self::Rg8Uint,
193 TextureFormat::Rg8Sint => Self::Rg8Sint,
194 TextureFormat::R32Uint => Self::R32Uint,
195 TextureFormat::R32Sint => Self::R32Sint,
196 TextureFormat::R32Float => Self::R32Float,
197 TextureFormat::Rg16Uint => Self::Rg16Uint,
198 TextureFormat::Rg16Sint => Self::Rg16Sint,
199 TextureFormat::Rg16Unorm => Self::Rg16Unorm,
200 TextureFormat::Rg16Snorm => Self::Rg16Snorm,
201 TextureFormat::Rg16Float => Self::Rg16Float,
202 TextureFormat::Rgba8Unorm => Self::Rgba8Unorm,
203 TextureFormat::Rgba8UnormSrgb => Self::Rgba8UnormSrgb,
204 TextureFormat::Rgba8Snorm => Self::Rgba8Snorm,
205 TextureFormat::Rgba8Uint => Self::Rgba8Uint,
206 TextureFormat::Rgba8Sint => Self::Rgba8Sint,
207 TextureFormat::Bgra8Unorm => Self::Bgra8Unorm,
208 TextureFormat::Bgra8UnormSrgb => Self::Bgra8UnormSrgb,
209 TextureFormat::Rgb9e5Ufloat => Self::Rgb9e5Ufloat,
210 TextureFormat::Rgb10a2Uint => Self::Rgb10a2Uint,
211 TextureFormat::Rgb10a2Unorm => Self::Rgb10a2Unorm,
212 TextureFormat::Rg11b10Ufloat => Self::Rg11b10Ufloat,
213 TextureFormat::R64Uint => Self::R64Uint,
214 TextureFormat::Rg32Uint => Self::Rg32Uint,
215 TextureFormat::Rg32Sint => Self::Rg32Sint,
216 TextureFormat::Rg32Float => Self::Rg32Float,
217 TextureFormat::Rgba16Uint => Self::Rgba16Uint,
218 TextureFormat::Rgba16Sint => Self::Rgba16Sint,
219 TextureFormat::Rgba16Unorm => Self::Rgba16Unorm,
220 TextureFormat::Rgba16Snorm => Self::Rgba16Snorm,
221 TextureFormat::Rgba16Float => Self::Rgba16Float,
222 TextureFormat::Rgba32Uint => Self::Rgba32Uint,
223 TextureFormat::Rgba32Sint => Self::Rgba32Sint,
224 TextureFormat::Rgba32Float => Self::Rgba32Float,
225 TextureFormat::Stencil8 => Self::Stencil8,
226 TextureFormat::Depth16Unorm => Self::Depth16Unorm,
227 TextureFormat::Depth24Plus => Self::Depth24Plus,
228 TextureFormat::Depth24PlusStencil8 => Self::Depth24PlusStencil8,
229 TextureFormat::Depth32Float => Self::Depth32Float,
230 TextureFormat::Depth32FloatStencil8 => Self::Depth32FloatStencil8,
231 TextureFormat::NV12 => Self::NV12,
232 TextureFormat::P010 => Self::P010,
233 TextureFormat::Bc1RgbaUnorm => Self::Bc1RgbaUnorm,
234 TextureFormat::Bc1RgbaUnormSrgb => Self::Bc1RgbaUnormSrgb,
235 TextureFormat::Bc2RgbaUnorm => Self::Bc2RgbaUnorm,
236 TextureFormat::Bc2RgbaUnormSrgb => Self::Bc2RgbaUnormSrgb,
237 TextureFormat::Bc3RgbaUnorm => Self::Bc3RgbaUnorm,
238 TextureFormat::Bc3RgbaUnormSrgb => Self::Bc3RgbaUnormSrgb,
239 TextureFormat::Bc4RUnorm => Self::Bc4RUnorm,
240 TextureFormat::Bc4RSnorm => Self::Bc4RSnorm,
241 TextureFormat::Bc5RgUnorm => Self::Bc5RgUnorm,
242 TextureFormat::Bc5RgSnorm => Self::Bc5RgSnorm,
243 TextureFormat::Bc6hRgbUfloat => Self::Bc6hRgbUfloat,
244 TextureFormat::Bc6hRgbFloat => Self::Bc6hRgbFloat,
245 TextureFormat::Bc7RgbaUnorm => Self::Bc7RgbaUnorm,
246 TextureFormat::Bc7RgbaUnormSrgb => Self::Bc7RgbaUnormSrgb,
247 TextureFormat::Etc2Rgb8Unorm => Self::Etc2Rgb8Unorm,
248 TextureFormat::Etc2Rgb8UnormSrgb => Self::Etc2Rgb8UnormSrgb,
249 TextureFormat::Etc2Rgb8A1Unorm => Self::Etc2Rgb8A1Unorm,
250 TextureFormat::Etc2Rgb8A1UnormSrgb => Self::Etc2Rgb8A1UnormSrgb,
251 TextureFormat::Etc2Rgba8Unorm => Self::Etc2Rgba8Unorm,
252 TextureFormat::Etc2Rgba8UnormSrgb => Self::Etc2Rgba8UnormSrgb,
253 TextureFormat::EacR11Unorm => Self::EacR11Unorm,
254 TextureFormat::EacR11Snorm => Self::EacR11Snorm,
255 TextureFormat::EacRg11Unorm => Self::EacRg11Unorm,
256 TextureFormat::EacRg11Snorm => Self::EacRg11Snorm,
257 TextureFormat::Astc { block, channel } => Self::Astc { block: block.into(), channel: channel.into() },
258 }
259 }
260}
261
262impl From<wgpu::TextureFormat> for TextureFormat {
263 fn from(format: wgpu::TextureFormat) -> Self {
264 match format {
265 wgpu::TextureFormat::R8Unorm => Self::R8Unorm,
266 wgpu::TextureFormat::R8Snorm => Self::R8Snorm,
267 wgpu::TextureFormat::R8Uint => Self::R8Uint,
268 wgpu::TextureFormat::R8Sint => Self::R8Sint,
269 wgpu::TextureFormat::R16Uint => Self::R16Uint,
270 wgpu::TextureFormat::R16Sint => Self::R16Sint,
271 wgpu::TextureFormat::R16Unorm => Self::R16Unorm,
272 wgpu::TextureFormat::R16Snorm => Self::R16Snorm,
273 wgpu::TextureFormat::R16Float => Self::R16Float,
274 wgpu::TextureFormat::Rg8Unorm => Self::Rg8Unorm,
275 wgpu::TextureFormat::Rg8Snorm => Self::Rg8Snorm,
276 wgpu::TextureFormat::Rg8Uint => Self::Rg8Uint,
277 wgpu::TextureFormat::Rg8Sint => Self::Rg8Sint,
278 wgpu::TextureFormat::R32Uint => Self::R32Uint,
279 wgpu::TextureFormat::R32Sint => Self::R32Sint,
280 wgpu::TextureFormat::R32Float => Self::R32Float,
281 wgpu::TextureFormat::Rg16Uint => Self::Rg16Uint,
282 wgpu::TextureFormat::Rg16Sint => Self::Rg16Sint,
283 wgpu::TextureFormat::Rg16Unorm => Self::Rg16Unorm,
284 wgpu::TextureFormat::Rg16Snorm => Self::Rg16Snorm,
285 wgpu::TextureFormat::Rg16Float => Self::Rg16Float,
286 wgpu::TextureFormat::Rgba8Unorm => Self::Rgba8Unorm,
287 wgpu::TextureFormat::Rgba8UnormSrgb => Self::Rgba8UnormSrgb,
288 wgpu::TextureFormat::Rgba8Snorm => Self::Rgba8Snorm,
289 wgpu::TextureFormat::Rgba8Uint => Self::Rgba8Uint,
290 wgpu::TextureFormat::Rgba8Sint => Self::Rgba8Sint,
291 wgpu::TextureFormat::Bgra8Unorm => Self::Bgra8Unorm,
292 wgpu::TextureFormat::Bgra8UnormSrgb => Self::Bgra8UnormSrgb,
293 wgpu::TextureFormat::Rgb9e5Ufloat => Self::Rgb9e5Ufloat,
294 wgpu::TextureFormat::Rgb10a2Uint => Self::Rgb10a2Uint,
295 wgpu::TextureFormat::Rgb10a2Unorm => Self::Rgb10a2Unorm,
296 wgpu::TextureFormat::Rg11b10Ufloat => Self::Rg11b10Ufloat,
297 wgpu::TextureFormat::R64Uint => Self::R64Uint,
298 wgpu::TextureFormat::Rg32Uint => Self::Rg32Uint,
299 wgpu::TextureFormat::Rg32Sint => Self::Rg32Sint,
300 wgpu::TextureFormat::Rg32Float => Self::Rg32Float,
301 wgpu::TextureFormat::Rgba16Uint => Self::Rgba16Uint,
302 wgpu::TextureFormat::Rgba16Sint => Self::Rgba16Sint,
303 wgpu::TextureFormat::Rgba16Unorm => Self::Rgba16Unorm,
304 wgpu::TextureFormat::Rgba16Snorm => Self::Rgba16Snorm,
305 wgpu::TextureFormat::Rgba16Float => Self::Rgba16Float,
306 wgpu::TextureFormat::Rgba32Uint => Self::Rgba32Uint,
307 wgpu::TextureFormat::Rgba32Sint => Self::Rgba32Sint,
308 wgpu::TextureFormat::Rgba32Float => Self::Rgba32Float,
309 wgpu::TextureFormat::Stencil8 => Self::Stencil8,
310 wgpu::TextureFormat::Depth16Unorm => Self::Depth16Unorm,
311 wgpu::TextureFormat::Depth24Plus => Self::Depth24Plus,
312 wgpu::TextureFormat::Depth24PlusStencil8 => Self::Depth24PlusStencil8,
313 wgpu::TextureFormat::Depth32Float => Self::Depth32Float,
314 wgpu::TextureFormat::Depth32FloatStencil8 => Self::Depth32FloatStencil8,
315 wgpu::TextureFormat::NV12 => Self::NV12,
316 wgpu::TextureFormat::P010 => Self::P010,
317 wgpu::TextureFormat::Bc1RgbaUnorm => Self::Bc1RgbaUnorm,
318 wgpu::TextureFormat::Bc1RgbaUnormSrgb => Self::Bc1RgbaUnormSrgb,
319 wgpu::TextureFormat::Bc2RgbaUnorm => Self::Bc2RgbaUnorm,
320 wgpu::TextureFormat::Bc2RgbaUnormSrgb => Self::Bc2RgbaUnormSrgb,
321 wgpu::TextureFormat::Bc3RgbaUnorm => Self::Bc3RgbaUnorm,
322 wgpu::TextureFormat::Bc3RgbaUnormSrgb => Self::Bc3RgbaUnormSrgb,
323 wgpu::TextureFormat::Bc4RUnorm => Self::Bc4RUnorm,
324 wgpu::TextureFormat::Bc4RSnorm => Self::Bc4RSnorm,
325 wgpu::TextureFormat::Bc5RgUnorm => Self::Bc5RgUnorm,
326 wgpu::TextureFormat::Bc5RgSnorm => Self::Bc5RgSnorm,
327 wgpu::TextureFormat::Bc6hRgbUfloat => Self::Bc6hRgbUfloat,
328 wgpu::TextureFormat::Bc6hRgbFloat => Self::Bc6hRgbFloat,
329 wgpu::TextureFormat::Bc7RgbaUnorm => Self::Bc7RgbaUnorm,
330 wgpu::TextureFormat::Bc7RgbaUnormSrgb => Self::Bc7RgbaUnormSrgb,
331 wgpu::TextureFormat::Etc2Rgb8Unorm => Self::Etc2Rgb8Unorm,
332 wgpu::TextureFormat::Etc2Rgb8UnormSrgb => Self::Etc2Rgb8UnormSrgb,
333 wgpu::TextureFormat::Etc2Rgb8A1Unorm => Self::Etc2Rgb8A1Unorm,
334 wgpu::TextureFormat::Etc2Rgb8A1UnormSrgb => Self::Etc2Rgb8A1UnormSrgb,
335 wgpu::TextureFormat::Etc2Rgba8Unorm => Self::Etc2Rgba8Unorm,
336 wgpu::TextureFormat::Etc2Rgba8UnormSrgb => Self::Etc2Rgba8UnormSrgb,
337 wgpu::TextureFormat::EacR11Unorm => Self::EacR11Unorm,
338 wgpu::TextureFormat::EacR11Snorm => Self::EacR11Snorm,
339 wgpu::TextureFormat::EacRg11Unorm => Self::EacRg11Unorm,
340 wgpu::TextureFormat::EacRg11Snorm => Self::EacRg11Snorm,
341 wgpu::TextureFormat::Astc { block, channel } => Self::Astc { block: block.into(), channel: channel.into() },
342 }
343 }
344}