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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// Generated by `scripts/generate_vk.js`

use utils::vk_traits::*;

pub type RawVkAccessFlags = u32;

#[derive(Debug, Clone, Copy)]
pub struct VkAccessFlags {
    pub indirect_command_read: bool,
    pub index_read: bool,
    pub vertex_attribute_read: bool,
    pub uniform_read: bool,
    pub input_attachment_read: bool,
    pub shader_read: bool,
    pub shader_write: bool,
    pub color_attachment_read: bool,
    pub color_attachment_write: bool,
    pub depth_stencil_attachment_read: bool,
    pub depth_stencil_attachment_write: bool,
    pub transfer_read: bool,
    pub transfer_write: bool,
    pub host_read: bool,
    pub host_write: bool,
    pub memory_read: bool,
    pub memory_write: bool,
    pub conditional_rendering_read_ext: bool,
    pub command_process_read_nvx: bool,
    pub command_process_write_nvx: bool,
    pub color_attachment_read_noncoherent_ext: bool,
}

impl VkRawType<VkAccessFlags> for RawVkAccessFlags {
    fn vk_to_wrapped(src: &RawVkAccessFlags) -> VkAccessFlags {
        VkAccessFlags {
            indirect_command_read: (src & 0x00000001) != 0,
            index_read: (src & 0x00000002) != 0,
            vertex_attribute_read: (src & 0x00000004) != 0,
            uniform_read: (src & 0x00000008) != 0,
            input_attachment_read: (src & 0x00000010) != 0,
            shader_read: (src & 0x00000020) != 0,
            shader_write: (src & 0x00000040) != 0,
            color_attachment_read: (src & 0x00000080) != 0,
            color_attachment_write: (src & 0x00000100) != 0,
            depth_stencil_attachment_read: (src & 0x00000200) != 0,
            depth_stencil_attachment_write: (src & 0x00000400) != 0,
            transfer_read: (src & 0x00000800) != 0,
            transfer_write: (src & 0x00001000) != 0,
            host_read: (src & 0x00002000) != 0,
            host_write: (src & 0x00004000) != 0,
            memory_read: (src & 0x00008000) != 0,
            memory_write: (src & 0x00010000) != 0,
            conditional_rendering_read_ext: (src & 0x00100000) != 0,
            command_process_read_nvx: (src & 0x00020000) != 0,
            command_process_write_nvx: (src & 0x00040000) != 0,
            color_attachment_read_noncoherent_ext: (src & 0x00080000) != 0,
        }
    }
}

impl VkWrappedType<RawVkAccessFlags> for VkAccessFlags {
    fn vk_to_raw(src: &VkAccessFlags, dst: &mut RawVkAccessFlags) {
        *dst = 0;
        if src.indirect_command_read { *dst |= 0x00000001; }
        if src.index_read { *dst |= 0x00000002; }
        if src.vertex_attribute_read { *dst |= 0x00000004; }
        if src.uniform_read { *dst |= 0x00000008; }
        if src.input_attachment_read { *dst |= 0x00000010; }
        if src.shader_read { *dst |= 0x00000020; }
        if src.shader_write { *dst |= 0x00000040; }
        if src.color_attachment_read { *dst |= 0x00000080; }
        if src.color_attachment_write { *dst |= 0x00000100; }
        if src.depth_stencil_attachment_read { *dst |= 0x00000200; }
        if src.depth_stencil_attachment_write { *dst |= 0x00000400; }
        if src.transfer_read { *dst |= 0x00000800; }
        if src.transfer_write { *dst |= 0x00001000; }
        if src.host_read { *dst |= 0x00002000; }
        if src.host_write { *dst |= 0x00004000; }
        if src.memory_read { *dst |= 0x00008000; }
        if src.memory_write { *dst |= 0x00010000; }
        if src.conditional_rendering_read_ext { *dst |= 0x00100000; }
        if src.command_process_read_nvx { *dst |= 0x00020000; }
        if src.command_process_write_nvx { *dst |= 0x00040000; }
        if src.color_attachment_read_noncoherent_ext { *dst |= 0x00080000; }
    }
}

impl Default for VkAccessFlags {
    fn default() -> VkAccessFlags {
        VkAccessFlags {
            indirect_command_read: false,
            index_read: false,
            vertex_attribute_read: false,
            uniform_read: false,
            input_attachment_read: false,
            shader_read: false,
            shader_write: false,
            color_attachment_read: false,
            color_attachment_write: false,
            depth_stencil_attachment_read: false,
            depth_stencil_attachment_write: false,
            transfer_read: false,
            transfer_write: false,
            host_read: false,
            host_write: false,
            memory_read: false,
            memory_write: false,
            conditional_rendering_read_ext: false,
            command_process_read_nvx: false,
            command_process_write_nvx: false,
            color_attachment_read_noncoherent_ext: false,
        }
    }
}

impl VkAccessFlags {
    
    pub fn none() -> VkAccessFlags {
        VkAccessFlags {
            indirect_command_read: false,
            index_read: false,
            vertex_attribute_read: false,
            uniform_read: false,
            input_attachment_read: false,
            shader_read: false,
            shader_write: false,
            color_attachment_read: false,
            color_attachment_write: false,
            depth_stencil_attachment_read: false,
            depth_stencil_attachment_write: false,
            transfer_read: false,
            transfer_write: false,
            host_read: false,
            host_write: false,
            memory_read: false,
            memory_write: false,
            conditional_rendering_read_ext: false,
            command_process_read_nvx: false,
            command_process_write_nvx: false,
            color_attachment_read_noncoherent_ext: false,
        }
    }
    
    pub fn all() -> VkAccessFlags {
        VkAccessFlags {
            indirect_command_read: true,
            index_read: true,
            vertex_attribute_read: true,
            uniform_read: true,
            input_attachment_read: true,
            shader_read: true,
            shader_write: true,
            color_attachment_read: true,
            color_attachment_write: true,
            depth_stencil_attachment_read: true,
            depth_stencil_attachment_write: true,
            transfer_read: true,
            transfer_write: true,
            host_read: true,
            host_write: true,
            memory_read: true,
            memory_write: true,
            conditional_rendering_read_ext: true,
            command_process_read_nvx: true,
            command_process_write_nvx: true,
            color_attachment_read_noncoherent_ext: true,
        }
    }
}