vulkan: update error db for 0.10.2
authorMatthew Waters <matthew@centricular.com>
Wed, 30 Dec 2015 03:06:01 +0000 (14:06 +1100)
committerMatthew Waters <matthew@centricular.com>
Tue, 16 Feb 2016 14:13:43 +0000 (01:13 +1100)
ext/vulkan/vkdevice.c
ext/vulkan/vkerror.c
ext/vulkan/vkerror.h
ext/vulkan/vkinstance.c
ext/vulkan/vkswapper.c

index 7a75736acc919e78eb039d51d9223d4b9cb3baa8..b57a561d27d52f1b11dd53bd5692c5b0c32567ef 100644 (file)
@@ -129,8 +129,7 @@ _physical_device_info (GstVulkanDevice * device, GError ** error)
 
   gpu = gst_vulkan_device_get_physical_device (device);
   if (!gpu) {
-    g_set_error (error, GST_VULKAN_ERROR,
-        GST_VULKAN_ERROR_INITIALIZATION_FAILED,
+    g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
         "Failed to retrieve physical device");
     return FALSE;
   }
@@ -262,8 +261,7 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error)
       break;
   }
   if (i >= device->n_queue_families) {
-    g_set_error (error, GST_VULKAN_ERROR,
-        GST_VULKAN_ERROR_INITIALIZATION_FAILED,
+    g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
         "Failed to find a compatible queue family");
     goto error;
   }
index fca2d6a6ad006a02aab33422c31ba99c78e7d107..3fec27e4d86652e1910170f3037935663c8f69e4 100644 (file)
@@ -32,29 +32,21 @@ static const struct
   VkResult result;
   const char *str;
 } vk_result_string_map[] = {
-  {VK_ERROR_OUT_OF_HOST_MEMORY, "Out Of Host Memory"},
-  {VK_ERROR_OUT_OF_DEVICE_MEMORY, "Out of Device Memory"},
-  {VK_ERROR_INITIALIZATION_FAILED, "Initialization Failed"},
-  {VK_ERROR_DEVICE_LOST, "Device Lost"},
-  {VK_ERROR_MEMORY_MAP_FAILED, "Map Failed"},
-  {VK_ERROR_LAYER_NOT_PRESENT, "Layer Not Present"},
-  {VK_ERROR_EXTENSION_NOT_PRESENT, "Extension Not Present"},
-  {VK_ERROR_INCOMPATIBLE_DRIVER, "Incompatible Driver"},
-};
-
-static const struct
-{
-  VkResult result;
-  GstVulkanError gst_enum;
-} vk_result_gst_error_map[] = {
-  {VK_ERROR_OUT_OF_HOST_MEMORY, GST_VULKAN_ERROR_OUT_OF_HOST_MEMORY},
-  {VK_ERROR_OUT_OF_DEVICE_MEMORY, VK_ERROR_OUT_OF_DEVICE_MEMORY},
-  {VK_ERROR_INITIALIZATION_FAILED, GST_VULKAN_ERROR_INITIALIZATION_FAILED},
-  {VK_ERROR_DEVICE_LOST, GST_VULKAN_ERROR_DEVICE_LOST},
-  {VK_ERROR_MEMORY_MAP_FAILED, GST_VULKAN_ERROR_MEMORY_MAP_FAILED},
-  {VK_ERROR_LAYER_NOT_PRESENT, GST_VULKAN_ERROR_LAYER_NOT_PRESENT},
-  {VK_ERROR_EXTENSION_NOT_PRESENT, GST_VULKAN_ERROR_EXTENSION_NOT_PRESENT},
-  {VK_ERROR_INCOMPATIBLE_DRIVER, GST_VULKAN_ERROR_INCOMPATIBLE_DRIVER},
+  {VK_ERROR_OUT_OF_HOST_MEMORY, "Out Of host memory"},
+  {VK_ERROR_OUT_OF_DEVICE_MEMORY, "Out of device memory"},
+  {VK_ERROR_INITIALIZATION_FAILED, "Initialization failed"},
+  {VK_ERROR_DEVICE_LOST, "Device lost"},
+  {VK_ERROR_MEMORY_MAP_FAILED, "Map failed"},
+  {VK_ERROR_LAYER_NOT_PRESENT, "Layer not present"},
+  {VK_ERROR_EXTENSION_NOT_PRESENT, "Extension not present"},
+  {VK_ERROR_FEATURE_NOT_PRESENT, "Feature not present"},
+  {VK_ERROR_INCOMPATIBLE_DRIVER, "Incompatible driver"},
+  {VK_ERROR_TOO_MANY_OBJECTS, "Too many objects"},
+  {VK_ERROR_FORMAT_NOT_SUPPORTED, "format not supported"},
+  {VK_ERROR_SURFACE_LOST_KHR, "Surface lost"},
+  {VK_ERROR_OUT_OF_DATE_KHR, "out of date"},
+  {VK_ERROR_INCOMPATIBLE_DISPLAY_KHR, "Incompatible display"},
+  {VK_ERROR_NATIVE_WINDOW_IN_USE_KHR, "Native window in use"},
 };
 /* *INDENT-ON* */
 
