Various dispatchable objects will use the same underlying dispatch table if they * are created from that "parent" object. Thus use pointer to dispatch table * as the key to these table maps. * Instance -> PhysicalDevice * Device -> CommandBuffer or Queue * If use the object themselves as key to map then implies Create entrypoints have to be intercepted * and a new key inserted into map
| 103 | * If use the object themselves as key to map then implies Create entrypoints have to be intercepted |
| 104 | * and a new key inserted into map */ |
| 105 | VkuInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa, instance_table_map &map) { |
| 106 | VkuInstanceDispatchTable *pTable; |
| 107 | dispatch_key key = get_dispatch_key(instance); |
| 108 | instance_table_map::const_iterator it = map.find((void *)key); |
| 109 | |
| 110 | if (it == map.end()) { |
| 111 | auto table = std::make_unique<VkuInstanceDispatchTable>(); |
| 112 | pTable = table.get(); |
| 113 | map[(void *)key] = std::move(table); |
| 114 | } else { |
| 115 | return it->second.get(); |
| 116 | } |
| 117 | |
| 118 | vkuInitInstanceDispatchTable(instance, pTable, gpa); |
| 119 | |
| 120 | // Setup func pointers that are required but not externally exposed. These won't be added to the instance dispatch table by |
| 121 | // default. |
| 122 | pTable->GetPhysicalDeviceProcAddr = (PFN_GetPhysicalDeviceProcAddr)gpa(instance, "vk_layerGetPhysicalDeviceProcAddr"); |
| 123 | |
| 124 | return pTable; |
| 125 | } |
| 126 | |
| 127 | VkuInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa) { |
| 128 | return initInstanceTable(instance, gpa, tableInstanceMap); |
nothing calls this directly
no test coverage detected