vulkan: update to release 1.0.1.1
authorMatthew Waters <matthew@centricular.com>
Wed, 27 Jan 2016 04:20:49 +0000 (15:20 +1100)
committerMatthew Waters <matthew@centricular.com>
Tue, 16 Feb 2016 14:13:43 +0000 (01:13 +1100)
configure.ac
ext/vulkan/vkapi.h
ext/vulkan/vkdevice.c
ext/vulkan/vkinstance.c
ext/vulkan/vkinstance.h
ext/vulkan/vkswapper.c
ext/vulkan/xcb/vkwindow_xcb.c

index c50647c..5fd90e3 100644 (file)
@@ -2905,8 +2905,8 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_VULKAN, true)
 AG_GST_CHECK_FEATURE(VULKAN, [Vulkan elements], vulkan, [
   HAVE_VULKAN=no
   AC_CHECK_HEADER(vulkan/vulkan.h, [
-    AC_CHECK_LIB(vulkan, vkCreateDevice, [
-      VULKAN_LIBS="-lvulkan"
+    AC_CHECK_LIB(vulkan-1, vkCreateDevice, [
+      VULKAN_LIBS="-lvulkan-1"
       AC_SUBST(VULKAN_LIBS)
       dnl TODO check platform support (x11, win32, wayland, android, etc)
       if test "x$HAVE_XCB" = "xyes"; then
index 138f21c..371efc9 100644 (file)
@@ -35,6 +35,6 @@
 #endif
 
 #include <vulkan/vulkan.h>
-#include <vulkan/vk_lunarg_debug_report.h>
+#include <vulkan/vk_ext_debug_report.h>
 
 #endif /* _VK_H_ */
index 1df23b0..257ad34 100644 (file)
 #include <string.h>
 
 static const char *device_validation_layers[] = {
-  "VK_LAYER_LUNARG_Threading",
-  "VK_LAYER_LUNARG_MemTracker",
-  "VK_LAYER_LUNARG_ObjectTracker",
-  "VK_LAYER_LUNARG_DrawState",
-  "VK_LAYER_LUNARG_ParamChecker",
-  "VK_LAYER_LUNARG_Swapchain",
-  "VK_LAYER_LUNARG_DeviceLimits",
-  "VK_LAYER_LUNARG_Image",
+  "VK_LAYER_LUNARG_threading",
+  "VK_LAYER_LUNARG_mem_tracker",
+  "VK_LAYER_LUNARG_object_tracker",
+  "VK_LAYER_LUNARG_draw_state",
+  "VK_LAYER_LUNARG_param_checker",
+  "VK_LAYER_LUNARG_swapchain",
+  "VK_LAYER_LUNARG_device_limits",
+  "VK_LAYER_LUNARG_image",
 };
 
 #define GST_CAT_DEFAULT gst_vulkan_device_debug
@@ -284,10 +284,10 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error)
     device_info.pNext = NULL;
     device_info.queueCreateInfoCount = 1;
     device_info.pQueueCreateInfos = &queue_info;
-    device_info.enabledLayerNameCount = enabled_layer_count;
+    device_info.enabledLayerCount = enabled_layer_count;
     device_info.ppEnabledLayerNames =
         (const char *const *) device_validation_layers;
-    device_info.enabledExtensionNameCount = enabled_extension_count;
+    device_info.enabledExtensionCount = enabled_extension_count;
     device_info.ppEnabledExtensionNames = (const char *const *) extension_names;
     device_info.pEnabledFeatures = NULL;
 
@@ -387,7 +387,7 @@ gst_vulkan_device_create_cmd_buffer (GstVulkanDevice * device,
   cmd_info.pNext = NULL;
   cmd_info.commandPool = device->cmd_pool;
   cmd_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
-  cmd_info.bufferCount = 1;
+  cmd_info.commandBufferCount = 1;
 
   err = vkAllocateCommandBuffers (device->device, &cmd_info, cmd);
   if (gst_vulkan_error_to_g_error (err, error, "vkCreateCommandBuffer") < 0)
index ede4177..09c3b99 100644 (file)
 #define APP_SHORT_NAME "GStreamer"
 
 static const char *instance_validation_layers[] = {
-  "VK_LAYER_LUNARG_Threading",
-  "VK_LAYER_LUNARG_MemTracker",
-  "VK_LAYER_LUNARG_ObjectTracker",
-  "VK_LAYER_LUNARG_DrawState",
-  "VK_LAYER_LUNARG_ParamChecker",
-  "VK_LAYER_LUNARG_Swapchain",
-  "VK_LAYER_LUNARG_DeviceLimits",
-  "VK_LAYER_LUNARG_Image",
+  "VK_LAYER_LUNARG_threading",
+  "VK_LAYER_LUNARG_mem_tracker",
+  "VK_LAYER_LUNARG_object_tracker",
+  "VK_LAYER_LUNARG_draw_state",
+  "VK_LAYER_LUNARG_param_checker",
+  "VK_LAYER_LUNARG_swapchain",
+  "VK_LAYER_LUNARG_device_limits",
+  "VK_LAYER_LUNARG_image",
 };
 
 #define GST_CAT_DEFAULT gst_vulkan_instance_debug
@@ -90,9 +90,9 @@ gst_vulkan_instance_finalize (GObject * object)
   GstVulkanInstance *instance = GST_VULKAN_INSTANCE (object);
 
   if (instance->priv->opened) {
-    if (instance->dbgDestroyMsgCallback)
-      instance->dbgDestroyMsgCallback (instance->instance,
-          instance->msg_callback);
+    if (instance->dbgDestroyDebugReportCallback)
+      instance->dbgDestroyDebugReportCallback (instance->instance,
+          instance->msg_callback, NULL);
 
     g_free (instance->physical_devices);
   }
@@ -104,23 +104,24 @@ gst_vulkan_instance_finalize (GObject * object)
 }
 
 static VkBool32
-_gst_vk_debug_callback (VkFlags msgFlags, VkDbgObjectType objType,
-    uint64_t srcObject, size_t location, int32_t msgCode,
-    const char *pLayerPrefix, const char *pMsg, void *pUserData)
+_gst_vk_debug_callback (VkDebugReportFlagsEXT msgFlags,
+    VkDebugReportObjectTypeEXT objType, uint64_t srcObject, size_t location,
+    int32_t msgCode, const char *pLayerPrefix, const char *pMsg,
+    void *pUserData)
 {
-  if (msgFlags & VK_DBG_REPORT_ERROR_BIT) {
+  if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
     GST_CAT_ERROR (GST_VULKAN_DEBUG_CAT, "[%s] Code %d : %s", pLayerPrefix,
         msgCode, pMsg);
-  } else if (msgFlags & VK_DBG_REPORT_WARN_BIT) {
+  } else if (msgFlags & VK_DEBUG_REPORT_WARN_BIT_EXT) {
     GST_CAT_WARNING (GST_VULKAN_DEBUG_CAT, "[%s] Code %d : %s", pLayerPrefix,
         msgCode, pMsg);
-  } else if (msgFlags & VK_DBG_REPORT_INFO_BIT) {
+  } else if (msgFlags & VK_DEBUG_REPORT_INFO_BIT_EXT) {
     GST_CAT_LOG (GST_VULKAN_DEBUG_CAT, "[%s] Code %d : %s", pLayerPrefix,
         msgCode, pMsg);
-  } else if (msgFlags & VK_DBG_REPORT_PERF_WARN_BIT) {
+  } else if (msgFlags & VK_DEBUG_REPORT_PERF_WARN_BIT_EXT) {
     GST_CAT_FIXME (GST_VULKAN_DEBUG_CAT, "[%s] Code %d : %s", pLayerPrefix,
         msgCode, pMsg);
-  } else if (msgFlags & VK_DBG_REPORT_DEBUG_BIT) {
+  } else if (msgFlags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) {
     GST_CAT_TRACE (GST_VULKAN_DEBUG_CAT, "[%s] Code %d : %s", pLayerPrefix,
         msgCode, pMsg);
   } else {
@@ -233,10 +234,10 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
         extension_names[enabled_extension_count++] =
             (gchar *) VK_KHR_SURFACE_EXTENSION_NAME;
       }
-      if (!g_strcmp0 (VK_DEBUG_REPORT_EXTENSION_NAME,
+      if (!g_strcmp0 (VK_EXT_DEBUG_REPORT_EXTENSION_NAME,
               instance_extensions[i].extensionName)) {
         extension_names[enabled_extension_count++] =
-            (gchar *) VK_DEBUG_REPORT_EXTENSION_NAME;
+            (gchar *) VK_EXT_DEBUG_REPORT_EXTENSION_NAME;
       }
       if (!g_strcmp0 (winsys_ext_name, instance_extensions[i].extensionName)) {
         winsys_ext_found = TRUE;
@@ -277,10 +278,10 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
     inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
     inst_info.pNext = NULL;
     inst_info.pApplicationInfo = &app;
-    inst_info.enabledLayerNameCount = enabled_layer_count;
+    inst_info.enabledLayerCount = enabled_layer_count;
     inst_info.ppEnabledLayerNames =
         (const char *const *) instance_validation_layers;
-    inst_info.enabledExtensionNameCount = enabled_extension_count;
+    inst_info.enabledExtensionCount = enabled_extension_count;
     inst_info.ppEnabledExtensionNames = (const char *const *) extension_names;
 
     err = vkCreateInstance (&inst_info, NULL, &instance->instance);
@@ -310,36 +311,51 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
           "vkEnumeratePhysicalDevices") < 0)
     goto error;
 
-  instance->dbgCreateMsgCallback = (PFN_vkDbgCreateMsgCallback)
-      gst_vulkan_instance_get_proc_address (instance, "vkDbgCreateMsgCallback");
-  if (!instance->dbgCreateMsgCallback) {
+  instance->dbgCreateDebugReportCallback = (PFN_vkCreateDebugReportCallbackEXT)
+      gst_vulkan_instance_get_proc_address (instance,
+      "vkCreateDebugReportCallbackEXT");
+  if (!instance->dbgCreateDebugReportCallback) {
     g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
-        "Failed to retreive vkDbgCreateMsgCallback");
+        "Failed to retreive vkCreateDebugReportCallback");
     goto error;
   }
-  instance->dbgDestroyMsgCallback = (PFN_vkDbgDestroyMsgCallback)
+  instance->dbgDestroyDebugReportCallback =
+      (PFN_vkDestroyDebugReportCallbackEXT)
       gst_vulkan_instance_get_proc_address (instance,
-      "vkDbgDestroyMsgCallback");
-  if (!instance->dbgDestroyMsgCallback) {
+      "vkDestroyDebugReportCallbackEXT");
+  if (!instance->dbgDestroyDebugReportCallback) {
     g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
-        "Failed to retreive vkDbgDestroyMsgCallback");
+        "Failed to retreive vkDestroyDebugReportCallback");
     goto error;
   }
-  instance->dbgBreakCallback =
-      (PFN_vkDbgMsgCallback) gst_vulkan_instance_get_proc_address (instance,
-      "vkDbgBreakCallback");
-  if (!instance->dbgBreakCallback) {
+  instance->dbgReportMessage = (PFN_vkDebugReportMessageEXT)
+      gst_vulkan_instance_get_proc_address (instance,
+      "vkDebugReportMessageEXT");
+  if (!instance->dbgReportMessage) {
     g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
-        "Failed to retreive vkDbgBreakCallback");
+        "Failed to retreive vkDebugReportMessage");
     goto error;
   }
 
-  err = instance->dbgCreateMsgCallback (instance->instance,
-      VK_DBG_REPORT_ERROR_BIT | VK_DBG_REPORT_WARN_BIT | VK_DBG_REPORT_INFO_BIT
-      | VK_DBG_REPORT_DEBUG_BIT | VK_DBG_REPORT_PERF_WARN_BIT,
-      _gst_vk_debug_callback, NULL, &instance->msg_callback);
-  if (gst_vulkan_error_to_g_error (err, error, "vkDbgCreateMsgCallback") < 0)
-    goto error;
+  {
+    VkDebugReportCallbackCreateInfoEXT info = { 0, };
+
+    info.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
+    info.pNext = NULL;
+    info.flags =
+        VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARN_BIT_EXT |
+        VK_DEBUG_REPORT_INFO_BIT_EXT | VK_DEBUG_REPORT_DEBUG_BIT_EXT |
+        VK_DEBUG_REPORT_PERF_WARN_BIT_EXT;
+    info.pfnCallback = (PFN_vkDebugReportCallbackEXT) _gst_vk_debug_callback;
+    info.pUserData = NULL;
+
+    err =
+        instance->dbgCreateDebugReportCallback (instance->instance, &info, NULL,
+        &instance->msg_callback);
+    if (gst_vulkan_error_to_g_error (err, error,
+            "vkCreateDebugReportCallback") < 0)
+      goto error;
+  }
 
   instance->priv->opened = TRUE;
   GST_OBJECT_UNLOCK (instance);
index a02c70d..f70ba7d 100644 (file)
@@ -43,10 +43,10 @@ struct _GstVulkanInstance
   VkPhysicalDevice *physical_devices; /* hides a pointer */
   guint32 n_physical_devices;
 
-  VkDbgMsgCallback msg_callback;
-  PFN_vkDbgCreateMsgCallback dbgCreateMsgCallback;
-  PFN_vkDbgDestroyMsgCallback dbgDestroyMsgCallback;
-  PFN_vkDbgMsgCallback dbgBreakCallback;
+  VkDebugReportCallbackEXT msg_callback;
+  PFN_vkCreateDebugReportCallbackEXT dbgCreateDebugReportCallback;
+  PFN_vkDestroyDebugReportCallbackEXT dbgDestroyDebugReportCallback;
+  PFN_vkDebugReportMessageEXT dbgReportMessage;
 
   GstVulkanInstancePrivate *priv;
 };
index 2452656..8dab820 100644 (file)
@@ -181,8 +181,8 @@ _vulkan_swapper_retrieve_surface_properties (GstVulkanSwapper * swapper,
     supports_present =
         gst_vulkan_window_get_presentation_support (swapper->window,
         swapper->device, i);
-    if ((swapper->device->
-            queue_family_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0) {
+    if ((swapper->device->queue_family_props[i].
+            queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0) {
       if (supports_present) {
         /* found one that supports both */
         graphics_queue = present_queue = i;
@@ -402,13 +402,12 @@ _swapper_set_image_layout_with_cmd (GstVulkanSwapper * swapper,
   VkPipelineStageFlags src_stages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
   VkPipelineStageFlags dest_stages = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
   VkImageMemoryBarrier image_memory_barrier;
-  VkImageMemoryBarrier *pmemory_barrier = &image_memory_barrier;
 
   gst_vulkan_image_memory_set_layout (image, new_image_layout,
       &image_memory_barrier);
 
-  vkCmdPipelineBarrier (cmd, src_stages, dest_stages, FALSE, 1,
-      (const void *const *) &pmemory_barrier);
+  vkCmdPipelineBarrier (cmd, src_stages, dest_stages, 0, 0, NULL, 0, NULL, 1,
+      &image_memory_barrier);
 
   return TRUE;
 }
@@ -446,17 +445,22 @@ _swapper_set_image_layout (GstVulkanSwapper * swapper,
     return FALSE;
 
   {
+    VkCommandBufferInheritanceInfo buf_inh = { 0, };
     VkCommandBufferBeginInfo cmd_buf_info = { 0, };
 
+    buf_inh.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
+    buf_inh.pNext = NULL;
+    buf_inh.renderPass = VK_NULL_HANDLE;
+    buf_inh.subpass = 0;
+    buf_inh.framebuffer = VK_NULL_HANDLE;
+    buf_inh.occlusionQueryEnable = FALSE;
+    buf_inh.queryFlags = 0;
+    buf_inh.pipelineStatistics = 0;
+
     cmd_buf_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
     cmd_buf_info.pNext = NULL;
     cmd_buf_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
-    cmd_buf_info.renderPass = VK_NULL_HANDLE;
-    cmd_buf_info.subpass = 0;
-    cmd_buf_info.framebuffer = VK_NULL_HANDLE;
-    cmd_buf_info.occlusionQueryEnable = FALSE;
-    cmd_buf_info.queryFlags = 0;
-    cmd_buf_info.pipelineStatistics = 0;
+    cmd_buf_info.pInheritanceInfo = &buf_inh;
 
     err = vkBeginCommandBuffer (cmd, &cmd_buf_info);
     if (gst_vulkan_error_to_g_error (err, error, "vkBeginCommandBuffer") < 0)
@@ -564,9 +568,9 @@ _allocate_swapchain (GstVulkanSwapper * swapper, GstCaps * caps,
     n_images_wanted = swapper->surf_props.maxImageCount;
   }
 
-  if (swapper->surf_props.
-      supportedTransforms & VK_SURFACE_TRANSFORM_NONE_BIT_KHR) {
-    preTransform = VK_SURFACE_TRANSFORM_NONE_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;
   }
@@ -575,7 +579,7 @@ _allocate_swapchain (GstVulkanSwapper * swapper, GstCaps * caps,
       _vk_format_from_video_format (GST_VIDEO_INFO_FORMAT (&swapper->v_info));
   color_space = _vk_color_space_from_video_info (&swapper->v_info);
 
-#if 0
+#if 1
   /* FIXME: unsupported by LunarG's driver */
   g_print ("alpha flags 0x%x\n",
       (guint) swapper->surf_props.supportedCompositeAlpha);
@@ -605,8 +609,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 {
@@ -800,17 +804,22 @@ _build_render_buffer_cmd (GstVulkanSwapper * swapper, guint32 swap_idx,
   gst_memory_unmap ((GstMemory *) staging, &staging_map_info);
 
   {
+    VkCommandBufferInheritanceInfo buf_inh = { 0, };
     VkCommandBufferBeginInfo cmd_buf_info = { 0, };
 
+    buf_inh.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
+    buf_inh.pNext = NULL;
+    buf_inh.renderPass = VK_NULL_HANDLE;
+    buf_inh.subpass = 0;
+    buf_inh.framebuffer = VK_NULL_HANDLE;
+    buf_inh.occlusionQueryEnable = FALSE;
+    buf_inh.queryFlags = 0;
+    buf_inh.pipelineStatistics = 0;
+
     cmd_buf_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
     cmd_buf_info.pNext = NULL;
     cmd_buf_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
-    cmd_buf_info.renderPass = VK_NULL_HANDLE;
-    cmd_buf_info.subpass = 0;
-    cmd_buf_info.framebuffer = VK_NULL_HANDLE;
-    cmd_buf_info.occlusionQueryEnable = FALSE;
-    cmd_buf_info.queryFlags = 0;
-    cmd_buf_info.pipelineStatistics = 0;
+    cmd_buf_info.pInheritanceInfo = &buf_inh;
 
     err = vkBeginCommandBuffer (cmd, &cmd_buf_info);
     if (gst_vulkan_error_to_g_error (err, error, "vkBeginCommandBuffer") < 0)
index a99f580..6369a1d 100644 (file)
@@ -206,12 +206,19 @@ gst_vulkan_window_xcb_create_window (GstVulkanWindowXCB * window_xcb)
 static VkSurfaceKHR
 gst_vulkan_window_xcb_get_surface (GstVulkanWindow * window, GError ** error)
 {
+  VkXcbSurfaceCreateInfoKHR info = { 0, };
   VkSurfaceKHR ret;
   VkResult err;
 
-  err = vkCreateXcbSurfaceKHR (window->display->instance->instance,
-      GST_VULKAN_DISPLAY_XCB_CONNECTION (window->display),
-      GST_VULKAN_WINDOW_XCB (window)->win_id, NULL, &ret);
+  info.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
+  info.pNext = NULL;
+  info.flags = 0;
+  info.connection = GST_VULKAN_DISPLAY_XCB_CONNECTION (window->display);
+  info.window = GST_VULKAN_WINDOW_XCB (window)->win_id;
+
+  err =
+      vkCreateXcbSurfaceKHR (window->display->instance->instance, &info, NULL,
+      &ret);
   if (gst_vulkan_error_to_g_error (err, error, "vkCreateXcbSurfaceKHR") < 0)
     return NULL;