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
// Generated by `scripts/generate.js`

use utils::vk_traits::*;

/// Wrapper for [VkSwapchainCreateFlagBitsKHR](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkSwapchainCreateFlagBitsKHR.html)
#[derive(Debug, Clone, Copy)]
pub struct VkSwapchainCreateFlags {
    pub split_instance_bind_regions: bool,
    pub protected: bool,
    pub mutable_format: bool,
}

#[doc(hidden)]
pub type RawVkSwapchainCreateFlags = u32;

impl VkWrappedType<RawVkSwapchainCreateFlags> for VkSwapchainCreateFlags {
    fn vk_to_raw(src: &VkSwapchainCreateFlags, dst: &mut RawVkSwapchainCreateFlags) {
        *dst = 0;
        if src.split_instance_bind_regions { *dst |= 0x00000001; }
        if src.protected { *dst |= 0x00000002; }
        if src.mutable_format { *dst |= 0x00000004; }
    }
}

impl VkRawType<VkSwapchainCreateFlags> for RawVkSwapchainCreateFlags {
    fn vk_to_wrapped(src: &RawVkSwapchainCreateFlags) -> VkSwapchainCreateFlags {
        VkSwapchainCreateFlags {
            split_instance_bind_regions: (src & 0x00000001) != 0,
            protected: (src & 0x00000002) != 0,
            mutable_format: (src & 0x00000004) != 0,
        }
    }
}

impl Default for VkSwapchainCreateFlags {
    fn default() -> VkSwapchainCreateFlags {
        VkSwapchainCreateFlags {
            split_instance_bind_regions: false,
            protected: false,
            mutable_format: false,
        }
    }
}

impl VkSwapchainCreateFlags {
    
    pub fn none() -> VkSwapchainCreateFlags {
        VkSwapchainCreateFlags {
            split_instance_bind_regions: false,
            protected: false,
            mutable_format: false,
        }
    }
    
    pub fn all() -> VkSwapchainCreateFlags {
        VkSwapchainCreateFlags {
            split_instance_bind_regions: true,
            protected: true,
            mutable_format: true,
        }
    }
}

#[macro_export]
macro_rules! VkSwapchainCreateFlags {
    ( $( $x:ident ),* ) => {
        VkSwapchainCreateFlags {
            $($x: true,)*
            ..VkSwapchainCreateFlags::none()
        }
    }
}

impl VkSwapchainCreateFlags {
    
    pub fn to_u32(&self) -> u32 {
        0
        + if self.split_instance_bind_regions { 0x00000001 } else { 0 }
        + if self.protected { 0x00000002 } else { 0 }
        + if self.mutable_format { 0x00000004 } else { 0 }
    }
}