@@ -82,29 +74,10 @@ _vk_result_to_string (VkResult result)
   return "Unknown Error";
 }
 
-static GstVulkanError
-_vk_result_to_g_error_enum (VkResult result)
-{
-  int i;
-
-  if (result >= 0)
-    return 0;
-  if (result < VK_RESULT_BEGIN_RANGE)
-    return 0;
-
-  for (i = 0; i < G_N_ELEMENTS (vk_result_gst_error_map); i++) {
-    if (result == vk_result_gst_error_map[i].result)
-      return vk_result_gst_error_map[i].gst_enum;
-  }
-
-  return GST_VULKAN_ERROR_FAILED;
-}
-
 VkResult
 gst_vulkan_error_to_g_error (VkResult result, GError ** error,
     const char *format, ...)
 {
-  GstVulkanError gst_enum;
   const char *result_str;
   gchar *string;
   va_list args;
@@ -117,13 +90,11 @@ gst_vulkan_error_to_g_error (VkResult result, GError ** error,
   if (result_str == NULL)
     return result;
 
-  gst_enum = _vk_result_to_g_error_enum (result);
-
   va_start (args, format);
   g_vasprintf (&string, format, args);
   va_end (args);
 
-  g_set_error (error, GST_VULKAN_ERROR, gst_enum, "%s: %s", result_str, string);
+  g_set_error (error, GST_VULKAN_ERROR, result, "%s: %s", result_str, string);
 
   return result;
 }
index 6f5e4cca865c2b01693a2f864e5368a057ed91a5..788e66da46943b0a8c44258eecdba51408f109c7 100644 (file)
@@ -29,19 +29,6 @@ G_BEGIN_DECLS
 #define GST_VULKAN_ERROR (gst_vulkan_error_quark ())
 GQuark gst_vulkan_error_quark (void);
 
-typedef enum
-{
-  GST_VULKAN_ERROR_FAILED = 0,
-  GST_VULKAN_ERROR_OUT_OF_HOST_MEMORY = -1,
-  GST_VULKAN_ERROR_OUT_OF_DEVICE_MEMORY = -2,
-  GST_VULKAN_ERROR_INITIALIZATION_FAILED = -3,
-  GST_VULKAN_ERROR_DEVICE_LOST = -4,
-  GST_VULKAN_ERROR_MEMORY_MAP_FAILED = -5,
-  GST_VULKAN_ERROR_LAYER_NOT_PRESENT = -6,
-  GST_VULKAN_ERROR_EXTENSION_NOT_PRESENT = -7,
-  GST_VULKAN_ERROR_INCOMPATIBLE_DRIVER = -8,
-} GstVulkanError;
-
 /* only fills error iff error != NULL and result < 0 */
 VkResult gst_vulkan_error_to_g_error (VkResult result, GError ** error, const char * format, ...) G_GNUC_PRINTF (3, 4);
 
index 958479c60e846d7382ba9595bee7c76ee1fefc4e..9cd743846ca01b0b430700dd2b65c2ef8857b3c9 100644 (file)
@@ -282,7 +282,7 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
   instance->dbgCreateMsgCallback = (PFN_vkDbgCreateMsgCallback)
       gst_vulkan_instance_get_proc_address (instance, "vkDbgCreateMsgCallback");
   if (!instance->dbgCreateMsgCallback) {
-    g_set_error (error, GST_VULKAN_ERROR, GST_VULKAN_ERROR_FAILED,
+    g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
         "Failed to retreive vkDbgCreateMsgCallback");
     goto error;
   }
@@ -290,7 +290,7 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
       gst_vulkan_instance_get_proc_address (instance,
       "vkDbgDestroyMsgCallback");
   if (!instance->dbgDestroyMsgCallback) {
-    g_set_error (error, GST_VULKAN_ERROR, GST_VULKAN_ERROR_FAILED,
+    g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
         "Failed to retreive vkDbgDestroyMsgCallback");
     goto error;
   }
@@ -298,7 +298,7 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
       (PFN_vkDbgMsgCallback) gst_vulkan_instance_get_proc_address (instance,
       "vkDbgBreakCallback");
   if (!instance->dbgBreakCallback) {
-    g_set_error (error, GST_VULKAN_ERROR, GST_VULKAN_ERROR_FAILED,
+    g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
         "Failed to retreive vkDbgBreakCallback");
     goto error;
   }
index 94c4a7ed41105815ca086b4c201d96e45f35c4c9..e8b85db7238698b6d07db9f8f81f5dbcf872017e 100644 (file)
@@ -199,7 +199,7 @@ _vulkan_swapper_retrieve_surface_properties (GstVulkanSwapper * swapper,
   if (graphics_queue != present_queue) {
     /* FIXME: add support for separate graphics/present queues */
     g_set_error (error, GST_VULKAN_ERROR,
-        GST_VULKAN_ERROR_INITIALIZATION_FAILED,
+        VK_ERROR_INITIALIZATION_FAILED,
         "Failed to find a compatible present/graphics queue");
     return FALSE;
   }
@@ -588,7 +588,7 @@ _allocate_swapchain (GstVulkanSwapper * swapper, GstCaps * caps,
     alpha_flags = VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
   } else {
     g_set_error (error, GST_VULKAN_ERROR,
-        GST_VULKAN_ERROR_INITIALIZATION_FAILED,
+        VK_ERROR_INITIALIZATION_FAILED,
         "Incorrect alpha flags available for the swap images");
     return FALSE;
   }
@@ -601,7 +601,7 @@ _allocate_swapchain (GstVulkanSwapper * swapper, GstCaps * caps,
     usage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
   } else {
     g_set_error (error, GST_VULKAN_ERROR,
-        GST_VULKAN_ERROR_INITIALIZATION_FAILED,
+        VK_ERROR_INITIALIZATION_FAILED,
         "Incorrect usage flags available for the swap images");
     return FALSE;
   }
@@ -611,7 +611,7 @@ _allocate_swapchain (GstVulkanSwapper * swapper, GstCaps * caps,
     usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
   } else {
     g_set_error (error, GST_VULKAN_ERROR,
-        GST_VULKAN_ERROR_INITIALIZATION_FAILED,
+        VK_ERROR_INITIALIZATION_FAILED,
         "Incorrect usage flags available for the swap images");
     return FALSE;
   }
@@ -714,7 +714,7 @@ gst_vulkan_swapper_set_caps (GstVulkanSwapper * swapper, GstCaps * caps,
 {
   if (!gst_video_info_from_caps (&swapper->v_info, caps)) {
     g_set_error (error, GST_VULKAN_ERROR,
-        GST_VULKAN_ERROR_INITIALIZATION_FAILED,
+        VK_ERROR_INITIALIZATION_FAILED,
         "Failed to geto GstVideoInfo from caps");
     return FALSE;
   }
@@ -756,7 +756,7 @@ _build_render_buffer_cmd (GstVulkanSwapper * swapper, guint32 swap_idx,
     return FALSE;
 
   if (!gst_video_frame_map (&vframe, &swapper->v_info, buffer, GST_MAP_READ)) {
-    g_set_error (error, GST_VULKAN_ERROR, GST_VULKAN_ERROR_MEMORY_MAP_FAILED,
+    g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_MEMORY_MAP_FAILED,
         "Failed to map buffer");
     return FALSE;
   }
@@ -768,14 +768,14 @@ _build_render_buffer_cmd (GstVulkanSwapper * swapper, guint32 swap_idx,
       VK_IMAGE_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
 
   if (!staging) {
-    g_set_error (error, GST_VULKAN_ERROR, GST_VULKAN_ERROR_MEMORY_MAP_FAILED,
+    g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_MEMORY_MAP_FAILED,
         "Failed to create staging memory");
     gst_video_frame_unmap (&vframe);
     return FALSE;
   }
 
   if (!gst_memory_map ((GstMemory *) staging, &staging_map_info, GST_MAP_WRITE)) {
-    g_set_error (error, GST_VULKAN_ERROR, GST_VULKAN_ERROR_MEMORY_MAP_FAILED,
+    g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_MEMORY_MAP_FAILED,
         "Failed to map swap image");
     gst_video_frame_unmap (&vframe);
     gst_memory_unref ((GstMemory *) staging);
@@ -912,12 +912,12 @@ _render_buffer_unlocked (GstVulkanSwapper * swapper,
 
   if (!buffer) {
     g_set_error (error, GST_VULKAN_ERROR,
-        GST_VULKAN_ERROR_INITIALIZATION_FAILED, "Invalid buffer");
+        VK_ERROR_INITIALIZATION_FAILED, "Invalid buffer");
     goto error;
   }
 
   if (g_atomic_int_get (&swapper->to_quit)) {
-    g_set_error (error, GST_VULKAN_ERROR, GST_VULKAN_ERROR_DEVICE_LOST,
+    g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_SURFACE_LOST_KHR,
         "Output window was closed");
     goto error;
   }