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