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