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
// Generated by `scripts/generate.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 vulkan::vk::*;
use vulkan::vk::{VkStructureType,RawVkStructureType};
use vulkan::vk::{VkSemaphore,RawVkSemaphore};
use vulkan::vk::{VkPipelineStageFlags,RawVkPipelineStageFlags};
use vulkan::vk::{VkCommandBuffer,RawVkCommandBuffer};

/// Wrapper for [VkSubmitInfo](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkSubmitInfo.html)
#[derive(Debug, Clone)]
pub struct VkSubmitInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g>
    where
        'b: 'a,
        'e: 'd,
        'g: 'f,
{
    pub wait_semaphores: &'a [&'b VkSemaphore],
    pub wait_dst_stage_mask: &'c [VkPipelineStageFlags],
    pub command_buffers: &'d [&'e VkCommandBuffer],
    pub signal_semaphores: &'f [&'g VkSemaphore],
}

#[doc(hidden)]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RawVkSubmitInfo {
    pub s_type: RawVkStructureType,
    pub next: *const c_void,
    pub wait_semaphore_count: u32,
    pub wait_semaphores: *mut RawVkSemaphore,
    pub wait_dst_stage_mask: *mut RawVkPipelineStageFlags,
    pub command_buffer_count: u32,
    pub command_buffers: *mut RawVkCommandBuffer,
    pub signal_semaphore_count: u32,
    pub signal_semaphores: *mut RawVkSemaphore,
}

impl<'a, 'b, 'c, 'd, 'e, 'f, 'g> VkWrappedType<RawVkSubmitInfo> for VkSubmitInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g>
    where
        'b: 'a,
        'e: 'd,
        'g: 'f,
{
    fn vk_to_raw(src: &VkSubmitInfo, dst: &mut RawVkSubmitInfo) {
        dst.s_type = vk_to_raw_value(&VkStructureType::SubmitInfo);
        dst.next = ptr::null();
        dst.wait_semaphore_count = cmp::max(src.wait_semaphores.len(), src.wait_dst_stage_mask.len()) as u32;
        dst.wait_semaphores = new_ptr_vk_array_from_ref(src.wait_semaphores);
        dst.wait_dst_stage_mask = new_ptr_vk_array(src.wait_dst_stage_mask);
        dst.command_buffer_count = src.command_buffers.len() as u32;
        dst.command_buffers = new_ptr_vk_array_from_ref(src.command_buffers);
        dst.signal_semaphore_count = src.signal_semaphores.len() as u32;
        dst.signal_semaphores = new_ptr_vk_array_from_ref(src.signal_semaphores);
    }
}

impl Default for VkSubmitInfo<'static, 'static, 'static, 'static, 'static, 'static, 'static> {
    fn default() -> VkSubmitInfo<'static, 'static, 'static, 'static, 'static, 'static, 'static> {
        VkSubmitInfo {
            wait_semaphores: &[],
            wait_dst_stage_mask: &[],
            command_buffers: &[],
            signal_semaphores: &[],
        }
    }
}

impl<'a, 'b, 'c, 'd, 'e, 'f, 'g> VkSetup for VkSubmitInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g>
    where
        'b: 'a,
        'e: 'd,
        'g: 'f,
{
    fn vk_setup(&mut self, fn_table: *mut VkInstanceFunctionTable, instance: RawVkInstance, device: RawVkDevice) {
        
    }
}

impl VkFree for RawVkSubmitInfo {
    fn vk_free(&mut self) {
        free_ptr(self.wait_semaphores);
        free_ptr(self.wait_dst_stage_mask);
        free_ptr(self.command_buffers);
        free_ptr(self.signal_semaphores);
    }
}