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