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.
This commit is contained in:
Lynne 2024-12-18 17:27:46 +09:00
parent 8fbecfd1a0
commit 1b8cd00da6
No known key found for this signature in database
GPG key ID: A2FEA5F03F034464
2 changed files with 15 additions and 1 deletions

View file

@ -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;
}