1 /*
2  * Copyright (c) 2015-2016 Valve Corporation
3  * Copyright (c) 2015-2016 LunarG, Inc.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * Author: Jon Ashburn <jon@lunarg.com>
18  */
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <assert.h>
24 #include "vk_loader_platform.h"
25 #include "vulkan/vk_layer.h"
26 #include "vk_dispatch_table_helper.h"
27 #include "vk_layer_extension_utils.h"
28 #include "vk_layer_utils.h"
29 #include "wrap_objects.h"
30 
31 namespace wrap_objects {
32 
33 static const VkLayerProperties global_layer = {
34     "VK_LAYER_LUNARG_wrap_objects", VK_LAYER_API_VERSION, 1, "LunarG Test Layer",
35 };
36 
37 //TODO Add wrapping of Vkdevice, Vkqueue, VkcommandBuffer
38 
vkCreateInstance(const VkInstanceCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkInstance * pInstance)39 VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
40 {
41     VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO);
42     PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr;
43     PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance) fpGetInstanceProcAddr(NULL, "vkCreateInstance");
44     if (fpCreateInstance == NULL) {
45         return VK_ERROR_INITIALIZATION_FAILED;
46     }
47     // Advance the link info for the next element on the chain
48     chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext;
49     VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance);
50     if (result != VK_SUCCESS) {
51         return result;
52     }
53     auto inst = new wrapped_inst_obj;
54     if (!inst)
55         return VK_ERROR_OUT_OF_HOST_MEMORY;
56     memset(inst, 0, sizeof(*inst));
57     inst->obj = (*pInstance);
58     *pInstance = reinterpret_cast<VkInstance> (inst);
59     // store the loader callback for initializing created dispatchable objects
60     chain_info = get_chain_info(pCreateInfo, VK_LOADER_DATA_CALLBACK);
61     if (chain_info) {
62         inst->pfn_inst_init = chain_info->u.pfnSetInstanceLoaderData;
63         result = inst->pfn_inst_init(inst->obj, reinterpret_cast<void *> (inst));
64         if (VK_SUCCESS != result)
65             return result;
66     } else {
67         inst->pfn_inst_init = NULL;
68         inst->loader_disp = *(reinterpret_cast<VkLayerInstanceDispatchTable **> (*pInstance));
69     }
70     layer_init_instance_dispatch_table(*pInstance, &inst->layer_disp, fpGetInstanceProcAddr);
71 
72     return result;
73 }
74 
75 
vkDestroyInstance(VkInstance instance,const VkAllocationCallbacks * pAllocator)76 VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator)
77 {
78     wrapped_inst_obj *inst;
79     auto vk_inst = unwrap_instance(instance, &inst);
80     VkLayerInstanceDispatchTable *pDisp  =  &inst->layer_disp;
81     pDisp->DestroyInstance(vk_inst, pAllocator);
82     if (inst->ptr_phys_devs)
83         delete[] inst->ptr_phys_devs;
84     delete inst;
85 }
86 
vkEnumeratePhysicalDevices(VkInstance instance,uint32_t * pPhysicalDeviceCount,VkPhysicalDevice * pPhysicalDevices)87 VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices)
88 {
89     wrapped_inst_obj *inst;
90     auto vk_inst = unwrap_instance(instance, &inst);
91     VkResult result = inst->layer_disp.EnumeratePhysicalDevices(vk_inst, pPhysicalDeviceCount, pPhysicalDevices);
92 
93     if (VK_SUCCESS != result)
94         return result;
95 
96     if (pPhysicalDevices != NULL) {
97         assert(pPhysicalDeviceCount);
98         auto phys_devs = new wrapped_phys_dev_obj[*pPhysicalDeviceCount];
99         if (!phys_devs)
100             return VK_ERROR_OUT_OF_HOST_MEMORY;
101         if (inst->ptr_phys_devs)
102             delete[] inst->ptr_phys_devs;
103         inst->ptr_phys_devs = phys_devs;
104         for (uint32_t i = 0; i < *pPhysicalDeviceCount; i++) {
105             if (inst->pfn_inst_init == NULL) {
106                 phys_devs[i].loader_disp = *(reinterpret_cast<VkLayerInstanceDispatchTable **> (pPhysicalDevices[i]));
107             } else {
108                 result = inst->pfn_inst_init(vk_inst, reinterpret_cast<void *> (&phys_devs[i]));
109                 if (VK_SUCCESS != result)
110                     return result;
111 
112             }
113             phys_devs[i].obj = reinterpret_cast<void *> (pPhysicalDevices[i]);
114             phys_devs[i].inst = inst;
115             pPhysicalDevices[i] = reinterpret_cast<VkPhysicalDevice> (&phys_devs[i]);
116         }
117     }
118     return result;
119 }
120 
vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,VkPhysicalDeviceFeatures * pFeatures)121 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures)
122 {
123     wrapped_phys_dev_obj *phys_dev;
124     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
125     phys_dev->inst->layer_disp.GetPhysicalDeviceFeatures(vk_phys_dev, pFeatures);
126 }
127 
vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,VkFormat format,VkFormatProperties * pFormatProperties)128 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties)
129 {
130     wrapped_phys_dev_obj *phys_dev;
131     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
132     phys_dev->inst->layer_disp.GetPhysicalDeviceFormatProperties(vk_phys_dev, format, pFormatProperties);
133 }
134 
vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice,VkFormat format,VkImageType type,VkImageTiling tiling,VkImageUsageFlags usage,VkImageCreateFlags flags,VkImageFormatProperties * pImageFormatProperties)135 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties)
136 {
137     wrapped_phys_dev_obj *phys_dev;
138     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
139     VkResult result = phys_dev->inst->layer_disp.GetPhysicalDeviceImageFormatProperties(vk_phys_dev, format, type, tiling, usage, flags, pImageFormatProperties);
140     return result;
141 }
142 
vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,VkPhysicalDeviceProperties * pProperties)143 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties)
144 {
145     wrapped_phys_dev_obj *phys_dev;
146     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
147     phys_dev->inst->layer_disp.GetPhysicalDeviceProperties(vk_phys_dev, pProperties);
148 }
149 
vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice,uint32_t * pQueueFamilyPropertyCount,VkQueueFamilyProperties * pQueueFamilyProperties)150 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties)
151 {
152     wrapped_phys_dev_obj *phys_dev;
153     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
154     phys_dev->inst->layer_disp.GetPhysicalDeviceQueueFamilyProperties(vk_phys_dev, pQueueFamilyPropertyCount, pQueueFamilyProperties);
155 }
156 
vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice,VkPhysicalDeviceMemoryProperties * pMemoryProperties)157 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties)
158 {
159     wrapped_phys_dev_obj *phys_dev;
160     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
161     phys_dev->inst->layer_disp.GetPhysicalDeviceMemoryProperties(vk_phys_dev, pMemoryProperties);
162 }
163 
vkCreateDevice(VkPhysicalDevice physicalDevice,const VkDeviceCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkDevice * pDevice)164 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice)
165 {
166     wrapped_phys_dev_obj *phys_dev;
167     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
168     VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO);
169     PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr;
170     PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr;
171     PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice) fpGetInstanceProcAddr(NULL, "vkCreateDevice");
172     if (fpCreateDevice == NULL) {
173         return VK_ERROR_INITIALIZATION_FAILED;
174     }
175     // Advance the link info for the next element on the chain
176     chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext;
177     VkResult result = fpCreateDevice(vk_phys_dev, pCreateInfo, pAllocator, pDevice);
178     if (result != VK_SUCCESS) {
179         return result;
180     }
181     initDeviceTable(*pDevice, fpGetDeviceProcAddr);
182 
183 #if 0 // TODO add once device is wrapped
184     // store the loader callback for initializing created dispatchable objects
185     chain_info = get_chain_info(pCreateInfo, VK_LOADER_DATA_CALLBACK);
186     if (chain_info) {
187         dev->pfn_dev_init = chain_info->u.pfnSetDeviceLoaderData;
188     } else {
189         dev->pfn_dev_init = NULL;
190     }
191 #endif
192     return result;
193 }
194 
195 
vkDestroyDevice(VkDevice device,const VkAllocationCallbacks * pAllocator)196 VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator)
197 {
198     dispatch_key key = get_dispatch_key(device);
199     VkLayerDispatchTable *pDisp  =  device_dispatch_table(device);
200     pDisp->DestroyDevice(device, pAllocator);
201     destroy_device_dispatch_table(key);
202 }
203 
vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,const char * pLayerName,uint32_t * pPropertyCount,VkExtensionProperties * pProperties)204 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
205 {
206     wrapped_phys_dev_obj *phys_dev;
207     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
208 
209     if (pLayerName && !strcmp(pLayerName, global_layer.layerName))
210         return util_GetExtensionProperties(0, nullptr, pPropertyCount, pProperties);
211 
212     return phys_dev->inst->layer_disp.EnumerateDeviceExtensionProperties(vk_phys_dev, pLayerName, pPropertyCount, pProperties);
213 }
214 
vkGetDeviceQueue(VkDevice device,uint32_t queueFamilyIndex,uint32_t queueIndex,VkQueue * pQueue)215 VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue)
216 {
217     device_dispatch_table(device)->GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue);
218 }
219 
vkQueueSubmit(VkQueue queue,uint32_t submitCount,const VkSubmitInfo * pSubmits,VkFence fence)220 VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence)
221 {
222     VkResult result = device_dispatch_table(queue)->QueueSubmit(queue, submitCount, pSubmits, fence);
223     return result;
224 }
225 
226 
vkQueueWaitIdle(VkQueue queue)227 VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue)
228 {
229     VkResult result = device_dispatch_table(queue)->QueueWaitIdle(queue);
230     return result;
231 }
232 
233 
vkDeviceWaitIdle(VkDevice device)234 VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device)
235 {
236     VkResult result = device_dispatch_table(device)->DeviceWaitIdle(device);
237     return result;
238 }
239 
240 
vkAllocateMemory(VkDevice device,const VkMemoryAllocateInfo * pAllocateInfo,const VkAllocationCallbacks * pAllocator,VkDeviceMemory * pMemory)241 VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
242 {
243     VkResult result = device_dispatch_table(device)->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
244     return result;
245 }
246 
247 
vkFreeMemory(VkDevice device,VkDeviceMemory memory,const VkAllocationCallbacks * pAllocator)248 VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
249 {
250     device_dispatch_table(device)->FreeMemory(device, memory, pAllocator);
251 }
252 
253 
vkMapMemory(VkDevice device,VkDeviceMemory memory,VkDeviceSize offset,VkDeviceSize size,VkMemoryMapFlags flags,void ** ppData)254 VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData)
255 {
256     VkResult result = device_dispatch_table(device)->MapMemory(device, memory, offset, size, flags, ppData);
257     return result;
258 }
259 
vkUnmapMemory(VkDevice device,VkDeviceMemory memory)260 VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
261 {
262     device_dispatch_table(device)->UnmapMemory(device, memory);
263 }
264 
265 
vkFlushMappedMemoryRanges(VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)266 VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
267 {
268     VkResult result = device_dispatch_table(device)->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
269     return result;
270 }
271 
272 
273 
vkInvalidateMappedMemoryRanges(VkDevice device,uint32_t memoryRangeCount,const VkMappedMemoryRange * pMemoryRanges)274 VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
275 {
276     VkResult result = device_dispatch_table(device)->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
277     return result;
278 }
279 
280 
vkGetDeviceMemoryCommitment(VkDevice device,VkDeviceMemory memory,VkDeviceSize * pCommittedMemoryInBytes)281 VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes)
282 {
283     device_dispatch_table(device)->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
284 }
285 
286 
vkBindBufferMemory(VkDevice device,VkBuffer buffer,VkDeviceMemory memory,VkDeviceSize memoryOffset)287 VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
288 {
289     VkResult result = device_dispatch_table(device)->BindBufferMemory(device, buffer, memory, memoryOffset);
290     return result;
291 }
292 
293 
vkBindImageMemory(VkDevice device,VkImage image,VkDeviceMemory memory,VkDeviceSize memoryOffset)294 VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset)
295 {
296     VkResult result = device_dispatch_table(device)->BindImageMemory(device, image, memory, memoryOffset);
297     return result;
298 }
299 
vkGetBufferMemoryRequirements(VkDevice device,VkBuffer buffer,VkMemoryRequirements * pMemoryRequirements)300 VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
301 {
302     device_dispatch_table(device)->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
303 }
304 
305 
vkGetImageMemoryRequirements(VkDevice device,VkImage image,VkMemoryRequirements * pMemoryRequirements)306 VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements)
307 {
308     device_dispatch_table(device)->GetImageMemoryRequirements(device, image, pMemoryRequirements);
309 }
310 
311 
vkGetImageSparseMemoryRequirements(VkDevice device,VkImage image,uint32_t * pSparseMemoryRequirementCount,VkSparseImageMemoryRequirements * pSparseMemoryRequirements)312 VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
313 {
314     device_dispatch_table(device)->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
315 }
316 
317 
vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice,VkFormat format,VkImageType type,VkSampleCountFlagBits samples,VkImageUsageFlags usage,VkImageTiling tiling,uint32_t * pPropertyCount,VkSparseImageFormatProperties * pProperties)318 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties)
319 {
320     wrapped_phys_dev_obj *phys_dev;
321     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
322     phys_dev->inst->layer_disp.GetPhysicalDeviceSparseImageFormatProperties(vk_phys_dev, format, type, samples, usage, tiling, pPropertyCount, pProperties);
323 }
324 
325 
vkQueueBindSparse(VkQueue queue,uint32_t bindInfoCount,const VkBindSparseInfo * pBindInfo,VkFence fence)326 VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence)
327 {
328     VkResult result = device_dispatch_table(queue)->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
329     return result;
330 }
331 
332 
vkCreateFence(VkDevice device,const VkFenceCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkFence * pFence)333 VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
334 {
335     VkResult result = device_dispatch_table(device)->CreateFence(device, pCreateInfo, pAllocator, pFence);
336     return result;
337 }
338 
339 
vkDestroyFence(VkDevice device,VkFence fence,const VkAllocationCallbacks * pAllocator)340 VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
341 {
342     device_dispatch_table(device)->DestroyFence(device, fence, pAllocator);
343 }
344 
345 
vkResetFences(VkDevice device,uint32_t fenceCount,const VkFence * pFences)346 VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences)
347 {
348     VkResult result = device_dispatch_table(device)->ResetFences(device, fenceCount, pFences);
349     return result;
350 }
351 
vkGetFenceStatus(VkDevice device,VkFence fence)352 VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence)
353 {
354     VkResult result = device_dispatch_table(device)->GetFenceStatus(device, fence);
355     return result;
356 }
357 
358 
vkWaitForFences(VkDevice device,uint32_t fenceCount,const VkFence * pFences,VkBool32 waitAll,uint64_t timeout)359 VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
360 {
361     VkResult result = device_dispatch_table(device)->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
362     return result;
363 }
364 
365 
vkCreateSemaphore(VkDevice device,const VkSemaphoreCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSemaphore * pSemaphore)366 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore)
367 {
368     VkResult result = device_dispatch_table(device)->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
369     return result;
370 }
371 
372 
vkDestroySemaphore(VkDevice device,VkSemaphore semaphore,const VkAllocationCallbacks * pAllocator)373 VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator)
374 {
375     device_dispatch_table(device)->DestroySemaphore(device, semaphore, pAllocator);
376 }
377 
378 
vkCreateEvent(VkDevice device,const VkEventCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkEvent * pEvent)379 VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
380 {
381     VkResult result = device_dispatch_table(device)->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
382     return result;
383 }
384 
385 
vkDestroyEvent(VkDevice device,VkEvent event,const VkAllocationCallbacks * pAllocator)386 VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
387 {
388     device_dispatch_table(device)->DestroyEvent(device, event, pAllocator);
389 }
390 
391 
vkGetEventStatus(VkDevice device,VkEvent event)392 VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event)
393 {
394     VkResult result = device_dispatch_table(device)->GetEventStatus(device, event);
395     return result;
396 }
397 
398 
vkSetEvent(VkDevice device,VkEvent event)399 VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event)
400 {
401     VkResult result = device_dispatch_table(device)->SetEvent(device, event);
402     return result;
403 }
404 
405 
vkResetEvent(VkDevice device,VkEvent event)406 VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event)
407 {
408     VkResult result = device_dispatch_table(device)->ResetEvent(device, event);
409     return result;
410 }
411 
412 
vkCreateQueryPool(VkDevice device,const VkQueryPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkQueryPool * pQueryPool)413 VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
414 {
415     VkResult result = device_dispatch_table(device)->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
416     return result;
417 }
418 
vkDestroyQueryPool(VkDevice device,VkQueryPool queryPool,const VkAllocationCallbacks * pAllocator)419 VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
420 {
421     device_dispatch_table(device)->DestroyQueryPool(device, queryPool, pAllocator);
422 }
423 
424 
vkGetQueryPoolResults(VkDevice device,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,size_t dataSize,void * pData,VkDeviceSize stride,VkQueryResultFlags flags)425 VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
426 {
427     VkResult result = device_dispatch_table(device)->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
428     return result;
429 }
430 
431 
vkCreateBuffer(VkDevice device,const VkBufferCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkBuffer * pBuffer)432 VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
433 {
434     VkResult result = device_dispatch_table(device)->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
435     return result;
436 }
437 
438 
vkDestroyBuffer(VkDevice device,VkBuffer buffer,const VkAllocationCallbacks * pAllocator)439 VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
440 {
441     device_dispatch_table(device)->DestroyBuffer(device, buffer, pAllocator);
442 }
443 
444 
vkCreateBufferView(VkDevice device,const VkBufferViewCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkBufferView * pView)445 VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
446 {
447     VkResult result = device_dispatch_table(device)->CreateBufferView(device, pCreateInfo, pAllocator, pView);
448     return result;
449 }
450 
451 
vkDestroyBufferView(VkDevice device,VkBufferView bufferView,const VkAllocationCallbacks * pAllocator)452 VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
453 {
454     device_dispatch_table(device)->DestroyBufferView(device, bufferView, pAllocator);
455 }
456 
vkCreateImage(VkDevice device,const VkImageCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkImage * pImage)457 VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage)
458 {
459     VkResult result = device_dispatch_table(device)->CreateImage(device, pCreateInfo, pAllocator, pImage);
460     return result;
461 }
462 
463 
vkDestroyImage(VkDevice device,VkImage image,const VkAllocationCallbacks * pAllocator)464 VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator)
465 {
466     device_dispatch_table(device)->DestroyImage(device, image, pAllocator);
467 }
468 
469 
vkGetImageSubresourceLayout(VkDevice device,VkImage image,const VkImageSubresource * pSubresource,VkSubresourceLayout * pLayout)470 VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)
471 {
472     device_dispatch_table(device)->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
473 }
474 
vkCreateImageView(VkDevice device,const VkImageViewCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkImageView * pView)475 VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
476 {
477     VkResult result = device_dispatch_table(device)->CreateImageView(device, pCreateInfo, pAllocator, pView);
478     return result;
479 }
480 
vkDestroyImageView(VkDevice device,VkImageView imageView,const VkAllocationCallbacks * pAllocator)481 VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
482 {
483     device_dispatch_table(device)->DestroyImageView(device, imageView, pAllocator);
484 }
485 
vkCreateShaderModule(VkDevice device,const VkShaderModuleCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkShaderModule * pShaderModule)486 VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
487 {
488     VkResult result = device_dispatch_table(device)->CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule);
489     return result;
490 }
491 
492 
vkDestroyShaderModule(VkDevice device,VkShaderModule shaderModule,const VkAllocationCallbacks * pAllocator)493 VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
494 {
495     device_dispatch_table(device)->DestroyShaderModule(device, shaderModule, pAllocator);
496 }
497 
498 
vkCreatePipelineCache(VkDevice device,const VkPipelineCacheCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPipelineCache * pPipelineCache)499 VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
500 {
501     VkResult result = device_dispatch_table(device)->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
502     return result;
503 }
504 
vkDestroyPipelineCache(VkDevice device,VkPipelineCache pipelineCache,const VkAllocationCallbacks * pAllocator)505 VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
506 {
507     device_dispatch_table(device)->DestroyPipelineCache(device, pipelineCache, pAllocator);
508 }
509 
510 
vkGetPipelineCacheData(VkDevice device,VkPipelineCache pipelineCache,size_t * pDataSize,void * pData)511 VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
512 {
513     VkResult result = device_dispatch_table(device)->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
514     return result;
515 }
516 
517 
vkMergePipelineCaches(VkDevice device,VkPipelineCache dstCache,uint32_t srcCacheCount,const VkPipelineCache * pSrcCaches)518 VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
519 {
520     VkResult result = device_dispatch_table(device)->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
521     return result;
522 }
523 
524 
vkCreateGraphicsPipelines(VkDevice device,VkPipelineCache pipelineCache,uint32_t createInfoCount,const VkGraphicsPipelineCreateInfo * pCreateInfos,const VkAllocationCallbacks * pAllocator,VkPipeline * pPipelines)525 VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines)
526 {
527     VkResult result = device_dispatch_table(device)->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
528     return result;
529 }
530 
531 
vkCreateComputePipelines(VkDevice device,VkPipelineCache pipelineCache,uint32_t createInfoCount,const VkComputePipelineCreateInfo * pCreateInfos,const VkAllocationCallbacks * pAllocator,VkPipeline * pPipelines)532 VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines)
533 {
534     VkResult result = device_dispatch_table(device)->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
535     return result;
536 }
537 
538 
vkDestroyPipeline(VkDevice device,VkPipeline pipeline,const VkAllocationCallbacks * pAllocator)539 VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator)
540 {
541     device_dispatch_table(device)->DestroyPipeline(device, pipeline, pAllocator);
542 }
543 
544 
vkCreatePipelineLayout(VkDevice device,const VkPipelineLayoutCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkPipelineLayout * pPipelineLayout)545 VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
546 {
547     VkResult result = device_dispatch_table(device)->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
548     return result;
549 }
550 
551 
vkDestroyPipelineLayout(VkDevice device,VkPipelineLayout pipelineLayout,const VkAllocationCallbacks * pAllocator)552 VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
553 {
554     device_dispatch_table(device)->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
555 }
556 
557 
vkCreateSampler(VkDevice device,const VkSamplerCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSampler * pSampler)558 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
559 {
560     VkResult result = device_dispatch_table(device)->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
561     return result;
562 }
563 
564 
vkDestroySampler(VkDevice device,VkSampler sampler,const VkAllocationCallbacks * pAllocator)565 VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
566 {
567     device_dispatch_table(device)->DestroySampler(device, sampler, pAllocator);
568 }
569 
570 
vkCreateDescriptorSetLayout(VkDevice device,const VkDescriptorSetLayoutCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkDescriptorSetLayout * pSetLayout)571 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
572 {
573     VkResult result = device_dispatch_table(device)->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
574     return result;
575 }
576 
577 
vkDestroyDescriptorSetLayout(VkDevice device,VkDescriptorSetLayout descriptorSetLayout,const VkAllocationCallbacks * pAllocator)578 VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
579 {
580     device_dispatch_table(device)->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
581 }
582 
583 
vkCreateDescriptorPool(VkDevice device,const VkDescriptorPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkDescriptorPool * pDescriptorPool)584 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
585 {
586     VkResult result = device_dispatch_table(device)->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
587     return result;
588 }
589 
vkDestroyDescriptorPool(VkDevice device,VkDescriptorPool descriptorPool,const VkAllocationCallbacks * pAllocator)590 VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
591 {
592     device_dispatch_table(device)->DestroyDescriptorPool(device, descriptorPool, pAllocator);
593 }
594 
595 
vkResetDescriptorPool(VkDevice device,VkDescriptorPool descriptorPool,VkDescriptorPoolResetFlags flags)596 VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
597 {
598     VkResult result = device_dispatch_table(device)->ResetDescriptorPool(device, descriptorPool, flags);
599     return result;
600 }
601 
602 
vkAllocateDescriptorSets(VkDevice device,const VkDescriptorSetAllocateInfo * pAllocateInfo,VkDescriptorSet * pDescriptorSets)603 VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
604 {
605     VkResult result = device_dispatch_table(device)->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
606     return result;
607 }
608 
609 
vkFreeDescriptorSets(VkDevice device,VkDescriptorPool descriptorPool,uint32_t descriptorSetCount,const VkDescriptorSet * pDescriptorSets)610 VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
611 {
612     VkResult result = device_dispatch_table(device)->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
613     return result;
614 }
615 
616 
vkUpdateDescriptorSets(VkDevice device,uint32_t descriptorWriteCount,const VkWriteDescriptorSet * pDescriptorWrites,uint32_t descriptorCopyCount,const VkCopyDescriptorSet * pDescriptorCopies)617 VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
618 {
619     device_dispatch_table(device)->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
620 }
621 
vkCreateFramebuffer(VkDevice device,const VkFramebufferCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkFramebuffer * pFramebuffer)622 VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
623 {
624     VkResult result = device_dispatch_table(device)->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
625     return result;
626 }
627 
628 
vkDestroyFramebuffer(VkDevice device,VkFramebuffer framebuffer,const VkAllocationCallbacks * pAllocator)629 VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
630 {
631     device_dispatch_table(device)->DestroyFramebuffer(device, framebuffer, pAllocator);
632 }
633 
634 
vkCreateRenderPass(VkDevice device,const VkRenderPassCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkRenderPass * pRenderPass)635 VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass)
636 {
637     VkResult result = device_dispatch_table(device)->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
638     return result;
639 }
640 
vkDestroyRenderPass(VkDevice device,VkRenderPass renderPass,const VkAllocationCallbacks * pAllocator)641 VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator)
642 {
643     device_dispatch_table(device)->DestroyRenderPass(device, renderPass, pAllocator);
644 }
645 
646 
vkGetRenderAreaGranularity(VkDevice device,VkRenderPass renderPass,VkExtent2D * pGranularity)647 VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity)
648 {
649     device_dispatch_table(device)->GetRenderAreaGranularity(device, renderPass, pGranularity);
650 }
651 
652 
vkCreateCommandPool(VkDevice device,const VkCommandPoolCreateInfo * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkCommandPool * pCommandPool)653 VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
654 {
655     VkResult result = device_dispatch_table(device)->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
656     return result;
657 }
658 
659 
vkDestroyCommandPool(VkDevice device,VkCommandPool commandPool,const VkAllocationCallbacks * pAllocator)660 VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
661 {
662     device_dispatch_table(device)->DestroyCommandPool(device, commandPool, pAllocator);
663 }
664 
vkResetCommandPool(VkDevice device,VkCommandPool commandPool,VkCommandPoolResetFlags flags)665 VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
666 {
667     VkResult result = device_dispatch_table(device)->ResetCommandPool(device, commandPool, flags);
668     return result;
669 }
670 
vkAllocateCommandBuffers(VkDevice device,const VkCommandBufferAllocateInfo * pAllocateInfo,VkCommandBuffer * pCommandBuffers)671 VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers)
672 {
673     VkResult result = device_dispatch_table(device)->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
674     return result;
675 }
676 
vkFreeCommandBuffers(VkDevice device,VkCommandPool commandPool,uint32_t commandBufferCount,const VkCommandBuffer * pCommandBuffers)677 VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers)
678 {
679     device_dispatch_table(device)->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
680 }
681 
682 
vkBeginCommandBuffer(VkCommandBuffer commandBuffer,const VkCommandBufferBeginInfo * pBeginInfo)683 VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo)
684 {
685     VkResult result = device_dispatch_table(commandBuffer)->BeginCommandBuffer(commandBuffer, pBeginInfo);
686     return result;
687 }
688 
689 
vkEndCommandBuffer(VkCommandBuffer commandBuffer)690 VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer)
691 {
692     VkResult result = device_dispatch_table(commandBuffer)->EndCommandBuffer(commandBuffer);
693     return result;
694 }
695 
696 
vkResetCommandBuffer(VkCommandBuffer commandBuffer,VkCommandBufferResetFlags flags)697 VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags)
698 {
699     VkResult result = device_dispatch_table(commandBuffer)->ResetCommandBuffer(commandBuffer, flags);
700     return result;
701 }
702 
vkCmdBindPipeline(VkCommandBuffer commandBuffer,VkPipelineBindPoint pipelineBindPoint,VkPipeline pipeline)703 VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
704 {
705     device_dispatch_table(commandBuffer)->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
706 }
707 
708 
vkCmdSetViewport(VkCommandBuffer commandBuffer,uint32_t firstViewport,uint32_t viewportCount,const VkViewport * pViewports)709 VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports)
710 {
711     device_dispatch_table(commandBuffer)->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports);
712 }
713 
714 
vkCmdSetScissor(VkCommandBuffer commandBuffer,uint32_t firstScissor,uint32_t scissorCount,const VkRect2D * pScissors)715 VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors)
716 {
717     device_dispatch_table(commandBuffer)->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
718 }
719 
720 
vkCmdSetLineWidth(VkCommandBuffer commandBuffer,float lineWidth)721 VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth)
722 {
723     device_dispatch_table(commandBuffer)->CmdSetLineWidth(commandBuffer, lineWidth);
724 }
725 
726 
vkCmdSetDepthBias(VkCommandBuffer commandBuffer,float depthBiasConstantFactor,float depthBiasClamp,float depthBiasSlopeFactor)727 VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor)
728 {
729     device_dispatch_table(commandBuffer)->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
730 }
731 
732 
vkCmdSetBlendConstants(VkCommandBuffer commandBuffer,const float blendConstants[4])733 VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4])
734 {
735     device_dispatch_table(commandBuffer)->CmdSetBlendConstants(commandBuffer, blendConstants);
736 }
737 
738 
vkCmdSetDepthBounds(VkCommandBuffer commandBuffer,float minDepthBounds,float maxDepthBounds)739 VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds)
740 {
741     device_dispatch_table(commandBuffer)->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
742 }
743 
744 
vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer,VkStencilFaceFlags faceMask,uint32_t compareMask)745 VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask)
746 {
747     device_dispatch_table(commandBuffer)->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
748 }
749 
750 
vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer,VkStencilFaceFlags faceMask,uint32_t writeMask)751 VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask)
752 {
753     device_dispatch_table(commandBuffer)->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
754 }
755 
756 
vkCmdSetStencilReference(VkCommandBuffer commandBuffer,VkStencilFaceFlags faceMask,uint32_t reference)757 VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference)
758 {
759     device_dispatch_table(commandBuffer)->CmdSetStencilReference(commandBuffer, faceMask, reference);
760 }
761 
762 
vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer,VkPipelineBindPoint pipelineBindPoint,VkPipelineLayout layout,uint32_t firstSet,uint32_t descriptorSetCount,const VkDescriptorSet * pDescriptorSets,uint32_t dynamicOffsetCount,const uint32_t * pDynamicOffsets)763 VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets)
764 {
765     device_dispatch_table(commandBuffer)->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
766 }
767 
768 
vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset,VkIndexType indexType)769 VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
770 {
771     device_dispatch_table(commandBuffer)->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
772 }
773 
774 
vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer,uint32_t firstBinding,uint32_t bindingCount,const VkBuffer * pBuffers,const VkDeviceSize * pOffsets)775 VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets)
776 {
777     device_dispatch_table(commandBuffer)->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets);
778 }
779 
780 
vkCmdDraw(VkCommandBuffer commandBuffer,uint32_t vertexCount,uint32_t instanceCount,uint32_t firstVertex,uint32_t firstInstance)781 VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance)
782 {
783     device_dispatch_table(commandBuffer)->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
784 }
785 
786 
vkCmdDrawIndexed(VkCommandBuffer commandBuffer,uint32_t indexCount,uint32_t instanceCount,uint32_t firstIndex,int32_t vertexOffset,uint32_t firstInstance)787 VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance)
788 {
789     device_dispatch_table(commandBuffer)->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
790 }
791 
792 
vkCmdDrawIndirect(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset,uint32_t drawCount,uint32_t stride)793 VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
794 {
795     device_dispatch_table(commandBuffer)->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
796 }
797 
798 
vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset,uint32_t drawCount,uint32_t stride)799 VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
800 {
801     device_dispatch_table(commandBuffer)->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
802 }
803 
804 
vkCmdDispatch(VkCommandBuffer commandBuffer,uint32_t x,uint32_t y,uint32_t z)805 VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z)
806 {
807     device_dispatch_table(commandBuffer)->CmdDispatch(commandBuffer, x, y, z);
808 }
809 
810 
vkCmdDispatchIndirect(VkCommandBuffer commandBuffer,VkBuffer buffer,VkDeviceSize offset)811 VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset)
812 {
813     device_dispatch_table(commandBuffer)->CmdDispatchIndirect(commandBuffer, buffer, offset);
814 }
815 
816 
vkCmdCopyBuffer(VkCommandBuffer commandBuffer,VkBuffer srcBuffer,VkBuffer dstBuffer,uint32_t regionCount,const VkBufferCopy * pRegions)817 VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
818 {
819     device_dispatch_table(commandBuffer)->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
820 }
821 
822 
vkCmdCopyImage(VkCommandBuffer commandBuffer,VkImage srcImage,VkImageLayout srcImageLayout,VkImage dstImage,VkImageLayout dstImageLayout,uint32_t regionCount,const VkImageCopy * pRegions)823 VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions)
824 {
825     device_dispatch_table(commandBuffer)->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
826 }
827 
828 
vkCmdBlitImage(VkCommandBuffer commandBuffer,VkImage srcImage,VkImageLayout srcImageLayout,VkImage dstImage,VkImageLayout dstImageLayout,uint32_t regionCount,const VkImageBlit * pRegions,VkFilter filter)829 VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter)
830 {
831     device_dispatch_table(commandBuffer)->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
832 }
833 
834 
vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer,VkBuffer srcBuffer,VkImage dstImage,VkImageLayout dstImageLayout,uint32_t regionCount,const VkBufferImageCopy * pRegions)835 VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions)
836 {
837     device_dispatch_table(commandBuffer)->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
838 }
839 
vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer,VkImage srcImage,VkImageLayout srcImageLayout,VkBuffer dstBuffer,uint32_t regionCount,const VkBufferImageCopy * pRegions)840 VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions)
841 {
842     device_dispatch_table(commandBuffer)->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
843 }
844 
845 
vkCmdUpdateBuffer(VkCommandBuffer commandBuffer,VkBuffer dstBuffer,VkDeviceSize dstOffset,VkDeviceSize dataSize,const uint32_t * pData)846 VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData)
847 {
848     device_dispatch_table(commandBuffer)->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
849 }
850 
vkCmdFillBuffer(VkCommandBuffer commandBuffer,VkBuffer dstBuffer,VkDeviceSize dstOffset,VkDeviceSize size,uint32_t data)851 VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data)
852 {
853     device_dispatch_table(commandBuffer)->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
854 }
855 
856 
vkCmdClearColorImage(VkCommandBuffer commandBuffer,VkImage image,VkImageLayout imageLayout,const VkClearColorValue * pColor,uint32_t rangeCount,const VkImageSubresourceRange * pRanges)857 VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
858 {
859     device_dispatch_table(commandBuffer)->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
860 }
861 
vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer,VkImage image,VkImageLayout imageLayout,const VkClearDepthStencilValue * pDepthStencil,uint32_t rangeCount,const VkImageSubresourceRange * pRanges)862 VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
863 {
864     device_dispatch_table(commandBuffer)->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
865 }
866 
867 
vkCmdClearAttachments(VkCommandBuffer commandBuffer,uint32_t attachmentCount,const VkClearAttachment * pAttachments,uint32_t rectCount,const VkClearRect * pRects)868 VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects)
869 {
870     device_dispatch_table(commandBuffer)->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
871 }
872 
873 
vkCmdResolveImage(VkCommandBuffer commandBuffer,VkImage srcImage,VkImageLayout srcImageLayout,VkImage dstImage,VkImageLayout dstImageLayout,uint32_t regionCount,const VkImageResolve * pRegions)874 VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions)
875 {
876     device_dispatch_table(commandBuffer)->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
877 }
878 
879 
vkCmdSetEvent(VkCommandBuffer commandBuffer,VkEvent event,VkPipelineStageFlags stageMask)880 VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
881 {
882     device_dispatch_table(commandBuffer)->CmdSetEvent(commandBuffer, event, stageMask);
883 }
884 
885 
vkCmdResetEvent(VkCommandBuffer commandBuffer,VkEvent event,VkPipelineStageFlags stageMask)886 VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
887 {
888     device_dispatch_table(commandBuffer)->CmdResetEvent(commandBuffer, event, stageMask);
889 }
890 
891 
vkCmdWaitEvents(VkCommandBuffer commandBuffer,uint32_t eventCount,const VkEvent * pEvents,VkPipelineStageFlags srcStageMask,VkPipelineStageFlags dstStageMask,uint32_t memoryBarrierCount,const VkMemoryBarrier * pMemoryBarriers,uint32_t bufferMemoryBarrierCount,const VkBufferMemoryBarrier * pBufferMemoryBarriers,uint32_t imageMemoryBarrierCount,const VkImageMemoryBarrier * pImageMemoryBarriers)892 VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers)
893 {
894     device_dispatch_table(commandBuffer)->CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
895 }
896 
vkCmdPipelineBarrier(VkCommandBuffer commandBuffer,VkPipelineStageFlags srcStageMask,VkPipelineStageFlags dstStageMask,VkDependencyFlags dependencyFlags,uint32_t memoryBarrierCount,const VkMemoryBarrier * pMemoryBarriers,uint32_t bufferMemoryBarrierCount,const VkBufferMemoryBarrier * pBufferMemoryBarriers,uint32_t imageMemoryBarrierCount,const VkImageMemoryBarrier * pImageMemoryBarriers)897 VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers)
898 {
899     device_dispatch_table(commandBuffer)->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
900 }
901 
vkCmdBeginQuery(VkCommandBuffer commandBuffer,VkQueryPool queryPool,uint32_t query,VkQueryControlFlags flags)902 VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags)
903 {
904     device_dispatch_table(commandBuffer)->CmdBeginQuery(commandBuffer, queryPool, query, flags);
905 }
906 
vkCmdEndQuery(VkCommandBuffer commandBuffer,VkQueryPool queryPool,uint32_t query)907 VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query)
908 {
909     device_dispatch_table(commandBuffer)->CmdEndQuery(commandBuffer, queryPool, query);
910 }
911 
vkCmdResetQueryPool(VkCommandBuffer commandBuffer,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount)912 VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
913 {
914     device_dispatch_table(commandBuffer)->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
915 }
916 
vkCmdWriteTimestamp(VkCommandBuffer commandBuffer,VkPipelineStageFlagBits pipelineStage,VkQueryPool queryPool,uint32_t query)917 VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query)
918 {
919     device_dispatch_table(commandBuffer)->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query);
920 }
921 
vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer,VkQueryPool queryPool,uint32_t firstQuery,uint32_t queryCount,VkBuffer dstBuffer,VkDeviceSize dstOffset,VkDeviceSize stride,VkQueryResultFlags flags)922 VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags)
923 {
924     device_dispatch_table(commandBuffer)->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
925 }
926 
vkCmdPushConstants(VkCommandBuffer commandBuffer,VkPipelineLayout layout,VkShaderStageFlags stageFlags,uint32_t offset,uint32_t size,const void * pValues)927 VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues)
928 {
929     device_dispatch_table(commandBuffer)->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
930 }
931 
vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,const VkRenderPassBeginInfo * pRenderPassBegin,VkSubpassContents contents)932 VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents)
933 {
934     device_dispatch_table(commandBuffer)->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
935 }
936 
vkCmdNextSubpass(VkCommandBuffer commandBuffer,VkSubpassContents contents)937 VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents)
938 {
939     device_dispatch_table(commandBuffer)->CmdNextSubpass(commandBuffer, contents);
940 }
941 
vkCmdEndRenderPass(VkCommandBuffer commandBuffer)942 VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
943 {
944     device_dispatch_table(commandBuffer)->CmdEndRenderPass(commandBuffer);
945 }
946 
vkCmdExecuteCommands(VkCommandBuffer commandBuffer,uint32_t commandBufferCount,const VkCommandBuffer * pCommandBuffers)947 VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers)
948 {
949     device_dispatch_table(commandBuffer)->CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers);
950 }
951 
vkDestroySurfaceKHR(VkInstance instance,VkSurfaceKHR surface,const VkAllocationCallbacks * pAllocator)952 VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator)
953 {
954     wrapped_inst_obj *inst;
955     auto vk_inst = unwrap_instance(instance, &inst);
956     inst->layer_disp.DestroySurfaceKHR(vk_inst, surface, pAllocator);
957 }
958 
vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,uint32_t queueFamilyIndex,VkSurfaceKHR surface,VkBool32 * pSupported)959 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported)
960 {
961     wrapped_phys_dev_obj *phys_dev;
962     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
963     VkResult result = phys_dev->inst->layer_disp.GetPhysicalDeviceSurfaceSupportKHR(vk_phys_dev, queueFamilyIndex, surface, pSupported);
964     return result;
965 }
966 
967 
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice,VkSurfaceKHR surface,VkSurfaceCapabilitiesKHR * pSurfaceCapabilities)968 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities)
969 {
970     wrapped_phys_dev_obj *phys_dev;
971     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
972     VkResult result = phys_dev->inst->layer_disp.GetPhysicalDeviceSurfaceCapabilitiesKHR(vk_phys_dev, surface, pSurfaceCapabilities);
973     return result;
974 }
975 
vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice,VkSurfaceKHR surface,uint32_t * pSurfaceFormatCount,VkSurfaceFormatKHR * pSurfaceFormats)976 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats)
977 {
978     wrapped_phys_dev_obj *phys_dev;
979     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
980     VkResult result = phys_dev->inst->layer_disp.GetPhysicalDeviceSurfaceFormatsKHR(vk_phys_dev, surface, pSurfaceFormatCount, pSurfaceFormats);
981     return result;
982 }
983 
984 
vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice,VkSurfaceKHR surface,uint32_t * pPresentModeCount,VkPresentModeKHR * pPresentModes)985 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes)
986 {
987     wrapped_phys_dev_obj *phys_dev;
988     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
989     VkResult result = phys_dev->inst->layer_disp.GetPhysicalDeviceSurfacePresentModesKHR(vk_phys_dev, surface, pPresentModeCount, pPresentModes);
990     return result;
991 }
992 
vkCreateSwapchainKHR(VkDevice device,const VkSwapchainCreateInfoKHR * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSwapchainKHR * pSwapchain)993 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain)
994 {
995     VkResult result = device_dispatch_table(device)->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain);
996     return result;
997 }
998 
vkDestroySwapchainKHR(VkDevice device,VkSwapchainKHR swapchain,const VkAllocationCallbacks * pAllocator)999 VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator)
1000 {
1001     device_dispatch_table(device)->DestroySwapchainKHR(device, swapchain, pAllocator);
1002 }
1003 
vkGetSwapchainImagesKHR(VkDevice device,VkSwapchainKHR swapchain,uint32_t * pSwapchainImageCount,VkImage * pSwapchainImages)1004 VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages)
1005 {
1006     VkResult result = device_dispatch_table(device)->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages);
1007     return result;
1008 }
1009 
vkAcquireNextImageKHR(VkDevice device,VkSwapchainKHR swapchain,uint64_t timeout,VkSemaphore semaphore,VkFence fence,uint32_t * pImageIndex)1010 VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex)
1011 {
1012     VkResult result = device_dispatch_table(device)->AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex);
1013     return result;
1014 }
1015 
vkQueuePresentKHR(VkQueue queue,const VkPresentInfoKHR * pPresentInfo)1016 VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo)
1017 {
1018     VkResult result = device_dispatch_table(queue)->QueuePresentKHR(queue, pPresentInfo);
1019     return result;
1020 }
1021 
1022 #ifdef VK_USE_PLATFORM_WIN32_KHR
1023 
1024 VKAPI_ATTR VkResult VKAPI_CALL
vkCreateWin32SurfaceKHR(VkInstance instance,const VkWin32SurfaceCreateInfoKHR * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSurfaceKHR * pSurface)1025 vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
1026                         const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
1027     VkResult result;
1028     wrapped_inst_obj *inst;
1029     auto vk_inst = unwrap_instance(instance, &inst);
1030     result = inst->layer_disp.CreateWin32SurfaceKHR(vk_inst, pCreateInfo, pAllocator, pSurface);
1031     return result;
1032 }
1033 
1034 VKAPI_ATTR VkBool32 VKAPI_CALL
vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice,uint32_t queueFamilyIndex)1035 vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex) {
1036     VkBool32 result;
1037     wrapped_phys_dev_obj *phys_dev;
1038     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
1039     result = phys_dev->inst->layer_disp.GetPhysicalDeviceWin32PresentationSupportKHR(vk_phys_dev, queueFamilyIndex);
1040     return result;
1041 }
1042 #endif // VK_USE_PLATFORM_WIN32_KHR
1043 
1044 #ifdef VK_USE_PLATFORM_XCB_KHR
1045 
vkCreateXcbSurfaceKHR(VkInstance instance,const VkXcbSurfaceCreateInfoKHR * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSurfaceKHR * pSurface)1046 VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface)
1047 {
1048     wrapped_inst_obj *inst;
1049     auto vk_inst = unwrap_instance(instance, &inst);
1050     VkResult result = inst->layer_disp.CreateXcbSurfaceKHR(vk_inst, pCreateInfo, pAllocator, pSurface);
1051     return result;
1052 }
1053 
vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice,uint32_t queueFamilyIndex,xcb_connection_t * connection,xcb_visualid_t visual_id)1054 VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id)
1055 {
1056     wrapped_phys_dev_obj *phys_dev;
1057     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
1058     VkBool32 result = phys_dev->inst->layer_disp.GetPhysicalDeviceXcbPresentationSupportKHR(vk_phys_dev, queueFamilyIndex, connection, visual_id);
1059     return result;
1060 }
1061 #endif  // VK_USE_PLATFORM_XCB_KHR
1062 
1063 
1064 #ifdef VK_USE_PLATFORM_XLIB_KHR
1065 
vkCreateXlibSurfaceKHR(VkInstance instance,const VkXlibSurfaceCreateInfoKHR * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSurfaceKHR * pSurface)1066 VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface)
1067 {
1068     wrapped_inst_obj *inst;
1069     auto vk_inst = unwrap_instance(instance, &inst);
1070     VkResult result = inst->layer_disp.CreateXlibSurfaceKHR(vk_inst, pCreateInfo, pAllocator, pSurface);
1071     return result;
1072 }
1073 
vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice,uint32_t queueFamilyIndex,Display * dpy,VisualID visualID)1074 VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID)
1075 {
1076     wrapped_phys_dev_obj *phys_dev;
1077     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
1078     VkBool32 result = phys_dev->inst->layer_disp.GetPhysicalDeviceXlibPresentationSupportKHR(vk_phys_dev, queueFamilyIndex, dpy, visualID);
1079     return result;
1080 }
1081 #endif  // VK_USE_PLATFORM_XLIB_KHR
1082 
1083 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
1084 
vkCreateWaylandSurfaceKHR(VkInstance instance,const VkWaylandSurfaceCreateInfoKHR * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSurfaceKHR * pSurface)1085 VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface)
1086 {
1087     wrapped_inst_obj *inst;
1088     auto vk_inst = unwrap_instance(instance, &inst);
1089     VkResult result = inst->layer_disp.CreateWaylandSurfaceKHR(vk_inst, pCreateInfo, pAllocator, pSurface);
1090     return result;
1091 }
1092 
vkGetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice,uint32_t queueFamilyIndex,struct wl_display * display)1093 VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display)
1094 {
1095     wrapped_phys_dev_obj *phys_dev;
1096     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
1097     VkBool32 result = phys_dev->inst->layer_disp.GetPhysicalDeviceWaylandPresentationSupportKHR(vk_phys_dev, queueFamilyIndex, display);
1098     return result;
1099 }
1100 #endif  // VK_USE_PLATFORM_WAYLAND_KHR
1101 
1102 
1103 #ifdef VK_USE_PLATFORM_MIR_KHR
1104 
1105 
vkCreateMirSurfaceKHR(VkInstance instance,const VkMirSurfaceCreateInfoKHR * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkSurfaceKHR * pSurface)1106 VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface)
1107 {
1108     wrapped_inst_obj *inst;
1109     auto vk_inst = unwrap_instance(instance, &inst);
1110     VkResult result = inst->layer_disp.CreateMirSurfaceKHR(vk_inst, pCreateInfo, pAllocator, pSurface);
1111     return result;
1112 }
1113 
vkGetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice,uint32_t queueFamilyIndex,MirConnection * connection)1114 VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection)
1115 {
1116     wrapped_phys_dev_obj *phys_dev;
1117     auto vk_phys_dev = unwrap_phys_dev(physicalDevice, &phys_dev);
1118     VkBool32 result = phys_dev->inst->layer_disp.GetPhysicalDeviceMirPresentationSupportKHR(vk_phys_dev, queueFamilyIndex, connection);
1119     return result;
1120 }
1121 #endif  // VK_USE_PLATFORM_MIR_KHR
1122 
1123 VKAPI_ATTR VkResult VKAPI_CALL
vkCreateDebugReportCallbackEXT(VkInstance instance,const VkDebugReportCallbackCreateInfoEXT * pCreateInfo,const VkAllocationCallbacks * pAllocator,VkDebugReportCallbackEXT * pMsgCallback)1124 vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
1125                              const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pMsgCallback) {
1126     wrapped_inst_obj *inst;
1127     auto vk_inst = unwrap_instance(instance, &inst);
1128 
1129     VkResult res = inst->layer_disp.CreateDebugReportCallbackEXT(vk_inst, pCreateInfo, pAllocator, pMsgCallback);
1130     return res;
1131 }
1132 
1133 VKAPI_ATTR void VKAPI_CALL
vkDestroyDebugReportCallbackEXT(VkInstance instance,VkDebugReportCallbackEXT msgCallback,const VkAllocationCallbacks * pAllocator)1134 vkDestroyDebugReportCallbackEXT(VkInstance instance,
1135                               VkDebugReportCallbackEXT msgCallback,
1136                               const VkAllocationCallbacks *pAllocator) {
1137     wrapped_inst_obj *inst;
1138     auto vk_inst = unwrap_instance(instance, &inst);
1139     inst->layer_disp.DestroyDebugReportCallbackEXT(vk_inst, msgCallback, pAllocator);
1140 }
1141 
1142 VKAPI_ATTR void VKAPI_CALL
vkDebugReportMessageEXT(VkInstance instance,VkDebugReportFlagsEXT flags,VkDebugReportObjectTypeEXT objType,uint64_t object,size_t location,int32_t msgCode,const char * pLayerPrefix,const char * pMsg)1143 vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t object,
1144                       size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg) {
1145     wrapped_inst_obj *inst;
1146     auto vk_inst = unwrap_instance(instance, &inst);
1147     inst->layer_disp.DebugReportMessageEXT(vk_inst, flags, objType, object, location, msgCode, pLayerPrefix,
1148                                                             pMsg);
1149 }
1150 
layer_intercept_proc(const char * name)1151 static inline PFN_vkVoidFunction layer_intercept_proc(const char *name)
1152 {
1153     if (!name || name[0] != 'v' || name[1] != 'k')
1154         return NULL;
1155 
1156     name += 2;
1157     if (!strcmp(name, "CreateInstance"))
1158         return (PFN_vkVoidFunction) vkCreateInstance;
1159     if (!strcmp(name, "DestroyInstance"))
1160         return (PFN_vkVoidFunction) vkDestroyInstance;
1161     if (!strcmp(name, "EnumeratePhysicalDevices"))
1162         return (PFN_vkVoidFunction) vkEnumeratePhysicalDevices;
1163     if (!strcmp(name, "GetPhysicalDeviceFeatures"))
1164         return (PFN_vkVoidFunction) vkGetPhysicalDeviceFeatures;
1165     if (!strcmp(name, "GetPhysicalDeviceFormatProperties"))
1166         return (PFN_vkVoidFunction) vkGetPhysicalDeviceFormatProperties;
1167     if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties"))
1168         return (PFN_vkVoidFunction) vkGetPhysicalDeviceImageFormatProperties;
1169     if (!strcmp(name, "GetPhysicalDeviceProperties"))
1170         return (PFN_vkVoidFunction) vkGetPhysicalDeviceProperties;
1171     if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties"))
1172         return (PFN_vkVoidFunction) vkGetPhysicalDeviceQueueFamilyProperties;
1173     if (!strcmp(name, "GetPhysicalDeviceMemoryProperties"))
1174         return (PFN_vkVoidFunction) vkGetPhysicalDeviceMemoryProperties;
1175     if (!strcmp(name, "CreateDevice"))
1176         return (PFN_vkVoidFunction) vkCreateDevice;
1177     if (!strcmp(name, "DestroyDevice"))
1178         return (PFN_vkVoidFunction) vkDestroyDevice;
1179     if (!strcmp(name, "GetDeviceQueue"))
1180         return (PFN_vkVoidFunction) vkGetDeviceQueue;
1181     if (!strcmp(name, "QueueSubmit"))
1182         return (PFN_vkVoidFunction) vkQueueSubmit;
1183     if (!strcmp(name, "QueueWaitIdle"))
1184         return (PFN_vkVoidFunction) vkQueueWaitIdle;
1185     if (!strcmp(name, "DeviceWaitIdle"))
1186         return (PFN_vkVoidFunction) vkDeviceWaitIdle;
1187     if (!strcmp(name, "AllocateMemory"))
1188         return (PFN_vkVoidFunction) vkAllocateMemory;
1189     if (!strcmp(name, "FreeMemory"))
1190         return (PFN_vkVoidFunction) vkFreeMemory;
1191     if (!strcmp(name, "MapMemory"))
1192         return (PFN_vkVoidFunction) vkMapMemory;
1193     if (!strcmp(name, "UnmapMemory"))
1194         return (PFN_vkVoidFunction) vkUnmapMemory;
1195     if (!strcmp(name, "FlushMappedMemoryRanges"))
1196         return (PFN_vkVoidFunction) vkFlushMappedMemoryRanges;
1197     if (!strcmp(name, "InvalidateMappedMemoryRanges"))
1198         return (PFN_vkVoidFunction) vkInvalidateMappedMemoryRanges;
1199     if (!strcmp(name, "GetDeviceMemoryCommitment"))
1200         return (PFN_vkVoidFunction) vkGetDeviceMemoryCommitment;
1201     if (!strcmp(name, "BindBufferMemory"))
1202         return (PFN_vkVoidFunction) vkBindBufferMemory;
1203     if (!strcmp(name, "BindImageMemory"))
1204         return (PFN_vkVoidFunction) vkBindImageMemory;
1205     if (!strcmp(name, "GetBufferMemoryRequirements"))
1206         return (PFN_vkVoidFunction) vkGetBufferMemoryRequirements;
1207     if (!strcmp(name, "GetImageMemoryRequirements"))
1208         return (PFN_vkVoidFunction) vkGetImageMemoryRequirements;
1209     if (!strcmp(name, "GetImageSparseMemoryRequirements"))
1210         return (PFN_vkVoidFunction) vkGetImageSparseMemoryRequirements;
1211     if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties"))
1212         return (PFN_vkVoidFunction) vkGetPhysicalDeviceSparseImageFormatProperties;
1213     if (!strcmp(name, "QueueBindSparse"))
1214         return (PFN_vkVoidFunction) vkQueueBindSparse;
1215     if (!strcmp(name, "CreateFence"))
1216         return (PFN_vkVoidFunction) vkCreateFence;
1217     if (!strcmp(name, "DestroyFence"))
1218         return (PFN_vkVoidFunction) vkDestroyFence;
1219     if (!strcmp(name, "ResetFences"))
1220         return (PFN_vkVoidFunction) vkResetFences;
1221     if (!strcmp(name, "GetFenceStatus"))
1222         return (PFN_vkVoidFunction) vkGetFenceStatus;
1223     if (!strcmp(name, "WaitForFences"))
1224         return (PFN_vkVoidFunction) vkWaitForFences;
1225     if (!strcmp(name, "CreateSemaphore"))
1226         return (PFN_vkVoidFunction) vkCreateSemaphore;
1227     if (!strcmp(name, "DestroySemaphore"))
1228         return (PFN_vkVoidFunction) vkDestroySemaphore;
1229     if (!strcmp(name, "CreateEvent"))
1230         return (PFN_vkVoidFunction) vkCreateEvent;
1231     if (!strcmp(name, "DestroyEvent"))
1232         return (PFN_vkVoidFunction) vkDestroyEvent;
1233     if (!strcmp(name, "GetEventStatus"))
1234         return (PFN_vkVoidFunction) vkGetEventStatus;
1235     if (!strcmp(name, "SetEvent"))
1236         return (PFN_vkVoidFunction) vkSetEvent;
1237     if (!strcmp(name, "ResetEvent"))
1238         return (PFN_vkVoidFunction) vkResetEvent;
1239     if (!strcmp(name, "CreateQueryPool"))
1240         return (PFN_vkVoidFunction) vkCreateQueryPool;
1241     if (!strcmp(name, "DestroyQueryPool"))
1242         return (PFN_vkVoidFunction) vkDestroyQueryPool;
1243     if (!strcmp(name, "GetQueryPoolResults"))
1244         return (PFN_vkVoidFunction) vkGetQueryPoolResults;
1245     if (!strcmp(name, "CreateBuffer"))
1246         return (PFN_vkVoidFunction) vkCreateBuffer;
1247     if (!strcmp(name, "DestroyBuffer"))
1248         return (PFN_vkVoidFunction) vkDestroyBuffer;
1249     if (!strcmp(name, "CreateBufferView"))
1250         return (PFN_vkVoidFunction) vkCreateBufferView;
1251     if (!strcmp(name, "DestroyBufferView"))
1252         return (PFN_vkVoidFunction) vkDestroyBufferView;
1253     if (!strcmp(name, "CreateImage"))
1254         return (PFN_vkVoidFunction) vkCreateImage;
1255     if (!strcmp(name, "DestroyImage"))
1256         return (PFN_vkVoidFunction) vkDestroyImage;
1257     if (!strcmp(name, "GetImageSubresourceLayout"))
1258         return (PFN_vkVoidFunction) vkGetImageSubresourceLayout;
1259     if (!strcmp(name, "CreateImageView"))
1260         return (PFN_vkVoidFunction) vkCreateImageView;
1261     if (!strcmp(name, "DestroyImageView"))
1262         return (PFN_vkVoidFunction) vkDestroyImageView;
1263     if (!strcmp(name, "CreateShaderModule"))
1264         return (PFN_vkVoidFunction) vkCreateShaderModule;
1265     if (!strcmp(name, "DestroyShaderModule"))
1266         return (PFN_vkVoidFunction) vkDestroyShaderModule;
1267     if (!strcmp(name, "CreatePipelineCache"))
1268         return (PFN_vkVoidFunction) vkCreatePipelineCache;
1269     if (!strcmp(name, "DestroyPipelineCache"))
1270         return (PFN_vkVoidFunction) vkDestroyPipelineCache;
1271     if (!strcmp(name, "GetPipelineCacheData"))
1272         return (PFN_vkVoidFunction) vkGetPipelineCacheData;
1273     if (!strcmp(name, "MergePipelineCaches"))
1274         return (PFN_vkVoidFunction) vkMergePipelineCaches;
1275     if (!strcmp(name, "CreateGraphicsPipelines"))
1276         return (PFN_vkVoidFunction) vkCreateGraphicsPipelines;
1277     if (!strcmp(name, "CreateComputePipelines"))
1278         return (PFN_vkVoidFunction) vkCreateComputePipelines;
1279     if (!strcmp(name, "DestroyPipeline"))
1280         return (PFN_vkVoidFunction) vkDestroyPipeline;
1281     if (!strcmp(name, "CreatePipelineLayout"))
1282         return (PFN_vkVoidFunction) vkCreatePipelineLayout;
1283     if (!strcmp(name, "DestroyPipelineLayout"))
1284         return (PFN_vkVoidFunction) vkDestroyPipelineLayout;
1285     if (!strcmp(name, "CreateSampler"))
1286         return (PFN_vkVoidFunction) vkCreateSampler;
1287     if (!strcmp(name, "DestroySampler"))
1288         return (PFN_vkVoidFunction) vkDestroySampler;
1289     if (!strcmp(name, "CreateDescriptorSetLayout"))
1290         return (PFN_vkVoidFunction) vkCreateDescriptorSetLayout;
1291     if (!strcmp(name, "DestroyDescriptorSetLayout"))
1292         return (PFN_vkVoidFunction) vkDestroyDescriptorSetLayout;
1293     if (!strcmp(name, "CreateDescriptorPool"))
1294         return (PFN_vkVoidFunction) vkCreateDescriptorPool;
1295     if (!strcmp(name, "DestroyDescriptorPool"))
1296         return (PFN_vkVoidFunction) vkDestroyDescriptorPool;
1297     if (!strcmp(name, "ResetDescriptorPool"))
1298         return (PFN_vkVoidFunction) vkResetDescriptorPool;
1299     if (!strcmp(name, "AllocateDescriptorSets"))
1300         return (PFN_vkVoidFunction) vkAllocateDescriptorSets;
1301     if (!strcmp(name, "FreeDescriptorSets"))
1302         return (PFN_vkVoidFunction) vkFreeDescriptorSets;
1303     if (!strcmp(name, "UpdateDescriptorSets"))
1304         return (PFN_vkVoidFunction) vkUpdateDescriptorSets;
1305     if (!strcmp(name, "CreateFramebuffer"))
1306         return (PFN_vkVoidFunction) vkCreateFramebuffer;
1307     if (!strcmp(name, "DestroyFramebuffer"))
1308         return (PFN_vkVoidFunction) vkDestroyFramebuffer;
1309     if (!strcmp(name, "CreateRenderPass"))
1310         return (PFN_vkVoidFunction) vkCreateRenderPass;
1311     if (!strcmp(name, "DestroyRenderPass"))
1312         return (PFN_vkVoidFunction) vkDestroyRenderPass;
1313     if (!strcmp(name, "GetRenderAreaGranularity"))
1314         return (PFN_vkVoidFunction) vkGetRenderAreaGranularity;
1315     if (!strcmp(name, "CreateCommandPool"))
1316         return (PFN_vkVoidFunction) vkCreateCommandPool;
1317     if (!strcmp(name, "DestroyCommandPool"))
1318         return (PFN_vkVoidFunction) vkDestroyCommandPool;
1319     if (!strcmp(name, "ResetCommandPool"))
1320         return (PFN_vkVoidFunction) vkResetCommandPool;
1321     if (!strcmp(name, "AllocateCommandBuffers"))
1322         return (PFN_vkVoidFunction) vkAllocateCommandBuffers;
1323     if (!strcmp(name, "FreeCommandBuffers"))
1324         return (PFN_vkVoidFunction) vkFreeCommandBuffers;
1325     if (!strcmp(name, "BeginCommandBuffer"))
1326         return (PFN_vkVoidFunction) vkBeginCommandBuffer;
1327     if (!strcmp(name, "EndCommandBuffer"))
1328         return (PFN_vkVoidFunction) vkEndCommandBuffer;
1329     if (!strcmp(name, "ResetCommandBuffer"))
1330         return (PFN_vkVoidFunction) vkResetCommandBuffer;
1331     if (!strcmp(name, "CmdBindPipeline"))
1332         return (PFN_vkVoidFunction) vkCmdBindPipeline;
1333     if (!strcmp(name, "CmdSetViewport"))
1334         return (PFN_vkVoidFunction) vkCmdSetViewport;
1335     if (!strcmp(name, "CmdSetScissor"))
1336         return (PFN_vkVoidFunction) vkCmdSetScissor;
1337     if (!strcmp(name, "CmdSetLineWidth"))
1338         return (PFN_vkVoidFunction) vkCmdSetLineWidth;
1339     if (!strcmp(name, "CmdSetDepthBias"))
1340         return (PFN_vkVoidFunction) vkCmdSetDepthBias;
1341     if (!strcmp(name, "CmdSetBlendConstants"))
1342         return (PFN_vkVoidFunction) vkCmdSetBlendConstants;
1343     if (!strcmp(name, "CmdSetDepthBounds"))
1344         return (PFN_vkVoidFunction) vkCmdSetDepthBounds;
1345     if (!strcmp(name, "CmdSetStencilCompareMask"))
1346         return (PFN_vkVoidFunction) vkCmdSetStencilCompareMask;
1347     if (!strcmp(name, "CmdSetStencilWriteMask"))
1348         return (PFN_vkVoidFunction) vkCmdSetStencilWriteMask;
1349     if (!strcmp(name, "CmdSetStencilReference"))
1350         return (PFN_vkVoidFunction) vkCmdSetStencilReference;
1351     if (!strcmp(name, "CmdBindDescriptorSets"))
1352         return (PFN_vkVoidFunction) vkCmdBindDescriptorSets;
1353     if (!strcmp(name, "CmdBindIndexBuffer"))
1354         return (PFN_vkVoidFunction) vkCmdBindIndexBuffer;
1355     if (!strcmp(name, "CmdBindVertexBuffers"))
1356         return (PFN_vkVoidFunction) vkCmdBindVertexBuffers;
1357     if (!strcmp(name, "CmdDraw"))
1358         return (PFN_vkVoidFunction) vkCmdDraw;
1359     if (!strcmp(name, "CmdDrawIndexed"))
1360         return (PFN_vkVoidFunction) vkCmdDrawIndexed;
1361     if (!strcmp(name, "CmdDrawIndirect"))
1362         return (PFN_vkVoidFunction) vkCmdDrawIndirect;
1363     if (!strcmp(name, "CmdDrawIndexedIndirect"))
1364         return (PFN_vkVoidFunction) vkCmdDrawIndexedIndirect;
1365     if (!strcmp(name, "CmdDispatch"))
1366         return (PFN_vkVoidFunction) vkCmdDispatch;
1367     if (!strcmp(name, "CmdDispatchIndirect"))
1368         return (PFN_vkVoidFunction) vkCmdDispatchIndirect;
1369     if (!strcmp(name, "CmdCopyBuffer"))
1370         return (PFN_vkVoidFunction) vkCmdCopyBuffer;
1371     if (!strcmp(name, "CmdCopyImage"))
1372         return (PFN_vkVoidFunction) vkCmdCopyImage;
1373     if (!strcmp(name, "CmdBlitImage"))
1374         return (PFN_vkVoidFunction) vkCmdBlitImage;
1375     if (!strcmp(name, "CmdCopyBufferToImage"))
1376         return (PFN_vkVoidFunction) vkCmdCopyBufferToImage;
1377     if (!strcmp(name, "CmdCopyImageToBuffer"))
1378         return (PFN_vkVoidFunction) vkCmdCopyImageToBuffer;
1379     if (!strcmp(name, "CmdUpdateBuffer"))
1380         return (PFN_vkVoidFunction) vkCmdUpdateBuffer;
1381     if (!strcmp(name, "CmdFillBuffer"))
1382         return (PFN_vkVoidFunction) vkCmdFillBuffer;
1383     if (!strcmp(name, "CmdClearColorImage"))
1384         return (PFN_vkVoidFunction) vkCmdClearColorImage;
1385     if (!strcmp(name, "CmdClearDepthStencilImage"))
1386         return (PFN_vkVoidFunction) vkCmdClearDepthStencilImage;
1387     if (!strcmp(name, "CmdClearAttachments"))
1388         return (PFN_vkVoidFunction) vkCmdClearAttachments;
1389     if (!strcmp(name, "CmdResolveImage"))
1390         return (PFN_vkVoidFunction) vkCmdResolveImage;
1391     if (!strcmp(name, "CmdSetEvent"))
1392         return (PFN_vkVoidFunction) vkCmdSetEvent;
1393     if (!strcmp(name, "CmdResetEvent"))
1394         return (PFN_vkVoidFunction) vkCmdResetEvent;
1395     if (!strcmp(name, "CmdWaitEvents"))
1396         return (PFN_vkVoidFunction) vkCmdWaitEvents;
1397     if (!strcmp(name, "CmdPipelineBarrier"))
1398         return (PFN_vkVoidFunction) vkCmdPipelineBarrier;
1399     if (!strcmp(name, "CmdBeginQuery"))
1400         return (PFN_vkVoidFunction) vkCmdBeginQuery;
1401     if (!strcmp(name, "CmdEndQuery"))
1402         return (PFN_vkVoidFunction) vkCmdEndQuery;
1403     if (!strcmp(name, "CmdResetQueryPool"))
1404         return (PFN_vkVoidFunction) vkCmdResetQueryPool;
1405     if (!strcmp(name, "CmdWriteTimestamp"))
1406         return (PFN_vkVoidFunction) vkCmdWriteTimestamp;
1407     if (!strcmp(name, "CmdCopyQueryPoolResults"))
1408         return (PFN_vkVoidFunction) vkCmdCopyQueryPoolResults;
1409     if (!strcmp(name, "CmdPushConstants"))
1410         return (PFN_vkVoidFunction) vkCmdPushConstants;
1411     if (!strcmp(name, "CmdBeginRenderPass"))
1412         return (PFN_vkVoidFunction) vkCmdBeginRenderPass;
1413     if (!strcmp(name, "CmdNextSubpass"))
1414         return (PFN_vkVoidFunction) vkCmdNextSubpass;
1415     if (!strcmp(name, "CmdEndRenderPass"))
1416         return (PFN_vkVoidFunction) vkCmdEndRenderPass;
1417     if (!strcmp(name, "CmdExecuteCommands"))
1418         return (PFN_vkVoidFunction) vkCmdExecuteCommands;
1419 
1420     return NULL;
1421 }
1422 
layer_intercept_instance_proc(const char * name)1423 static inline PFN_vkVoidFunction layer_intercept_instance_proc(const char *name)
1424 {
1425     if (!name || name[0] != 'v' || name[1] != 'k')
1426         return NULL;
1427 
1428     name += 2;
1429     if (!strcmp(name, "GetInstanceProcAddr"))
1430         return (PFN_vkVoidFunction)vkGetInstanceProcAddr;
1431     if (!strcmp(name, "DestroyInstance"))
1432         return (PFN_vkVoidFunction) vkDestroyInstance;
1433     if (!strcmp(name, "EnumeratePhysicalDevices"))
1434         return (PFN_vkVoidFunction) vkEnumeratePhysicalDevices;
1435     if (!strcmp(name, "GetPhysicalDeviceFeatures"))
1436         return (PFN_vkVoidFunction) vkGetPhysicalDeviceFeatures;
1437     if (!strcmp(name, "GetPhysicalDeviceFormatProperties"))
1438         return (PFN_vkVoidFunction) vkGetPhysicalDeviceFormatProperties;
1439     if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties"))
1440         return (PFN_vkVoidFunction) vkGetPhysicalDeviceImageFormatProperties;
1441     if (!strcmp(name, "GetPhysicalDeviceProperties"))
1442         return (PFN_vkVoidFunction) vkGetPhysicalDeviceProperties;
1443     if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties"))
1444         return (PFN_vkVoidFunction) vkGetPhysicalDeviceQueueFamilyProperties;
1445     if (!strcmp(name, "GetPhysicalDeviceMemoryProperties"))
1446         return (PFN_vkVoidFunction) vkGetPhysicalDeviceMemoryProperties;
1447     if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties"))
1448         return (PFN_vkVoidFunction) vkGetPhysicalDeviceSparseImageFormatProperties;
1449     if (!strcmp(name, "EnumerateDeviceExtensionProperties"))
1450         return (PFN_vkVoidFunction)vkEnumerateDeviceExtensionProperties;
1451     return NULL;
1452 }
1453 
vkGetDeviceProcAddr(VkDevice device,const char * funcName)1454 VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* funcName)
1455 {
1456     PFN_vkVoidFunction addr;
1457 
1458 
1459     if (!strcmp("vkGetDeviceProcAddr", funcName)) {
1460         return (PFN_vkVoidFunction) vkGetDeviceProcAddr;
1461     }
1462 
1463     addr = layer_intercept_proc(funcName);
1464     if (addr)
1465         return addr;
1466     if (device == VK_NULL_HANDLE) {
1467         return NULL;
1468     }
1469 
1470     if (!strcmp("vkCreateSwapchainKHR", funcName))
1471         return reinterpret_cast<PFN_vkVoidFunction>(vkCreateSwapchainKHR);
1472     if (!strcmp("vkDestroySwapchainKHR", funcName))
1473         return reinterpret_cast<PFN_vkVoidFunction>(vkDestroySwapchainKHR);
1474     if (!strcmp("vkGetSwapchainImagesKHR", funcName))
1475         return reinterpret_cast<PFN_vkVoidFunction>(vkGetSwapchainImagesKHR);
1476     if (!strcmp("vkAcquireNextImageKHR", funcName))
1477         return reinterpret_cast<PFN_vkVoidFunction>(vkAcquireNextImageKHR);
1478     if (!strcmp("vkQueuePresentKHR", funcName))
1479         return reinterpret_cast<PFN_vkVoidFunction>(vkQueuePresentKHR);
1480 
1481     VkLayerDispatchTable *pDisp =  device_dispatch_table(device);
1482     if (pDisp->GetDeviceProcAddr == NULL)
1483     {
1484         return NULL;
1485     }
1486 
1487     return pDisp->GetDeviceProcAddr(device, funcName);
1488 }
1489 
vkGetInstanceProcAddr(VkInstance instance,const char * funcName)1490 VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* funcName)
1491 {
1492     PFN_vkVoidFunction addr;
1493 
1494     if (!strcmp(funcName, "vkCreateInstance"))
1495         return (PFN_vkVoidFunction) vkCreateInstance;
1496     if (!strcmp(funcName, "vkCreateDevice"))
1497         return (PFN_vkVoidFunction) vkCreateDevice;
1498 
1499     if (instance == VK_NULL_HANDLE) {
1500         return NULL;
1501     }
1502 
1503     addr = layer_intercept_instance_proc(funcName);
1504     if (addr)
1505         return addr;
1506 
1507     wrapped_inst_obj *inst;
1508     (void)unwrap_instance(instance, &inst);
1509     VkLayerInstanceDispatchTable* pTable = &inst->layer_disp;
1510 
1511     // EXT_debug_report
1512     if (!strcmp(funcName, "vkCreateDebugReportCallbackEXT"))
1513         return (PFN_vkVoidFunction)vkCreateDebugReportCallbackEXT;
1514     if (!strcmp(funcName, "vkDestroyDebugReportCallbackEXT"))
1515         return (PFN_vkVoidFunction)vkDestroyDebugReportCallbackEXT;
1516     if (!strcmp(funcName, "vkDebugReportMessageEXT"))
1517         return (PFN_vkVoidFunction)vkDebugReportMessageEXT;
1518 
1519     //KHR_surface
1520     if (!strcmp("vkDestroySurfaceKHR", funcName))
1521         return reinterpret_cast<PFN_vkVoidFunction>(vkDestroySurfaceKHR);
1522     if (!strcmp("vkGetPhysicalDeviceSurfaceSupportKHR", funcName))
1523         return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfaceSupportKHR);
1524     if (!strcmp("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", funcName))
1525         return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfaceCapabilitiesKHR);
1526     if (!strcmp("vkGetPhysicalDeviceSurfaceFormatsKHR", funcName))
1527         return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfaceFormatsKHR);
1528     if (!strcmp("vkGetPhysicalDeviceSurfacePresentModesKHR", funcName))
1529         return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceSurfacePresentModesKHR);
1530 
1531     // KHR_XXX_surface
1532 #ifdef VK_USE_PLATFORM_XCB_KHR
1533     if (!strcmp("vkCreateXcbSurfaceKHR", funcName))
1534         return reinterpret_cast<PFN_vkVoidFunction>(vkCreateXcbSurfaceKHR);
1535     if (!strcmp("vkGetPhysicalDeviceXcbPresentationSupportKHR", funcName))
1536         return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceXcbPresentationSupportKHR);
1537 #endif // VK_USE_PLATFORM_XCB_KHR
1538 #ifdef VK_USE_PLATFORM_XLIB_KHR
1539     if (!strcmp("vkCreateXlibSurfaceKHR", funcName))
1540         return reinterpret_cast<PFN_vkVoidFunction>(vkCreateXlibSurfaceKHR);
1541     if (!strcmp("vkGetPhysicalDeviceXlibPresentationSupportKHR", funcName))
1542         return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceXlibPresentationSupportKHR);
1543 #endif // VK_USE_PLATFORM_XLIB_KHR
1544 #ifdef VK_USE_PLATFORM_MIR_KHR
1545     if (!strcmp("vkCreateMirSurfaceKHR", funcName))
1546         return reinterpret_cast<PFN_vkVoidFunction>(vkCreateMirSurfaceKHR);
1547     if (!strcmp("vkGetPhysicalDeviceMirPresentationSupportKHR", funcName))
1548         return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceMirPresentationSupportKHR);
1549 #endif // VK_USE_PLATFORM_MIR_KHR
1550 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
1551     if (!strcmp("vkCreateWaylandSurfaceKHR", funcName))
1552         return reinterpret_cast<PFN_vkVoidFunction>(vkCreateWaylandSurfaceKHR);
1553     if (!strcmp("vkGetPhysicalDeviceWaylandPresentationSupportKHR", funcName))
1554         return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceWaylandPresentationSupportKHR);
1555 #endif // VK_USE_PLATFORM_WAYLAND_KHR
1556 #ifdef VK_USE_PLATFORM_WIN32_KHR
1557     if (!strcmp("vkCreateWin32SurfaceKHR", funcName))
1558         return reinterpret_cast<PFN_vkVoidFunction>(vkCreateWin32SurfaceKHR);
1559     if (!strcmp("vkGetPhysicalDeviceWin32PresentationSupportKHR", funcName))
1560         return reinterpret_cast<PFN_vkVoidFunction>(vkGetPhysicalDeviceWin32PresentationSupportKHR);
1561 #endif // VK_USE_PLATFORM_WIN32_KHR
1562 
1563     if (pTable->GetInstanceProcAddr == NULL)
1564         return NULL;
1565     return pTable->GetInstanceProcAddr(instance, funcName);
1566 }
1567 
1568 } // namespace wrap_objects
1569 
1570 // loader-layer interface v0, just wrappers since there is only a layer
vkGetInstanceProcAddr(VkInstance instance,const char * funcName)1571 VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* funcName) {
1572     return wrap_objects::vkGetInstanceProcAddr(instance, funcName);
1573 }
1574 
vkGetDeviceProcAddr(VkDevice device,const char * funcName)1575 VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* funcName) {
1576     return wrap_objects::vkGetDeviceProcAddr(device, funcName);
1577 }
1578 VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateInstanceExtensionProperties(const char * pLayerName,uint32_t * pCount,VkExtensionProperties * pProperties)1579 vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) {
1580     assert(0); // TODO return wrap_objects::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties);
1581     return VK_SUCCESS;
1582 }
1583 
1584 VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateInstanceLayerProperties(uint32_t * pCount,VkLayerProperties * pProperties)1585 vkEnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) {
1586     assert(0); // TODO return wrap_objects::EnumerateInstanceLayerProperties(pCount, pProperties);
1587     return VK_SUCCESS;
1588 }
1589 
1590 VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,uint32_t * pCount,VkLayerProperties * pProperties)1591 vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, VkLayerProperties *pProperties) {
1592     // the layer command handles VK_NULL_HANDLE just fine internally
1593     assert(physicalDevice == VK_NULL_HANDLE);
1594     assert(0); // TODO return wrap_objects::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties);
1595     return VK_SUCCESS;
1596 }
1597 
vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,const char * pLayerName,uint32_t * pCount,VkExtensionProperties * pProperties)1598 VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
1599     const char *pLayerName, uint32_t *pCount,
1600     VkExtensionProperties *pProperties) {
1601     // the layer command handles VK_NULL_HANDLE just fine internally
1602     assert(physicalDevice == VK_NULL_HANDLE);
1603     return wrap_objects::vkEnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties);
1604 }
1605