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

use std::os::raw::c_char;
use std::ops::Deref;
use std::ptr;
use std::cmp;
use std::mem;
use utils::c_bindings::*;
use utils::vk_convert::*;
use utils::vk_null::*;
use utils::vk_ptr::*;
use utils::vk_traits::*;
use vk::vk_instance_function_table::*;
use vk::vk_instance::*;
use vk::vk_device::*;
use vk::vk_structure_type::*;
use vk::vk_image_create_flags::*;
use vk::vk_image_type::*;
use vk::vk_format::*;
use vk::vk_extent_3d::*;
use vk::vk_sample_count_flags::*;
use vk::vk_image_tiling::*;
use vk::vk_image_usage_flags::*;
use vk::vk_sharing_mode::*;
use vk::vk_image_layout::*;

#[repr(C)]
pub struct RawVkImageCreateInfo {
    s_type: RawVkStructureType,
    next: *const c_void,
    flags: RawVkImageCreateFlags,
    image_type: RawVkImageType,
    format: RawVkFormat,
    extent: RawVkExtent3D,
    mip_levels: u32,
    array_layers: u32,
    samples: RawVkSampleCountFlags,
    tiling: RawVkImageTiling,
    usage: RawVkImageUsageFlags,
    sharing_mode: RawVkSharingMode,
    queue_family_index_count: u32,
    queue_family_indices: *mut u32,
    initial_layout: RawVkImageLayout,
}

#[derive(Debug, Clone)]
pub struct VkImageCreateInfo<'a> {
    pub flags: VkImageCreateFlags,
    pub image_type: VkImageType,
    pub format: VkFormat,
    pub extent: VkExtent3D,
    pub mip_levels: usize,
    pub array_layers: usize,
    pub samples: VkSampleCountFlags,
    pub tiling: VkImageTiling,
    pub usage: VkImageUsageFlags,
    pub sharing_mode: VkSharingMode,
    pub queue_family_indices: &'a [usize],
    pub initial_layout: VkImageLayout,
}

impl<'a> VkWrappedType<RawVkImageCreateInfo> for VkImageCreateInfo<'a> {
    fn vk_to_raw(src: &VkImageCreateInfo, dst: &mut RawVkImageCreateInfo) {
        dst.s_type = vk_to_raw_value(&VkStructureType::ImageCreateInfo);
        dst.next = ptr::null();
        dst.flags = vk_to_raw_value(&src.flags);
        dst.image_type = vk_to_raw_value(&src.image_type);
        dst.format = vk_to_raw_value(&src.format);
        dst.extent = vk_to_raw_value(&src.extent);
        dst.mip_levels = vk_to_raw_value(&src.mip_levels);
        dst.array_layers = vk_to_raw_value(&src.array_layers);
        dst.samples = vk_to_raw_value(&src.samples);
        dst.tiling = vk_to_raw_value(&src.tiling);
        dst.usage = vk_to_raw_value(&src.usage);
        dst.sharing_mode = vk_to_raw_value(&src.sharing_mode);
        dst.queue_family_index_count = src.queue_family_indices.len() as u32;
        dst.queue_family_indices = new_ptr_vk_array(src.queue_family_indices);
        dst.initial_layout = vk_to_raw_value(&src.initial_layout);
    }
}

impl Default for VkImageCreateInfo<'static> {
    fn default() -> VkImageCreateInfo<'static> {
        VkImageCreateInfo {
            flags: VkImageCreateFlags::default(),
            image_type: VkImageType::default(),
            format: VkFormat::default(),
            extent: VkExtent3D::default(),
            mip_levels: 0,
            array_layers: 0,
            samples: VkSampleCountFlags::default(),
            tiling: VkImageTiling::default(),
            usage: VkImageUsageFlags::default(),
            sharing_mode: VkSharingMode::default(),
            queue_family_indices: &[],
            initial_layout: VkImageLayout::default(),
        }
    }
}

impl<'a> VkSetup for VkImageCreateInfo<'a> {
    fn vk_setup(&mut self, fn_table: *mut VkInstanceFunctionTable, instance: RawVkInstance, device: RawVkDevice) {
        VkSetup::vk_setup(&mut self.extent, fn_table, instance, device);
    }
}

impl VkFree for RawVkImageCreateInfo {
    fn vk_free(&mut self) {
        RawVkExtent3D::vk_free(&mut self.extent);
        free_ptr(self.queue_family_indices);
    }
}