configure: add option to statically link to libvulkan

This may be useful in weird setups and on platforms where
static linking to libvulkan is supported.

libplacebo also has this fallback.
pull/391/head
Lynne 4 weeks ago
parent 8fbecfd1a0
commit 1b8cd00da6
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
  1. 7
      configure
  2. 9
      libavutil/hwcontext_vulkan.c

7
configure vendored

@ -363,6 +363,7 @@ External library support:
--disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
--disable-videotoolbox disable VideoToolbox code [autodetect]
--disable-vulkan disable Vulkan code [autodetect]
--enable-vulkan-static statically link to libvulkan [no]
Toolchain options:
--arch=ARCH select architecture [$arch]
@ -1987,6 +1988,7 @@ EXTERNAL_LIBRARY_LIST="
openssl
pocketsphinx
vapoursynth
vulkan_static
"
HWACCEL_AUTODETECT_LIBRARY_LIST="
@ -7379,7 +7381,10 @@ enabled vdpau &&
enabled vdpau &&
check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
if enabled vulkan; then
if enabled_all vulkan vulkan_static; then
check_pkg_config vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
check_lib vulkan "vulkan/vulkan.h" vkGetInstanceProcAddr -lvulkan
elif enabled vulkan; then
check_pkg_config_header_only vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 277)"
fi

@ -533,11 +533,19 @@ static int vkfmt_from_pixfmt2(AVHWDeviceContext *dev_ctx, enum AVPixelFormat p,
return AVERROR(EINVAL);
}
#if CONFIG_VULKAN_STATIC
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance,
const char *pName);
#endif
static int load_libvulkan(AVHWDeviceContext *ctx)
{
VulkanDevicePriv *p = ctx->hwctx;
AVVulkanDeviceContext *hwctx = &p->p;
#if CONFIG_VULKAN_STATIC
hwctx->get_proc_addr = vkGetInstanceProcAddr;
#else
static const char *lib_names[] = {
#if defined(_WIN32)
"vulkan-1.dll",
@ -563,6 +571,7 @@ static int load_libvulkan(AVHWDeviceContext *ctx)
}
hwctx->get_proc_addr = (PFN_vkGetInstanceProcAddr)dlsym(p->libvulkan, "vkGetInstanceProcAddr");
#endif /* CONFIG_VULKAN_STATIC */
return 0;
}

Loading…
Cancel
Save