From 59d49b2159ea14e1e5e8b10a2c0729d8261c8ab0 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 3 Aug 2018 12:37:28 +0200 Subject: [PATCH] Apply rustfmt --- ash/src/device.rs | 158 +++++++++++++++++++++++++++++--------------- ash/src/instance.rs | 71 +++++++++++--------- 2 files changed, 144 insertions(+), 85 deletions(-) diff --git a/ash/src/device.rs b/ash/src/device.rs index 03d4411..cd2b69b 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -18,7 +18,7 @@ pub trait DeviceV1_1: DeviceV1_0 { ); match err_code { vk::Result::SUCCESS => Ok(()), - _ => Err(err_code) + _ => Err(err_code), } } @@ -30,13 +30,16 @@ pub trait DeviceV1_1: DeviceV1_0 { ); match err_code { vk::Result::SUCCESS => Ok(()), - _ => Err(err_code) + _ => Err(err_code), } } - fn get_device_group_peer_memory_features(&self, heap_index: vk::uint32_t, - local_device_index: vk::uint32_t, - remote_device_index: vk::uint32_t) -> vk::PeerMemoryFeatureFlags { + fn get_device_group_peer_memory_features( + &self, + heap_index: vk::uint32_t, + local_device_index: vk::uint32_t, + remote_device_index: vk::uint32_t, + ) -> vk::PeerMemoryFeatureFlags { unsafe { let mut peer_memory_features = mem::uninitialized(); self.fp_v1_1().get_device_group_peer_memory_features( @@ -50,20 +53,25 @@ pub trait DeviceV1_1: DeviceV1_0 { } } - unsafe fn cmd_set_device_mask(&self, command_buffer: vk::CommandBuffer, device_mask: vk::uint32_t) { - self.fp_v1_1().cmd_set_device_mask( - command_buffer, - device_mask - ); + unsafe fn cmd_set_device_mask( + &self, + command_buffer: vk::CommandBuffer, + device_mask: vk::uint32_t, + ) { + self.fp_v1_1() + .cmd_set_device_mask(command_buffer, device_mask); } - unsafe fn cmd_dispatch_base(&self, command_buffer: vk::CommandBuffer, - base_group_x: vk::uint32_t, - base_group_y: vk::uint32_t, - base_group_z: vk::uint32_t, - group_count_x: vk::uint32_t, - group_count_y: vk::uint32_t, - group_count_z: vk::uint32_t,) { + unsafe fn cmd_dispatch_base( + &self, + command_buffer: vk::CommandBuffer, + base_group_x: vk::uint32_t, + base_group_y: vk::uint32_t, + base_group_z: vk::uint32_t, + group_count_x: vk::uint32_t, + group_count_y: vk::uint32_t, + group_count_z: vk::uint32_t, + ) { self.fp_v1_1().cmd_dispatch_base( command_buffer, base_group_x, @@ -75,7 +83,10 @@ pub trait DeviceV1_1: DeviceV1_0 { ); } - unsafe fn get_image_memory_requirements2(&self, info: &vk::ImageMemoryRequirementsInfo2) -> vk::MemoryRequirements2 { + unsafe fn get_image_memory_requirements2( + &self, + info: &vk::ImageMemoryRequirementsInfo2, + ) -> vk::MemoryRequirements2 { let mut image_memory_requirements = mem::uninitialized(); self.fp_v1_1().get_image_memory_requirements2( self.handle(), @@ -85,7 +96,10 @@ pub trait DeviceV1_1: DeviceV1_0 { image_memory_requirements } - unsafe fn get_buffer_memory_requirements2(&self, info: &vk::BufferMemoryRequirementsInfo2) -> vk::MemoryRequirements2 { + unsafe fn get_buffer_memory_requirements2( + &self, + info: &vk::BufferMemoryRequirementsInfo2, + ) -> vk::MemoryRequirements2 { let mut image_memory_requirements = mem::uninitialized(); self.fp_v1_1().get_buffer_memory_requirements2( self.handle(), @@ -95,10 +109,17 @@ pub trait DeviceV1_1: DeviceV1_0 { image_memory_requirements } - unsafe fn get_image_sparse_memory_requirements2(&self, info: &vk::ImageSparseMemoryRequirementsInfo2) -> Vec { + unsafe fn get_image_sparse_memory_requirements2( + &self, + info: &vk::ImageSparseMemoryRequirementsInfo2, + ) -> Vec { let mut count = mem::uninitialized(); - self.fp_v1_1() - .get_image_sparse_memory_requirements2(self.handle(), info, &mut count, ptr::null_mut()); + self.fp_v1_1().get_image_sparse_memory_requirements2( + self.handle(), + info, + &mut count, + ptr::null_mut(), + ); let mut requirements = Vec::with_capacity(count as usize); self.fp_v1_1().get_image_sparse_memory_requirements2( self.handle(), @@ -110,68 +131,99 @@ pub trait DeviceV1_1: DeviceV1_0 { requirements } - unsafe fn trim_command_pool(&self, command_pool: vk::CommandPool, flags: vk::CommandPoolTrimFlags) { - self.fp_v1_1().trim_command_pool( - self.handle(), - command_pool, - flags - ); + unsafe fn trim_command_pool( + &self, + command_pool: vk::CommandPool, + flags: vk::CommandPoolTrimFlags, + ) { + self.fp_v1_1() + .trim_command_pool(self.handle(), command_pool, flags); } - unsafe fn create_sampler_ycbcr_conversion(&self, - create_info: &vk::SamplerYcbcrConversionCreateInfo, - allocation_callbacks: Option<&vk::AllocationCallbacks>) -> VkResult { + unsafe fn create_sampler_ycbcr_conversion( + &self, + create_info: &vk::SamplerYcbcrConversionCreateInfo, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) -> VkResult { let mut ycbcr_conversion = mem::uninitialized(); let err_code = self.fp_v1_1().create_sampler_ycbcr_conversion( self.handle(), create_info, allocation_callbacks.as_raw_ptr(), - &mut ycbcr_conversion + &mut ycbcr_conversion, ); match err_code { vk::Result::SUCCESS => Ok(ycbcr_conversion), - _ => Err(err_code) + _ => Err(err_code), } } - unsafe fn destroy_sampler_ycbcr_conversion(&self, - ycbcr_conversion: vk::SamplerYcbcrConversion, - allocation_callbacks: Option<&vk::AllocationCallbacks>) { - self.fp_v1_1().destroy_sampler_ycbcr_conversion(self.handle(), ycbcr_conversion, allocation_callbacks.as_raw_ptr()); + unsafe fn destroy_sampler_ycbcr_conversion( + &self, + ycbcr_conversion: vk::SamplerYcbcrConversion, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) { + self.fp_v1_1().destroy_sampler_ycbcr_conversion( + self.handle(), + ycbcr_conversion, + allocation_callbacks.as_raw_ptr(), + ); } - unsafe fn create_descriptor_update_template(&self, - create_info: &vk::DescriptorUpdateTemplateCreateInfo, - allocation_callbacks: Option<&vk::AllocationCallbacks>) -> VkResult { + unsafe fn create_descriptor_update_template( + &self, + create_info: &vk::DescriptorUpdateTemplateCreateInfo, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) -> VkResult { let mut descriptor_update_template = mem::uninitialized(); let err_code = self.fp_v1_1().create_descriptor_update_template( self.handle(), create_info, allocation_callbacks.as_raw_ptr(), - &mut descriptor_update_template + &mut descriptor_update_template, ); match err_code { vk::Result::SUCCESS => Ok(descriptor_update_template), - _ => Err(err_code) + _ => Err(err_code), } } - unsafe fn destroy_descriptor_update_template(&self, - descriptor_update_template: vk::DescriptorUpdateTemplate, - allocation_callbacks: Option<&vk::AllocationCallbacks>) { - self.fp_v1_1().destroy_descriptor_update_template(self.handle(), descriptor_update_template, allocation_callbacks.as_raw_ptr()); + unsafe fn destroy_descriptor_update_template( + &self, + descriptor_update_template: vk::DescriptorUpdateTemplate, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) { + self.fp_v1_1().destroy_descriptor_update_template( + self.handle(), + descriptor_update_template, + allocation_callbacks.as_raw_ptr(), + ); } - unsafe fn update_descriptor_set_with_template(&self, - descriptor_set: vk::DescriptorSet, - descriptor_update_template: vk::DescriptorUpdateTemplate, - data: *const vk::c_void) { - self.fp_v1_1().update_descriptor_set_with_template(self.handle(), descriptor_set, descriptor_update_template, data); + unsafe fn update_descriptor_set_with_template( + &self, + descriptor_set: vk::DescriptorSet, + descriptor_update_template: vk::DescriptorUpdateTemplate, + data: *const vk::c_void, + ) { + self.fp_v1_1().update_descriptor_set_with_template( + self.handle(), + descriptor_set, + descriptor_update_template, + data, + ); } - unsafe fn get_descriptor_set_layout_support(&self, create_info: &vk::DescriptorSetLayoutCreateInfo) -> vk::DescriptorSetLayoutSupport { + unsafe fn get_descriptor_set_layout_support( + &self, + create_info: &vk::DescriptorSetLayoutCreateInfo, + ) -> vk::DescriptorSetLayoutSupport { let mut descriptor_set_layout_support = mem::uninitialized(); - self.fp_v1_1().get_descriptor_set_layout_support(self.handle(), create_info, &mut descriptor_set_layout_support); + self.fp_v1_1().get_descriptor_set_layout_support( + self.handle(), + create_info, + &mut descriptor_set_layout_support, + ); descriptor_set_layout_support } } diff --git a/ash/src/instance.rs b/ash/src/instance.rs index 97565dd..5d1c811 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -88,19 +88,21 @@ pub trait InstanceV1_1: InstanceV1_0 { unsafe fn enumerate_instance_version(&self) -> VkResult { let mut api_version = mem::uninitialized(); - let err_code = self.fp_v1_1() - .enumerate_instance_version(&mut api_version); + let err_code = self.fp_v1_1().enumerate_instance_version(&mut api_version); match err_code { vk::Result::SUCCESS => Ok(api_version), - _ => Err(err_code) + _ => Err(err_code), } } fn enumerate_physical_device_groups(&self) -> VkResult> { unsafe { let mut group_count = mem::uninitialized(); - self.fp_v1_1() - .enumerate_physical_device_groups(self.handle(), &mut group_count, ptr::null_mut()); + self.fp_v1_1().enumerate_physical_device_groups( + self.handle(), + &mut group_count, + ptr::null_mut(), + ); let mut physical_device_groups = Vec::with_capacity(group_count as usize); let err_code = self.fp_v1_1().enumerate_physical_device_groups( self.handle(), @@ -204,19 +206,21 @@ pub trait InstanceV1_1: InstanceV1_0 { ) -> Vec { unsafe { let mut format_count = 0; - self.fp_v1_1().get_physical_device_sparse_image_format_properties2( - physical_device, - format_info, - &mut format_count, - ptr::null_mut(), - ); + self.fp_v1_1() + .get_physical_device_sparse_image_format_properties2( + physical_device, + format_info, + &mut format_count, + ptr::null_mut(), + ); let mut format_prop = Vec::with_capacity(format_count as usize); - self.fp_v1_1().get_physical_device_sparse_image_format_properties2( - physical_device, - format_info, - &mut format_count, - format_prop.as_mut_ptr(), - ); + self.fp_v1_1() + .get_physical_device_sparse_image_format_properties2( + physical_device, + format_info, + &mut format_count, + format_prop.as_mut_ptr(), + ); format_prop.set_len(format_count as usize); format_prop } @@ -229,11 +233,12 @@ pub trait InstanceV1_1: InstanceV1_0 { ) -> vk::ExternalBufferProperties { unsafe { let mut image_format_prop = mem::uninitialized(); - self.fp_v1_1().get_physical_device_external_buffer_properties( - physical_device, - external_buffer_info, - &mut image_format_prop, - ); + self.fp_v1_1() + .get_physical_device_external_buffer_properties( + physical_device, + external_buffer_info, + &mut image_format_prop, + ); image_format_prop } } @@ -245,11 +250,12 @@ pub trait InstanceV1_1: InstanceV1_0 { ) -> vk::ExternalFenceProperties { unsafe { let mut fence_prop = mem::uninitialized(); - self.fp_v1_1().get_physical_device_external_fence_properties( - physical_device, - external_fence_info, - &mut fence_prop, - ); + self.fp_v1_1() + .get_physical_device_external_fence_properties( + physical_device, + external_fence_info, + &mut fence_prop, + ); fence_prop } } @@ -261,11 +267,12 @@ pub trait InstanceV1_1: InstanceV1_0 { ) -> vk::ExternalSemaphoreProperties { unsafe { let mut semaphore_prop = mem::uninitialized(); - self.fp_v1_1().get_physical_device_external_semaphore_properties( - physical_device, - external_semaphore_info, - &mut semaphore_prop, - ); + self.fp_v1_1() + .get_physical_device_external_semaphore_properties( + physical_device, + external_semaphore_info, + &mut semaphore_prop, + ); semaphore_prop } }