1pub mod flags;
2pub mod pipeline_state;
3
4#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
5pub enum CursorIcon {
6 #[default]
7 Default,
8 ContextMenu,
9 Help,
10 Pointer,
11 Progress,
12 Wait,
13 Cell,
14 Crosshair,
15 Text,
16 VerticalText,
17 Alias,
18 Copy,
19 Move,
20 NoDrop,
21 NotAllowed,
22 Grab,
23 Grabbing,
24 EResize,
25 NResize,
26 NeResize,
27 NwResize,
28 SResize,
29 SeResize,
30 SwResize,
31 WResize,
32 EwResize,
33 NsResize,
34 NeswResize,
35 NwseResize,
36 ColResize,
37 RowResize,
38 AllScroll,
39 ZoomIn,
40 ZoomOut,
41 DndAsk,
42 AllResize,
43}
44
45impl From<CursorIcon> for winit::window::CursorIcon {
46 fn from(value: CursorIcon) -> Self {
47 match value {
48 CursorIcon::Default => Self::Default,
49 CursorIcon::ContextMenu => Self::ContextMenu,
50 CursorIcon::Help => Self::Help,
51 CursorIcon::Pointer => Self::Pointer,
52 CursorIcon::Progress => Self::Progress,
53 CursorIcon::Wait => Self::Wait,
54 CursorIcon::Cell => Self::Cell,
55 CursorIcon::Crosshair => Self::Crosshair,
56 CursorIcon::Text => Self::Text,
57 CursorIcon::VerticalText => Self::VerticalText,
58 CursorIcon::Alias => Self::Alias,
59 CursorIcon::Copy => Self::Copy,
60 CursorIcon::Move => Self::Move,
61 CursorIcon::NoDrop => Self::NoDrop,
62 CursorIcon::NotAllowed => Self::NotAllowed,
63 CursorIcon::Grab => Self::Grab,
64 CursorIcon::Grabbing => Self::Grabbing,
65 CursorIcon::EResize => Self::EResize,
66 CursorIcon::NResize => Self::NResize,
67 CursorIcon::NeResize => Self::NeResize,
68 CursorIcon::NwResize => Self::NwResize,
69 CursorIcon::SResize => Self::SResize,
70 CursorIcon::SeResize => Self::SeResize,
71 CursorIcon::SwResize => Self::SwResize,
72 CursorIcon::WResize => Self::WResize,
73 CursorIcon::EwResize => Self::EwResize,
74 CursorIcon::NsResize => Self::NsResize,
75 CursorIcon::NeswResize => Self::NeswResize,
76 CursorIcon::NwseResize => Self::NwseResize,
77 CursorIcon::ColResize => Self::ColResize,
78 CursorIcon::RowResize => Self::RowResize,
79 CursorIcon::AllScroll => Self::AllScroll,
80 CursorIcon::ZoomIn => Self::ZoomIn,
81 CursorIcon::ZoomOut => Self::ZoomOut,
82 CursorIcon::DndAsk => Self::DndAsk,
83 CursorIcon::AllResize => Self::AllResize,
84 }
85 }
86}
87
88#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
89pub enum CursorGrabMode {
90 #[default]
91 None,
92 Confined,
93 Locked,
94}
95
96impl From<CursorGrabMode> for winit::window::CursorGrabMode {
97 fn from(value: CursorGrabMode) -> Self {
98 match value {
99 CursorGrabMode::None => Self::None,
100 CursorGrabMode::Confined => Self::Confined,
101 CursorGrabMode::Locked => Self::Locked,
102 }
103 }
104}
105
106#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
107pub enum KeyCode {
108 Backquote,
109 Backslash,
110 BracketLeft,
111 BracketRight,
112 Comma,
113 Digit0,
114 Digit1,
115 Digit2,
116 Digit3,
117 Digit4,
118 Digit5,
119 Digit6,
120 Digit7,
121 Digit8,
122 Digit9,
123 Equal,
124 IntlBackslash,
125 IntlRo,
126 IntlYen,
127 KeyA,
128 KeyB,
129 KeyC,
130 KeyD,
131 KeyE,
132 KeyF,
133 KeyG,
134 KeyH,
135 KeyI,
136 KeyJ,
137 KeyK,
138 KeyL,
139 KeyM,
140 KeyN,
141 KeyO,
142 KeyP,
143 KeyQ,
144 KeyR,
145 KeyS,
146 KeyT,
147 KeyU,
148 KeyV,
149 KeyW,
150 KeyX,
151 KeyY,
152 KeyZ,
153 Minus,
154 Period,
155 Quote,
156 Semicolon,
157 Slash,
158 AltLeft,
159 AltRight,
160 Backspace,
161 CapsLock,
162 ContextMenu,
163 ControlLeft,
164 ControlRight,
165 Enter,
166 SuperLeft,
167 SuperRight,
168 ShiftLeft,
169 ShiftRight,
170 Space,
171 Tab,
172 Convert,
173 KanaMode,
174 Lang1,
175 Lang2,
176 Lang3,
177 Lang4,
178 Lang5,
179 NonConvert,
180 Delete,
181 End,
182 Help,
183 Home,
184 Insert,
185 PageDown,
186 PageUp,
187 ArrowDown,
188 ArrowLeft,
189 ArrowRight,
190 ArrowUp,
191 NumLock,
192 Numpad0,
193 Numpad1,
194 Numpad2,
195 Numpad3,
196 Numpad4,
197 Numpad5,
198 Numpad6,
199 Numpad7,
200 Numpad8,
201 Numpad9,
202 NumpadAdd,
203 NumpadBackspace,
204 NumpadClear,
205 NumpadClearEntry,
206 NumpadComma,
207 NumpadDecimal,
208 NumpadDivide,
209 NumpadEnter,
210 NumpadEqual,
211 NumpadHash,
212 NumpadMemoryAdd,
213 NumpadMemoryClear,
214 NumpadMemoryRecall,
215 NumpadMemoryStore,
216 NumpadMemorySubtract,
217 NumpadMultiply,
218 NumpadParenLeft,
219 NumpadParenRight,
220 NumpadStar,
221 NumpadSubtract,
222 Escape,
223 Fn,
224 FnLock,
225 PrintScreen,
226 ScrollLock,
227 Pause,
228 BrowserBack,
229 BrowserFavorites,
230 BrowserForward,
231 BrowserHome,
232 BrowserRefresh,
233 BrowserSearch,
234 BrowserStop,
235 Eject,
236 LaunchApp1,
237 LaunchApp2,
238 LaunchMail,
239 MediaPlayPause,
240 MediaSelect,
241 MediaStop,
242 MediaTrackNext,
243 MediaTrackPrevious,
244 Power,
245 Sleep,
246 AudioVolumeDown,
247 AudioVolumeMute,
248 AudioVolumeUp,
249 WakeUp,
250 Meta,
251 Hyper,
252 Turbo,
253 Abort,
254 Resume,
255 Suspend,
256 Again,
257 Copy,
258 Cut,
259 Find,
260 Open,
261 Paste,
262 Props,
263 Select,
264 Undo,
265 Hiragana,
266 Katakana,
267 F1,
268 F2,
269 F3,
270 F4,
271 F5,
272 F6,
273 F7,
274 F8,
275 F9,
276 F10,
277 F11,
278 F12,
279 F13,
280 F14,
281 F15,
282 F16,
283 F17,
284 F18,
285 F19,
286 F20,
287 F21,
288 F22,
289 F23,
290 F24,
291 F25,
292 F26,
293 F27,
294 F28,
295 F29,
296 F30,
297 F31,
298 F32,
299 F33,
300 F34,
301 F35,
302}
303
304impl From<KeyCode> for winit::keyboard::KeyCode {
305 fn from(value: KeyCode) -> Self {
306 match value {
307 KeyCode::Backquote => Self::Backquote,
308 KeyCode::Backslash => Self::Backslash,
309 KeyCode::BracketLeft => Self::BracketLeft,
310 KeyCode::BracketRight => Self::BracketRight,
311 KeyCode::Comma => Self::Comma,
312 KeyCode::Digit0 => Self::Digit0,
313 KeyCode::Digit1 => Self::Digit1,
314 KeyCode::Digit2 => Self::Digit2,
315 KeyCode::Digit3 => Self::Digit3,
316 KeyCode::Digit4 => Self::Digit4,
317 KeyCode::Digit5 => Self::Digit5,
318 KeyCode::Digit6 => Self::Digit6,
319 KeyCode::Digit7 => Self::Digit7,
320 KeyCode::Digit8 => Self::Digit8,
321 KeyCode::Digit9 => Self::Digit9,
322 KeyCode::Equal => Self::Equal,
323 KeyCode::IntlBackslash => Self::IntlBackslash,
324 KeyCode::IntlRo => Self::IntlRo,
325 KeyCode::IntlYen => Self::IntlYen,
326 KeyCode::KeyA => Self::KeyA,
327 KeyCode::KeyB => Self::KeyB,
328 KeyCode::KeyC => Self::KeyC,
329 KeyCode::KeyD => Self::KeyD,
330 KeyCode::KeyE => Self::KeyE,
331 KeyCode::KeyF => Self::KeyF,
332 KeyCode::KeyG => Self::KeyG,
333 KeyCode::KeyH => Self::KeyH,
334 KeyCode::KeyI => Self::KeyI,
335 KeyCode::KeyJ => Self::KeyJ,
336 KeyCode::KeyK => Self::KeyK,
337 KeyCode::KeyL => Self::KeyL,
338 KeyCode::KeyM => Self::KeyM,
339 KeyCode::KeyN => Self::KeyN,
340 KeyCode::KeyO => Self::KeyO,
341 KeyCode::KeyP => Self::KeyP,
342 KeyCode::KeyQ => Self::KeyQ,
343 KeyCode::KeyR => Self::KeyR,
344 KeyCode::KeyS => Self::KeyS,
345 KeyCode::KeyT => Self::KeyT,
346 KeyCode::KeyU => Self::KeyU,
347 KeyCode::KeyV => Self::KeyV,
348 KeyCode::KeyW => Self::KeyW,
349 KeyCode::KeyX => Self::KeyX,
350 KeyCode::KeyY => Self::KeyY,
351 KeyCode::KeyZ => Self::KeyZ,
352 KeyCode::Minus => Self::Minus,
353 KeyCode::Period => Self::Period,
354 KeyCode::Quote => Self::Quote,
355 KeyCode::Semicolon => Self::Semicolon,
356 KeyCode::Slash => Self::Slash,
357 KeyCode::AltLeft => Self::AltLeft,
358 KeyCode::AltRight => Self::AltRight,
359 KeyCode::Backspace => Self::Backspace,
360 KeyCode::CapsLock => Self::CapsLock,
361 KeyCode::ContextMenu => Self::ContextMenu,
362 KeyCode::ControlLeft => Self::ControlLeft,
363 KeyCode::ControlRight => Self::ControlRight,
364 KeyCode::Enter => Self::Enter,
365 KeyCode::SuperLeft => Self::SuperLeft,
366 KeyCode::SuperRight => Self::SuperRight,
367 KeyCode::ShiftLeft => Self::ShiftLeft,
368 KeyCode::ShiftRight => Self::ShiftRight,
369 KeyCode::Space => Self::Space,
370 KeyCode::Tab => Self::Tab,
371 KeyCode::Convert => Self::Convert,
372 KeyCode::KanaMode => Self::KanaMode,
373 KeyCode::Lang1 => Self::Lang1,
374 KeyCode::Lang2 => Self::Lang2,
375 KeyCode::Lang3 => Self::Lang3,
376 KeyCode::Lang4 => Self::Lang4,
377 KeyCode::Lang5 => Self::Lang5,
378 KeyCode::NonConvert => Self::NonConvert,
379 KeyCode::Delete => Self::Delete,
380 KeyCode::End => Self::End,
381 KeyCode::Help => Self::Help,
382 KeyCode::Home => Self::Home,
383 KeyCode::Insert => Self::Insert,
384 KeyCode::PageDown => Self::PageDown,
385 KeyCode::PageUp => Self::PageUp,
386 KeyCode::ArrowDown => Self::ArrowDown,
387 KeyCode::ArrowLeft => Self::ArrowLeft,
388 KeyCode::ArrowRight => Self::ArrowRight,
389 KeyCode::ArrowUp => Self::ArrowUp,
390 KeyCode::NumLock => Self::NumLock,
391 KeyCode::Numpad0 => Self::Numpad0,
392 KeyCode::Numpad1 => Self::Numpad1,
393 KeyCode::Numpad2 => Self::Numpad2,
394 KeyCode::Numpad3 => Self::Numpad3,
395 KeyCode::Numpad4 => Self::Numpad4,
396 KeyCode::Numpad5 => Self::Numpad5,
397 KeyCode::Numpad6 => Self::Numpad6,
398 KeyCode::Numpad7 => Self::Numpad7,
399 KeyCode::Numpad8 => Self::Numpad8,
400 KeyCode::Numpad9 => Self::Numpad9,
401 KeyCode::NumpadAdd => Self::NumpadAdd,
402 KeyCode::NumpadBackspace => Self::NumpadBackspace,
403 KeyCode::NumpadClear => Self::NumpadClear,
404 KeyCode::NumpadClearEntry => Self::NumpadClearEntry,
405 KeyCode::NumpadComma => Self::NumpadComma,
406 KeyCode::NumpadDecimal => Self::NumpadDecimal,
407 KeyCode::NumpadDivide => Self::NumpadDivide,
408 KeyCode::NumpadEnter => Self::NumpadEnter,
409 KeyCode::NumpadEqual => Self::NumpadEqual,
410 KeyCode::NumpadHash => Self::NumpadHash,
411 KeyCode::NumpadMemoryAdd => Self::NumpadMemoryAdd,
412 KeyCode::NumpadMemoryClear => Self::NumpadMemoryClear,
413 KeyCode::NumpadMemoryRecall => Self::NumpadMemoryRecall,
414 KeyCode::NumpadMemoryStore => Self::NumpadMemoryStore,
415 KeyCode::NumpadMemorySubtract => Self::NumpadMemorySubtract,
416 KeyCode::NumpadMultiply => Self::NumpadMultiply,
417 KeyCode::NumpadParenLeft => Self::NumpadParenLeft,
418 KeyCode::NumpadParenRight => Self::NumpadParenRight,
419 KeyCode::NumpadStar => Self::NumpadStar,
420 KeyCode::NumpadSubtract => Self::NumpadSubtract,
421 KeyCode::Escape => Self::Escape,
422 KeyCode::Fn => Self::Fn,
423 KeyCode::FnLock => Self::FnLock,
424 KeyCode::PrintScreen => Self::PrintScreen,
425 KeyCode::ScrollLock => Self::ScrollLock,
426 KeyCode::Pause => Self::Pause,
427 KeyCode::BrowserBack => Self::BrowserBack,
428 KeyCode::BrowserFavorites => Self::BrowserFavorites,
429 KeyCode::BrowserForward => Self::BrowserForward,
430 KeyCode::BrowserHome => Self::BrowserHome,
431 KeyCode::BrowserRefresh => Self::BrowserRefresh,
432 KeyCode::BrowserSearch => Self::BrowserSearch,
433 KeyCode::BrowserStop => Self::BrowserStop,
434 KeyCode::Eject => Self::Eject,
435 KeyCode::LaunchApp1 => Self::LaunchApp1,
436 KeyCode::LaunchApp2 => Self::LaunchApp2,
437 KeyCode::LaunchMail => Self::LaunchMail,
438 KeyCode::MediaPlayPause => Self::MediaPlayPause,
439 KeyCode::MediaSelect => Self::MediaSelect,
440 KeyCode::MediaStop => Self::MediaStop,
441 KeyCode::MediaTrackNext => Self::MediaTrackNext,
442 KeyCode::MediaTrackPrevious => Self::MediaTrackPrevious,
443 KeyCode::Power => Self::Power,
444 KeyCode::Sleep => Self::Sleep,
445 KeyCode::AudioVolumeDown => Self::AudioVolumeDown,
446 KeyCode::AudioVolumeMute => Self::AudioVolumeMute,
447 KeyCode::AudioVolumeUp => Self::AudioVolumeUp,
448 KeyCode::WakeUp => Self::WakeUp,
449 KeyCode::Meta => Self::Meta,
450 KeyCode::Hyper => Self::Hyper,
451 KeyCode::Turbo => Self::Turbo,
452 KeyCode::Abort => Self::Abort,
453 KeyCode::Resume => Self::Resume,
454 KeyCode::Suspend => Self::Suspend,
455 KeyCode::Again => Self::Again,
456 KeyCode::Copy => Self::Copy,
457 KeyCode::Cut => Self::Cut,
458 KeyCode::Find => Self::Find,
459 KeyCode::Open => Self::Open,
460 KeyCode::Paste => Self::Paste,
461 KeyCode::Props => Self::Props,
462 KeyCode::Select => Self::Select,
463 KeyCode::Undo => Self::Undo,
464 KeyCode::Hiragana => Self::Hiragana,
465 KeyCode::Katakana => Self::Katakana,
466 KeyCode::F1 => Self::F1,
467 KeyCode::F2 => Self::F2,
468 KeyCode::F3 => Self::F3,
469 KeyCode::F4 => Self::F4,
470 KeyCode::F5 => Self::F5,
471 KeyCode::F6 => Self::F6,
472 KeyCode::F7 => Self::F7,
473 KeyCode::F8 => Self::F8,
474 KeyCode::F9 => Self::F9,
475 KeyCode::F10 => Self::F10,
476 KeyCode::F11 => Self::F11,
477 KeyCode::F12 => Self::F12,
478 KeyCode::F13 => Self::F13,
479 KeyCode::F14 => Self::F14,
480 KeyCode::F15 => Self::F15,
481 KeyCode::F16 => Self::F16,
482 KeyCode::F17 => Self::F17,
483 KeyCode::F18 => Self::F18,
484 KeyCode::F19 => Self::F19,
485 KeyCode::F20 => Self::F20,
486 KeyCode::F21 => Self::F21,
487 KeyCode::F22 => Self::F22,
488 KeyCode::F23 => Self::F23,
489 KeyCode::F24 => Self::F24,
490 KeyCode::F25 => Self::F25,
491 KeyCode::F26 => Self::F26,
492 KeyCode::F27 => Self::F27,
493 KeyCode::F28 => Self::F28,
494 KeyCode::F29 => Self::F29,
495 KeyCode::F30 => Self::F30,
496 KeyCode::F31 => Self::F31,
497 KeyCode::F32 => Self::F32,
498 KeyCode::F33 => Self::F33,
499 KeyCode::F34 => Self::F34,
500 KeyCode::F35 => Self::F35,
501 }
502 }
503}
504
505#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
506pub enum MouseButton {
507 Left,
508 Right,
509 Middle,
510 Back,
511 Forward,
512 Other(u16),
513}
514
515impl From<MouseButton> for winit::event::MouseButton {
516 fn from(value: MouseButton) -> Self {
517 match value {
518 MouseButton::Left => Self::Left,
519 MouseButton::Right => Self::Right,
520 MouseButton::Middle => Self::Middle,
521 MouseButton::Back => Self::Back,
522 MouseButton::Forward => Self::Forward,
523 MouseButton::Other(code) => Self::Other(code),
524 }
525 }
526}
527
528#[derive(Copy, Clone, Debug, PartialEq, Eq)]
529pub enum TouchPhase {
530 Started,
531 Moved,
532 Ended,
533 Cancelled,
534}
535
536impl From<winit::event::TouchPhase> for TouchPhase {
537 fn from(value: winit::event::TouchPhase) -> Self {
538 match value {
539 winit::event::TouchPhase::Started => Self::Started,
540 winit::event::TouchPhase::Moved => Self::Moved,
541 winit::event::TouchPhase::Ended => Self::Ended,
542 winit::event::TouchPhase::Cancelled => Self::Cancelled,
543 }
544 }
545}
546
547#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
548pub enum AstcBlock {
549 B4x4,
550 B5x4,
551 B5x5,
552 B6x5,
553 B6x6,
554 B8x5,
555 B8x6,
556 B8x8,
557 B10x5,
558 B10x6,
559 B10x8,
560 B10x10,
561 B12x10,
562 B12x12,
563}
564
565impl From<AstcBlock> for wgpu::AstcBlock {
566 fn from(value: AstcBlock) -> Self {
567 match value {
568 AstcBlock::B4x4 => Self::B4x4,
569 AstcBlock::B5x4 => Self::B5x4,
570 AstcBlock::B5x5 => Self::B5x5,
571 AstcBlock::B6x5 => Self::B6x5,
572 AstcBlock::B6x6 => Self::B6x6,
573 AstcBlock::B8x5 => Self::B8x5,
574 AstcBlock::B8x6 => Self::B8x6,
575 AstcBlock::B8x8 => Self::B8x8,
576 AstcBlock::B10x5 => Self::B10x5,
577 AstcBlock::B10x6 => Self::B10x6,
578 AstcBlock::B10x8 => Self::B10x8,
579 AstcBlock::B10x10 => Self::B10x10,
580 AstcBlock::B12x10 => Self::B12x10,
581 AstcBlock::B12x12 => Self::B12x12,
582 }
583 }
584}
585
586impl From<wgpu::AstcBlock> for AstcBlock {
587 fn from(value: wgpu::AstcBlock) -> Self {
588 match value {
589 wgpu::AstcBlock::B4x4 => Self::B4x4,
590 wgpu::AstcBlock::B5x4 => Self::B5x4,
591 wgpu::AstcBlock::B5x5 => Self::B5x5,
592 wgpu::AstcBlock::B6x5 => Self::B6x5,
593 wgpu::AstcBlock::B6x6 => Self::B6x6,
594 wgpu::AstcBlock::B8x5 => Self::B8x5,
595 wgpu::AstcBlock::B8x6 => Self::B8x6,
596 wgpu::AstcBlock::B8x8 => Self::B8x8,
597 wgpu::AstcBlock::B10x5 => Self::B10x5,
598 wgpu::AstcBlock::B10x6 => Self::B10x6,
599 wgpu::AstcBlock::B10x8 => Self::B10x8,
600 wgpu::AstcBlock::B10x10 => Self::B10x10,
601 wgpu::AstcBlock::B12x10 => Self::B12x10,
602 wgpu::AstcBlock::B12x12 => Self::B12x12,
603 }
604 }
605}
606
607#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
608pub enum AstcChannel {
609 Unorm,
610 UnormSrgb,
611 Hdr,
612}
613
614impl From<AstcChannel> for wgpu::AstcChannel {
615 fn from(value: AstcChannel) -> Self {
616 match value {
617 AstcChannel::Unorm => Self::Unorm,
618 AstcChannel::UnormSrgb => Self::UnormSrgb,
619 AstcChannel::Hdr => Self::Hdr,
620 }
621 }
622}
623
624impl From<wgpu::AstcChannel> for AstcChannel {
625 fn from(value: wgpu::AstcChannel) -> Self {
626 match value {
627 wgpu::AstcChannel::Unorm => Self::Unorm,
628 wgpu::AstcChannel::UnormSrgb => Self::UnormSrgb,
629 wgpu::AstcChannel::Hdr => Self::Hdr,
630 }
631 }
632}
633
634#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
635pub enum TextureFormat {
636 R8Unorm,
637 R8Snorm,
638 R8Uint,
639 R8Sint,
640 R16Uint,
641 R16Sint,
642 R16Unorm,
643 R16Snorm,
644 R16Float,
645 Rg8Unorm,
646 Rg8Snorm,
647 Rg8Uint,
648 Rg8Sint,
649 R32Uint,
650 R32Sint,
651 R32Float,
652 Rg16Uint,
653 Rg16Sint,
654 Rg16Unorm,
655 Rg16Snorm,
656 Rg16Float,
657 Rgba8Unorm,
658 Rgba8UnormSrgb,
659 Rgba8Snorm,
660 Rgba8Uint,
661 Rgba8Sint,
662 Bgra8Unorm,
663 Bgra8UnormSrgb,
664 Rgb9e5Ufloat,
665 Rgb10a2Uint,
666 Rgb10a2Unorm,
667 Rg11b10Ufloat,
668 R64Uint,
669 Rg32Uint,
670 Rg32Sint,
671 Rg32Float,
672 Rgba16Uint,
673 Rgba16Sint,
674 Rgba16Unorm,
675 Rgba16Snorm,
676 Rgba16Float,
677 Rgba32Uint,
678 Rgba32Sint,
679 Rgba32Float,
680 Stencil8,
681 Depth16Unorm,
682 Depth24Plus,
683 Depth24PlusStencil8,
684 Depth32Float,
685 Depth32FloatStencil8,
686 NV12,
687 P010,
688 Bc1RgbaUnorm,
689 Bc1RgbaUnormSrgb,
690 Bc2RgbaUnorm,
691 Bc2RgbaUnormSrgb,
692 Bc3RgbaUnorm,
693 Bc3RgbaUnormSrgb,
694 Bc4RUnorm,
695 Bc4RSnorm,
696 Bc5RgUnorm,
697 Bc5RgSnorm,
698 Bc6hRgbUfloat,
699 Bc6hRgbFloat,
700 Bc7RgbaUnorm,
701 Bc7RgbaUnormSrgb,
702 Etc2Rgb8Unorm,
703 Etc2Rgb8UnormSrgb,
704 Etc2Rgb8A1Unorm,
705 Etc2Rgb8A1UnormSrgb,
706 Etc2Rgba8Unorm,
707 Etc2Rgba8UnormSrgb,
708 EacR11Unorm,
709 EacR11Snorm,
710 EacRg11Unorm,
711 EacRg11Snorm,
712 Astc { block: AstcBlock, channel: AstcChannel },
713}
714
715impl From<TextureFormat> for wgpu::TextureFormat {
716 fn from(format: TextureFormat) -> Self {
717 match format {
718 TextureFormat::R8Unorm => Self::R8Unorm,
719 TextureFormat::R8Snorm => Self::R8Snorm,
720 TextureFormat::R8Uint => Self::R8Uint,
721 TextureFormat::R8Sint => Self::R8Sint,
722 TextureFormat::R16Uint => Self::R16Uint,
723 TextureFormat::R16Sint => Self::R16Sint,
724 TextureFormat::R16Unorm => Self::R16Unorm,
725 TextureFormat::R16Snorm => Self::R16Snorm,
726 TextureFormat::R16Float => Self::R16Float,
727 TextureFormat::Rg8Unorm => Self::Rg8Unorm,
728 TextureFormat::Rg8Snorm => Self::Rg8Snorm,
729 TextureFormat::Rg8Uint => Self::Rg8Uint,
730 TextureFormat::Rg8Sint => Self::Rg8Sint,
731 TextureFormat::R32Uint => Self::R32Uint,
732 TextureFormat::R32Sint => Self::R32Sint,
733 TextureFormat::R32Float => Self::R32Float,
734 TextureFormat::Rg16Uint => Self::Rg16Uint,
735 TextureFormat::Rg16Sint => Self::Rg16Sint,
736 TextureFormat::Rg16Unorm => Self::Rg16Unorm,
737 TextureFormat::Rg16Snorm => Self::Rg16Snorm,
738 TextureFormat::Rg16Float => Self::Rg16Float,
739 TextureFormat::Rgba8Unorm => Self::Rgba8Unorm,
740 TextureFormat::Rgba8UnormSrgb => Self::Rgba8UnormSrgb,
741 TextureFormat::Rgba8Snorm => Self::Rgba8Snorm,
742 TextureFormat::Rgba8Uint => Self::Rgba8Uint,
743 TextureFormat::Rgba8Sint => Self::Rgba8Sint,
744 TextureFormat::Bgra8Unorm => Self::Bgra8Unorm,
745 TextureFormat::Bgra8UnormSrgb => Self::Bgra8UnormSrgb,
746 TextureFormat::Rgb9e5Ufloat => Self::Rgb9e5Ufloat,
747 TextureFormat::Rgb10a2Uint => Self::Rgb10a2Uint,
748 TextureFormat::Rgb10a2Unorm => Self::Rgb10a2Unorm,
749 TextureFormat::Rg11b10Ufloat => Self::Rg11b10Ufloat,
750 TextureFormat::R64Uint => Self::R64Uint,
751 TextureFormat::Rg32Uint => Self::Rg32Uint,
752 TextureFormat::Rg32Sint => Self::Rg32Sint,
753 TextureFormat::Rg32Float => Self::Rg32Float,
754 TextureFormat::Rgba16Uint => Self::Rgba16Uint,
755 TextureFormat::Rgba16Sint => Self::Rgba16Sint,
756 TextureFormat::Rgba16Unorm => Self::Rgba16Unorm,
757 TextureFormat::Rgba16Snorm => Self::Rgba16Snorm,
758 TextureFormat::Rgba16Float => Self::Rgba16Float,
759 TextureFormat::Rgba32Uint => Self::Rgba32Uint,
760 TextureFormat::Rgba32Sint => Self::Rgba32Sint,
761 TextureFormat::Rgba32Float => Self::Rgba32Float,
762 TextureFormat::Stencil8 => Self::Stencil8,
763 TextureFormat::Depth16Unorm => Self::Depth16Unorm,
764 TextureFormat::Depth24Plus => Self::Depth24Plus,
765 TextureFormat::Depth24PlusStencil8 => Self::Depth24PlusStencil8,
766 TextureFormat::Depth32Float => Self::Depth32Float,
767 TextureFormat::Depth32FloatStencil8 => Self::Depth32FloatStencil8,
768 TextureFormat::NV12 => Self::NV12,
769 TextureFormat::P010 => Self::P010,
770 TextureFormat::Bc1RgbaUnorm => Self::Bc1RgbaUnorm,
771 TextureFormat::Bc1RgbaUnormSrgb => Self::Bc1RgbaUnormSrgb,
772 TextureFormat::Bc2RgbaUnorm => Self::Bc2RgbaUnorm,
773 TextureFormat::Bc2RgbaUnormSrgb => Self::Bc2RgbaUnormSrgb,
774 TextureFormat::Bc3RgbaUnorm => Self::Bc3RgbaUnorm,
775 TextureFormat::Bc3RgbaUnormSrgb => Self::Bc3RgbaUnormSrgb,
776 TextureFormat::Bc4RUnorm => Self::Bc4RUnorm,
777 TextureFormat::Bc4RSnorm => Self::Bc4RSnorm,
778 TextureFormat::Bc5RgUnorm => Self::Bc5RgUnorm,
779 TextureFormat::Bc5RgSnorm => Self::Bc5RgSnorm,
780 TextureFormat::Bc6hRgbUfloat => Self::Bc6hRgbUfloat,
781 TextureFormat::Bc6hRgbFloat => Self::Bc6hRgbFloat,
782 TextureFormat::Bc7RgbaUnorm => Self::Bc7RgbaUnorm,
783 TextureFormat::Bc7RgbaUnormSrgb => Self::Bc7RgbaUnormSrgb,
784 TextureFormat::Etc2Rgb8Unorm => Self::Etc2Rgb8Unorm,
785 TextureFormat::Etc2Rgb8UnormSrgb => Self::Etc2Rgb8UnormSrgb,
786 TextureFormat::Etc2Rgb8A1Unorm => Self::Etc2Rgb8A1Unorm,
787 TextureFormat::Etc2Rgb8A1UnormSrgb => Self::Etc2Rgb8A1UnormSrgb,
788 TextureFormat::Etc2Rgba8Unorm => Self::Etc2Rgba8Unorm,
789 TextureFormat::Etc2Rgba8UnormSrgb => Self::Etc2Rgba8UnormSrgb,
790 TextureFormat::EacR11Unorm => Self::EacR11Unorm,
791 TextureFormat::EacR11Snorm => Self::EacR11Snorm,
792 TextureFormat::EacRg11Unorm => Self::EacRg11Unorm,
793 TextureFormat::EacRg11Snorm => Self::EacRg11Snorm,
794 TextureFormat::Astc { block, channel } => {
795 Self::Astc { block: block.into(), channel: channel.into() }
796 }
797 }
798 }
799}
800
801impl From<wgpu::TextureFormat> for TextureFormat {
802 fn from(format: wgpu::TextureFormat) -> Self {
803 match format {
804 wgpu::TextureFormat::R8Unorm => Self::R8Unorm,
805 wgpu::TextureFormat::R8Snorm => Self::R8Snorm,
806 wgpu::TextureFormat::R8Uint => Self::R8Uint,
807 wgpu::TextureFormat::R8Sint => Self::R8Sint,
808 wgpu::TextureFormat::R16Uint => Self::R16Uint,
809 wgpu::TextureFormat::R16Sint => Self::R16Sint,
810 wgpu::TextureFormat::R16Unorm => Self::R16Unorm,
811 wgpu::TextureFormat::R16Snorm => Self::R16Snorm,
812 wgpu::TextureFormat::R16Float => Self::R16Float,
813 wgpu::TextureFormat::Rg8Unorm => Self::Rg8Unorm,
814 wgpu::TextureFormat::Rg8Snorm => Self::Rg8Snorm,
815 wgpu::TextureFormat::Rg8Uint => Self::Rg8Uint,
816 wgpu::TextureFormat::Rg8Sint => Self::Rg8Sint,
817 wgpu::TextureFormat::R32Uint => Self::R32Uint,
818 wgpu::TextureFormat::R32Sint => Self::R32Sint,
819 wgpu::TextureFormat::R32Float => Self::R32Float,
820 wgpu::TextureFormat::Rg16Uint => Self::Rg16Uint,
821 wgpu::TextureFormat::Rg16Sint => Self::Rg16Sint,
822 wgpu::TextureFormat::Rg16Unorm => Self::Rg16Unorm,
823 wgpu::TextureFormat::Rg16Snorm => Self::Rg16Snorm,
824 wgpu::TextureFormat::Rg16Float => Self::Rg16Float,
825 wgpu::TextureFormat::Rgba8Unorm => Self::Rgba8Unorm,
826 wgpu::TextureFormat::Rgba8UnormSrgb => Self::Rgba8UnormSrgb,
827 wgpu::TextureFormat::Rgba8Snorm => Self::Rgba8Snorm,
828 wgpu::TextureFormat::Rgba8Uint => Self::Rgba8Uint,
829 wgpu::TextureFormat::Rgba8Sint => Self::Rgba8Sint,
830 wgpu::TextureFormat::Bgra8Unorm => Self::Bgra8Unorm,
831 wgpu::TextureFormat::Bgra8UnormSrgb => Self::Bgra8UnormSrgb,
832 wgpu::TextureFormat::Rgb9e5Ufloat => Self::Rgb9e5Ufloat,
833 wgpu::TextureFormat::Rgb10a2Uint => Self::Rgb10a2Uint,
834 wgpu::TextureFormat::Rgb10a2Unorm => Self::Rgb10a2Unorm,
835 wgpu::TextureFormat::Rg11b10Ufloat => Self::Rg11b10Ufloat,
836 wgpu::TextureFormat::R64Uint => Self::R64Uint,
837 wgpu::TextureFormat::Rg32Uint => Self::Rg32Uint,
838 wgpu::TextureFormat::Rg32Sint => Self::Rg32Sint,
839 wgpu::TextureFormat::Rg32Float => Self::Rg32Float,
840 wgpu::TextureFormat::Rgba16Uint => Self::Rgba16Uint,
841 wgpu::TextureFormat::Rgba16Sint => Self::Rgba16Sint,
842 wgpu::TextureFormat::Rgba16Unorm => Self::Rgba16Unorm,
843 wgpu::TextureFormat::Rgba16Snorm => Self::Rgba16Snorm,
844 wgpu::TextureFormat::Rgba16Float => Self::Rgba16Float,
845 wgpu::TextureFormat::Rgba32Uint => Self::Rgba32Uint,
846 wgpu::TextureFormat::Rgba32Sint => Self::Rgba32Sint,
847 wgpu::TextureFormat::Rgba32Float => Self::Rgba32Float,
848 wgpu::TextureFormat::Stencil8 => Self::Stencil8,
849 wgpu::TextureFormat::Depth16Unorm => Self::Depth16Unorm,
850 wgpu::TextureFormat::Depth24Plus => Self::Depth24Plus,
851 wgpu::TextureFormat::Depth24PlusStencil8 => Self::Depth24PlusStencil8,
852 wgpu::TextureFormat::Depth32Float => Self::Depth32Float,
853 wgpu::TextureFormat::Depth32FloatStencil8 => Self::Depth32FloatStencil8,
854 wgpu::TextureFormat::NV12 => Self::NV12,
855 wgpu::TextureFormat::P010 => Self::P010,
856 wgpu::TextureFormat::Bc1RgbaUnorm => Self::Bc1RgbaUnorm,
857 wgpu::TextureFormat::Bc1RgbaUnormSrgb => Self::Bc1RgbaUnormSrgb,
858 wgpu::TextureFormat::Bc2RgbaUnorm => Self::Bc2RgbaUnorm,
859 wgpu::TextureFormat::Bc2RgbaUnormSrgb => Self::Bc2RgbaUnormSrgb,
860 wgpu::TextureFormat::Bc3RgbaUnorm => Self::Bc3RgbaUnorm,
861 wgpu::TextureFormat::Bc3RgbaUnormSrgb => Self::Bc3RgbaUnormSrgb,
862 wgpu::TextureFormat::Bc4RUnorm => Self::Bc4RUnorm,
863 wgpu::TextureFormat::Bc4RSnorm => Self::Bc4RSnorm,
864 wgpu::TextureFormat::Bc5RgUnorm => Self::Bc5RgUnorm,
865 wgpu::TextureFormat::Bc5RgSnorm => Self::Bc5RgSnorm,
866 wgpu::TextureFormat::Bc6hRgbUfloat => Self::Bc6hRgbUfloat,
867 wgpu::TextureFormat::Bc6hRgbFloat => Self::Bc6hRgbFloat,
868 wgpu::TextureFormat::Bc7RgbaUnorm => Self::Bc7RgbaUnorm,
869 wgpu::TextureFormat::Bc7RgbaUnormSrgb => Self::Bc7RgbaUnormSrgb,
870 wgpu::TextureFormat::Etc2Rgb8Unorm => Self::Etc2Rgb8Unorm,
871 wgpu::TextureFormat::Etc2Rgb8UnormSrgb => Self::Etc2Rgb8UnormSrgb,
872 wgpu::TextureFormat::Etc2Rgb8A1Unorm => Self::Etc2Rgb8A1Unorm,
873 wgpu::TextureFormat::Etc2Rgb8A1UnormSrgb => Self::Etc2Rgb8A1UnormSrgb,
874 wgpu::TextureFormat::Etc2Rgba8Unorm => Self::Etc2Rgba8Unorm,
875 wgpu::TextureFormat::Etc2Rgba8UnormSrgb => Self::Etc2Rgba8UnormSrgb,
876 wgpu::TextureFormat::EacR11Unorm => Self::EacR11Unorm,
877 wgpu::TextureFormat::EacR11Snorm => Self::EacR11Snorm,
878 wgpu::TextureFormat::EacRg11Unorm => Self::EacRg11Unorm,
879 wgpu::TextureFormat::EacRg11Snorm => Self::EacRg11Snorm,
880 wgpu::TextureFormat::Astc { block, channel } => {
881 Self::Astc { block: block.into(), channel: channel.into() }
882 }
883 }
884 }
885}
886
887#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
888pub enum VertexFormat {
889 Uint8,
890 Uint8x2,
891 Uint8x4,
892 Sint8,
893 Sint8x2,
894 Sint8x4,
895 Unorm8,
896 Unorm8x2,
897 Unorm8x4,
898 Snorm8,
899 Snorm8x2,
900 Snorm8x4,
901 Uint16,
902 Uint16x2,
903 Uint16x4,
904 Sint16,
905 Sint16x2,
906 Sint16x4,
907 Unorm16,
908 Unorm16x2,
909 Unorm16x4,
910 Snorm16,
911 Snorm16x2,
912 Snorm16x4,
913 Float16,
914 Float16x2,
915 Float16x4,
916 Float32,
917 Float32x2,
918 Float32x3,
919 Float32x4,
920 Uint32,
921 Uint32x2,
922 Uint32x3,
923 Uint32x4,
924 Sint32,
925 Sint32x2,
926 Sint32x3,
927 Sint32x4,
928 Float64,
929 Float64x2,
930 Float64x3,
931 Float64x4,
932 Unorm10_10_10_2,
933 Unorm8x4Bgra,
934}
935
936impl From<VertexFormat> for wgpu::VertexFormat {
937 fn from(format: VertexFormat) -> Self {
938 match format {
939 VertexFormat::Uint8 => Self::Uint8,
940 VertexFormat::Uint8x2 => Self::Uint8x2,
941 VertexFormat::Uint8x4 => Self::Uint8x4,
942 VertexFormat::Sint8 => Self::Sint8,
943 VertexFormat::Sint8x2 => Self::Sint8x2,
944 VertexFormat::Sint8x4 => Self::Sint8x4,
945 VertexFormat::Unorm8 => Self::Unorm8,
946 VertexFormat::Unorm8x2 => Self::Unorm8x2,
947 VertexFormat::Unorm8x4 => Self::Unorm8x4,
948 VertexFormat::Snorm8 => Self::Snorm8,
949 VertexFormat::Snorm8x2 => Self::Snorm8x2,
950 VertexFormat::Snorm8x4 => Self::Snorm8x4,
951 VertexFormat::Uint16 => Self::Uint16,
952 VertexFormat::Uint16x2 => Self::Uint16x2,
953 VertexFormat::Uint16x4 => Self::Uint16x4,
954 VertexFormat::Sint16 => Self::Sint16,
955 VertexFormat::Sint16x2 => Self::Sint16x2,
956 VertexFormat::Sint16x4 => Self::Sint16x4,
957 VertexFormat::Unorm16 => Self::Unorm16,
958 VertexFormat::Unorm16x2 => Self::Unorm16x2,
959 VertexFormat::Unorm16x4 => Self::Unorm16x4,
960 VertexFormat::Snorm16 => Self::Snorm16,
961 VertexFormat::Snorm16x2 => Self::Snorm16x2,
962 VertexFormat::Snorm16x4 => Self::Snorm16x4,
963 VertexFormat::Float16 => Self::Float16,
964 VertexFormat::Float16x2 => Self::Float16x2,
965 VertexFormat::Float16x4 => Self::Float16x4,
966 VertexFormat::Float32 => Self::Float32,
967 VertexFormat::Float32x2 => Self::Float32x2,
968 VertexFormat::Float32x3 => Self::Float32x3,
969 VertexFormat::Float32x4 => Self::Float32x4,
970 VertexFormat::Uint32 => Self::Uint32,
971 VertexFormat::Uint32x2 => Self::Uint32x2,
972 VertexFormat::Uint32x3 => Self::Uint32x3,
973 VertexFormat::Uint32x4 => Self::Uint32x4,
974 VertexFormat::Sint32 => Self::Sint32,
975 VertexFormat::Sint32x2 => Self::Sint32x2,
976 VertexFormat::Sint32x3 => Self::Sint32x3,
977 VertexFormat::Sint32x4 => Self::Sint32x4,
978 VertexFormat::Float64 => Self::Float64,
979 VertexFormat::Float64x2 => Self::Float64x2,
980 VertexFormat::Float64x3 => Self::Float64x3,
981 VertexFormat::Float64x4 => Self::Float64x4,
982 VertexFormat::Unorm10_10_10_2 => Self::Unorm10_10_10_2,
983 VertexFormat::Unorm8x4Bgra => Self::Unorm8x4Bgra,
984 }
985 }
986}
987
988#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
989pub enum VertexStepMode {
990 Vertex,
991 Instance,
992}
993
994impl From<VertexStepMode> for wgpu::VertexStepMode {
995 fn from(mode: VertexStepMode) -> Self {
996 match mode {
997 VertexStepMode::Vertex => Self::Vertex,
998 VertexStepMode::Instance => Self::Instance,
999 }
1000 }
1001}
1002
1003#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1004pub enum Face {
1005 Front,
1006 Back,
1007}
1008
1009impl From<Face> for wgpu::Face {
1010 fn from(value: Face) -> Self {
1011 match value {
1012 Face::Front => Self::Front,
1013 Face::Back => Self::Back,
1014 }
1015 }
1016}
1017
1018#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1019pub enum PolygonMode {
1020 Fill,
1021 Line,
1022 Point,
1023}
1024
1025impl From<PolygonMode> for wgpu::PolygonMode {
1026 fn from(value: PolygonMode) -> Self {
1027 match value {
1028 PolygonMode::Fill => Self::Fill,
1029 PolygonMode::Line => Self::Line,
1030 PolygonMode::Point => Self::Point,
1031 }
1032 }
1033}
1034
1035#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1036pub enum BlendFactor {
1037 Zero,
1038 One,
1039 Src,
1040 OneMinusSrc,
1041 SrcAlpha,
1042 OneMinusSrcAlpha,
1043 Dst,
1044 OneMinusDst,
1045 DstAlpha,
1046 OneMinusDstAlpha,
1047 SrcAlphaSaturated,
1048 Constant,
1049 OneMinusConstant,
1050 Src1,
1051 OneMinusSrc1,
1052 Src1Alpha,
1053 OneMinusSrc1Alpha,
1054}
1055
1056impl From<BlendFactor> for wgpu::BlendFactor {
1057 fn from(value: BlendFactor) -> Self {
1058 match value {
1059 BlendFactor::Zero => Self::Zero,
1060 BlendFactor::One => Self::One,
1061 BlendFactor::Src => Self::Src,
1062 BlendFactor::OneMinusSrc => Self::OneMinusSrc,
1063 BlendFactor::SrcAlpha => Self::SrcAlpha,
1064 BlendFactor::OneMinusSrcAlpha => Self::OneMinusSrcAlpha,
1065 BlendFactor::Dst => Self::Dst,
1066 BlendFactor::OneMinusDst => Self::OneMinusDst,
1067 BlendFactor::DstAlpha => Self::DstAlpha,
1068 BlendFactor::OneMinusDstAlpha => Self::OneMinusDstAlpha,
1069 BlendFactor::SrcAlphaSaturated => Self::SrcAlphaSaturated,
1070 BlendFactor::Constant => Self::Constant,
1071 BlendFactor::OneMinusConstant => Self::OneMinusConstant,
1072 BlendFactor::Src1 => Self::Src1,
1073 BlendFactor::OneMinusSrc1 => Self::OneMinusSrc1,
1074 BlendFactor::Src1Alpha => Self::Src1Alpha,
1075 BlendFactor::OneMinusSrc1Alpha => Self::OneMinusSrc1Alpha,
1076 }
1077 }
1078}
1079
1080#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1081pub enum BlendOperation {
1082 Add,
1083 Subtract,
1084 ReverseSubtract,
1085 Min,
1086 Max,
1087}
1088
1089impl From<BlendOperation> for wgpu::BlendOperation {
1090 fn from(value: BlendOperation) -> Self {
1091 match value {
1092 BlendOperation::Add => Self::Add,
1093 BlendOperation::Subtract => Self::Subtract,
1094 BlendOperation::ReverseSubtract => Self::ReverseSubtract,
1095 BlendOperation::Min => Self::Min,
1096 BlendOperation::Max => Self::Max,
1097 }
1098 }
1099}
1100
1101#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1102pub enum CompareFunction {
1103 Never,
1104 Less,
1105 Equal,
1106 LessEqual,
1107 Greater,
1108 NotEqual,
1109 GreaterEqual,
1110 Always,
1111}
1112
1113impl From<CompareFunction> for wgpu::CompareFunction {
1114 fn from(value: CompareFunction) -> Self {
1115 match value {
1116 CompareFunction::Never => Self::Never,
1117 CompareFunction::Less => Self::Less,
1118 CompareFunction::Equal => Self::Equal,
1119 CompareFunction::LessEqual => Self::LessEqual,
1120 CompareFunction::Greater => Self::Greater,
1121 CompareFunction::NotEqual => Self::NotEqual,
1122 CompareFunction::GreaterEqual => Self::GreaterEqual,
1123 CompareFunction::Always => Self::Always,
1124 }
1125 }
1126}
1127
1128#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1129pub enum StencilOperation {
1130 Keep,
1131 Zero,
1132 Replace,
1133 Invert,
1134 IncrementClamp,
1135 DecrementClamp,
1136 IncrementWrap,
1137 DecrementWrap,
1138}
1139
1140impl From<StencilOperation> for wgpu::StencilOperation {
1141 fn from(value: StencilOperation) -> Self {
1142 match value {
1143 StencilOperation::Keep => Self::Keep,
1144 StencilOperation::Zero => Self::Zero,
1145 StencilOperation::Replace => Self::Replace,
1146 StencilOperation::Invert => Self::Invert,
1147 StencilOperation::IncrementClamp => Self::IncrementClamp,
1148 StencilOperation::DecrementClamp => Self::DecrementClamp,
1149 StencilOperation::IncrementWrap => Self::IncrementWrap,
1150 StencilOperation::DecrementWrap => Self::DecrementWrap,
1151 }
1152 }
1153}
1154
1155#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1156pub enum TextureSampleType {
1157 Float { filterable: bool },
1158 Depth,
1159 Sint,
1160 Uint,
1161}
1162
1163impl From<TextureSampleType> for wgpu::TextureSampleType {
1164 fn from(value: TextureSampleType) -> Self {
1165 match value {
1166 TextureSampleType::Float { filterable } => Self::Float { filterable },
1167 TextureSampleType::Depth => Self::Depth,
1168 TextureSampleType::Sint => Self::Sint,
1169 TextureSampleType::Uint => Self::Uint,
1170 }
1171 }
1172}
1173
1174#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1175pub enum TextureViewDimension {
1176 D1,
1177 D2,
1178 D2Array,
1179 Cube,
1180 CubeArray,
1181 D3,
1182}
1183
1184impl From<TextureViewDimension> for wgpu::TextureViewDimension {
1185 fn from(value: TextureViewDimension) -> Self {
1186 match value {
1187 TextureViewDimension::D1 => Self::D1,
1188 TextureViewDimension::D2 => Self::D2,
1189 TextureViewDimension::D2Array => Self::D2Array,
1190 TextureViewDimension::Cube => Self::Cube,
1191 TextureViewDimension::CubeArray => Self::CubeArray,
1192 TextureViewDimension::D3 => Self::D3,
1193 }
1194 }
1195}
1196
1197#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1198pub enum StorageTextureAccess {
1199 WriteOnly,
1200 ReadOnly,
1201 ReadWrite,
1202 Atomic,
1203}
1204
1205impl From<StorageTextureAccess> for wgpu::StorageTextureAccess {
1206 fn from(value: StorageTextureAccess) -> Self {
1207 match value {
1208 StorageTextureAccess::WriteOnly => Self::WriteOnly,
1209 StorageTextureAccess::ReadOnly => Self::ReadOnly,
1210 StorageTextureAccess::ReadWrite => Self::ReadWrite,
1211 StorageTextureAccess::Atomic => Self::Atomic,
1212 }
1213 }
1214}
1215
1216#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
1217pub enum IndexFormat {
1218 Uint16,
1219 Uint32,
1220}
1221
1222impl From<IndexFormat> for wgpu::IndexFormat {
1223 fn from(format: IndexFormat) -> Self {
1224 match format {
1225 IndexFormat::Uint16 => Self::Uint16,
1226 IndexFormat::Uint32 => Self::Uint32,
1227 }
1228 }
1229}
1230
1231#[cfg(test)]
1232mod tests {
1233 use super::*;
1234
1235 #[test]
1236 fn cursor_icon_conversion_is_positional_not_coincidental() {
1237 assert_eq!(winit::window::CursorIcon::from(CursorIcon::Default), winit::window::CursorIcon::Default);
1238 assert_eq!(winit::window::CursorIcon::from(CursorIcon::Pointer), winit::window::CursorIcon::Pointer);
1239 assert_eq!(winit::window::CursorIcon::from(CursorIcon::NwseResize), winit::window::CursorIcon::NwseResize);
1240 assert_eq!(winit::window::CursorIcon::from(CursorIcon::AllResize), winit::window::CursorIcon::AllResize);
1241 }
1242
1243 #[test]
1244 fn cursor_grab_mode_conversion_round_trips() {
1245 assert_eq!(winit::window::CursorGrabMode::from(CursorGrabMode::None), winit::window::CursorGrabMode::None);
1246 assert_eq!(winit::window::CursorGrabMode::from(CursorGrabMode::Confined), winit::window::CursorGrabMode::Confined);
1247 assert_eq!(winit::window::CursorGrabMode::from(CursorGrabMode::Locked), winit::window::CursorGrabMode::Locked);
1248 }
1249
1250 #[test]
1251 fn key_code_conversion_is_positional_not_coincidental() {
1252 assert_eq!(winit::keyboard::KeyCode::from(KeyCode::Backquote), winit::keyboard::KeyCode::Backquote);
1253 assert_eq!(winit::keyboard::KeyCode::from(KeyCode::KeyW), winit::keyboard::KeyCode::KeyW);
1254 assert_eq!(winit::keyboard::KeyCode::from(KeyCode::ArrowUp), winit::keyboard::KeyCode::ArrowUp);
1255 assert_eq!(winit::keyboard::KeyCode::from(KeyCode::ShiftLeft), winit::keyboard::KeyCode::ShiftLeft);
1256 assert_eq!(winit::keyboard::KeyCode::from(KeyCode::F35), winit::keyboard::KeyCode::F35);
1257 }
1258
1259 #[test]
1260 fn mouse_button_conversion_preserves_the_other_code() {
1261 assert_eq!(winit::event::MouseButton::from(MouseButton::Left), winit::event::MouseButton::Left);
1262 assert_eq!(winit::event::MouseButton::from(MouseButton::Other(7)), winit::event::MouseButton::Other(7));
1263 }
1264
1265 #[test]
1266 fn touch_phase_conversion_is_positional() {
1267 assert_eq!(TouchPhase::from(winit::event::TouchPhase::Started), TouchPhase::Started);
1268 assert_eq!(TouchPhase::from(winit::event::TouchPhase::Cancelled), TouchPhase::Cancelled);
1269 }
1270
1271 #[test]
1272 fn texture_format_round_trips_including_astc() {
1273 let astc = TextureFormat::Astc { block: AstcBlock::B4x4, channel: AstcChannel::Hdr };
1274 let raw = wgpu::TextureFormat::from(astc);
1275 assert_eq!(TextureFormat::from(raw), astc);
1276 assert_eq!(wgpu::TextureFormat::from(TextureFormat::Bgra8UnormSrgb), wgpu::TextureFormat::Bgra8UnormSrgb);
1277 }
1278
1279 #[test]
1280 fn index_format_conversion_round_trips() {
1281 assert_eq!(wgpu::IndexFormat::from(IndexFormat::Uint16), wgpu::IndexFormat::Uint16);
1282 assert_eq!(wgpu::IndexFormat::from(IndexFormat::Uint32), wgpu::IndexFormat::Uint32);
1283 }
1284}