History

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.

Lynne committed 1 year ago

Commit 1b8cd001 parent 8fbecfd2 files · +15 −1Browse files

Unified · Split

2 files
  1. configure +6 −1
  2. libavutil/hwcontext_vulkan.c +9 −0
configure+6−1
@@ -363,6 +363,7 @@ External library support: · 362 unmodified lines
363363 --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
364364 --disable-videotoolbox disable VideoToolbox code [autodetect]
365365 --disable-vulkan disable Vulkan code [autodetect]
366+ --enable-vulkan-static statically link to libvulkan [no]
366367
367368 Toolchain options:
368369 --arch=ARCH select architecture [$arch]
@@ -1987,6 +1988,7 @@ EXTERNAL_LIBRARY_LIST=" · 1618 unmodified lines
19871988 openssl
19881989 pocketsphinx
19891990 vapoursynth
1991+ vulkan_static
19901992 "
19911993
19921994 HWACCEL_AUTODETECT_LIBRARY_LIST="
@@ -7379,7 +7381,10 @@ enabled vdpau && · 5386 unmodified lines
73797381 enabled vdpau &&
73807382 check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
73817383
7382−if enabled vulkan; then
7384+if enabled_all vulkan vulkan_static; then
7385+ check_pkg_config vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
7386+ check_lib vulkan "vulkan/vulkan.h" vkGetInstanceProcAddr -lvulkan
7387+elif enabled vulkan; then
73837388 check_pkg_config_header_only vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
73847389 check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 277)"
73857390 fi
libavutil/hwcontext_vulkan.c+9−0
@@ -533,11 +533,19 @@ static int vkfmt_from_pixfmt2(AVHWDeviceContext *dev_ctx, enum AVPixelFormat p, · 532 unmodified lines
533533 return AVERROR(EINVAL);
534534 }
535535
536+#if CONFIG_VULKAN_STATIC
537+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance,
538+ const char *pName);
539+#endif
540+
536541 static int load_libvulkan(AVHWDeviceContext *ctx)
537542 {
538543 VulkanDevicePriv *p = ctx->hwctx;
539544 AVVulkanDeviceContext *hwctx = &p->p;
540545
546+#if CONFIG_VULKAN_STATIC
547+ hwctx->get_proc_addr = vkGetInstanceProcAddr;
548+#else
541549 static const char *lib_names[] = {
542550 #if defined(_WIN32)
543551 "vulkan-1.dll",
@@ -563,6 +571,7 @@ static int load_libvulkan(AVHWDeviceContext *ctx) · 19 unmodified lines
563571 }
564572
565573 hwctx->get_proc_addr = (PFN_vkGetInstanceProcAddr)dlsym(p->libvulkan, "vkGetInstanceProcAddr");
574+#endif /* CONFIG_VULKAN_STATIC */
566575
567576 return 0;
568577 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t