--- libavutil/hwcontext_vulkan.c | 39 ++++++++++++++++++++++++++++++++++++ libavutil/vulkan_functions.h | 1 + libavutil/vulkan_loader.h | 1 + 3 files changed, 41 insertions(+)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index d6500de677..518c3d642b 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -100,6 +100,9 @@ typedef struct VulkanDevicePriv { VkPhysicalDeviceOpticalFlowFeaturesNV optical_flow_features; VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features; VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features; +#ifdef VK_KHR_shader_relaxed_extended_instruction + VkPhysicalDeviceShaderRelaxedExtendedInstructionFeaturesKHR relaxed_extended_instr_features; +#endif /* Queues */ pthread_mutex_t **qf_mutex; @@ -622,6 +625,28 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, } } +#ifdef VK_KHR_shader_relaxed_extended_instruction + if (debug_mode == FF_VULKAN_DEBUG_PRINTF) { + tstr = VK_KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_EXTENSION_NAME; + found = 0; + for (int j = 0; j < sup_ext_count; j++) { + if (!strcmp(tstr, sup_ext[j].extensionName)) { + found = 1; + break; + } + } + if (found) { + av_log(ctx, AV_LOG_VERBOSE, "Using %s extension %s\n", mod, tstr); + ADD_VAL_TO_LIST(extension_names, extensions_found, tstr); + } else { + av_log(ctx, AV_LOG_ERROR, "Debug printf enabled, but extension \"%s\" not found!\n", + tstr); + err = AVERROR(EINVAL); + goto fail; + } +#endif + } + if (user_exts_str) { char *save, *token = av_strtok(user_exts_str, "+", &save); while (token) { @@ -1419,9 +1444,19 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, VkPhysicalDeviceTimelineSemaphoreFeatures timeline_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES, }; +#ifdef VK_KHR_shader_relaxed_extended_instruction + VkPhysicalDeviceShaderRelaxedExtendedInstructionFeaturesKHR relaxed_extended_instr_features = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_RELAXED_EXTENDED_INSTRUCTION_FEATURES_KHR, + .pNext = &timeline_features, + }; +#endif VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR, +#ifdef VK_KHR_shader_relaxed_extended_instruction + .pNext = &relaxed_extended_instr_features, +#else .pNext = &timeline_features, +#endif }; VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT, @@ -1535,6 +1570,10 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx, p->shader_object_features.shaderObject = shader_object_features.shaderObject; +#ifdef VK_KHR_shader_relaxed_extended_instruction + p->relaxed_extended_instr_features.shaderRelaxedExtendedInstruction = relaxed_extended_instr_features.shaderRelaxedExtendedInstruction; +#endif + /* Find and enable extensions */ if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames, &dev_info.enabledExtensionCount, debug_mode))) { diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h index c565d62335..7a5385381b 100644 --- a/libavutil/vulkan_functions.h +++ b/libavutil/vulkan_functions.h @@ -47,6 +47,7 @@ typedef uint64_t FFVulkanExtensions; #define FF_VK_EXT_OPTICAL_FLOW (1ULL << 12) /* VK_NV_optical_flow */ #define FF_VK_EXT_SHADER_OBJECT (1ULL << 13) /* VK_EXT_shader_object */ #define FF_VK_EXT_PUSH_DESCRIPTOR (1ULL << 14) /* VK_KHR_push_descriptor */ +#define FF_VK_EXT_RELAXED_EXTENDED_INSTR (1ULL << 15) /* VK_KHR_shader_relaxed_extended_instruction */ /* Video extensions */ #define FF_VK_EXT_VIDEO_QUEUE (1ULL << 36) /* VK_KHR_video_queue */ diff --git a/libavutil/vulkan_loader.h b/libavutil/vulkan_loader.h index 2022eb320b..3dc27c159e 100644 --- a/libavutil/vulkan_loader.h +++ b/libavutil/vulkan_loader.h @@ -40,6 +40,7 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions, const char *name; FFVulkanExtensions flag; } extension_map[] = { + { VK_KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_EXTENSION_NAME, FF_VK_EXT_RELAXED_EXTENDED_INSTR }, { VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_DMABUF_MEMORY }, { VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME, FF_VK_EXT_DRM_MODIFIER_FLAGS }, { VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_MEMORY }, -- 2.45.2.753.g447d99e1c3b _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".