Skip to content
Snippets Groups Projects
Commit c6b4b791 authored by Jakob Bornecrantz's avatar Jakob Bornecrantz
Browse files

comp: Refactor vk_get_loader_functions function

parent e4a016f4
Branches
Tags
No related merge requests found
...@@ -673,6 +673,19 @@ vk_destroy_validation_callback(struct vk_bundle *vk) ...@@ -673,6 +673,19 @@ vk_destroy_validation_callback(struct vk_bundle *vk)
#define GET_DEV_PROC(vk, name) \ #define GET_DEV_PROC(vk, name) \
(PFN_##name) vk->vkGetDeviceProcAddr(vk->device, #name); (PFN_##name) vk->vkGetDeviceProcAddr(vk->device, #name);
VkResult
vk_get_loader_functions(struct vk_bundle *vk, PFN_vkGetInstanceProcAddr g)
{
vk->vkGetInstanceProcAddr = g;
// Fill in all loader functions.
// clang-format off
vk->vkCreateInstance = GET_PROC(vk, vkCreateInstance);
// clang-format on
return VK_SUCCESS;
}
VkResult VkResult
vk_get_instance_functions(struct vk_bundle *vk) vk_get_instance_functions(struct vk_bundle *vk)
{ {
......
...@@ -227,6 +227,12 @@ vk_init_validation_callback(struct vk_bundle *vk); ...@@ -227,6 +227,12 @@ vk_init_validation_callback(struct vk_bundle *vk);
void void
vk_destroy_validation_callback(struct vk_bundle *vk); vk_destroy_validation_callback(struct vk_bundle *vk);
/*!
* @ingroup comp_common
*/
VkResult
vk_get_loader_functions(struct vk_bundle *vk, PFN_vkGetInstanceProcAddr g);
/*! /*!
* @ingroup comp_common * @ingroup comp_common
*/ */
......
...@@ -137,7 +137,6 @@ compositor_end_frame(struct xrt_compositor *xc, ...@@ -137,7 +137,6 @@ compositor_end_frame(struct xrt_compositor *xc,
* *
*/ */
#define GET_PROC(name) (PFN_##name) c->vk.vkGetInstanceProcAddr(NULL, #name);
#define GET_DEV_PROC(c, name) \ #define GET_DEV_PROC(c, name) \
(PFN_##name) c->vk.vkGetDeviceProcAddr(c->vk.device, #name); (PFN_##name) c->vk.vkGetDeviceProcAddr(c->vk.device, #name);
#define GET_INS_PROC(c, name) \ #define GET_INS_PROC(c, name) \
...@@ -152,14 +151,7 @@ static VkResult ...@@ -152,14 +151,7 @@ static VkResult
find_get_instance_proc_addr(struct comp_compositor *c) find_get_instance_proc_addr(struct comp_compositor *c)
{ {
//! @todo Do any library loading here. //! @todo Do any library loading here.
c->vk.vkGetInstanceProcAddr = vkGetInstanceProcAddr; return vk_get_loader_functions(&c->vk, vkGetInstanceProcAddr);
// Fill in all loader functions.
// clang-format off
c->vk.vkCreateInstance = GET_PROC(vkCreateInstance);
// clang-format on
return VK_SUCCESS;
} }
#ifdef XRT_ENABLE_VK_VALIDATION #ifdef XRT_ENABLE_VK_VALIDATION
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment