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
// 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::{VkDescriptorType,RawVkDescriptorType};
use vulkan::vk::{VkShaderStageFlags,RawVkShaderStageFlags};
use vulkan::vk::{VkSampler,RawVkSampler};

/// Wrapper for [VkDescriptorSetLayoutBinding](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkDescriptorSetLayoutBinding.html).
#[derive(Debug, Clone)]
pub struct VkDescriptorSetLayoutBinding {
    pub binding: usize,
    pub descriptor_type: VkDescriptorType,
    pub descriptor_count: usize,
    pub stage_flags: VkShaderStageFlags,
    pub immutable_samplers: Option<Vec<VkSampler>>,
}

#[doc(hidden)]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RawVkDescriptorSetLayoutBinding {
    pub binding: u32,
    pub descriptor_type: RawVkDescriptorType,
    pub descriptor_count: u32,
    pub stage_flags: RawVkShaderStageFlags,
    pub immutable_samplers: *mut RawVkSampler,
}

impl VkWrappedType<RawVkDescriptorSetLayoutBinding> for VkDescriptorSetLayoutBinding {
    fn vk_to_raw(src: &VkDescriptorSetLayoutBinding, dst: &mut RawVkDescriptorSetLayoutBinding) {
        dst.binding = vk_to_raw_value(&src.binding);
        dst.descriptor_type = vk_to_raw_value(&src.descriptor_type);
        dst.descriptor_count = vk_to_raw_value(&src.descriptor_count);
        dst.stage_flags = vk_to_raw_value(&src.stage_flags);
        dst.immutable_samplers = new_ptr_vk_array_checked(&src.immutable_samplers);
    }
}

impl VkRawType<VkDescriptorSetLayoutBinding> for RawVkDescriptorSetLayoutBinding {
    fn vk_to_wrapped(src: &RawVkDescriptorSetLayoutBinding) -> VkDescriptorSetLayoutBinding {
        VkDescriptorSetLayoutBinding {
            binding: u32::vk_to_wrapped(&src.binding),
            descriptor_type: RawVkDescriptorType::vk_to_wrapped(&src.descriptor_type),
            descriptor_count: u32::vk_to_wrapped(&src.descriptor_count),
            stage_flags: RawVkShaderStageFlags::vk_to_wrapped(&src.stage_flags),
            immutable_samplers: new_vk_array_checked(src.descriptor_count, src.immutable_samplers),
        }
    }
}

impl Default for VkDescriptorSetLayoutBinding {
    fn default() -> VkDescriptorSetLayoutBinding {
        VkDescriptorSetLayoutBinding {
            binding: 0,
            descriptor_type: Default::default(),
            descriptor_count: 0,
            stage_flags: Default::default(),
            immutable_samplers: None,
        }
    }
}

impl VkSetup for VkDescriptorSetLayoutBinding {
    fn vk_setup(&mut self, fn_table: *mut VkFunctionTable) {
        
    }
}

impl VkFree for RawVkDescriptorSetLayoutBinding {
    fn vk_free(&self) {
        free_ptr(self.immutable_samplers);
    }
}