vkswapper: add the necessary call to check if the physical device supports the surface
authorMatthew Waters <matthew@centricular.com>
Tue, 16 Feb 2016 05:12:07 +0000 (16:12 +1100)
committerMatthew Waters <matthew@centricular.com>
Tue, 16 Feb 2016 14:13:43 +0000 (01:13 +1100)
Silences an error in the validation layers.

ext/vulkan/vkswapper.c

index c50589595e7ab14a901a00cd29199304fed4a8db..b92f2abe98da4f2d023d21b64633ca40ff58f003 100644 (file)
@@ -171,8 +171,27 @@ _choose_queue (GstVulkanDevice * device, GstVulkanQueue * queue,
     struct choose_data *data)
 {
   guint flags = device->queue_family_props[queue->family].queueFlags;
+  VkPhysicalDevice gpu;
   gboolean supports_present;
 
+  gpu = gst_vulkan_device_get_physical_device (data->swapper->device);
+
+  {
+    VkResult err;
+    GError *error = NULL;
+    VkBool32 physical_device_supported;
+
+    err =
+        data->swapper->GetPhysicalDeviceSurfaceSupportKHR (gpu, queue->index,
+        data->swapper->surface, &physical_device_supported);
+    if (gst_vulkan_error_to_g_error (err, &error,
+            "GetPhysicalDeviceSurfaceSupport") < 0) {
+      GST_DEBUG_OBJECT (data->swapper,
+          "surface not supported by the physical device: %s", error->message);
+      return TRUE;
+    }
+  }
+
   supports_present =
       gst_vulkan_window_get_presentation_support (data->swapper->window,
       device, queue->index);
@@ -603,8 +622,8 @@ _allocate_swapchain (GstVulkanSwapper * swapper, GstCaps * caps,
     n_images_wanted = swapper->surf_props.maxImageCount;
   }
 
-  if (swapper->surf_props.
-      supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) {
+  if (swapper->
+      surf_props.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) {
     preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
   } else {
     preTransform = swapper->surf_props.currentTransform;
@@ -636,8 +655,8 @@ _allocate_swapchain (GstVulkanSwapper * swapper, GstCaps * caps,
         "Incorrect usage flags available for the swap images");
     return FALSE;
   }
-  if ((swapper->
-          surf_props.supportedUsageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT)
+  if ((swapper->surf_props.
+          supportedUsageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT)
       != 0) {
     usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
   } else {