From: Jacob Lifshay Date: Thu, 4 Oct 2018 06:40:26 +0000 (-0700) Subject: fixed xcb swapchain bug; vulkaninfo just doesn't check the result from vkGetPhysicalD... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=798706f9693018a516234e25765210f6afe13a41;p=kazan.git fixed xcb swapchain bug; vulkaninfo just doesn't check the result from vkGetPhysicalDeviceSurfaceCapabilitiesKHR --- diff --git a/vulkan-driver/src/xcb_swapchain.rs b/vulkan-driver/src/xcb_swapchain.rs index 8fdff80..b687efd 100644 --- a/vulkan-driver/src/xcb_swapchain.rs +++ b/vulkan-driver/src/xcb_swapchain.rs @@ -107,10 +107,13 @@ unsafe fn create_shm_seg( } } +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] enum SurfaceFormatGroup { + R8G8B8A8, B8G8R8A8, } +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] enum SwapchainSetupError { BadSurface, NoSupport, @@ -264,6 +267,14 @@ impl SwapchainSetupFirstStage { && g == green_mask && b == blue_mask && (alpha_mask == 0 || a == alpha_mask) => + { + SurfaceFormatGroup::R8G8B8A8 + } + (b, g, r, a) + if r == red_mask + && g == green_mask + && b == blue_mask + && (alpha_mask == 0 || a == alpha_mask) => { SurfaceFormatGroup::B8G8R8A8 } @@ -369,6 +380,19 @@ impl SurfaceImplementation for XcbSurfaceImplementation { ]; Ok(Cow::Borrowed(SURFACE_FORMATS)) } + SurfaceFormatGroup::R8G8B8A8 => { + const SURFACE_FORMATS: &'static [api::VkSurfaceFormatKHR] = &[ + api::VkSurfaceFormatKHR { + format: api::VK_FORMAT_R8G8B8A8_SRGB, + colorSpace: api::VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + }, + api::VkSurfaceFormatKHR { + format: api::VK_FORMAT_R8G8B8A8_UNORM, + colorSpace: api::VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + }, + ]; + Ok(Cow::Borrowed(SURFACE_FORMATS)) + } } } unsafe fn get_present_modes(