1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

hwcontext_vulkan: dynamically load functions

This patch allows for alternative loader implementations.
This commit is contained in:
Lynne 2021-04-29 02:44:41 +02:00
parent ffeeff4fbc
commit 4a6581e968
3 changed files with 375 additions and 147 deletions

View File

@ -427,16 +427,19 @@ static int cuda_device_derive(AVHWDeviceContext *device_ctx,
switch (src_ctx->type) { switch (src_ctx->type) {
#if CONFIG_VULKAN #if CONFIG_VULKAN
#define TYPE PFN_vkGetPhysicalDeviceProperties2
case AV_HWDEVICE_TYPE_VULKAN: { case AV_HWDEVICE_TYPE_VULKAN: {
AVVulkanDeviceContext *vkctx = src_ctx->hwctx; AVVulkanDeviceContext *vkctx = src_ctx->hwctx;
TYPE prop_fn = (TYPE)vkctx->get_proc_addr(vkctx->inst, "vkGetPhysicalDeviceProperties2");
VkPhysicalDeviceProperties2 vk_dev_props = { VkPhysicalDeviceProperties2 vk_dev_props = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
.pNext = &vk_idp, .pNext = &vk_idp,
}; };
vkGetPhysicalDeviceProperties2(vkctx->phys_dev, &vk_dev_props); prop_fn(vkctx->phys_dev, &vk_dev_props);
src_uuid = vk_idp.deviceUUID; src_uuid = vk_idp.deviceUUID;
break; break;
} }
#undef TYPE
#endif #endif
default: default:
return AVERROR(ENOSYS); return AVERROR(ENOSYS);

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,13 @@ typedef struct AVVulkanDeviceContext {
*/ */
const VkAllocationCallbacks *alloc; const VkAllocationCallbacks *alloc;
/**
* Pointer to the instance-provided vkGetInstanceProcAddr loading function.
* If NULL, will pick either libvulkan or libvolk, depending on libavutil's
* compilation settings, and set this field.
*/
PFN_vkGetInstanceProcAddr get_proc_addr;
/** /**
* Vulkan instance. Must be at least version 1.1. * Vulkan instance. Must be at least version 1.1.
*/ */