diff options
Diffstat (limited to 'loader')
| -rw-r--r-- | loader/loader.c | 15 | ||||
| -rw-r--r-- | loader/loader.h | 7 | ||||
| -rw-r--r-- | loader/table_ops.h | 23 |
3 files changed, 19 insertions, 26 deletions
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); } diff --git a/loader/loader.h b/loader/loader.h index 73b780fd..8b427b5f 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -321,13 +321,6 @@ VkResult loader_GetPhysicalDeviceExtensionInfo( size_t* pDataSize, void* pData); -VkResult loader_EnumerateLayers( - VkPhysicalDevice gpu, - size_t maxStringSize, - size_t* pLayerCount, - char* const* pOutLayers, - void* pReserved); - VkResult loader_GetMultiDeviceCompatibility( VkPhysicalDevice gpu0, VkPhysicalDevice gpu1, diff --git a/loader/table_ops.h b/loader/table_ops.h index 1fb624bc..93131b18 100644 --- a/loader/table_ops.h +++ b/loader/table_ops.h @@ -30,9 +30,13 @@ static inline void loader_init_device_dispatch_table(VkLayerDispatchTable *table, PFN_vkGetDeviceProcAddr gpa, + VkDevice dev_next, VkDevice dev) { - table->GetDeviceProcAddr = gpa; + // If layer is next, this will trigger layers to initialize their dispatch tables + //then use the gpa in their dispatch for subsequent layers in the chain + table->GetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) gpa(dev_next, "vkGetDeviceProcAddr"); + table->DestroyDevice = (PFN_vkDestroyDevice) gpa(dev, "vkDestroyDevice"); table->GetDeviceQueue = (PFN_vkGetDeviceQueue) gpa(dev, "vkGetDeviceQueue"); table->QueueSubmit = (PFN_vkQueueSubmit) gpa(dev, "vkQueueSubmit"); @@ -137,6 +141,8 @@ static inline void loader_init_device_dispatch_table(VkLayerDispatchTable *table table->CmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) gpa(dev, "vkCmdBeginRenderPass"); table->CmdEndRenderPass = (PFN_vkCmdEndRenderPass) gpa(dev, "vkCmdEndRenderPass"); //TODO move into it's own table +//TODO also consider dropping trampoline code for these device level extensions entirely +// then don't need loader to know about these at all but then not queryable via GIPA table->CreateSwapChainWSI = (PFN_vkCreateSwapChainWSI) gpa(dev, "vkCreateSwapChainWSI"); table->DestroySwapChainWSI = (PFN_vkDestroySwapChainWSI) gpa(dev, "vkDestroySwapChainWSI"); table->GetSwapChainInfoWSI = (PFN_vkGetSwapChainInfoWSI) gpa(dev, "vkGetSwapChainInfoWSI"); @@ -359,28 +365,23 @@ static inline void *loader_lookup_device_dispatch_table( return (void *) table->CmdBeginRenderPass; if (!strcmp(name, "CmdEndRenderPass")) return (void *) table->CmdEndRenderPass; -//TODO put in it's own table - if (!strcmp(name, "CreateSwapChainWSI")) - return (void *) table->CreateSwapChainWSI; - if (!strcmp(name, "DestroySwapChainWSI")) - return (void *) table->DestroySwapChainWSI; - if (!strcmp(name, "GetSwapChainInfoWSI")) - return (void *) table->GetSwapChainInfoWSI; - if (!strcmp(name, "QueuePresentWSI")) - return (void *) table->QueuePresentWSI; return NULL; } static inline void loader_init_instance_core_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa, + VkInstance inst_next, VkInstance inst) { + // If layer is next, this will trigger layers to initialize their dispatch tables + //then use the gpa in their dispatch for subsequent layers in the chain + table->GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) gpa(inst_next, "vkGetInstanceProcAddr"); + table->CreateInstance = (PFN_vkCreateInstance) gpa(inst, "vkCreateInstance"); table->DestroyInstance = (PFN_vkDestroyInstance) gpa(inst, "vkDestroyInstance"); table->EnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) gpa(inst, "vkEnumeratePhysicalDevices"); table->GetPhysicalDeviceInfo = (PFN_vkGetPhysicalDeviceInfo) gpa(inst, "vkGetPhysicalDeviceInfo"); - table->GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) gpa(inst, "vkGetInstanceProcAddr"); table->CreateDevice = (PFN_vkCreateDevice) gpa(inst, "vkCreateDevice"); table->GetGlobalExtensionInfo = (PFN_vkGetGlobalExtensionInfo) gpa(inst,"vkGetGlobalExtensionInfo"); table->GetPhysicalDeviceExtensionInfo = (PFN_vkGetPhysicalDeviceExtensionInfo) gpa(inst, "vkGetPhysicalDeviceExtensionInfo"); |
