vkinstance: enable GPU assisted validation

This allows to check for syncronization issues while using the validation layer.

https://vulkan.lunarg.com/doc/sdk/1.3.239.0/linux/synchronization_usage.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4245>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-03-21 21:04:14 +01:00 committed by Sebastian Dröge
parent b30f982cf5
commit 1ace1a5275

View file

@ -940,6 +940,16 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
{
VkApplicationInfo app = { 0, };
VkInstanceCreateInfo inst_info = { 0, };
#if !defined (GST_DISABLE_DEBUG) && defined (VK_API_VERSION_1_2)
VkValidationFeaturesEXT validation_features;
VkValidationFeatureEnableEXT feat_list[] = {
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT,
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
#if defined (VK_API_VERSION_1_3)
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
#endif
};
#endif
/* *INDENT-OFF* */
app = (VkApplicationInfo) {
@ -963,6 +973,24 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
};
/* *INDENT-ON* */
#if !defined (GST_DISABLE_DEBUG)
vulkan_debug_level =
gst_debug_category_get_threshold (GST_VULKAN_DEBUG_CAT);
#if defined (VK_API_VERSION_1_2)
if (vulkan_debug_level >= GST_LEVEL_ERROR) {
/* *INDENT-OFF* */
validation_features = (VkValidationFeaturesEXT) {
.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT,
.pEnabledValidationFeatures = feat_list,
.enabledValidationFeatureCount = G_N_ELEMENTS (feat_list),
};
inst_info.pNext = &validation_features;
/* *INDENT-ON* */
}
#endif
#endif
err = vkCreateInstance (&inst_info, NULL, &instance->instance);
if (gst_vulkan_error_to_g_error (err, error, "vkCreateInstance") < 0) {
goto error;
@ -994,8 +1022,6 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
goto error;
#if !defined (GST_DISABLE_DEBUG)
vulkan_debug_level = gst_debug_category_get_threshold (GST_VULKAN_DEBUG_CAT);
if (vulkan_debug_level >= GST_LEVEL_ERROR
&& gst_vulkan_instance_is_extension_enabled_unlocked (instance,
VK_EXT_DEBUG_REPORT_EXTENSION_NAME, NULL)) {