History

hwcontext_vulkan: forward debug_mode to check_extensions() for devices

This allows disabling of certain extensions when debug mode is turned on.

Lynne committed 2 years ago

Commit 2942ca81 parent b5184c51 file · +13 −12Browse files

Unified · Split

libavutil/hwcontext_vulkan.c+13−12
@@ -798,11 +798,11 @@ end: · 797 unmodified lines
798798 }
799799
800800 /* Creates a VkInstance */
801−static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
801+static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts,
802+ enum FFVulkanDebugMode *debug_mode)
802803 {
803804 int err = 0;
804805 VkResult ret;
805− enum FFVulkanDebugMode debug_mode;
806806 VulkanDevicePriv *p = ctx->hwctx;
807807 AVVulkanDeviceContext *hwctx = &p->p;
808808 FFVulkanFunctions *vk = &p->vkctx.vkfn;
@@ -839,20 +839,20 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) · 30 unmodified lines
839839 }
840840
841841 err = check_layers(ctx, opts, &inst_props.ppEnabledLayerNames,
842− &inst_props.enabledLayerCount, &debug_mode);
842+ &inst_props.enabledLayerCount, debug_mode);
843843 if (err)
844844 goto fail;
845845
846846 /* Check for present/missing extensions */
847847 err = check_extensions(ctx, 0, opts, &inst_props.ppEnabledExtensionNames,
848− &inst_props.enabledExtensionCount, debug_mode);
848+ &inst_props.enabledExtensionCount, *debug_mode);
849849 hwctx->enabled_inst_extensions = inst_props.ppEnabledExtensionNames;
850850 hwctx->nb_enabled_inst_extensions = inst_props.enabledExtensionCount;
851851 if (err < 0)
852852 goto fail;
853853
854854 /* Enable debug features if needed */
855− if (debug_mode == FF_VULKAN_DEBUG_VALIDATE) {
855+ if (*debug_mode == FF_VULKAN_DEBUG_VALIDATE) {
856856 static const VkValidationFeatureEnableEXT feat_list_validate[] = {
857857 VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
858858 VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
@@ -861,7 +861,7 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) · 2 unmodified lines
861861 validation_features.pEnabledValidationFeatures = feat_list_validate;
862862 validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list_validate);
863863 inst_props.pNext = &validation_features;
864− } else if (debug_mode == FF_VULKAN_DEBUG_PRINTF) {
864+ } else if (*debug_mode == FF_VULKAN_DEBUG_PRINTF) {
865865 static const VkValidationFeatureEnableEXT feat_list_debug[] = {
866866 VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
867867 VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
@@ -870,7 +870,7 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) · 2 unmodified lines
870870 validation_features.pEnabledValidationFeatures = feat_list_debug;
871871 validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list_debug);
872872 inst_props.pNext = &validation_features;
873− } else if (debug_mode == FF_VULKAN_DEBUG_PRACTICES) {
873+ } else if (*debug_mode == FF_VULKAN_DEBUG_PRACTICES) {
874874 static const VkValidationFeatureEnableEXT feat_list_practices[] = {
875875 VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
876876 VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT,
@@ -908,9 +908,9 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts) · 31 unmodified lines
908908 }
909909
910910 /* Setup debugging callback if needed */
911− if ((debug_mode == FF_VULKAN_DEBUG_VALIDATE) ||
912− (debug_mode == FF_VULKAN_DEBUG_PRINTF) ||
913− (debug_mode == FF_VULKAN_DEBUG_PRACTICES)) {
911+ if ((*debug_mode == FF_VULKAN_DEBUG_VALIDATE) ||
912+ (*debug_mode == FF_VULKAN_DEBUG_PRINTF) ||
913+ (*debug_mode == FF_VULKAN_DEBUG_PRACTICES)) {
914914 VkDebugUtilsMessengerCreateInfoEXT dbg = {
915915 .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
916916 .messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
@@ -1403,6 +1403,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, · 486 unmodified lines
14031403 VulkanDevicePriv *p = ctx->hwctx;
14041404 AVVulkanDeviceContext *hwctx = &p->p;
14051405 FFVulkanFunctions *vk = &p->vkctx.vkfn;
1406+ enum FFVulkanDebugMode debug_mode = FF_VULKAN_DEBUG_NONE;
14061407
14071408 /*
14081409 * VkPhysicalDeviceVulkan12Features has a timelineSemaphore field, but
@@ -1460,7 +1461,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, · 51 unmodified lines
14601461 ctx->free = vulkan_device_free;
14611462
14621463 /* Create an instance if not given one */
1463− if ((err = create_instance(ctx, opts)))
1464+ if ((err = create_instance(ctx, opts, &debug_mode)))
14641465 goto end;
14651466
14661467 /* Find a device (if not given one) */
@@ -1529,7 +1530,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, · 62 unmodified lines
15291530
15301531 /* Find and enable extensions */
15311532 if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames,
1532− &dev_info.enabledExtensionCount, 0))) {
1533+ &dev_info.enabledExtensionCount, debug_mode))) {
15331534 for (int i = 0; i < dev_info.queueCreateInfoCount; i++)
15341535 av_free((void *)dev_info.pQueueCreateInfos[i].pQueuePriorities);
15351536 av_free((void *)dev_info.pQueueCreateInfos);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t