1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
use utils::vk_traits::*;
#[derive(Debug, Clone, Copy)]
pub struct VkDisplayPlaneAlphaFlags {
pub opaque: bool,
pub global: bool,
pub per_pixel: bool,
pub per_pixel_premultiplied: bool,
}
#[doc(hidden)]
pub type RawVkDisplayPlaneAlphaFlags = u32;
impl VkWrappedType<RawVkDisplayPlaneAlphaFlags> for VkDisplayPlaneAlphaFlags {
fn vk_to_raw(src: &VkDisplayPlaneAlphaFlags, dst: &mut RawVkDisplayPlaneAlphaFlags) {
*dst = 0;
if src.opaque { *dst |= 0x00000001; }
if src.global { *dst |= 0x00000002; }
if src.per_pixel { *dst |= 0x00000004; }
if src.per_pixel_premultiplied { *dst |= 0x00000008; }
}
}
impl VkRawType<VkDisplayPlaneAlphaFlags> for RawVkDisplayPlaneAlphaFlags {
fn vk_to_wrapped(src: &RawVkDisplayPlaneAlphaFlags) -> VkDisplayPlaneAlphaFlags {
VkDisplayPlaneAlphaFlags {
opaque: (src & 0x00000001) != 0,
global: (src & 0x00000002) != 0,
per_pixel: (src & 0x00000004) != 0,
per_pixel_premultiplied: (src & 0x00000008) != 0,
}
}
}
impl Default for VkDisplayPlaneAlphaFlags {
fn default() -> VkDisplayPlaneAlphaFlags {
VkDisplayPlaneAlphaFlags {
opaque: false,
global: false,
per_pixel: false,
per_pixel_premultiplied: false,
}
}
}
impl VkDisplayPlaneAlphaFlags {
pub fn none() -> Self {
VkDisplayPlaneAlphaFlags {
opaque: false,
global: false,
per_pixel: false,
per_pixel_premultiplied: false,
}
}
pub fn all() -> Self {
VkDisplayPlaneAlphaFlags {
opaque: true,
global: true,
per_pixel: true,
per_pixel_premultiplied: true,
}
}
pub fn to_u32(&self) -> u32 {
0
+ if self.opaque { 0x00000001 } else { 0 }
+ if self.global { 0x00000002 } else { 0 }
+ if self.per_pixel { 0x00000004 } else { 0 }
+ if self.per_pixel_premultiplied { 0x00000008 } else { 0 }
}
pub fn from_u32(value: u32) -> Self {
VkDisplayPlaneAlphaFlags {
opaque: value & 0x00000001 > 0,
global: value & 0x00000002 > 0,
per_pixel: value & 0x00000004 > 0,
per_pixel_premultiplied: value & 0x00000008 > 0,
}
}
}
#[doc(hidden)]
#[macro_export]
macro_rules! VkDisplayPlaneAlphaFlags {
( $( $x:ident ),* ) => {
VkDisplayPlaneAlphaFlags {
$($x: true,)*
..VkDisplayPlaneAlphaFlags::none()
}
}
}