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