You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
hwcontext_vulkan: forward debug_mode to check_extensions() for devices
This allows disabling of certain extensions when debug mode is turned on.
This commit is contained in:
@ -798,11 +798,11 @@ end:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Creates a VkInstance */
|
/* Creates a VkInstance */
|
||||||
static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
|
static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts,
|
||||||
|
enum FFVulkanDebugMode *debug_mode)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
VkResult ret;
|
VkResult ret;
|
||||||
enum FFVulkanDebugMode debug_mode;
|
|
||||||
VulkanDevicePriv *p = ctx->hwctx;
|
VulkanDevicePriv *p = ctx->hwctx;
|
||||||
AVVulkanDeviceContext *hwctx = &p->p;
|
AVVulkanDeviceContext *hwctx = &p->p;
|
||||||
FFVulkanFunctions *vk = &p->vkctx.vkfn;
|
FFVulkanFunctions *vk = &p->vkctx.vkfn;
|
||||||
@ -839,20 +839,20 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = check_layers(ctx, opts, &inst_props.ppEnabledLayerNames,
|
err = check_layers(ctx, opts, &inst_props.ppEnabledLayerNames,
|
||||||
&inst_props.enabledLayerCount, &debug_mode);
|
&inst_props.enabledLayerCount, debug_mode);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Check for present/missing extensions */
|
/* Check for present/missing extensions */
|
||||||
err = check_extensions(ctx, 0, opts, &inst_props.ppEnabledExtensionNames,
|
err = check_extensions(ctx, 0, opts, &inst_props.ppEnabledExtensionNames,
|
||||||
&inst_props.enabledExtensionCount, debug_mode);
|
&inst_props.enabledExtensionCount, *debug_mode);
|
||||||
hwctx->enabled_inst_extensions = inst_props.ppEnabledExtensionNames;
|
hwctx->enabled_inst_extensions = inst_props.ppEnabledExtensionNames;
|
||||||
hwctx->nb_enabled_inst_extensions = inst_props.enabledExtensionCount;
|
hwctx->nb_enabled_inst_extensions = inst_props.enabledExtensionCount;
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Enable debug features if needed */
|
/* Enable debug features if needed */
|
||||||
if (debug_mode == FF_VULKAN_DEBUG_VALIDATE) {
|
if (*debug_mode == FF_VULKAN_DEBUG_VALIDATE) {
|
||||||
static const VkValidationFeatureEnableEXT feat_list_validate[] = {
|
static const VkValidationFeatureEnableEXT feat_list_validate[] = {
|
||||||
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
|
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
|
||||||
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
|
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
|
||||||
@ -861,7 +861,7 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
|
|||||||
validation_features.pEnabledValidationFeatures = feat_list_validate;
|
validation_features.pEnabledValidationFeatures = feat_list_validate;
|
||||||
validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list_validate);
|
validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list_validate);
|
||||||
inst_props.pNext = &validation_features;
|
inst_props.pNext = &validation_features;
|
||||||
} else if (debug_mode == FF_VULKAN_DEBUG_PRINTF) {
|
} else if (*debug_mode == FF_VULKAN_DEBUG_PRINTF) {
|
||||||
static const VkValidationFeatureEnableEXT feat_list_debug[] = {
|
static const VkValidationFeatureEnableEXT feat_list_debug[] = {
|
||||||
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
|
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
|
||||||
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
|
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
|
||||||
@ -870,7 +870,7 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
|
|||||||
validation_features.pEnabledValidationFeatures = feat_list_debug;
|
validation_features.pEnabledValidationFeatures = feat_list_debug;
|
||||||
validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list_debug);
|
validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list_debug);
|
||||||
inst_props.pNext = &validation_features;
|
inst_props.pNext = &validation_features;
|
||||||
} else if (debug_mode == FF_VULKAN_DEBUG_PRACTICES) {
|
} else if (*debug_mode == FF_VULKAN_DEBUG_PRACTICES) {
|
||||||
static const VkValidationFeatureEnableEXT feat_list_practices[] = {
|
static const VkValidationFeatureEnableEXT feat_list_practices[] = {
|
||||||
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
|
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
|
||||||
VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT,
|
VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT,
|
||||||
@ -908,9 +908,9 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Setup debugging callback if needed */
|
/* Setup debugging callback if needed */
|
||||||
if ((debug_mode == FF_VULKAN_DEBUG_VALIDATE) ||
|
if ((*debug_mode == FF_VULKAN_DEBUG_VALIDATE) ||
|
||||||
(debug_mode == FF_VULKAN_DEBUG_PRINTF) ||
|
(*debug_mode == FF_VULKAN_DEBUG_PRINTF) ||
|
||||||
(debug_mode == FF_VULKAN_DEBUG_PRACTICES)) {
|
(*debug_mode == FF_VULKAN_DEBUG_PRACTICES)) {
|
||||||
VkDebugUtilsMessengerCreateInfoEXT dbg = {
|
VkDebugUtilsMessengerCreateInfoEXT dbg = {
|
||||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
|
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
|
||||||
.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
|
.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
|
||||||
@ -1403,6 +1403,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
|
|||||||
VulkanDevicePriv *p = ctx->hwctx;
|
VulkanDevicePriv *p = ctx->hwctx;
|
||||||
AVVulkanDeviceContext *hwctx = &p->p;
|
AVVulkanDeviceContext *hwctx = &p->p;
|
||||||
FFVulkanFunctions *vk = &p->vkctx.vkfn;
|
FFVulkanFunctions *vk = &p->vkctx.vkfn;
|
||||||
|
enum FFVulkanDebugMode debug_mode = FF_VULKAN_DEBUG_NONE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VkPhysicalDeviceVulkan12Features has a timelineSemaphore field, but
|
* VkPhysicalDeviceVulkan12Features has a timelineSemaphore field, but
|
||||||
@ -1460,7 +1461,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
|
|||||||
ctx->free = vulkan_device_free;
|
ctx->free = vulkan_device_free;
|
||||||
|
|
||||||
/* Create an instance if not given one */
|
/* Create an instance if not given one */
|
||||||
if ((err = create_instance(ctx, opts)))
|
if ((err = create_instance(ctx, opts, &debug_mode)))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
/* Find a device (if not given one) */
|
/* Find a device (if not given one) */
|
||||||
@ -1529,7 +1530,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
|
|||||||
|
|
||||||
/* Find and enable extensions */
|
/* Find and enable extensions */
|
||||||
if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames,
|
if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames,
|
||||||
&dev_info.enabledExtensionCount, 0))) {
|
&dev_info.enabledExtensionCount, debug_mode))) {
|
||||||
for (int i = 0; i < dev_info.queueCreateInfoCount; i++)
|
for (int i = 0; i < dev_info.queueCreateInfoCount; i++)
|
||||||
av_free((void *)dev_info.pQueueCreateInfos[i].pQueuePriorities);
|
av_free((void *)dev_info.pQueueCreateInfos[i].pQueuePriorities);
|
||||||
av_free((void *)dev_info.pQueueCreateInfos);
|
av_free((void *)dev_info.pQueueCreateInfos);
|
||||||
|
Reference in New Issue
Block a user