Rustfmt pass

This commit is contained in:
Dzmitry Malyshau 2021-01-19 01:29:02 -05:00
parent 68848dc9a1
commit 33a306d7b3
2 changed files with 46 additions and 49 deletions

View file

@ -3032,14 +3032,22 @@ pub unsafe extern "C" fn gfxCreateFramebuffer(
depth: info.layers, depth: info.layers,
}; };
let framebuffer = if info.flags & VkFramebufferCreateFlagBits::VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR as u32 != 0 { let framebuffer = if info.flags
& VkFramebufferCreateFlagBits::VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR as u32
!= 0
{
let mut ptr = pCreateInfo as *const VkStructureType; let mut ptr = pCreateInfo as *const VkStructureType;
let mut raw_attachment_infos = &[][..]; let mut raw_attachment_infos = &[][..];
while !ptr.is_null() { while !ptr.is_null() {
ptr = match *ptr { ptr = match *ptr {
VkStructureType::VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR => { VkStructureType::VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR => {
let data = (ptr as *const VkFramebufferAttachmentsCreateInfoKHR).as_ref().unwrap(); let data = (ptr as *const VkFramebufferAttachmentsCreateInfoKHR)
raw_attachment_infos = make_slice(data.pAttachmentImageInfos, data.attachmentImageInfoCount as usize); .as_ref()
.unwrap();
raw_attachment_infos = make_slice(
data.pAttachmentImageInfos,
data.attachmentImageInfoCount as usize,
);
data.pNext data.pNext
} }
other => { other => {
@ -3057,7 +3065,12 @@ pub unsafe extern "C" fn gfxCreateFramebuffer(
usage: conv::map_image_usage(ai.usage), usage: conv::map_image_usage(ai.usage),
view_caps: conv::map_image_create_flags(ai.flags), view_caps: conv::map_image_create_flags(ai.flags),
//TODO: properly support view format lists! //TODO: properly support view format lists!
format: ai.pViewFormats.as_ref().cloned().and_then(conv::map_format).unwrap(), format: ai
.pViewFormats
.as_ref()
.cloned()
.and_then(conv::map_format)
.unwrap(),
}), }),
extent, extent,
) { ) {
@ -4187,7 +4200,9 @@ pub unsafe extern "C" fn gfxCmdBeginRenderPass(
while !ptr.is_null() { while !ptr.is_null() {
ptr = match *ptr { ptr = match *ptr {
VkStructureType::VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR => { VkStructureType::VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR => {
let data = (ptr as *const VkRenderPassAttachmentBeginInfoKHR).as_ref().unwrap(); let data = (ptr as *const VkRenderPassAttachmentBeginInfoKHR)
.as_ref()
.unwrap();
image_views = make_slice(data.pAttachments, data.attachmentCount as usize); image_views = make_slice(data.pAttachments, data.attachmentCount as usize);
data.pNext data.pNext
} }

View file

@ -94,7 +94,9 @@ pub struct Gpu<B: hal::Backend> {
impl<B: hal::Backend> Gpu<B> { impl<B: hal::Backend> Gpu<B> {
fn has_extension(&self, extension: &[u8]) -> bool { fn has_extension(&self, extension: &[u8]) -> bool {
self.enabled_extensions.iter().any(|ext| ext.as_bytes() == &extension[..extension.len() - 1]) self.enabled_extensions
.iter()
.any(|ext| ext.as_bytes() == &extension[..extension.len() - 1])
} }
} }
@ -520,7 +522,8 @@ pub const VK_KHR_PORTABILITY_SUBSET_SPEC_VERSION: raw::c_uint = 1;
pub const VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME: &'static [u8; 26usize] = pub const VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME: &'static [u8; 26usize] =
b"VK_KHR_portability_subset\x00"; b"VK_KHR_portability_subset\x00";
pub const VK_KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION: raw::c_uint = 1; pub const VK_KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION: raw::c_uint = 1;
pub const VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME: &'static [u8; 29usize] = b"VK_KHR_imageless_framebuffer\x00"; pub const VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME: &'static [u8; 29usize] =
b"VK_KHR_imageless_framebuffer\x00";
pub type wchar_t = raw::c_int; pub type wchar_t = raw::c_int;
#[repr(C)] #[repr(C)]
@ -1905,12 +1908,8 @@ pub type PFN_vkReallocationFunction = Option<
allocationScope: VkSystemAllocationScope, allocationScope: VkSystemAllocationScope,
) -> *mut raw::c_void, ) -> *mut raw::c_void,
>; >;
pub type PFN_vkFreeFunction = Option< pub type PFN_vkFreeFunction =
unsafe extern "C" fn( Option<unsafe extern "C" fn(pUserData: *mut raw::c_void, pMemory: *mut raw::c_void)>;
pUserData: *mut raw::c_void,
pMemory: *mut raw::c_void,
),
>;
pub type PFN_vkInternalAllocationNotification = Option< pub type PFN_vkInternalAllocationNotification = Option<
unsafe extern "C" fn( unsafe extern "C" fn(
pUserData: *mut raw::c_void, pUserData: *mut raw::c_void,
@ -3697,17 +3696,10 @@ pub type PFN_vkGetPhysicalDeviceMemoryProperties = Option<
), ),
>; >;
pub type PFN_vkGetInstanceProcAddr = Option< pub type PFN_vkGetInstanceProcAddr = Option<
unsafe extern "C" fn( unsafe extern "C" fn(instance: VkInstance, pName: *const raw::c_char) -> PFN_vkVoidFunction,
instance: VkInstance,
pName: *const raw::c_char,
) -> PFN_vkVoidFunction,
>;
pub type PFN_vkGetDeviceProcAddr = Option<
unsafe extern "C" fn(
device: VkDevice,
pName: *const raw::c_char,
) -> PFN_vkVoidFunction,
>; >;
pub type PFN_vkGetDeviceProcAddr =
Option<unsafe extern "C" fn(device: VkDevice, pName: *const raw::c_char) -> PFN_vkVoidFunction>;
pub type PFN_vkCreateDevice = Option< pub type PFN_vkCreateDevice = Option<
unsafe extern "C" fn( unsafe extern "C" fn(
physicalDevice: VkPhysicalDevice, physicalDevice: VkPhysicalDevice,
@ -3716,9 +3708,8 @@ pub type PFN_vkCreateDevice = Option<
pDevice: *mut VkDevice, pDevice: *mut VkDevice,
) -> VkResult, ) -> VkResult,
>; >;
pub type PFN_vkDestroyDevice = Option< pub type PFN_vkDestroyDevice =
unsafe extern "C" fn(device: VkDevice, pAllocator: *const VkAllocationCallbacks), Option<unsafe extern "C" fn(device: VkDevice, pAllocator: *const VkAllocationCallbacks)>;
>;
pub type PFN_vkEnumerateInstanceExtensionProperties = Option< pub type PFN_vkEnumerateInstanceExtensionProperties = Option<
unsafe extern "C" fn( unsafe extern "C" fn(
pLayerName: *const raw::c_char, pLayerName: *const raw::c_char,
@ -3760,10 +3751,8 @@ pub type PFN_vkQueueSubmit = Option<
fence: VkFence, fence: VkFence,
) -> VkResult, ) -> VkResult,
>; >;
pub type PFN_vkQueueWaitIdle = pub type PFN_vkQueueWaitIdle = Option<unsafe extern "C" fn(queue: VkQueue) -> VkResult>;
Option<unsafe extern "C" fn(queue: VkQueue) -> VkResult>; pub type PFN_vkDeviceWaitIdle = Option<unsafe extern "C" fn(device: VkDevice) -> VkResult>;
pub type PFN_vkDeviceWaitIdle =
Option<unsafe extern "C" fn(device: VkDevice) -> VkResult>;
pub type PFN_vkAllocateMemory = Option< pub type PFN_vkAllocateMemory = Option<
unsafe extern "C" fn( unsafe extern "C" fn(
device: VkDevice, device: VkDevice,
@ -3789,8 +3778,7 @@ pub type PFN_vkMapMemory = Option<
ppData: *mut *mut raw::c_void, ppData: *mut *mut raw::c_void,
) -> VkResult, ) -> VkResult,
>; >;
pub type PFN_vkUnmapMemory = pub type PFN_vkUnmapMemory = Option<unsafe extern "C" fn(device: VkDevice, memory: VkDeviceMemory)>;
Option<unsafe extern "C" fn(device: VkDevice, memory: VkDeviceMemory)>;
pub type PFN_vkFlushMappedMemoryRanges = Option< pub type PFN_vkFlushMappedMemoryRanges = Option<
unsafe extern "C" fn( unsafe extern "C" fn(
device: VkDevice, device: VkDevice,
@ -4311,9 +4299,8 @@ pub type PFN_vkCmdSetDepthBias = Option<
depthBiasSlopeFactor: f32, depthBiasSlopeFactor: f32,
), ),
>; >;
pub type PFN_vkCmdSetBlendConstants = Option< pub type PFN_vkCmdSetBlendConstants =
unsafe extern "C" fn(commandBuffer: VkCommandBuffer, blendConstants: *const f32), Option<unsafe extern "C" fn(commandBuffer: VkCommandBuffer, blendConstants: *const f32)>;
>;
pub type PFN_vkCmdSetDepthBounds = Option< pub type PFN_vkCmdSetDepthBounds = Option<
unsafe extern "C" fn(commandBuffer: VkCommandBuffer, minDepthBounds: f32, maxDepthBounds: f32), unsafe extern "C" fn(commandBuffer: VkCommandBuffer, minDepthBounds: f32, maxDepthBounds: f32),
>; >;
@ -4624,11 +4611,9 @@ pub type PFN_vkCmdBeginRenderPass = Option<
contents: VkSubpassContents, contents: VkSubpassContents,
), ),
>; >;
pub type PFN_vkCmdNextSubpass = Option< pub type PFN_vkCmdNextSubpass =
unsafe extern "C" fn(commandBuffer: VkCommandBuffer, contents: VkSubpassContents), Option<unsafe extern "C" fn(commandBuffer: VkCommandBuffer, contents: VkSubpassContents)>;
>; pub type PFN_vkCmdEndRenderPass = Option<unsafe extern "C" fn(commandBuffer: VkCommandBuffer)>;
pub type PFN_vkCmdEndRenderPass =
Option<unsafe extern "C" fn(commandBuffer: VkCommandBuffer)>;
pub type PFN_vkCmdExecuteCommands = Option< pub type PFN_vkCmdExecuteCommands = Option<
unsafe extern "C" fn( unsafe extern "C" fn(
commandBuffer: VkCommandBuffer, commandBuffer: VkCommandBuffer,
@ -4928,9 +4913,8 @@ pub type PFN_vkAcquireNextImageKHR = Option<
pImageIndex: *mut u32, pImageIndex: *mut u32,
) -> VkResult, ) -> VkResult,
>; >;
pub type PFN_vkQueuePresentKHR = Option< pub type PFN_vkQueuePresentKHR =
unsafe extern "C" fn(queue: VkQueue, pPresentInfo: *const VkPresentInfoKHR) -> VkResult, Option<unsafe extern "C" fn(queue: VkQueue, pPresentInfo: *const VkPresentInfoKHR) -> VkResult>;
>;
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct VkDisplayKHR_T { pub struct VkDisplayKHR_T {
@ -5683,8 +5667,7 @@ pub type PFN_vkCmdDebugMarkerBeginEXT = Option<
pMarkerInfo: *mut VkDebugMarkerMarkerInfoEXT, pMarkerInfo: *mut VkDebugMarkerMarkerInfoEXT,
), ),
>; >;
pub type PFN_vkCmdDebugMarkerEndEXT = pub type PFN_vkCmdDebugMarkerEndEXT = Option<unsafe extern "C" fn(commandBuffer: VkCommandBuffer)>;
Option<unsafe extern "C" fn(commandBuffer: VkCommandBuffer)>;
pub type PFN_vkCmdDebugMarkerInsertEXT = Option< pub type PFN_vkCmdDebugMarkerInsertEXT = Option<
unsafe extern "C" fn( unsafe extern "C" fn(
commandBuffer: VkCommandBuffer, commandBuffer: VkCommandBuffer,
@ -7132,9 +7115,8 @@ pub type PFN_vkEnumeratePhysicalDevices = Option<
) -> VkResult, ) -> VkResult,
>; >;
pub type PFN_vkDestroyInstance = Option< pub type PFN_vkDestroyInstance =
unsafe extern "C" fn(instance: VkInstance, pAllocator: *const VkAllocationCallbacks), Option<unsafe extern "C" fn(instance: VkInstance, pAllocator: *const VkAllocationCallbacks)>;
>;
pub type PFN_vkCreateXlibSurfaceKHR = Option< pub type PFN_vkCreateXlibSurfaceKHR = Option<
unsafe extern "C" fn( unsafe extern "C" fn(
@ -7292,4 +7274,4 @@ impl Clone for VkRenderPassAttachmentBeginInfoKHR {
fn clone(&self) -> Self { fn clone(&self) -> Self {
*self *self
} }
} }