Apply rustfmt

This commit is contained in:
Tim 2018-08-03 12:37:28 +02:00
parent 623c26c9bc
commit 59d49b2159
2 changed files with 144 additions and 85 deletions

View file

@ -18,7 +18,7 @@ pub trait DeviceV1_1: DeviceV1_0 {
); );
match err_code { match err_code {
vk::Result::SUCCESS => Ok(()), vk::Result::SUCCESS => Ok(()),
_ => Err(err_code) _ => Err(err_code),
} }
} }
@ -30,13 +30,16 @@ pub trait DeviceV1_1: DeviceV1_0 {
); );
match err_code { match err_code {
vk::Result::SUCCESS => Ok(()), vk::Result::SUCCESS => Ok(()),
_ => Err(err_code) _ => Err(err_code),
} }
} }
fn get_device_group_peer_memory_features(&self, heap_index: vk::uint32_t, fn get_device_group_peer_memory_features(
local_device_index: vk::uint32_t, &self,
remote_device_index: vk::uint32_t) -> vk::PeerMemoryFeatureFlags { heap_index: vk::uint32_t,
local_device_index: vk::uint32_t,
remote_device_index: vk::uint32_t,
) -> vk::PeerMemoryFeatureFlags {
unsafe { unsafe {
let mut peer_memory_features = mem::uninitialized(); let mut peer_memory_features = mem::uninitialized();
self.fp_v1_1().get_device_group_peer_memory_features( 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) { unsafe fn cmd_set_device_mask(
self.fp_v1_1().cmd_set_device_mask( &self,
command_buffer, command_buffer: vk::CommandBuffer,
device_mask 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, unsafe fn cmd_dispatch_base(
base_group_x: vk::uint32_t, &self,
base_group_y: vk::uint32_t, command_buffer: vk::CommandBuffer,
base_group_z: vk::uint32_t, base_group_x: vk::uint32_t,
group_count_x: vk::uint32_t, base_group_y: vk::uint32_t,
group_count_y: vk::uint32_t, base_group_z: vk::uint32_t,
group_count_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( self.fp_v1_1().cmd_dispatch_base(
command_buffer, command_buffer,
base_group_x, 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(); let mut image_memory_requirements = mem::uninitialized();
self.fp_v1_1().get_image_memory_requirements2( self.fp_v1_1().get_image_memory_requirements2(
self.handle(), self.handle(),
@ -85,7 +96,10 @@ pub trait DeviceV1_1: DeviceV1_0 {
image_memory_requirements 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(); let mut image_memory_requirements = mem::uninitialized();
self.fp_v1_1().get_buffer_memory_requirements2( self.fp_v1_1().get_buffer_memory_requirements2(
self.handle(), self.handle(),
@ -95,10 +109,17 @@ pub trait DeviceV1_1: DeviceV1_0 {
image_memory_requirements image_memory_requirements
} }
unsafe fn get_image_sparse_memory_requirements2(&self, info: &vk::ImageSparseMemoryRequirementsInfo2) -> Vec<vk::SparseImageMemoryRequirements2> { unsafe fn get_image_sparse_memory_requirements2(
&self,
info: &vk::ImageSparseMemoryRequirementsInfo2,
) -> Vec<vk::SparseImageMemoryRequirements2> {
let mut count = mem::uninitialized(); let mut count = mem::uninitialized();
self.fp_v1_1() self.fp_v1_1().get_image_sparse_memory_requirements2(
.get_image_sparse_memory_requirements2(self.handle(), info, &mut count, ptr::null_mut()); self.handle(),
info,
&mut count,
ptr::null_mut(),
);
let mut requirements = Vec::with_capacity(count as usize); let mut requirements = Vec::with_capacity(count as usize);
self.fp_v1_1().get_image_sparse_memory_requirements2( self.fp_v1_1().get_image_sparse_memory_requirements2(
self.handle(), self.handle(),
@ -110,68 +131,99 @@ pub trait DeviceV1_1: DeviceV1_0 {
requirements requirements
} }
unsafe fn trim_command_pool(&self, command_pool: vk::CommandPool, flags: vk::CommandPoolTrimFlags) { unsafe fn trim_command_pool(
self.fp_v1_1().trim_command_pool( &self,
self.handle(), command_pool: vk::CommandPool,
command_pool, flags: vk::CommandPoolTrimFlags,
flags ) {
); self.fp_v1_1()
.trim_command_pool(self.handle(), command_pool, flags);
} }
unsafe fn create_sampler_ycbcr_conversion(&self, unsafe fn create_sampler_ycbcr_conversion(
create_info: &vk::SamplerYcbcrConversionCreateInfo, &self,
allocation_callbacks: Option<&vk::AllocationCallbacks>) -> VkResult<vk::SamplerYcbcrConversion> { create_info: &vk::SamplerYcbcrConversionCreateInfo,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::SamplerYcbcrConversion> {
let mut ycbcr_conversion = mem::uninitialized(); let mut ycbcr_conversion = mem::uninitialized();
let err_code = self.fp_v1_1().create_sampler_ycbcr_conversion( let err_code = self.fp_v1_1().create_sampler_ycbcr_conversion(
self.handle(), self.handle(),
create_info, create_info,
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),
&mut ycbcr_conversion &mut ycbcr_conversion,
); );
match err_code { match err_code {
vk::Result::SUCCESS => Ok(ycbcr_conversion), vk::Result::SUCCESS => Ok(ycbcr_conversion),
_ => Err(err_code) _ => Err(err_code),
} }
} }
unsafe fn destroy_sampler_ycbcr_conversion(&self, unsafe fn destroy_sampler_ycbcr_conversion(
ycbcr_conversion: vk::SamplerYcbcrConversion, &self,
allocation_callbacks: Option<&vk::AllocationCallbacks>) { ycbcr_conversion: vk::SamplerYcbcrConversion,
self.fp_v1_1().destroy_sampler_ycbcr_conversion(self.handle(), ycbcr_conversion, allocation_callbacks.as_raw_ptr()); 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, unsafe fn create_descriptor_update_template(
create_info: &vk::DescriptorUpdateTemplateCreateInfo, &self,
allocation_callbacks: Option<&vk::AllocationCallbacks>) -> VkResult<vk::DescriptorUpdateTemplate> { create_info: &vk::DescriptorUpdateTemplateCreateInfo,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::DescriptorUpdateTemplate> {
let mut descriptor_update_template = mem::uninitialized(); let mut descriptor_update_template = mem::uninitialized();
let err_code = self.fp_v1_1().create_descriptor_update_template( let err_code = self.fp_v1_1().create_descriptor_update_template(
self.handle(), self.handle(),
create_info, create_info,
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),
&mut descriptor_update_template &mut descriptor_update_template,
); );
match err_code { match err_code {
vk::Result::SUCCESS => Ok(descriptor_update_template), vk::Result::SUCCESS => Ok(descriptor_update_template),
_ => Err(err_code) _ => Err(err_code),
} }
} }
unsafe fn destroy_descriptor_update_template(&self, unsafe fn destroy_descriptor_update_template(
descriptor_update_template: vk::DescriptorUpdateTemplate, &self,
allocation_callbacks: Option<&vk::AllocationCallbacks>) { descriptor_update_template: vk::DescriptorUpdateTemplate,
self.fp_v1_1().destroy_descriptor_update_template(self.handle(), descriptor_update_template, allocation_callbacks.as_raw_ptr()); 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, unsafe fn update_descriptor_set_with_template(
descriptor_set: vk::DescriptorSet, &self,
descriptor_update_template: vk::DescriptorUpdateTemplate, descriptor_set: vk::DescriptorSet,
data: *const vk::c_void) { descriptor_update_template: vk::DescriptorUpdateTemplate,
self.fp_v1_1().update_descriptor_set_with_template(self.handle(), descriptor_set, descriptor_update_template, data); 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(); 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 descriptor_set_layout_support
} }
} }

View file

@ -88,19 +88,21 @@ pub trait InstanceV1_1: InstanceV1_0 {
unsafe fn enumerate_instance_version(&self) -> VkResult<vk::uint32_t> { unsafe fn enumerate_instance_version(&self) -> VkResult<vk::uint32_t> {
let mut api_version = mem::uninitialized(); let mut api_version = mem::uninitialized();
let err_code = self.fp_v1_1() let err_code = self.fp_v1_1().enumerate_instance_version(&mut api_version);
.enumerate_instance_version(&mut api_version);
match err_code { match err_code {
vk::Result::SUCCESS => Ok(api_version), vk::Result::SUCCESS => Ok(api_version),
_ => Err(err_code) _ => Err(err_code),
} }
} }
fn enumerate_physical_device_groups(&self) -> VkResult<Vec<vk::PhysicalDeviceGroupProperties>> { fn enumerate_physical_device_groups(&self) -> VkResult<Vec<vk::PhysicalDeviceGroupProperties>> {
unsafe { unsafe {
let mut group_count = mem::uninitialized(); let mut group_count = mem::uninitialized();
self.fp_v1_1() self.fp_v1_1().enumerate_physical_device_groups(
.enumerate_physical_device_groups(self.handle(), &mut group_count, ptr::null_mut()); self.handle(),
&mut group_count,
ptr::null_mut(),
);
let mut physical_device_groups = Vec::with_capacity(group_count as usize); let mut physical_device_groups = Vec::with_capacity(group_count as usize);
let err_code = self.fp_v1_1().enumerate_physical_device_groups( let err_code = self.fp_v1_1().enumerate_physical_device_groups(
self.handle(), self.handle(),
@ -204,19 +206,21 @@ pub trait InstanceV1_1: InstanceV1_0 {
) -> Vec<vk::SparseImageFormatProperties2> { ) -> Vec<vk::SparseImageFormatProperties2> {
unsafe { unsafe {
let mut format_count = 0; let mut format_count = 0;
self.fp_v1_1().get_physical_device_sparse_image_format_properties2( self.fp_v1_1()
physical_device, .get_physical_device_sparse_image_format_properties2(
format_info, physical_device,
&mut format_count, format_info,
ptr::null_mut(), &mut format_count,
); ptr::null_mut(),
);
let mut format_prop = Vec::with_capacity(format_count as usize); let mut format_prop = Vec::with_capacity(format_count as usize);
self.fp_v1_1().get_physical_device_sparse_image_format_properties2( self.fp_v1_1()
physical_device, .get_physical_device_sparse_image_format_properties2(
format_info, physical_device,
&mut format_count, format_info,
format_prop.as_mut_ptr(), &mut format_count,
); format_prop.as_mut_ptr(),
);
format_prop.set_len(format_count as usize); format_prop.set_len(format_count as usize);
format_prop format_prop
} }
@ -229,11 +233,12 @@ pub trait InstanceV1_1: InstanceV1_0 {
) -> vk::ExternalBufferProperties { ) -> vk::ExternalBufferProperties {
unsafe { unsafe {
let mut image_format_prop = mem::uninitialized(); let mut image_format_prop = mem::uninitialized();
self.fp_v1_1().get_physical_device_external_buffer_properties( self.fp_v1_1()
physical_device, .get_physical_device_external_buffer_properties(
external_buffer_info, physical_device,
&mut image_format_prop, external_buffer_info,
); &mut image_format_prop,
);
image_format_prop image_format_prop
} }
} }
@ -245,11 +250,12 @@ pub trait InstanceV1_1: InstanceV1_0 {
) -> vk::ExternalFenceProperties { ) -> vk::ExternalFenceProperties {
unsafe { unsafe {
let mut fence_prop = mem::uninitialized(); let mut fence_prop = mem::uninitialized();
self.fp_v1_1().get_physical_device_external_fence_properties( self.fp_v1_1()
physical_device, .get_physical_device_external_fence_properties(
external_fence_info, physical_device,
&mut fence_prop, external_fence_info,
); &mut fence_prop,
);
fence_prop fence_prop
} }
} }
@ -261,11 +267,12 @@ pub trait InstanceV1_1: InstanceV1_0 {
) -> vk::ExternalSemaphoreProperties { ) -> vk::ExternalSemaphoreProperties {
unsafe { unsafe {
let mut semaphore_prop = mem::uninitialized(); let mut semaphore_prop = mem::uninitialized();
self.fp_v1_1().get_physical_device_external_semaphore_properties( self.fp_v1_1()
physical_device, .get_physical_device_external_semaphore_properties(
external_semaphore_info, physical_device,
&mut semaphore_prop, external_semaphore_info,
); &mut semaphore_prop,
);
semaphore_prop semaphore_prop
} }
} }