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,
};
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 raw_attachment_infos = &[][..];
while !ptr.is_null() {
ptr = match *ptr {
VkStructureType::VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR => {
let data = (ptr as *const VkFramebufferAttachmentsCreateInfoKHR).as_ref().unwrap();
raw_attachment_infos = make_slice(data.pAttachmentImageInfos, data.attachmentImageInfoCount as usize);
let data = (ptr as *const VkFramebufferAttachmentsCreateInfoKHR)
.as_ref()
.unwrap();
raw_attachment_infos = make_slice(
data.pAttachmentImageInfos,
data.attachmentImageInfoCount as usize,
);
data.pNext
}
other => {
@ -3057,7 +3065,12 @@ pub unsafe extern "C" fn gfxCreateFramebuffer(
usage: conv::map_image_usage(ai.usage),
view_caps: conv::map_image_create_flags(ai.flags),
//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,
) {
@ -4187,7 +4200,9 @@ pub unsafe extern "C" fn gfxCmdBeginRenderPass(
while !ptr.is_null() {
ptr = match *ptr {
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);
data.pNext
}

View file

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