From 0d67c29d5d2a2f3383e11279a091a1f164f8eb95 Mon Sep 17 00:00:00 2001 From: Jon Ashburn Date: Thu, 28 May 2015 16:25:02 -0600 Subject: loader: Support layers that don't have an extension entrypoint Change all layers and loader interface to init dispatch tables on GPA("GetXXXProcAddr"). After that initialization rest of dispatch tables are inited via unwrapped object using the GPA in the dispatch table. This also allows App generated GPA calls that the loader can't resolve to function correctly. --- loader/loader.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'loader/loader.c') diff --git a/loader/loader.c b/loader/loader.c index 064b3dca..fd234657 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -820,14 +820,12 @@ static void* VKAPI loader_gpa_instance_internal(VkInstance inst, const char * pN VkLayerInstanceDispatchTable* disp_table = * (VkLayerInstanceDispatchTable **) inst; void *addr; + if (!strcmp(pName, "vkGetInstanceProcAddr")) + return (void *) loader_gpa_instance_internal; + if (disp_table == NULL) return NULL; -// addr = debug_report_instance_gpa((struct loader_instance *) inst, pName); -// if (addr) { -// return addr; -// } - addr = loader_lookup_instance_dispatch_table(disp_table, pName); if (addr) { return addr; @@ -1138,7 +1136,7 @@ uint32_t loader_activate_instance_layers(struct loader_instance *inst) layer_idx--; } - loader_init_instance_core_dispatch_table(inst->disp, nextGPA, (VkInstance) nextObj); + loader_init_instance_core_dispatch_table(inst->disp, nextGPA, (VkInstance) nextObj, (VkInstance) baseObj); return inst->layer_count; } @@ -1225,7 +1223,8 @@ extern uint32_t loader_activate_device_layers( layer_idx--; } - loader_init_device_dispatch_table(icd->loader_dispatch + gpu_index, nextGPA, (VkPhysicalDevice) nextObj); + loader_init_device_dispatch_table(icd->loader_dispatch + gpu_index, nextGPA, + (VkPhysicalDevice) nextObj, (VkPhysicalDevice) baseObj); } else { // TODO: Check that active layers match requested? } @@ -1370,7 +1369,7 @@ VkResult loader_EnumeratePhysicalDevices( (wrapped_gpus + i)->nextObject = gpus[i]; memcpy(pPhysicalDevices + count, gpus, sizeof(*pPhysicalDevices)); loader_init_device_dispatch_table(icd->loader_dispatch + i, - get_proc_addr, gpus[i]); + get_proc_addr, gpus[i], gpus[i]); loader_init_dispatch(gpus[i], ptr_instance->disp); } -- cgit v1.2.3