lava/vulkan/vk/
vk_buffer_view.rs

1// Generated by `scripts/generate.js`
2
3use utils::c_bindings::*;
4use utils::vk_traits::*;
5use utils::vk_ptr::*;
6use utils::vk_convert::*;
7use std::os::raw::c_char;
8use std::ops::Drop;
9use std::ptr;
10use std::mem;
11use std::cmp;
12use std::slice;
13use vulkan::*;
14use vulkan::vk::*;
15
16#[doc(hidden)]
17pub type RawVkBufferView = u64;
18
19/// Wrapper for [VkBufferView](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkBufferView.html).
20#[derive(Debug, Clone, Copy)]
21pub struct VkBufferView {
22    _handle: RawVkBufferView,
23    _fn_table: *mut VkFunctionTable
24}
25
26impl VkRawType<VkBufferView> for RawVkBufferView {
27    fn vk_to_wrapped(src: &RawVkBufferView) -> VkBufferView {
28        VkBufferView {
29            _handle: *src,
30            _fn_table: ptr::null_mut()
31        }
32    }
33}
34
35impl VkWrappedType<RawVkBufferView> for VkBufferView {
36    fn vk_to_raw(src: &VkBufferView, dst: &mut RawVkBufferView) {
37        *dst = src._handle
38    }
39}
40
41impl Default for VkBufferView {
42    fn default() -> VkBufferView {
43        VkBufferView {
44            _handle: 0,
45            _fn_table: ptr::null_mut()
46        }
47    }
48}
49
50impl PartialEq for VkBufferView {
51    fn eq(&self, other: &VkBufferView) -> bool {
52        self._handle == other._handle
53    }
54}
55
56impl VkSetup for VkBufferView {
57    fn vk_setup(&mut self, fn_table: *mut VkFunctionTable) {
58        self._fn_table = fn_table;
59    }
60}
61
62impl VkBufferView {
63    
64    /// Returns the internal Vulkan handle for the object.
65    pub fn vk_handle(&self) -> u64 {
66        self._handle
67    }
68    
69    /// Indicates if the Vulkan internal handle for this object is 0.
70    pub fn is_null(&self) -> bool {
71        self._handle == 0
72    }
73    
74    /// Creates an object with a null Vulkan internal handle.
75    ///
76    /// Calling a method with a null handle will most likely result in a crash.
77    pub fn null() -> Self {
78        Self {
79            _handle: 0,
80            _fn_table: ptr::null_mut()
81        }
82    }
83    
84    /// Wrapper for [vkDestroyBufferView](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkDestroyBufferView.html).
85    pub fn destroy(&self) {
86        unsafe {
87            ((&*self._fn_table).vkDestroyBufferView)((*self._fn_table).device, self._handle, ptr::null());
88        }
89    }
90}