Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 1 | /* |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2 | * Vulkan |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2014 LunarG, Inc. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #include <string.h> |
| 27 | #include <stdlib.h> |
| 28 | #include <assert.h> |
| 29 | #include <unordered_map> |
Ian Elliott | 81ac44c | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 30 | #include "loader_platform.h" |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 31 | #include "vk_dispatch_table_helper.h" |
| 32 | #include "vkLayer.h" |
Ian Elliott | 20f0687 | 2015-02-12 17:08:34 -0700 | [diff] [blame] | 33 | // The following is #included again to catch certain OS-specific functions |
| 34 | // being used: |
| 35 | #include "loader_platform.h" |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 36 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 37 | static void initLayerTable(const VkBaseLayerObject *devw, VkLayerDispatchTable *pTable, const unsigned int layerNum); |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 38 | static void initLayerInstanceTable(const VkBaseLayerObject *instw, VkLayerInstanceDispatchTable *pTable, const unsigned int layerNum); |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 39 | /* Various dispatchable objects will use the same underlying dispatch table if they |
| 40 | * are created from that "parent" object. Thus use pointer to dispatch table |
| 41 | * as the key to table maps (tableMap1, tableInstanceMap1, tableMap2, tableInstanceMap2. |
| 42 | * Instance -> PhysicalDevice |
| 43 | * Device -> CmdBuffer or Queue |
| 44 | * If use the object themselves as key to map then implies Create entrypoints have to be intercepted |
| 45 | * and a new key inserted into map */ |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 46 | /******************************** Layer multi1 functions **************************/ |
Jon Ashburn | 301c5f0 | 2015-04-06 10:58:22 -0600 | [diff] [blame] | 47 | static std::unordered_map<void *, VkLayerDispatchTable *> tableMap1; |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 48 | static std::unordered_map<void *, VkLayerInstanceDispatchTable *> tableInstanceMap1; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 49 | static bool layer1_first_activated = false; |
| 50 | |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 51 | static VkLayerDispatchTable *getLayer1Table(const VkBaseLayerObject *devw) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 52 | { |
Jon Ashburn | 301c5f0 | 2015-04-06 10:58:22 -0600 | [diff] [blame] | 53 | VkLayerDispatchTable *pTable; |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 54 | assert(devw); |
| 55 | VkLayerDispatchTable **ppDisp = (VkLayerDispatchTable **) devw->baseObject; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 56 | |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 57 | std::unordered_map<void *, VkLayerDispatchTable *>::const_iterator it = tableMap1.find((void *) *ppDisp); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 58 | if (it == tableMap1.end()) |
| 59 | { |
Jon Ashburn | 301c5f0 | 2015-04-06 10:58:22 -0600 | [diff] [blame] | 60 | pTable = new VkLayerDispatchTable; |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 61 | tableMap1[(void *) *ppDisp] = pTable; |
| 62 | initLayerTable(devw, pTable, 1); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 63 | return pTable; |
| 64 | } else |
| 65 | { |
| 66 | return it->second; |
| 67 | } |
| 68 | } |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 69 | static VkLayerInstanceDispatchTable *getLayer1InstanceTable(const VkBaseLayerObject *instw) |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 70 | { |
| 71 | VkLayerInstanceDispatchTable *pTable; |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 72 | assert(instw); |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 73 | VkLayerInstanceDispatchTable **ppDisp = (VkLayerInstanceDispatchTable **) instw->baseObject; |
| 74 | |
| 75 | std::unordered_map<void *, VkLayerInstanceDispatchTable *>::const_iterator it = tableInstanceMap1.find((void *) *ppDisp); |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 76 | if (it == tableInstanceMap1.end()) |
| 77 | { |
| 78 | pTable = new VkLayerInstanceDispatchTable; |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 79 | tableInstanceMap1[(void *) *ppDisp] = pTable; |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 80 | initLayerInstanceTable(instw, pTable, 1); |
| 81 | return pTable; |
| 82 | } else |
| 83 | { |
| 84 | return it->second; |
| 85 | } |
| 86 | } |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 87 | #ifdef __cplusplus |
| 88 | extern "C" { |
| 89 | #endif |
| 90 | |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 91 | /* hook DextroyDevice to remove tableMap entry */ |
| 92 | VK_LAYER_EXPORT VkResult VKAPI multi1DestroyDevice(VkDevice device) |
| 93 | { |
| 94 | VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device; |
| 95 | VkLayerDispatchTable *pTable = tableMap1[pDisp]; |
| 96 | VkResult res = pTable->DestroyDevice(device); |
| 97 | tableMap1.erase(pDisp); |
| 98 | return res; |
| 99 | } |
| 100 | |
| 101 | /* hook DestroyInstance to remove tableInstanceMap entry */ |
| 102 | VK_LAYER_EXPORT VkResult VKAPI multi1DestroyInstance(VkInstance instance) |
| 103 | { |
| 104 | VkLayerInstanceDispatchTable *pDisp = *(VkLayerInstanceDispatchTable **) instance; |
| 105 | VkLayerInstanceDispatchTable *pTable = tableInstanceMap1[pDisp]; |
| 106 | VkResult res = pTable->DestroyInstance(instance); |
| 107 | tableInstanceMap1.erase(pDisp); |
| 108 | return res; |
| 109 | } |
| 110 | |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 111 | VK_LAYER_EXPORT VkResult VKAPI multi1CreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, VkSampler* pSampler) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 112 | { |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 113 | VkLayerDispatchTable **ppDisp = (VkLayerDispatchTable **) device; |
| 114 | VkLayerDispatchTable *pTable = tableMap1[*ppDisp]; |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 115 | |
| 116 | printf("At start of multi1 layer vkCreateSampler()\n"); |
| 117 | VkResult result = pTable->CreateSampler(device, pCreateInfo, pSampler); |
| 118 | printf("Completed multi1 layer vkCreateSampler()\n"); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 119 | return result; |
| 120 | } |
| 121 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 122 | VK_LAYER_EXPORT VkResult VKAPI multi1CreateGraphicsPipeline(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, |
| 123 | VkPipeline* pPipeline) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 124 | { |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 125 | VkLayerDispatchTable **ppDisp = (VkLayerDispatchTable **) device; |
| 126 | VkLayerDispatchTable *pTable = tableMap1[*ppDisp]; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 127 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 128 | printf("At start of multi1 layer vkCreateGraphicsPipeline()\n"); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 129 | VkResult result = pTable->CreateGraphicsPipeline(device, pCreateInfo, pPipeline); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 130 | printf("Completed multi1 layer vkCreateGraphicsPipeline()\n"); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 131 | return result; |
| 132 | } |
| 133 | |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 134 | VK_LAYER_EXPORT VkResult VKAPI multi1StorePipeline(VkDevice device, VkPipeline pipeline, size_t* pDataSize, void* pData) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 135 | { |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 136 | VkLayerDispatchTable **ppDisp = (VkLayerDispatchTable **) device; |
| 137 | VkLayerDispatchTable *pTable = tableMap1[*ppDisp]; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 138 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 139 | printf("At start of multi1 layer vkStorePipeline()\n"); |
Mike Stroyan | 230e625 | 2015-04-17 12:36:38 -0600 | [diff] [blame] | 140 | VkResult result = pTable->StorePipeline(device, pipeline, pDataSize, pData); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 141 | printf("Completed multi1 layer vkStorePipeline()\n"); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 142 | return result; |
| 143 | } |
| 144 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 145 | VK_LAYER_EXPORT void * VKAPI multi1GetDeviceProcAddr(VkDevice device, const char* pName) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 146 | { |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 147 | VkBaseLayerObject* devw = (VkBaseLayerObject *) device; |
Chia-I Wu | e9ae388 | 2015-01-05 09:41:27 +0800 | [diff] [blame] | 148 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 149 | if (device == NULL) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 150 | return NULL; |
Chia-I Wu | e9ae388 | 2015-01-05 09:41:27 +0800 | [diff] [blame] | 151 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 152 | getLayer1Table(devw); |
Chia-I Wu | e9ae388 | 2015-01-05 09:41:27 +0800 | [diff] [blame] | 153 | |
Jon Ashburn | 7cb4e0e | 2015-05-19 10:05:54 -0600 | [diff] [blame] | 154 | if (!strcmp("vkGetDeviceProcAddr", pName)) |
| 155 | return (void *) multi1GetDeviceProcAddr; |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 156 | if (!strcmp("vkDestroyDevice", pName)) |
| 157 | return (void *) multi1DestroyDevice; |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 158 | if (!strcmp("vkCreateSampler", pName)) |
| 159 | return (void *) multi1CreateSampler; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 160 | else if (!strcmp("vkCreateGraphicsPipeline", pName)) |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 161 | return (void *) multi1CreateGraphicsPipeline; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 162 | else if (!strcmp("vkStorePipeline", pName)) |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 163 | return (void *) multi1StorePipeline; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 164 | else { |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 165 | if (devw->pGPA == NULL) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 166 | return NULL; |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 167 | return devw->pGPA((VkObject) devw->nextObject, pName); |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 168 | } |
| 169 | } |
| 170 | |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 171 | VK_LAYER_EXPORT void * VKAPI multi1GetInstanceProcAddr(VkInstance inst, const char* pName) |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 172 | { |
| 173 | VkBaseLayerObject* instw = (VkBaseLayerObject *) inst; |
| 174 | |
| 175 | if (inst == NULL) |
| 176 | return NULL; |
| 177 | |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 178 | getLayer1InstanceTable(instw); |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 179 | |
Jon Ashburn | 7cb4e0e | 2015-05-19 10:05:54 -0600 | [diff] [blame] | 180 | if (!strcmp("vkGetInstanceProcAddr", pName)) |
| 181 | return (void *) multi1GetInstanceProcAddr; |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 182 | if (!strcmp("vkDestroyInstance", pName)) |
| 183 | return (void *) multi1DestroyInstance; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 184 | else if (!strcmp("GetGlobalExtensionInfo", pName)) |
| 185 | return (void*) vkGetGlobalExtensionInfo; |
| 186 | else { |
| 187 | if (instw->pGPA == NULL) |
| 188 | return NULL; |
| 189 | return instw->pGPA((VkObject) instw->nextObject, pName); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 190 | } |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | /******************************** Layer multi2 functions **************************/ |
Jon Ashburn | 301c5f0 | 2015-04-06 10:58:22 -0600 | [diff] [blame] | 194 | static std::unordered_map<void *, VkLayerDispatchTable *> tableMap2; |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 195 | static std::unordered_map<void *, VkLayerInstanceDispatchTable *> tableInstanceMap2; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 196 | static bool layer2_first_activated = false; |
| 197 | |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 198 | static VkLayerInstanceDispatchTable *getLayer2InstanceTable(const VkBaseLayerObject *instw) |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 199 | { |
| 200 | VkLayerInstanceDispatchTable *pTable; |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 201 | assert(instw); |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 202 | VkLayerInstanceDispatchTable **ppDisp = (VkLayerInstanceDispatchTable **) instw->baseObject; |
| 203 | |
| 204 | std::unordered_map<void *, VkLayerInstanceDispatchTable *>::const_iterator it = tableInstanceMap2.find((void *) *ppDisp); |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 205 | if (it == tableInstanceMap2.end()) |
| 206 | { |
| 207 | pTable = new VkLayerInstanceDispatchTable; |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 208 | tableInstanceMap2[(void *) *ppDisp] = pTable; |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 209 | initLayerInstanceTable(instw, pTable, 2); |
| 210 | return pTable; |
| 211 | } else |
| 212 | { |
| 213 | return it->second; |
| 214 | } |
| 215 | } |
| 216 | |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 217 | static VkLayerDispatchTable *getLayer2Table(const VkBaseLayerObject *devw) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 218 | { |
Jon Ashburn | 301c5f0 | 2015-04-06 10:58:22 -0600 | [diff] [blame] | 219 | VkLayerDispatchTable *pTable; |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 220 | assert(devw); |
| 221 | VkLayerDispatchTable **ppDisp = (VkLayerDispatchTable **) devw->baseObject; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 222 | |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 223 | std::unordered_map<void *, VkLayerDispatchTable *>::const_iterator it = tableMap2.find((void *) *ppDisp); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 224 | if (it == tableMap2.end()) |
| 225 | { |
Jon Ashburn | 301c5f0 | 2015-04-06 10:58:22 -0600 | [diff] [blame] | 226 | pTable = new VkLayerDispatchTable; |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 227 | tableMap2[(void *) *ppDisp] = pTable; |
| 228 | initLayerTable(devw, pTable, 2); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 229 | return pTable; |
| 230 | } else |
| 231 | { |
| 232 | return it->second; |
| 233 | } |
| 234 | } |
| 235 | |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 236 | VK_LAYER_EXPORT VkResult VKAPI multi2EnumeratePhysicalDevices( |
| 237 | VkInstance instance, |
| 238 | uint32_t* pPhysicalDeviceCount, |
| 239 | VkPhysicalDevice* pPhysicalDevices) |
| 240 | { |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 241 | VkLayerInstanceDispatchTable **ppDisp = (VkLayerInstanceDispatchTable **) instance; |
| 242 | VkLayerInstanceDispatchTable *pInstTable = tableInstanceMap2[*ppDisp]; |
| 243 | |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 244 | printf("At start of wrapped multi2 vkEnumeratePhysicalDevices()\n"); |
| 245 | VkResult result = pInstTable->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 246 | printf("Completed multi2 layer vkEnumeratePhysicalDevices()\n"); |
| 247 | return result; |
| 248 | } |
| 249 | |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 250 | /* hook DextroyDevice to remove tableMap entry */ |
| 251 | VK_LAYER_EXPORT VkResult VKAPI multi2DestroyDevice(VkDevice device) |
| 252 | { |
| 253 | VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **) device; |
| 254 | VkLayerDispatchTable *pTable = tableMap2[pDisp]; |
| 255 | VkResult res = pTable->DestroyDevice(device); |
| 256 | tableMap2.erase(pDisp); |
| 257 | return res; |
| 258 | } |
| 259 | |
| 260 | /* hook DestroyInstance to remove tableInstanceMap entry */ |
| 261 | VK_LAYER_EXPORT VkResult VKAPI multi2DestroyInstance(VkInstance instance) |
| 262 | { |
| 263 | VkLayerInstanceDispatchTable *pDisp = *(VkLayerInstanceDispatchTable **) instance; |
| 264 | VkLayerInstanceDispatchTable *pTable = tableInstanceMap2[pDisp]; |
| 265 | VkResult res = pTable->DestroyInstance(instance); |
| 266 | tableInstanceMap2.erase(pDisp); |
| 267 | return res; |
| 268 | } |
| 269 | |
Tony Barbour | 8205d90 | 2015-04-16 15:59:00 -0600 | [diff] [blame] | 270 | VK_LAYER_EXPORT VkResult VKAPI multi2CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo, |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 271 | VkDevice* pDevice) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 272 | { |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 273 | VkLayerInstanceDispatchTable **ppDisp = (VkLayerInstanceDispatchTable **) gpu; |
| 274 | VkLayerInstanceDispatchTable *pInstTable = tableInstanceMap2[*ppDisp]; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 275 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 276 | printf("At start of multi2 vkCreateDevice()\n"); |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 277 | VkResult result = pInstTable->CreateDevice(gpu, pCreateInfo, pDevice); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 278 | printf("Completed multi2 layer vkCreateDevice()\n"); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 279 | return result; |
| 280 | } |
| 281 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 282 | VK_LAYER_EXPORT VkResult VKAPI multi2CreateCommandBuffer(VkDevice device, const VkCmdBufferCreateInfo* pCreateInfo, |
| 283 | VkCmdBuffer* pCmdBuffer) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 284 | { |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 285 | VkLayerDispatchTable **ppDisp = (VkLayerDispatchTable **) device; |
| 286 | VkLayerDispatchTable *pTable = tableMap2[*ppDisp]; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 287 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 288 | printf("At start of multi2 layer vkCreateCommandBuffer()\n"); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 289 | VkResult result = pTable->CreateCommandBuffer(device, pCreateInfo, pCmdBuffer); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 290 | printf("Completed multi2 layer vkCreateCommandBuffer()\n"); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 291 | return result; |
| 292 | } |
| 293 | |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 294 | VK_LAYER_EXPORT VkResult VKAPI multi2BeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 295 | { |
Jon Ashburn | d25a78e | 2015-05-15 16:40:25 -0600 | [diff] [blame] | 296 | VkLayerDispatchTable **ppDisp = (VkLayerDispatchTable **) cmdBuffer; |
| 297 | VkLayerDispatchTable *pTable = tableMap2[*ppDisp]; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 298 | |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 299 | printf("At start of multi2 layer vkBeginCommandBuffer()\n"); |
Courtney Goeltzenleuchter | 382489d | 2015-04-10 08:34:15 -0600 | [diff] [blame] | 300 | VkResult result = pTable->BeginCommandBuffer(cmdBuffer, pBeginInfo); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 301 | printf("Completed multi2 layer vkBeginCommandBuffer()\n"); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 302 | return result; |
| 303 | |
| 304 | } |
| 305 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 306 | VK_LAYER_EXPORT void * VKAPI multi2GetDeviceProcAddr(VkDevice device, const char* pName) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 307 | { |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 308 | VkBaseLayerObject* devw = (VkBaseLayerObject *) device; |
Chia-I Wu | e9ae388 | 2015-01-05 09:41:27 +0800 | [diff] [blame] | 309 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 310 | if (device == NULL) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 311 | return NULL; |
Chia-I Wu | e9ae388 | 2015-01-05 09:41:27 +0800 | [diff] [blame] | 312 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 313 | getLayer2Table(devw); |
Chia-I Wu | e9ae388 | 2015-01-05 09:41:27 +0800 | [diff] [blame] | 314 | |
Jon Ashburn | 7cb4e0e | 2015-05-19 10:05:54 -0600 | [diff] [blame] | 315 | if (!strcmp("vkGetDeviceProcAddr", pName)) |
| 316 | return (void *) multi2GetDeviceProcAddr; |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 317 | if (!strcmp("vkDestroyDevice", pName)) |
| 318 | return (void *) multi2DestroyDevice; |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 319 | if (!strcmp("vkCreateCommandBuffer", pName)) |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 320 | return (void *) multi2CreateCommandBuffer; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 321 | else if (!strcmp("vkBeginCommandBuffer", pName)) |
Mark Lobodzinski | e2d07a5 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 322 | return (void *) multi2BeginCommandBuffer; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 323 | else { |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 324 | if (devw->pGPA == NULL) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 325 | return NULL; |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 326 | return devw->pGPA((VkObject) devw->nextObject, pName); |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 327 | } |
| 328 | } |
| 329 | |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 330 | VK_LAYER_EXPORT void * VKAPI multi2GetInstanceProcAddr(VkInstance inst, const char* pName) |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 331 | { |
| 332 | VkBaseLayerObject* instw = (VkBaseLayerObject *) inst; |
| 333 | |
| 334 | if (inst == NULL) |
| 335 | return NULL; |
| 336 | |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 337 | getLayer2InstanceTable(instw); |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 338 | |
Jon Ashburn | 7cb4e0e | 2015-05-19 10:05:54 -0600 | [diff] [blame] | 339 | if (!strcmp("vkGetInstanceProcAddr", pName)) |
| 340 | return (void *) multi2GetInstanceProcAddr; |
Jon Ashburn | 2666e2f | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 341 | if (!strcmp("vkEnumeratePhysicalDevices", pName)) |
| 342 | return (void *) multi2EnumeratePhysicalDevices; |
Jon Ashburn | 17f3737 | 2015-05-19 16:34:53 -0600 | [diff] [blame] | 343 | if (!strcmp("vkDestroyInstance", pName)) |
| 344 | return (void *) multi2DestroyInstance; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 345 | if (!strcmp("vkCreateDevice", pName)) |
| 346 | return (void *) multi2CreateDevice; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 347 | else if (!strcmp("GetGlobalExtensionInfo", pName)) |
| 348 | return (void*) vkGetGlobalExtensionInfo; |
| 349 | else { |
| 350 | if (instw->pGPA == NULL) |
| 351 | return NULL; |
| 352 | return instw->pGPA((VkObject) instw->nextObject, pName); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 353 | } |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 354 | } |
| 355 | |
| 356 | /********************************* Common functions ********************************/ |
Courtney Goeltzenleuchter | bb1f360 | 2015-04-20 11:04:54 -0600 | [diff] [blame] | 357 | VK_LAYER_EXPORT VkResult VKAPI vkEnumerateLayers(VkPhysicalDevice gpu, size_t maxStringSize, |
| 358 | size_t* pLayerCount, char* const* pOutLayers, |
| 359 | void* pReserved) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 360 | { |
Courtney Goeltzenleuchter | bb1f360 | 2015-04-20 11:04:54 -0600 | [diff] [blame] | 361 | if (pLayerCount == NULL || pOutLayers == NULL || pOutLayers[0] == NULL || pOutLayers[1] == NULL || pReserved == NULL) |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 362 | return VK_ERROR_INVALID_POINTER; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 363 | |
Courtney Goeltzenleuchter | bb1f360 | 2015-04-20 11:04:54 -0600 | [diff] [blame] | 364 | if (*pLayerCount < 2) |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 365 | return VK_ERROR_INITIALIZATION_FAILED; |
Courtney Goeltzenleuchter | bb1f360 | 2015-04-20 11:04:54 -0600 | [diff] [blame] | 366 | *pLayerCount = 2; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 367 | strncpy((char *) pOutLayers[0], "multi1", maxStringSize); |
| 368 | strncpy((char *) pOutLayers[1], "multi2", maxStringSize); |
Courtney Goeltzenleuchter | 9cc421e | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 369 | return VK_SUCCESS; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 370 | } |
| 371 | |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 372 | struct extProps { |
| 373 | uint32_t version; |
| 374 | const char * const name; |
| 375 | }; |
| 376 | |
| 377 | #define MULTI_LAYER_EXT_ARRAY_SIZE 2 |
Courtney Goeltzenleuchter | 1c7c65d | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 378 | static const VkExtensionProperties multiExts[MULTI_LAYER_EXT_ARRAY_SIZE] = { |
| 379 | { |
| 380 | VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES, |
| 381 | "multi1", |
| 382 | 0x10, |
| 383 | "Sample layer: multi", |
| 384 | // 0, |
| 385 | // NULL, |
| 386 | }, |
| 387 | { |
| 388 | VK_STRUCTURE_TYPE_EXTENSION_PROPERTIES, |
| 389 | "multi2", |
| 390 | 0x10, |
| 391 | "Sample layer: multi", |
| 392 | // 0, |
| 393 | // NULL, |
| 394 | } |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 395 | }; |
| 396 | |
| 397 | VK_LAYER_EXPORT VkResult VKAPI vkGetGlobalExtensionInfo( |
Courtney Goeltzenleuchter | 1c7c65d | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 398 | VkExtensionInfoType infoType, |
| 399 | uint32_t extensionIndex, |
| 400 | size_t* pDataSize, |
| 401 | void* pData) |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 402 | { |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 403 | /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */ |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 404 | uint32_t *count; |
| 405 | |
| 406 | if (pDataSize == NULL) |
| 407 | return VK_ERROR_INVALID_POINTER; |
| 408 | |
| 409 | switch (infoType) { |
| 410 | case VK_EXTENSION_INFO_TYPE_COUNT: |
| 411 | *pDataSize = sizeof(uint32_t); |
| 412 | if (pData == NULL) |
| 413 | return VK_SUCCESS; |
| 414 | count = (uint32_t *) pData; |
| 415 | *count = MULTI_LAYER_EXT_ARRAY_SIZE; |
| 416 | break; |
| 417 | case VK_EXTENSION_INFO_TYPE_PROPERTIES: |
| 418 | *pDataSize = sizeof(VkExtensionProperties); |
| 419 | if (pData == NULL) |
| 420 | return VK_SUCCESS; |
| 421 | if (extensionIndex >= MULTI_LAYER_EXT_ARRAY_SIZE) |
| 422 | return VK_ERROR_INVALID_VALUE; |
Courtney Goeltzenleuchter | 1c7c65d | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 423 | memcpy((VkExtensionProperties *) pData, &multiExts[extensionIndex], sizeof(VkExtensionProperties)); |
Jon Ashburn | eb2728b | 2015-04-10 14:33:07 -0600 | [diff] [blame] | 424 | break; |
| 425 | default: |
| 426 | return VK_ERROR_INVALID_VALUE; |
| 427 | }; |
| 428 | |
| 429 | return VK_SUCCESS; |
| 430 | } |
| 431 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 432 | VK_LAYER_EXPORT void * VKAPI vkGetDeviceProcAddr(VkDevice device, const char* pName) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 433 | { |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 434 | // to find each layers GPA routine Loader will search via "<layerName>GetDeviceProcAddr" |
| 435 | if (!strcmp("multi1GetDeviceProcAddr", pName)) |
| 436 | return (void *) multi1GetDeviceProcAddr; |
| 437 | else if (!strcmp("multi2GetDeviceProcAddr", pName)) |
| 438 | return (void *) multi2GetDeviceProcAddr; |
| 439 | else if (!strcmp("vkGetDeviceProcAddr", pName)) |
| 440 | return (void *) vkGetDeviceProcAddr; |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 441 | |
| 442 | // use first layer activated as GPA dispatch table activation happens in order |
| 443 | else if (layer1_first_activated) |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 444 | return multi1GetDeviceProcAddr(device, pName); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 445 | else if (layer2_first_activated) |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 446 | return multi2GetDeviceProcAddr(device, pName); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 447 | else |
| 448 | return NULL; |
| 449 | |
| 450 | } |
| 451 | |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 452 | VK_LAYER_EXPORT void * VKAPI vkGetInstanceProcAddr(VkInstance inst, const char* pName) |
| 453 | { |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 454 | // to find each layers GPA routine Loader will search via "<layerName>GetInstanceProcAddr" |
| 455 | if (!strcmp("multi1GetInstanceProcAddr", pName)) |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 456 | return (void *) multi1GetInstanceProcAddr; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 457 | else if (!strcmp("multi2GetInstanceProcAddr", pName)) |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 458 | return (void *) multi2GetInstanceProcAddr; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 459 | else if (!strcmp("vkGetInstanceProcAddr", pName)) |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 460 | return (void *) vkGetInstanceProcAddr; |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 461 | |
| 462 | // use first layer activated as GPA dispatch table activation happens in order |
| 463 | else if (layer1_first_activated) |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 464 | return multi1GetInstanceProcAddr(inst, pName); |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 465 | else if (layer2_first_activated) |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 466 | return multi2GetInstanceProcAddr(inst, pName); |
Jon Ashburn | 79b78ac | 2015-05-05 14:22:52 -0600 | [diff] [blame] | 467 | else |
| 468 | return NULL; |
| 469 | |
| 470 | } |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 471 | #ifdef __cplusplus |
| 472 | } //extern "C" |
| 473 | #endif |
| 474 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 475 | static void initLayerTable(const VkBaseLayerObject *devw, VkLayerDispatchTable *pTable, const unsigned int layerNum) |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 476 | { |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 477 | if (layerNum == 2 && layer1_first_activated == false) |
| 478 | layer2_first_activated = true; |
| 479 | if (layerNum == 1 && layer2_first_activated == false) |
| 480 | layer1_first_activated = true; |
| 481 | |
Jon Ashburn | 1245cec | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 482 | layer_initialize_dispatch_table(pTable, (PFN_vkGetDeviceProcAddr) devw->pGPA, (VkDevice) devw->nextObject); |
Jon Ashburn | 8d8dad0 | 2014-12-01 14:22:40 -0700 | [diff] [blame] | 483 | } |
Jon Ashburn | d956400 | 2015-05-07 10:27:37 -0600 | [diff] [blame] | 484 | |
| 485 | static void initLayerInstanceTable(const VkBaseLayerObject *instw, VkLayerInstanceDispatchTable *pTable, const unsigned int layerNum) |
| 486 | { |
| 487 | if (layerNum == 2 && layer1_first_activated == false) |
| 488 | layer2_first_activated = true; |
| 489 | if (layerNum == 1 && layer2_first_activated == false) |
| 490 | layer1_first_activated = true; |
| 491 | |
| 492 | layer_init_instance_dispatch_table(pTable, (PFN_vkGetInstanceProcAddr) instw->pGPA, (VkInstance) instw->nextObject); |
| 493 | } |