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