hwcontext_vulkan: enable GPU-assisted validation when debugging

This commit is contained in:
Lynne 2023-03-14 20:45:45 +01:00
parent e5e12c5078
commit 9b385b480f
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
1 changed files with 14 additions and 0 deletions

View File

@ -696,6 +696,9 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
LIBAVUTIL_VERSION_MINOR,
LIBAVUTIL_VERSION_MICRO),
};
VkValidationFeaturesEXT validation_features = {
.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT,
};
VkInstanceCreateInfo inst_props = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pApplicationInfo = &application_info,
@ -726,6 +729,17 @@ static int create_instance(AVHWDeviceContext *ctx, AVDictionary *opts)
if (err < 0)
goto fail;
if (debug_mode) {
VkValidationFeatureEnableEXT feat_list[] = {
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT,
VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT,
};
validation_features.pEnabledValidationFeatures = feat_list;
validation_features.enabledValidationFeatureCount = FF_ARRAY_ELEMS(feat_list);
inst_props.pNext = &validation_features;
}
/* Try to create the instance */
ret = vk->CreateInstance(&inst_props, hwctx->alloc, &hwctx->inst);