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
| 102 | * If use the object themselves as key to map then implies Create entrypoints have to be intercepted |
| 103 | * and a new key inserted into map */ |
| 104 | VkuInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa, instance_table_map &map) { |
| 105 | VkuInstanceDispatchTable *pTable; |
| 106 | dispatch_key key = get_dispatch_key(instance); |
| 107 | instance_table_map::const_iterator it = map.find((void *)key); |
| 108 | |
| 109 | if (it == map.end()) { |
| 110 | pTable = new VkuInstanceDispatchTable; |
| 111 | map[(void *)key] = pTable; |
| 112 | } else { |
| 113 | return it->second; |
| 114 | } |
| 115 | |
| 116 | vkuInitInstanceDispatchTable(instance, pTable, gpa); |
| 117 | |
| 118 | // Setup func pointers that are required but not externally exposed. These won't be added to the instance dispatch table by |
| 119 | // default. |
| 120 | pTable->GetPhysicalDeviceProcAddr = (PFN_GetPhysicalDeviceProcAddr)gpa(instance, "vk_layerGetPhysicalDeviceProcAddr"); |
| 121 | |
| 122 | return pTable; |
| 123 | } |
| 124 | |
| 125 | VkuInstanceDispatchTable *initInstanceTable(VkInstance instance, const PFN_vkGetInstanceProcAddr gpa) { |
| 126 | return initInstanceTable(instance, gpa, tableInstanceMap); |
no test coverage detected