VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *funcName) {
PFN_vkVoidFunction proc = intercept_core_instance_command(funcName);
+ if (!proc)
+ proc = intercept_core_device_command(funcName);
if (proc)
return proc;
- if (instance == NULL) {
- return NULL;
- }
-
+ assert(instance);
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- PFN_vkVoidFunction fptr = debug_report_get_instance_proc_addr(my_data->report_data, funcName);
- if (fptr)
- return fptr;
+ proc = debug_report_get_instance_proc_addr(my_data->report_data, funcName);
+ if (proc)
+ return proc;
VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
if (pTable->GetInstanceProcAddr == NULL)
{ "vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(CreateInstance) },
{ "vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(DestroyInstance) },
{ "vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(CreateDevice) },
- { "vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateInstanceLayerProperties) },
- { "vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateInstanceExtensionProperties) },
- { "vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateDeviceLayerProperties) },
{ "vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceExtensionProperties) },
{ "vkGetPhysicalDeviceProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceProperties) },
};
+ // we should never be queried for these commands
+ assert(strcmp(name, "vkEnumerateInstanceLayerProperties") &&
+ strcmp(name, "vkEnumerateInstanceExtensionProperties") &&
+ strcmp(name, "vkEnumerateDeviceLayerProperties"));
+
for (size_t i = 0; i < ARRAY_SIZE(core_instance_commands); i++) {
if (!strcmp(core_instance_commands[i].name, name))
return core_instance_commands[i].proc;
}
VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *funcName) {
+ if (!strcmp(funcName, "vkEnumerateInstanceLayerProperties"))
+ return reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateInstanceLayerProperties);
+ if (!strcmp(funcName, "vkEnumerateInstanceExtensionProperties"))
+ return reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateInstanceExtensionProperties);
+ if (!strcmp(funcName, "vkEnumerateDeviceLayerProperties"))
+ return reinterpret_cast<PFN_vkVoidFunction>(vkEnumerateDeviceLayerProperties);
+ if (!strcmp(funcName, "vkGetInstanceProcAddr"))
+ return reinterpret_cast<PFN_vkVoidFunction>(vkGetInstanceProcAddr);
+
return image::GetInstanceProcAddr(instance, funcName);
}