1
0
mirror of https://github.com/elima/gpu-playground.git synced 2025-06-05 23:16:23 +00:00

common: Makes vk-api assume a Vulkan loader is being used

This commit is contained in:
Eduardo Lima Mitev 2016-11-10 10:45:33 +01:00
parent d125302c86
commit d0ef28783b
2 changed files with 11 additions and 3 deletions

View File

@ -17,7 +17,12 @@ void
vk_api_load_from_icd (struct vk_api* vk)
{
/* load API entry points from ICD */
GET_ICD_PROC_ADDR (*vk, GetInstanceProcAddr);
/* if program is linked against a Vulkan loader */
vk->GetInstanceProcAddr = vkGetInstanceProcAddr;
/* otherwise, */
/* GET_ICD_PROC_ADDR (vk, GetInstanceProcAddr); */
GET_PROC_ADDR (*vk, EnumerateInstanceLayerProperties);
GET_PROC_ADDR (*vk, EnumerateInstanceExtensionProperties);
GET_PROC_ADDR (*vk, CreateInstance);

View File

@ -14,11 +14,14 @@
#include <vulkan/vulkan.h>
/* This is only necessary if program is linked to a Vulkan vendor driver\
* directly
*/
PFN_vkVoidFunction vk_icdGetInstanceProcAddr (VkInstance instance,
const char* pName);
#define GET_ICD_PROC_ADDR(api, symbol) \
(api).symbol = (PFN_vk ##symbol) vk_icdGetInstanceProcAddr(NULL, "vk" #symbol);
api.symbol = (PFN_vk ##symbol) vk_icdGetInstanceProcAddr(NULL, "vk" #symbol);
#define GET_PROC_ADDR(api, symbol) \
(api).symbol = (PFN_vk ##symbol) (api).GetInstanceProcAddr(NULL, "vk" #symbol);