mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-25 16:48:11 +00:00
vulkan/instance: privatise defult debug callback
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1341>
This commit is contained in:
parent
0e72318515
commit
ceb5ac0e4f
2 changed files with 30 additions and 22 deletions
|
@ -84,6 +84,13 @@ struct _GstVulkanInstancePrivate
|
||||||
VkExtensionProperties *available_extensions;
|
VkExtensionProperties *available_extensions;
|
||||||
GPtrArray *enabled_layers;
|
GPtrArray *enabled_layers;
|
||||||
GPtrArray *enabled_extensions;
|
GPtrArray *enabled_extensions;
|
||||||
|
|
||||||
|
#if !defined (GST_DISABLE_DEBUG)
|
||||||
|
VkDebugReportCallbackEXT msg_callback;
|
||||||
|
PFN_vkCreateDebugReportCallbackEXT dbgCreateDebugReportCallback;
|
||||||
|
PFN_vkDestroyDebugReportCallbackEXT dbgDestroyDebugReportCallback;
|
||||||
|
PFN_vkDebugReportMessageEXT dbgReportMessage;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -250,9 +257,9 @@ gst_vulkan_instance_finalize (GObject * object)
|
||||||
GstVulkanInstancePrivate *priv = GET_PRIV (instance);
|
GstVulkanInstancePrivate *priv = GET_PRIV (instance);
|
||||||
|
|
||||||
if (priv->opened) {
|
if (priv->opened) {
|
||||||
if (instance->dbgDestroyDebugReportCallback)
|
if (priv->dbgDestroyDebugReportCallback)
|
||||||
instance->dbgDestroyDebugReportCallback (instance->instance,
|
priv->dbgDestroyDebugReportCallback (instance->instance,
|
||||||
instance->msg_callback, NULL);
|
priv->msg_callback, NULL);
|
||||||
|
|
||||||
g_free (instance->physical_devices);
|
g_free (instance->physical_devices);
|
||||||
}
|
}
|
||||||
|
@ -924,28 +931,26 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
|
||||||
VK_EXT_DEBUG_REPORT_EXTENSION_NAME, NULL)) {
|
VK_EXT_DEBUG_REPORT_EXTENSION_NAME, NULL)) {
|
||||||
VkDebugReportCallbackCreateInfoEXT info = { 0, };
|
VkDebugReportCallbackCreateInfoEXT info = { 0, };
|
||||||
|
|
||||||
instance->dbgCreateDebugReportCallback =
|
priv->dbgCreateDebugReportCallback = (PFN_vkCreateDebugReportCallbackEXT)
|
||||||
(PFN_vkCreateDebugReportCallbackEXT)
|
|
||||||
gst_vulkan_instance_get_proc_address (instance,
|
gst_vulkan_instance_get_proc_address (instance,
|
||||||
"vkCreateDebugReportCallbackEXT");
|
"vkCreateDebugReportCallbackEXT");
|
||||||
if (!instance->dbgCreateDebugReportCallback) {
|
if (!priv->dbgCreateDebugReportCallback) {
|
||||||
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"Failed to retrieve vkCreateDebugReportCallback");
|
"Failed to retrieve vkCreateDebugReportCallback");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
instance->dbgDestroyDebugReportCallback =
|
priv->dbgDestroyDebugReportCallback = (PFN_vkDestroyDebugReportCallbackEXT)
|
||||||
(PFN_vkDestroyDebugReportCallbackEXT)
|
|
||||||
gst_vulkan_instance_get_proc_address (instance,
|
gst_vulkan_instance_get_proc_address (instance,
|
||||||
"vkDestroyDebugReportCallbackEXT");
|
"vkDestroyDebugReportCallbackEXT");
|
||||||
if (!instance->dbgDestroyDebugReportCallback) {
|
if (!priv->dbgDestroyDebugReportCallback) {
|
||||||
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"Failed to retrieve vkDestroyDebugReportCallback");
|
"Failed to retrieve vkDestroyDebugReportCallback");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
instance->dbgReportMessage = (PFN_vkDebugReportMessageEXT)
|
priv->dbgReportMessage = (PFN_vkDebugReportMessageEXT)
|
||||||
gst_vulkan_instance_get_proc_address (instance,
|
gst_vulkan_instance_get_proc_address (instance,
|
||||||
"vkDebugReportMessageEXT");
|
"vkDebugReportMessageEXT");
|
||||||
if (!instance->dbgReportMessage) {
|
if (!priv->dbgReportMessage) {
|
||||||
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"Failed to retrieve vkDebugReportMessage");
|
"Failed to retrieve vkDebugReportMessage");
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -953,16 +958,24 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
|
||||||
|
|
||||||
info.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
|
info.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
|
||||||
info.pNext = NULL;
|
info.pNext = NULL;
|
||||||
info.flags =
|
info.flags = 0;
|
||||||
VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT |
|
|
||||||
VK_DEBUG_REPORT_INFORMATION_BIT_EXT | VK_DEBUG_REPORT_DEBUG_BIT_EXT |
|
|
||||||
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
|
|
||||||
info.pfnCallback = (PFN_vkDebugReportCallbackEXT) _gst_vk_debug_callback;
|
info.pfnCallback = (PFN_vkDebugReportCallbackEXT) _gst_vk_debug_callback;
|
||||||
info.pUserData = NULL;
|
info.pUserData = NULL;
|
||||||
|
/* matches the conditions in _gst_vk_debug_callback() */
|
||||||
|
if (vulkan_debug_level >= GST_LEVEL_ERROR)
|
||||||
|
info.flags |= VK_DEBUG_REPORT_ERROR_BIT_EXT;
|
||||||
|
if (vulkan_debug_level >= GST_LEVEL_WARNING)
|
||||||
|
info.flags |= VK_DEBUG_REPORT_WARNING_BIT_EXT;
|
||||||
|
if (vulkan_debug_level >= GST_LEVEL_FIXME)
|
||||||
|
info.flags |= VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
|
||||||
|
if (vulkan_debug_level >= GST_LEVEL_LOG)
|
||||||
|
info.flags |= VK_DEBUG_REPORT_INFORMATION_BIT_EXT;
|
||||||
|
if (vulkan_debug_level >= GST_LEVEL_TRACE)
|
||||||
|
info.flags |= VK_DEBUG_REPORT_DEBUG_BIT_EXT;
|
||||||
|
|
||||||
err =
|
err =
|
||||||
instance->dbgCreateDebugReportCallback (instance->instance, &info, NULL,
|
priv->dbgCreateDebugReportCallback (instance->instance, &info, NULL,
|
||||||
&instance->msg_callback);
|
&priv->msg_callback);
|
||||||
if (gst_vulkan_error_to_g_error (err, error,
|
if (gst_vulkan_error_to_g_error (err, error,
|
||||||
"vkCreateDebugReportCallback") < 0)
|
"vkCreateDebugReportCallback") < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -43,11 +43,6 @@ struct _GstVulkanInstance
|
||||||
VkInstance instance; /* hides a pointer */
|
VkInstance instance; /* hides a pointer */
|
||||||
VkPhysicalDevice *physical_devices; /* hides a pointer */
|
VkPhysicalDevice *physical_devices; /* hides a pointer */
|
||||||
guint32 n_physical_devices;
|
guint32 n_physical_devices;
|
||||||
|
|
||||||
VkDebugReportCallbackEXT msg_callback;
|
|
||||||
PFN_vkCreateDebugReportCallbackEXT dbgCreateDebugReportCallback;
|
|
||||||
PFN_vkDestroyDebugReportCallbackEXT dbgDestroyDebugReportCallback;
|
|
||||||
PFN_vkDebugReportMessageEXT dbgReportMessage;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstVulkanInstanceClass
|
struct _GstVulkanInstanceClass
|
||||||
|
|
Loading…
Reference in a new issue