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
use utils::vk_traits::*;
pub type RawVkMemoryPropertyFlags = u32;
#[derive(Debug, Clone, Copy)]
pub struct VkMemoryPropertyFlags {
pub device_local: bool,
pub host_visible: bool,
pub host_coherent: bool,
pub host_cached: bool,
pub lazily_allocated: bool,
pub protected: bool,
}
impl VkRawType<VkMemoryPropertyFlags> for RawVkMemoryPropertyFlags {
fn vk_to_wrapped(src: &RawVkMemoryPropertyFlags) -> VkMemoryPropertyFlags {
VkMemoryPropertyFlags {
device_local: (src & 0x00000001) != 0,
host_visible: (src & 0x00000002) != 0,
host_coherent: (src & 0x00000004) != 0,
host_cached: (src & 0x00000008) != 0,
lazily_allocated: (src & 0x00000010) != 0,
protected: (src & 0x00000020) != 0,
}
}
}
impl VkWrappedType<RawVkMemoryPropertyFlags> for VkMemoryPropertyFlags {
fn vk_to_raw(src: &VkMemoryPropertyFlags, dst: &mut RawVkMemoryPropertyFlags) {
*dst = 0;
if src.device_local { *dst |= 0x00000001; }
if src.host_visible { *dst |= 0x00000002; }
if src.host_coherent { *dst |= 0x00000004; }
if src.host_cached { *dst |= 0x00000008; }
if src.lazily_allocated { *dst |= 0x00000010; }
if src.protected { *dst |= 0x00000020; }
}
}
impl Default for VkMemoryPropertyFlags {
fn default() -> VkMemoryPropertyFlags {
VkMemoryPropertyFlags {
device_local: false,
host_visible: false,
host_coherent: false,
host_cached: false,
lazily_allocated: false,
protected: false,
}
}
}
impl VkMemoryPropertyFlags {
pub fn none() -> VkMemoryPropertyFlags {
VkMemoryPropertyFlags {
device_local: false,
host_visible: false,
host_coherent: false,
host_cached: false,
lazily_allocated: false,
protected: false,
}
}
pub fn all() -> VkMemoryPropertyFlags {
VkMemoryPropertyFlags {
device_local: true,
host_visible: true,
host_coherent: true,
host_cached: true,
lazily_allocated: true,
protected: true,
}
}
}