Commit 4a6581e9 authored by Lynne's avatar Lynne

hwcontext_vulkan: dynamically load functions

This patch allows for alternative loader implementations.
parent ffeeff4f
......@@ -427,16 +427,19 @@ static int cuda_device_derive(AVHWDeviceContext *device_ctx,
switch (src_ctx->type) {
#if CONFIG_VULKAN
#define TYPE PFN_vkGetPhysicalDeviceProperties2
case AV_HWDEVICE_TYPE_VULKAN: {
AVVulkanDeviceContext *vkctx = src_ctx->hwctx;
TYPE prop_fn = (TYPE)vkctx->get_proc_addr(vkctx->inst, "vkGetPhysicalDeviceProperties2");
VkPhysicalDeviceProperties2 vk_dev_props = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
.pNext = &vk_idp,
};
vkGetPhysicalDeviceProperties2(vkctx->phys_dev, &vk_dev_props);
prop_fn(vkctx->phys_dev, &vk_dev_props);
src_uuid = vk_idp.deviceUUID;
break;
}
#undef TYPE
#endif
default:
return AVERROR(ENOSYS);
......
This diff is collapsed.
......@@ -42,6 +42,13 @@ typedef struct AVVulkanDeviceContext {
*/
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.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment