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
use utils::c_bindings::*;
use utils::vk_traits::*;
use utils::vk_ptr::*;
use utils::vk_convert::*;
use std::os::raw::c_char;
use std::ops::Drop;
use std::ptr;
use std::mem;
use std::cmp;
use std::slice;
use vulkan::*;
use vulkan::vk::*;
#[doc(hidden)]
pub type RawVkRenderPass = u64;
#[derive(Debug, Clone, Copy)]
pub struct VkRenderPass {
_handle: RawVkRenderPass,
_fn_table: *mut VkFunctionTable
}
impl VkRawType<VkRenderPass> for RawVkRenderPass {
fn vk_to_wrapped(src: &RawVkRenderPass) -> VkRenderPass {
VkRenderPass {
_handle: *src,
_fn_table: ptr::null_mut()
}
}
}
impl VkWrappedType<RawVkRenderPass> for VkRenderPass {
fn vk_to_raw(src: &VkRenderPass, dst: &mut RawVkRenderPass) {
*dst = src._handle
}
}
impl Default for VkRenderPass {
fn default() -> VkRenderPass {
VkRenderPass {
_handle: 0,
_fn_table: ptr::null_mut()
}
}
}
impl PartialEq for VkRenderPass {
fn eq(&self, other: &VkRenderPass) -> bool {
self._handle == other._handle
}
}
impl VkSetup for VkRenderPass {
fn vk_setup(&mut self, fn_table: *mut VkFunctionTable) {
self._fn_table = fn_table;
}
}
impl VkRenderPass {
pub fn vk_handle(&self) -> u64 {
self._handle
}
pub fn is_null(&self) -> bool {
self._handle == 0
}
pub fn null() -> Self {
Self {
_handle: 0,
_fn_table: ptr::null_mut()
}
}
pub fn destroy(&self) {
unsafe {
((&*self._fn_table).vkDestroyRenderPass)((*self._fn_table).device, self._handle, ptr::null());
}
}
pub fn get_render_area_granularity(&self) -> VkExtent2D {
unsafe {
let raw_granularity = &mut mem::zeroed() as *mut RawVkExtent2D;
((&*self._fn_table).vkGetRenderAreaGranularity)((*self._fn_table).device, self._handle, raw_granularity);
let mut granularity = new_vk_value(raw_granularity);
let fn_table = self._fn_table;
VkSetup::vk_setup(&mut granularity, fn_table);
granularity
}
}
}