From ac092c6707d8fc9adee1f20c45ff384280fafe3a Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 4 Oct 2024 10:37:54 +0200 Subject: [PATCH] hwcontext_vulkan: guard all uses of new spec defines and fix stray bracket This fixes compilation with less recent Vulkan headers. --- libavutil/hwcontext_vulkan.c | 5 ++++- libavutil/vulkan_loader.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index af187d6840..278848fc1b 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -281,7 +281,10 @@ static void device_features_copy_needed(VulkanDeviceFeatures *dst, VulkanDeviceF COPY_VAL(atomic_float.shaderBufferFloat32Atomics); COPY_VAL(atomic_float.shaderBufferFloat32AtomicAdd); + +#ifdef VK_KHR_shader_relaxed_extended_instruction COPY_VAL(relaxed_extended_instruction.shaderRelaxedExtendedInstruction); +#endif COPY_VAL(optical_flow.opticalFlow); #undef COPY_VAL @@ -774,8 +777,8 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts, err = AVERROR(EINVAL); goto fail; } -#endif } +#endif if (user_exts_str) { char *save, *token = av_strtok(user_exts_str, "+", &save); diff --git a/libavutil/vulkan_loader.h b/libavutil/vulkan_loader.h index 12e9884b8c..3253863a62 100644 --- a/libavutil/vulkan_loader.h +++ b/libavutil/vulkan_loader.h @@ -44,7 +44,9 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions, { VK_EXT_DEBUG_UTILS_EXTENSION_NAME, FF_VK_EXT_DEBUG_UTILS }, /* Device extensions */ +#ifdef VK_KHR_shader_relaxed_extended_instruction { VK_KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_EXTENSION_NAME, FF_VK_EXT_RELAXED_EXTENDED_INSTR }, +#endif { 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 },