Beauty cleanup

This commit is contained in:
maik klein 2016-12-09 01:58:24 +01:00
parent f10e00eea2
commit 488d2392ce
2 changed files with 17 additions and 1 deletions

View file

@ -100,6 +100,7 @@ impl<'r> Device<'r> {
self.device_fn.destroy_semaphore(self.handle, semaphore, ptr::null()); self.device_fn.destroy_semaphore(self.handle, semaphore, ptr::null());
} }
} }
pub fn device_wait_idle(&self) -> VkResult<()> { pub fn device_wait_idle(&self) -> VkResult<()> {
unsafe { unsafe {
let err_code = self.device_fn.device_wait_idle(self.handle); let err_code = self.device_fn.device_wait_idle(self.handle);
@ -123,6 +124,7 @@ impl<'r> Device<'r> {
} }
} }
} }
pub fn reset_fences(&self, fences: &[vk::Fence]) -> VkResult<()> { pub fn reset_fences(&self, fences: &[vk::Fence]) -> VkResult<()> {
unsafe { unsafe {
let err_code = self.device_fn let err_code = self.device_fn
@ -180,6 +182,7 @@ impl<'r> Device<'r> {
self.device_fn.cmd_end_render_pass(command_buffer); self.device_fn.cmd_end_render_pass(command_buffer);
} }
} }
pub fn cmd_draw(&self, pub fn cmd_draw(&self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
vertex_count: vk::uint32_t, vertex_count: vk::uint32_t,
@ -203,6 +206,7 @@ impl<'r> Device<'r> {
viewports.as_ptr()); viewports.as_ptr());
} }
} }
pub fn acquire_next_image_khr(&self, pub fn acquire_next_image_khr(&self,
swapchain: vk::SwapchainKHR, swapchain: vk::SwapchainKHR,
timeout: vk::uint64_t, timeout: vk::uint64_t,
@ -224,6 +228,7 @@ impl<'r> Device<'r> {
} }
} }
} }
pub fn create_semaphore(&self, pub fn create_semaphore(&self,
create_info: &vk::SemaphoreCreateInfo) create_info: &vk::SemaphoreCreateInfo)
-> VkResult<vk::Semaphore> { -> VkResult<vk::Semaphore> {
@ -258,6 +263,7 @@ impl<'r> Device<'r> {
} }
} }
} }
pub fn create_buffer(&self, create_info: &vk::BufferCreateInfo) -> VkResult<vk::Buffer> { pub fn create_buffer(&self, create_info: &vk::BufferCreateInfo) -> VkResult<vk::Buffer> {
unsafe { unsafe {
let mut buffer = mem::uninitialized(); let mut buffer = mem::uninitialized();
@ -443,6 +449,7 @@ impl<'r> Device<'r> {
} }
} }
} }
pub fn queue_submit(&self, pub fn queue_submit(&self,
queue: vk::Queue, queue: vk::Queue,
submits: &[vk::SubmitInfo], submits: &[vk::SubmitInfo],
@ -474,6 +481,7 @@ impl<'r> Device<'r> {
} }
} }
} }
pub fn get_swapchain_images_khr(&self, pub fn get_swapchain_images_khr(&self,
swapchain: vk::SwapchainKHR) swapchain: vk::SwapchainKHR)
-> VkResult<Vec<vk::Image>> { -> VkResult<Vec<vk::Image>> {
@ -507,6 +515,7 @@ impl<'r> Device<'r> {
} }
} }
} }
pub fn create_command_pool(&self, pub fn create_command_pool(&self,
create_info: &vk::CommandPoolCreateInfo) create_info: &vk::CommandPoolCreateInfo)
-> VkResult<vk::CommandPool> { -> VkResult<vk::CommandPool> {
@ -520,6 +529,7 @@ impl<'r> Device<'r> {
} }
} }
} }
pub fn create_swapchain_khr(&self, pub fn create_swapchain_khr(&self,
create_info: &vk::SwapchainCreateInfoKHR) create_info: &vk::SwapchainCreateInfoKHR)
-> VkResult<vk::SwapchainKHR> { -> VkResult<vk::SwapchainKHR> {

View file

@ -24,11 +24,13 @@ impl<'r> Instance<'r> {
_lifetime: ::std::marker::PhantomData, _lifetime: ::std::marker::PhantomData,
} }
} }
pub fn destroy_instance(&self) { pub fn destroy_instance(&self) {
unsafe { unsafe {
self.instance_fn.destroy_instance(self.handle, ptr::null()); self.instance_fn.destroy_instance(self.handle, ptr::null());
} }
} }
pub fn destroy_debug_report_callback_ext(&self, debug: vk::DebugReportCallbackEXT) { pub fn destroy_debug_report_callback_ext(&self, debug: vk::DebugReportCallbackEXT) {
unsafe { unsafe {
self.instance_fn.destroy_debug_report_callback_ext(self.handle, debug, ptr::null()); self.instance_fn.destroy_debug_report_callback_ext(self.handle, debug, ptr::null());
@ -51,6 +53,7 @@ impl<'r> Instance<'r> {
} }
} }
} }
pub fn get_physical_device_memory_properties(&self, pub fn get_physical_device_memory_properties(&self,
physical_device: vk::PhysicalDevice) physical_device: vk::PhysicalDevice)
-> vk::PhysicalDeviceMemoryProperties { -> vk::PhysicalDeviceMemoryProperties {
@ -85,6 +88,7 @@ impl<'r> Instance<'r> {
} }
} }
} }
pub fn get_physical_device_surface_capabilities_khr(&self, pub fn get_physical_device_surface_capabilities_khr(&self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
surface: vk::SurfaceKHR) surface: vk::SurfaceKHR)
@ -131,6 +135,7 @@ impl<'r> Instance<'r> {
self.instance_fn.destroy_surface_khr(self.handle, surface, ptr::null()); self.instance_fn.destroy_surface_khr(self.handle, surface, ptr::null());
} }
} }
pub fn create_xlib_surface_khr(&self, pub fn create_xlib_surface_khr(&self,
create_info: &vk::XlibSurfaceCreateInfoKHR) create_info: &vk::XlibSurfaceCreateInfoKHR)
-> VkResult<vk::SurfaceKHR> { -> VkResult<vk::SurfaceKHR> {
@ -145,6 +150,7 @@ impl<'r> Instance<'r> {
} }
} }
pub fn get_physical_device_surface_support_khr(&self, pub fn get_physical_device_surface_support_khr(&self,
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
queue_index: vk::uint32_t, queue_index: vk::uint32_t,
@ -159,8 +165,8 @@ impl<'r> Instance<'r> {
&mut b); &mut b);
b > 0 b > 0
} }
} }
pub fn get_physical_device_queue_family_properties(&self, pub fn get_physical_device_queue_family_properties(&self,
physical_device: vk::PhysicalDevice) physical_device: vk::PhysicalDevice)
-> Vec<vk::QueueFamilyProperties> { -> Vec<vk::QueueFamilyProperties> {