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
363 --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]363 --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
364 --disable-videotoolbox disable VideoToolbox code [autodetect]364 --disable-videotoolbox disable VideoToolbox code [autodetect]
365 --disable-vulkan disable Vulkan code [autodetect]365 --disable-vulkan disable Vulkan code [autodetect]
366 --enable-vulkan-static statically link to libvulkan [no]
366 367
367Toolchain options:368Toolchain options:
368 --arch=ARCH select architecture [$arch]369 --arch=ARCH select architecture [$arch]
@@ -1987,6 +1988,7 @@ EXTERNAL_LIBRARY_LIST=" · 1618 unmodified lines
1987 openssl1988 openssl
1988 pocketsphinx1989 pocketsphinx
1989 vapoursynth1990 vapoursynth
1991 vulkan_static
1990"1992"
1991 1993
1992HWACCEL_AUTODETECT_LIBRARY_LIST="1994HWACCEL_AUTODETECT_LIBRARY_LIST="
@@ -7379,7 +7381,10 @@ enabled vdpau && · 5386 unmodified lines
7379enabled vdpau &&7381enabled vdpau &&
7380 check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX117382 check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
7381 7383
7382if enabled vulkan; then7384if 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
7387elif enabled vulkan; then
7383 check_pkg_config_header_only vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||7388 check_pkg_config_header_only vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
7384 check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 277)"7389 check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 277)"
7385fi7390fi
libavutil/hwcontext_vulkan.c+9−0
@@ -533,11 +533,19 @@ static int vkfmt_from_pixfmt2(AVHWDeviceContext *dev_ctx, enum AVPixelFormat p, · 532 unmodified lines
533 return AVERROR(EINVAL);533 return AVERROR(EINVAL);
534}534}
535 535
536#if CONFIG_VULKAN_STATIC
537VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance,
538 const char *pName);
539#endif
540
536static int load_libvulkan(AVHWDeviceContext *ctx)541static int load_libvulkan(AVHWDeviceContext *ctx)
537{542{
538 VulkanDevicePriv *p = ctx->hwctx;543 VulkanDevicePriv *p = ctx->hwctx;
539 AVVulkanDeviceContext *hwctx = &p->p;544 AVVulkanDeviceContext *hwctx = &p->p;
540 545
546#if CONFIG_VULKAN_STATIC
547 hwctx->get_proc_addr = vkGetInstanceProcAddr;
548#else
541 static const char *lib_names[] = {549 static const char *lib_names[] = {
542#if defined(_WIN32)550#if defined(_WIN32)
543 "vulkan-1.dll",551 "vulkan-1.dll",
@@ -563,6 +571,7 @@ static int load_libvulkan(AVHWDeviceContext *ctx) · 19 unmodified lines
563 }571 }
564 572
565 hwctx->get_proc_addr = (PFN_vkGetInstanceProcAddr)dlsym(p->libvulkan, "vkGetInstanceProcAddr");573 hwctx->get_proc_addr = (PFN_vkGetInstanceProcAddr)dlsym(p->libvulkan, "vkGetInstanceProcAddr");
574#endif /* CONFIG_VULKAN_STATIC */
566 575
567 return 0;576 return 0;
568}577}

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