fixed xcb swapchain bug; vulkaninfo just doesn't check the result from vkGetPhysicalD...
authorJacob Lifshay <programmerjake@gmail.com>
Thu, 4 Oct 2018 06:40:26 +0000 (23:40 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 4 Oct 2018 06:40:26 +0000 (23:40 -0700)
vulkan-driver/src/xcb_swapchain.rs

index 8fdff8072b98da7194ea5c493c59880647ac4eb9..b687efda60202a744b369a5a85351a198e94ea92 100644 (file)
@@ -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(