1 // Copyright 2018 The SwiftShader Authors. All Rights Reserved.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 #include "VkBuffer.hpp"
16 #include "VkBufferView.hpp"
17 #include "VkCommandBuffer.hpp"
18 #include "VkCommandPool.hpp"
20 #include "VkDebug.hpp"
21 #include "VkDescriptorPool.hpp"
22 #include "VkDescriptorSetLayout.hpp"
23 #include "VkDescriptorUpdateTemplate.hpp"
24 #include "VkDestroy.h"
25 #include "VkDevice.hpp"
26 #include "VkDeviceMemory.hpp"
27 #include "VkEvent.hpp"
28 #include "VkFence.hpp"
29 #include "VkFramebuffer.hpp"
30 #include "VkGetProcAddress.h"
31 #include "VkImage.hpp"
32 #include "VkImageView.hpp"
33 #include "VkInstance.hpp"
34 #include "VkPhysicalDevice.hpp"
35 #include "VkPipeline.hpp"
36 #include "VkPipelineCache.hpp"
37 #include "VkPipelineLayout.hpp"
38 #include "VkQueryPool.hpp"
39 #include "VkQueue.hpp"
40 #include "VkSampler.hpp"
41 #include "VkSemaphore.hpp"
42 #include "VkShaderModule.hpp"
43 #include "VkRenderPass.hpp"
45 #ifdef VK_USE_PLATFORM_XLIB_KHR
46 #include "WSI/XlibSurfaceKHR.hpp"
49 #include "WSI/VkSwapchainKHR.hpp"
58 bool HasExtensionProperty(const char* extensionName, const VkExtensionProperties* extensionProperties, uint32_t extensionPropertiesCount)
60 for(uint32_t j = 0; j < extensionPropertiesCount; ++j)
62 if(strcmp(extensionName, extensionProperties[j].extensionName) == 0)
75 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName)
77 TRACE("(VkInstance instance = 0x%X, const char* pName = 0x%X)", instance, pName);
79 return vk::GetInstanceProcAddr(instance, pName);
82 VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion)
84 *pSupportedVersion = 3;
88 static const VkExtensionProperties instanceExtensionProperties[] =
90 { VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME, VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION },
91 { VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION },
92 { VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION },
93 { VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION },
94 { VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION },
96 { VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_SPEC_VERSION },
98 #ifdef VK_USE_PLATFORM_XLIB_KHR
99 { VK_KHR_XLIB_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_SPEC_VERSION },
103 static const VkExtensionProperties deviceExtensionProperties[] =
105 { VK_KHR_16BIT_STORAGE_EXTENSION_NAME, VK_KHR_16BIT_STORAGE_SPEC_VERSION },
106 { VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, VK_KHR_BIND_MEMORY_2_SPEC_VERSION },
107 { VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION },
108 { VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME, VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION },
109 { VK_KHR_DEVICE_GROUP_EXTENSION_NAME, VK_KHR_DEVICE_GROUP_SPEC_VERSION },
110 { VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME, VK_KHR_EXTERNAL_FENCE_SPEC_VERSION },
111 { VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION },
112 { VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION },
113 { VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION },
114 { VK_KHR_MAINTENANCE1_EXTENSION_NAME, VK_KHR_MAINTENANCE1_SPEC_VERSION },
115 { VK_KHR_MAINTENANCE2_EXTENSION_NAME, VK_KHR_MAINTENANCE2_SPEC_VERSION },
116 { VK_KHR_MAINTENANCE3_EXTENSION_NAME, VK_KHR_MAINTENANCE3_SPEC_VERSION },
117 { VK_KHR_MULTIVIEW_EXTENSION_NAME, VK_KHR_MULTIVIEW_SPEC_VERSION },
118 { VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME, VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION },
119 { VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION },
120 { VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION },
121 { VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME, VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION },
122 { VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME, VK_KHR_VARIABLE_POINTERS_SPEC_VERSION },
124 { VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_SWAPCHAIN_SPEC_VERSION },
128 VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
130 TRACE("(const VkInstanceCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkInstance* pInstance = 0x%X)",
131 pCreateInfo, pAllocator, pInstance);
133 if(pCreateInfo->enabledLayerCount)
135 UNIMPLEMENTED("pCreateInfo->enabledLayerCount");
138 uint32_t extensionPropertiesCount = sizeof(instanceExtensionProperties) / sizeof(instanceExtensionProperties[0]);
139 for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i)
141 if (!HasExtensionProperty(pCreateInfo->ppEnabledExtensionNames[i], instanceExtensionProperties, extensionPropertiesCount))
143 return VK_ERROR_EXTENSION_NOT_PRESENT;
147 if(pCreateInfo->pNext)
149 switch(*reinterpret_cast<const VkStructureType*>(pCreateInfo->pNext))
151 case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO:
152 // According to the Vulkan spec, section 2.7.2. Implicit Valid Usage:
153 // "The values VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO and
154 // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO are reserved for
155 // internal use by the loader, and do not have corresponding
156 // Vulkan structures in this Specification."
159 UNIMPLEMENTED("pCreateInfo->pNext");
163 *pInstance = VK_NULL_HANDLE;
164 VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
166 VkResult result = vk::DispatchablePhysicalDevice::Create(pAllocator, pCreateInfo, &physicalDevice);
167 if(result != VK_SUCCESS)
172 vk::Instance::CreateInfo info =
178 result = vk::DispatchableInstance::Create(pAllocator, &info, pInstance);
179 if(result != VK_SUCCESS)
181 vk::destroy(physicalDevice, pAllocator);
188 VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator)
190 TRACE("(VkInstance instance = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)", instance, pAllocator);
192 vk::destroy(instance, pAllocator);
195 VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices)
197 TRACE("(VkInstance instance = 0x%X, uint32_t* pPhysicalDeviceCount = 0x%X, VkPhysicalDevice* pPhysicalDevices = 0x%X)",
198 instance, pPhysicalDeviceCount, pPhysicalDevices);
200 if(!pPhysicalDevices)
202 *pPhysicalDeviceCount = vk::Cast(instance)->getPhysicalDeviceCount();
206 vk::Cast(instance)->getPhysicalDevices(*pPhysicalDeviceCount, pPhysicalDevices);
212 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures)
214 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceFeatures* pFeatures = 0x%X)",
215 physicalDevice, pFeatures);
217 *pFeatures = vk::Cast(physicalDevice)->getFeatures();
220 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties)
222 TRACE("GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice = 0x%X, VkFormat format = %d, VkFormatProperties* pFormatProperties = 0x%X)",
223 physicalDevice, (int)format, pFormatProperties);
225 vk::Cast(physicalDevice)->getFormatProperties(format, pFormatProperties);
228 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties)
230 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkFormat format = %d, VkImageType type = %d, VkImageTiling tiling = %d, VkImageUsageFlags usage = %d, VkImageCreateFlags flags = %d, VkImageFormatProperties* pImageFormatProperties = 0x%X)",
231 physicalDevice, (int)format, (int)type, (int)tiling, usage, flags, pImageFormatProperties);
233 VkFormatProperties properties;
234 vk::Cast(physicalDevice)->getFormatProperties(format, &properties);
238 case VK_IMAGE_TILING_LINEAR:
239 if (properties.linearTilingFeatures == 0) return VK_ERROR_FORMAT_NOT_SUPPORTED;
242 case VK_IMAGE_TILING_OPTIMAL:
243 if (properties.optimalTilingFeatures == 0) return VK_ERROR_FORMAT_NOT_SUPPORTED;
247 UNIMPLEMENTED("tiling");
250 vk::Cast(physicalDevice)->getImageFormatProperties(format, type, tiling, usage, flags, pImageFormatProperties);
255 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties)
257 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceProperties* pProperties = 0x%X)",
258 physicalDevice, pProperties);
260 *pProperties = vk::Cast(physicalDevice)->getProperties();
263 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties)
265 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, uint32_t* pQueueFamilyPropertyCount = 0x%X, VkQueueFamilyProperties* pQueueFamilyProperties = 0x%X))", physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
267 if(!pQueueFamilyProperties)
269 *pQueueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount();
273 vk::Cast(physicalDevice)->getQueueFamilyProperties(*pQueueFamilyPropertyCount, pQueueFamilyProperties);
277 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties)
279 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceMemoryProperties* pMemoryProperties = 0x%X)", physicalDevice, pMemoryProperties);
281 *pMemoryProperties = vk::Cast(physicalDevice)->getMemoryProperties();
284 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* pName)
286 TRACE("(VkInstance instance = 0x%X, const char* pName = 0x%X)", instance, pName);
288 return vk::GetInstanceProcAddr(instance, pName);
291 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* pName)
293 TRACE("(VkDevice device = 0x%X, const char* pName = 0x%X)", device, pName);
295 return vk::GetDeviceProcAddr(device, pName);
298 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice)
300 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkDeviceCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkDevice* pDevice = 0x%X)",
301 physicalDevice, pCreateInfo, pAllocator, pDevice);
303 if(pCreateInfo->enabledLayerCount)
305 // "The ppEnabledLayerNames and enabledLayerCount members of VkDeviceCreateInfo are deprecated and their values must be ignored by implementations."
306 UNIMPLEMENTED("pCreateInfo->enabledLayerCount"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
309 uint32_t extensionPropertiesCount = sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]);
310 for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i)
312 if (!HasExtensionProperty(pCreateInfo->ppEnabledExtensionNames[i], deviceExtensionProperties, extensionPropertiesCount))
314 return VK_ERROR_EXTENSION_NOT_PRESENT;
318 const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext);
320 while(extensionCreateInfo)
322 switch(extensionCreateInfo->sType)
324 case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO:
325 // According to the Vulkan spec, section 2.7.2. Implicit Valid Usage:
326 // "The values VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO and
327 // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO are reserved for
328 // internal use by the loader, and do not have corresponding
329 // Vulkan structures in this Specification."
331 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2:
333 ASSERT(!pCreateInfo->pEnabledFeatures); // "If the pNext chain includes a VkPhysicalDeviceFeatures2 structure, then pEnabledFeatures must be NULL"
335 const VkPhysicalDeviceFeatures2* physicalDeviceFeatures2 = reinterpret_cast<const VkPhysicalDeviceFeatures2*>(extensionCreateInfo);
337 if(!vk::Cast(physicalDevice)->hasFeatures(physicalDeviceFeatures2->features))
339 return VK_ERROR_FEATURE_NOT_PRESENT;
343 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES:
345 const VkPhysicalDeviceSamplerYcbcrConversionFeatures* samplerYcbcrConversionFeatures = reinterpret_cast<const VkPhysicalDeviceSamplerYcbcrConversionFeatures*>(extensionCreateInfo);
347 if(samplerYcbcrConversionFeatures->samplerYcbcrConversion == VK_TRUE)
349 return VK_ERROR_FEATURE_NOT_PRESENT;
353 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES:
355 const VkPhysicalDevice16BitStorageFeatures* storage16BitFeatures = reinterpret_cast<const VkPhysicalDevice16BitStorageFeatures*>(extensionCreateInfo);
357 if(storage16BitFeatures->storageBuffer16BitAccess == VK_TRUE ||
358 storage16BitFeatures->uniformAndStorageBuffer16BitAccess == VK_TRUE ||
359 storage16BitFeatures->storagePushConstant16 == VK_TRUE ||
360 storage16BitFeatures->storageInputOutput16 == VK_TRUE)
362 return VK_ERROR_FEATURE_NOT_PRESENT;
366 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES:
368 const VkPhysicalDeviceVariablePointerFeatures* variablePointerFeatures = reinterpret_cast<const VkPhysicalDeviceVariablePointerFeatures*>(extensionCreateInfo);
370 if(variablePointerFeatures->variablePointersStorageBuffer == VK_TRUE ||
371 variablePointerFeatures->variablePointers == VK_TRUE)
373 return VK_ERROR_FEATURE_NOT_PRESENT;
377 case VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO:
379 const VkDeviceGroupDeviceCreateInfo* groupDeviceCreateInfo = reinterpret_cast<const VkDeviceGroupDeviceCreateInfo*>(extensionCreateInfo);
381 if((groupDeviceCreateInfo->physicalDeviceCount != 1) ||
382 (groupDeviceCreateInfo->pPhysicalDevices[0] != physicalDevice))
384 return VK_ERROR_FEATURE_NOT_PRESENT;
389 // "the [driver] must skip over, without processing (other than reading the sType and pNext members) any structures in the chain with sType values not defined by [supported extenions]"
390 UNIMPLEMENTED("extensionCreateInfo->sType"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
394 extensionCreateInfo = extensionCreateInfo->pNext;
397 ASSERT(pCreateInfo->queueCreateInfoCount > 0);
399 if(pCreateInfo->pEnabledFeatures)
401 if(!vk::Cast(physicalDevice)->hasFeatures(*(pCreateInfo->pEnabledFeatures)))
403 UNIMPLEMENTED("pCreateInfo->pEnabledFeatures");
404 return VK_ERROR_FEATURE_NOT_PRESENT;
408 uint32_t queueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount();
410 for(uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++)
412 const VkDeviceQueueCreateInfo& queueCreateInfo = pCreateInfo->pQueueCreateInfos[i];
413 if(queueCreateInfo.pNext || queueCreateInfo.flags)
415 UNIMPLEMENTED("queueCreateInfo.pNext || queueCreateInfo.flags");
418 ASSERT(queueCreateInfo.queueFamilyIndex < queueFamilyPropertyCount);
419 (void)queueFamilyPropertyCount; // Silence unused variable warning
422 vk::Device::CreateInfo deviceCreateInfo =
428 return vk::DispatchableDevice::Create(pAllocator, &deviceCreateInfo, pDevice);
431 VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator)
433 TRACE("(VkDevice device = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)", device, pAllocator);
435 vk::destroy(device, pAllocator);
438 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
440 TRACE("(const char* pLayerName = 0x%X, uint32_t* pPropertyCount = 0x%X, VkExtensionProperties* pProperties = 0x%X)",
441 pLayerName, pPropertyCount, pProperties);
443 uint32_t extensionPropertiesCount = sizeof(instanceExtensionProperties) / sizeof(instanceExtensionProperties[0]);
447 *pPropertyCount = extensionPropertiesCount;
451 for(uint32_t i = 0; i < std::min(*pPropertyCount, extensionPropertiesCount); i++)
453 pProperties[i] = instanceExtensionProperties[i];
456 return (*pPropertyCount < extensionPropertiesCount) ? VK_INCOMPLETE : VK_SUCCESS;
459 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
461 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const char* pLayerName, uint32_t* pPropertyCount = 0x%X, VkExtensionProperties* pProperties = 0x%X)", physicalDevice, pPropertyCount, pProperties);
463 uint32_t extensionPropertiesCount = sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]);
467 *pPropertyCount = extensionPropertiesCount;
471 for(uint32_t i = 0; i < std::min(*pPropertyCount, extensionPropertiesCount); i++)
473 pProperties[i] = deviceExtensionProperties[i];
476 return (*pPropertyCount < extensionPropertiesCount) ? VK_INCOMPLETE : VK_SUCCESS;
479 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties)
481 TRACE("(uint32_t* pPropertyCount = 0x%X, VkLayerProperties* pProperties = 0x%X)", pPropertyCount, pProperties);
492 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties)
494 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, uint32_t* pPropertyCount = 0x%X, VkLayerProperties* pProperties = 0x%X)", physicalDevice, pPropertyCount, pProperties);
505 VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue)
507 TRACE("(VkDevice device = 0x%X, uint32_t queueFamilyIndex = %d, uint32_t queueIndex = %d, VkQueue* pQueue = 0x%X)",
508 device, queueFamilyIndex, queueIndex, pQueue);
510 *pQueue = vk::Cast(device)->getQueue(queueFamilyIndex, queueIndex);
513 VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence)
515 TRACE("(VkQueue queue = 0x%X, uint32_t submitCount = %d, const VkSubmitInfo* pSubmits = 0x%X, VkFence fence = 0x%X)",
516 queue, submitCount, pSubmits, fence);
518 vk::Cast(queue)->submit(submitCount, pSubmits, fence);
523 VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue)
525 TRACE("(VkQueue queue = 0x%X)", queue);
527 vk::Cast(queue)->waitIdle();
532 VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device)
534 TRACE("(VkDevice device = 0x%X)", device);
536 vk::Cast(device)->waitIdle();
541 VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
543 TRACE("(VkDevice device = 0x%X, const VkMemoryAllocateInfo* pAllocateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkDeviceMemory* pMemory = 0x%X)",
544 device, pAllocateInfo, pAllocator, pMemory);
546 const VkBaseOutStructure* allocationInfo = reinterpret_cast<const VkBaseOutStructure*>(pAllocateInfo->pNext);
547 while(allocationInfo)
549 switch(allocationInfo->sType)
551 case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO:
552 // This can safely be ignored, as the Vulkan spec mentions:
553 // "If the pNext chain includes a VkMemoryDedicatedAllocateInfo structure, then that structure
554 // includes a handle of the sole buffer or image resource that the memory *can* be bound to."
557 UNIMPLEMENTED("allocationInfo->sType");
561 allocationInfo = allocationInfo->pNext;
564 VkResult result = vk::DeviceMemory::Create(pAllocator, pAllocateInfo, pMemory);
565 if(result != VK_SUCCESS)
570 // Make sure the memory allocation is done now so that OOM errors can be checked now
571 result = vk::Cast(*pMemory)->allocate();
572 if(result != VK_SUCCESS)
574 vk::destroy(*pMemory, pAllocator);
575 *pMemory = VK_NULL_HANDLE;
581 VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
583 TRACE("(VkDevice device = 0x%X, VkDeviceMemory memory = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
584 device, memory, pAllocator);
586 vk::destroy(memory, pAllocator);
589 VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData)
591 TRACE("(VkDevice device = 0x%X, VkDeviceMemory memory = 0x%X, VkDeviceSize offset = %d, VkDeviceSize size = %d, VkMemoryMapFlags flags = 0x%X, void** ppData = 0x%X)",
592 device, memory, offset, size, flags, ppData);
594 return vk::Cast(memory)->map(offset, size, ppData);
597 VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
599 TRACE("(VkDevice device = 0x%X, VkDeviceMemory memory = 0x%X)", device, memory);
601 // Noop, memory will be released when the DeviceMemory object is released
604 VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
606 TRACE("(VkDevice device = 0x%X, uint32_t memoryRangeCount = %d, const VkMappedMemoryRange* pMemoryRanges = 0x%X)",
607 device, memoryRangeCount, pMemoryRanges);
609 // Noop, host and device memory are the same to SwiftShader
614 VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
616 TRACE("(VkDevice device = 0x%X, uint32_t memoryRangeCount = %d, const VkMappedMemoryRange* pMemoryRanges = 0x%X)",
617 device, memoryRangeCount, pMemoryRanges);
619 // Noop, host and device memory are the same to SwiftShader
624 VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice pDevice, VkDeviceMemory pMemory, VkDeviceSize* pCommittedMemoryInBytes)
626 TRACE("(VkDevice device = 0x%X, VkDeviceMemory memory = 0x%X, VkDeviceSize* pCommittedMemoryInBytes = 0x%X)",
627 pDevice, pMemory, pCommittedMemoryInBytes);
629 auto memory = vk::Cast(pMemory);
631 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
632 const auto& memoryProperties = vk::Cast(vk::Cast(pDevice)->getPhysicalDevice())->getMemoryProperties();
633 uint32_t typeIndex = memory->getMemoryTypeIndex();
634 ASSERT(typeIndex < memoryProperties.memoryTypeCount);
635 ASSERT(memoryProperties.memoryTypes[typeIndex].propertyFlags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT);
638 *pCommittedMemoryInBytes = memory->getCommittedMemoryInBytes();
641 VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
643 TRACE("(VkDevice device = 0x%X, VkBuffer buffer = 0x%X, VkDeviceMemory memory = 0x%X, VkDeviceSize memoryOffset = %d)",
644 device, buffer, memory, memoryOffset);
646 vk::Cast(buffer)->bind(memory, memoryOffset);
651 VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset)
653 TRACE("(VkDevice device = 0x%X, VkImage image = 0x%X, VkDeviceMemory memory = 0x%X, VkDeviceSize memoryOffset = %d)",
654 device, image, memory, memoryOffset);
656 vk::Cast(image)->bind(memory, memoryOffset);
661 VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
663 TRACE("(VkDevice device = 0x%X, VkBuffer buffer = 0x%X, VkMemoryRequirements* pMemoryRequirements = 0x%X)",
664 device, buffer, pMemoryRequirements);
666 *pMemoryRequirements = vk::Cast(buffer)->getMemoryRequirements();
669 VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements)
671 TRACE("(VkDevice device = 0x%X, VkImage image = 0x%X, VkMemoryRequirements* pMemoryRequirements = 0x%X)",
672 device, image, pMemoryRequirements);
674 *pMemoryRequirements = vk::Cast(image)->getMemoryRequirements();
677 VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
679 TRACE("(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements)",
680 device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
682 // The 'sparseBinding' feature is not supported, so images can not be created with the VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag.
683 // "If the image was not created with VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT then pSparseMemoryRequirementCount will be set to zero and pSparseMemoryRequirements will not be written to."
684 *pSparseMemoryRequirementCount = 0;
687 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties)
689 TRACE("(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties)",
690 physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties);
692 // We do not support sparse images.
696 VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence)
699 UNIMPLEMENTED("vkQueueBindSparse");
703 VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
705 TRACE("(VkDevice device = 0x%X, const VkFenceCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkFence* pFence = 0x%X)",
706 device, pCreateInfo, pAllocator, pFence);
708 if(pCreateInfo->pNext)
710 UNIMPLEMENTED("pCreateInfo->pNext");
713 return vk::Fence::Create(pAllocator, pCreateInfo, pFence);
716 VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
718 TRACE("(VkDevice device = 0x%X, VkFence fence = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
719 device, fence, pAllocator);
722 vk::destroy(fence, pAllocator);
725 VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences)
727 TRACE("(VkDevice device = 0x%X, uint32_t fenceCount = %d, const VkFence* pFences = 0x%X)",
728 device, fenceCount, pFences);
730 for(uint32_t i = 0; i < fenceCount; i++)
732 vk::Cast(pFences[i])->reset();
738 VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence)
740 TRACE("(VkDevice device = 0x%X, VkFence fence = 0x%X)", device, fence);
742 return vk::Cast(fence)->getStatus();
745 VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
747 TRACE("(VkDevice device = 0x%X, uint32_t fenceCount = %d, const VkFence* pFences = 0x%X, VkBool32 waitAll = %d, uint64_t timeout = %d)",
748 device, fenceCount, pFences, waitAll, timeout);
750 vk::Cast(device)->waitForFences(fenceCount, pFences, waitAll, timeout);
755 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore)
757 TRACE("(VkDevice device = 0x%X, const VkSemaphoreCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkSemaphore* pSemaphore = 0x%X)",
758 device, pCreateInfo, pAllocator, pSemaphore);
760 if(pCreateInfo->pNext || pCreateInfo->flags)
762 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
765 return vk::Semaphore::Create(pAllocator, pCreateInfo, pSemaphore);
768 VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator)
770 TRACE("(VkDevice device = 0x%X, VkSemaphore semaphore = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
771 device, semaphore, pAllocator);
773 vk::destroy(semaphore, pAllocator);
776 VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
778 TRACE("(VkDevice device = 0x%X, const VkEventCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkEvent* pEvent = 0x%X)",
779 device, pCreateInfo, pAllocator, pEvent);
781 if(pCreateInfo->pNext || pCreateInfo->flags)
783 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
786 return vk::Event::Create(pAllocator, pCreateInfo, pEvent);
789 VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
791 TRACE("(VkDevice device = 0x%X, VkEvent event = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
792 device, event, pAllocator);
794 vk::destroy(event, pAllocator);
797 VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event)
799 TRACE("(VkDevice device = 0x%X, VkEvent event = 0x%X)", device, event);
801 return vk::Cast(event)->getStatus();
804 VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event)
806 TRACE("(VkDevice device = 0x%X, VkEvent event = 0x%X)", device, event);
808 vk::Cast(event)->signal();
813 VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event)
815 TRACE("(VkDevice device = 0x%X, VkEvent event = 0x%X)", device, event);
817 vk::Cast(event)->reset();
822 VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
824 TRACE("(VkDevice device = 0x%X, const VkQueryPoolCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkQueryPool* pQueryPool = 0x%X)",
825 device, pCreateInfo, pAllocator, pQueryPool);
827 if(pCreateInfo->pNext || pCreateInfo->flags)
829 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
832 return vk::QueryPool::Create(pAllocator, pCreateInfo, pQueryPool);
835 VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
837 TRACE("(VkDevice device = 0x%X, VkQueryPool queryPool = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
838 device, queryPool, pAllocator);
840 vk::destroy(queryPool, pAllocator);
843 VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
845 TRACE("(VkDevice device = 0x%X, VkQueryPool queryPool = 0x%X, uint32_t firstQuery = %d, uint32_t queryCount = %d, size_t dataSize = %d, void* pData = 0x%X, VkDeviceSize stride = 0x%X, VkQueryResultFlags flags = %d)",
846 device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
848 vk::Cast(queryPool)->getResults(firstQuery, queryCount, dataSize, pData, stride, flags);
853 VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
855 TRACE("(VkDevice device = 0x%X, const VkBufferCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkBuffer* pBuffer = 0x%X)",
856 device, pCreateInfo, pAllocator, pBuffer);
858 if(pCreateInfo->pNext)
860 UNIMPLEMENTED("pCreateInfo->pNext");
863 return vk::Buffer::Create(pAllocator, pCreateInfo, pBuffer);
866 VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
868 TRACE("(VkDevice device = 0x%X, VkBuffer buffer = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
869 device, buffer, pAllocator);
871 vk::destroy(buffer, pAllocator);
874 VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
876 TRACE("(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)",
877 device, pCreateInfo, pAllocator, pView);
879 if(pCreateInfo->pNext || pCreateInfo->flags)
881 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
884 return vk::BufferView::Create(pAllocator, pCreateInfo, pView);
887 VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
889 TRACE("(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)",
890 device, bufferView, pAllocator);
892 vk::destroy(bufferView, pAllocator);
895 VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage)
897 TRACE("(VkDevice device = 0x%X, const VkImageCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkImage* pImage = 0x%X)",
898 device, pCreateInfo, pAllocator, pImage);
900 if(pCreateInfo->pNext)
902 UNIMPLEMENTED("pCreateInfo->pNext");
905 vk::Image::CreateInfo imageCreateInfo =
911 return vk::Image::Create(pAllocator, &imageCreateInfo, pImage);
914 VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator)
916 TRACE("(VkDevice device = 0x%X, VkImage image = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
917 device, image, pAllocator);
919 vk::destroy(image, pAllocator);
922 VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)
924 TRACE("(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)",
925 device, image, pSubresource, pLayout);
927 vk::Cast(image)->getSubresourceLayout(pSubresource, pLayout);
930 VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
932 TRACE("(VkDevice device = 0x%X, const VkImageViewCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkImageView* pView = 0x%X)",
933 device, pCreateInfo, pAllocator, pView);
935 if(pCreateInfo->flags)
937 UNIMPLEMENTED("pCreateInfo->flags");
940 const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext);
942 while(extensionCreateInfo)
944 switch(extensionCreateInfo->sType)
946 case VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR:
948 const VkImageViewUsageCreateInfo* multiviewCreateInfo = reinterpret_cast<const VkImageViewUsageCreateInfo*>(extensionCreateInfo);
949 ASSERT(!(~vk::Cast(pCreateInfo->image)->getUsage() & multiviewCreateInfo->usage));
952 case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO:
954 const VkSamplerYcbcrConversionInfo* ycbcrConversionInfo = reinterpret_cast<const VkSamplerYcbcrConversionInfo*>(extensionCreateInfo);
955 if(ycbcrConversionInfo->conversion != VK_NULL_HANDLE)
957 ASSERT((pCreateInfo->components.r == VK_COMPONENT_SWIZZLE_IDENTITY) &&
958 (pCreateInfo->components.g == VK_COMPONENT_SWIZZLE_IDENTITY) &&
959 (pCreateInfo->components.b == VK_COMPONENT_SWIZZLE_IDENTITY) &&
960 (pCreateInfo->components.a == VK_COMPONENT_SWIZZLE_IDENTITY));
965 UNIMPLEMENTED("extensionCreateInfo->sType");
969 extensionCreateInfo = extensionCreateInfo->pNext;
972 return vk::ImageView::Create(pAllocator, pCreateInfo, pView);
975 VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
977 TRACE("(VkDevice device = 0x%X, VkImageView imageView = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
978 device, imageView, pAllocator);
980 vk::destroy(imageView, pAllocator);
983 VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
985 TRACE("(VkDevice device = 0x%X, const VkShaderModuleCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkShaderModule* pShaderModule = 0x%X)",
986 device, pCreateInfo, pAllocator, pShaderModule);
988 if(pCreateInfo->pNext || pCreateInfo->flags)
990 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
993 return vk::ShaderModule::Create(pAllocator, pCreateInfo, pShaderModule);
996 VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
998 TRACE("(VkDevice device = 0x%X, VkShaderModule shaderModule = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
999 device, shaderModule, pAllocator);
1001 vk::destroy(shaderModule, pAllocator);
1004 VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
1006 TRACE("(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)",
1007 device, pCreateInfo, pAllocator, pPipelineCache);
1009 if(pCreateInfo->pNext || pCreateInfo->flags)
1011 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
1014 return vk::PipelineCache::Create(pAllocator, pCreateInfo, pPipelineCache);
1017 VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
1019 TRACE("(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)",
1020 device, pipelineCache, pAllocator);
1022 vk::destroy(pipelineCache, pAllocator);
1025 VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
1028 UNIMPLEMENTED("vkGetPipelineCacheData");
1032 VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
1035 UNIMPLEMENTED("vkMergePipelineCaches");
1039 VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines)
1041 TRACE("(VkDevice device = 0x%X, VkPipelineCache pipelineCache = 0x%X, uint32_t createInfoCount = %d, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator = 0x%X, VkPipeline* pPipelines = 0x%X)",
1042 device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
1044 // TODO (b/123588002): Optimize based on pipelineCache.
1046 VkResult errorResult = VK_SUCCESS;
1047 for(uint32_t i = 0; i < createInfoCount; i++)
1049 VkResult result = vk::GraphicsPipeline::Create(pAllocator, &pCreateInfos[i], &pPipelines[i]);
1050 if(result == VK_SUCCESS)
1052 static_cast<vk::GraphicsPipeline*>(vk::Cast(pPipelines[i]))->compileShaders(pAllocator, &pCreateInfos[i]);
1056 // According to the Vulkan spec, section 9.4. Multiple Pipeline Creation
1057 // "When an application attempts to create many pipelines in a single command,
1058 // it is possible that some subset may fail creation. In that case, the
1059 // corresponding entries in the pPipelines output array will be filled with
1060 // VK_NULL_HANDLE values. If any pipeline fails creation (for example, due to
1061 // out of memory errors), the vkCreate*Pipelines commands will return an
1062 // error code. The implementation will attempt to create all pipelines, and
1063 // only return VK_NULL_HANDLE values for those that actually failed."
1064 pPipelines[i] = VK_NULL_HANDLE;
1065 errorResult = result;
1072 VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines)
1074 TRACE("(VkDevice device = 0x%X, VkPipelineCache pipelineCache = 0x%X, uint32_t createInfoCount = %d, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator = 0x%X, VkPipeline* pPipelines = 0x%X)",
1075 device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
1077 // TODO (b/123588002): Optimize based on pipelineCache.
1079 VkResult errorResult = VK_SUCCESS;
1080 for(uint32_t i = 0; i < createInfoCount; i++)
1082 VkResult result = vk::ComputePipeline::Create(pAllocator, &pCreateInfos[i], &pPipelines[i]);
1083 if(result == VK_SUCCESS)
1085 static_cast<vk::ComputePipeline*>(vk::Cast(pPipelines[i]))->compileShaders(pAllocator, &pCreateInfos[i]);
1089 // According to the Vulkan spec, section 9.4. Multiple Pipeline Creation
1090 // "When an application attempts to create many pipelines in a single command,
1091 // it is possible that some subset may fail creation. In that case, the
1092 // corresponding entries in the pPipelines output array will be filled with
1093 // VK_NULL_HANDLE values. If any pipeline fails creation (for example, due to
1094 // out of memory errors), the vkCreate*Pipelines commands will return an
1095 // error code. The implementation will attempt to create all pipelines, and
1096 // only return VK_NULL_HANDLE values for those that actually failed."
1097 pPipelines[i] = VK_NULL_HANDLE;
1098 errorResult = result;
1105 VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator)
1107 TRACE("(VkDevice device = 0x%X, VkPipeline pipeline = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1108 device, pipeline, pAllocator);
1110 vk::destroy(pipeline, pAllocator);
1113 VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
1115 TRACE("(VkDevice device = 0x%X, const VkPipelineLayoutCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkPipelineLayout* pPipelineLayout = 0x%X)",
1116 device, pCreateInfo, pAllocator, pPipelineLayout);
1118 if(pCreateInfo->pNext || pCreateInfo->flags)
1120 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
1123 return vk::PipelineLayout::Create(pAllocator, pCreateInfo, pPipelineLayout);
1126 VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
1128 TRACE("(VkDevice device = 0x%X, VkPipelineLayout pipelineLayout = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1129 device, pipelineLayout, pAllocator);
1131 vk::destroy(pipelineLayout, pAllocator);
1134 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
1136 TRACE("(VkDevice device = 0x%X, const VkSamplerCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkSampler* pSampler = 0x%X)",
1137 device, pCreateInfo, pAllocator, pSampler);
1139 if(pCreateInfo->pNext || pCreateInfo->flags)
1141 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
1144 return vk::Sampler::Create(pAllocator, pCreateInfo, pSampler);
1147 VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
1149 TRACE("(VkDevice device = 0x%X, VkSampler sampler = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1150 device, sampler, pAllocator);
1152 vk::destroy(sampler, pAllocator);
1155 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
1157 TRACE("(VkDevice device = 0x%X, const VkDescriptorSetLayoutCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkDescriptorSetLayout* pSetLayout = 0x%X)",
1158 device, pCreateInfo, pAllocator, pSetLayout);
1160 if(pCreateInfo->pNext)
1162 UNIMPLEMENTED("pCreateInfo->pNext");
1165 return vk::DescriptorSetLayout::Create(pAllocator, pCreateInfo, pSetLayout);
1168 VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
1170 TRACE("(VkDevice device = 0x%X, VkDescriptorSetLayout descriptorSetLayout = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1171 device, descriptorSetLayout, pAllocator);
1173 vk::destroy(descriptorSetLayout, pAllocator);
1176 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
1178 TRACE("(VkDevice device = 0x%X, const VkDescriptorPoolCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkDescriptorPool* pDescriptorPool = 0x%X)",
1179 device, pCreateInfo, pAllocator, pDescriptorPool);
1181 if(pCreateInfo->pNext)
1183 UNIMPLEMENTED("pCreateInfo->pNext");
1186 return vk::DescriptorPool::Create(pAllocator, pCreateInfo, pDescriptorPool);
1189 VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
1191 TRACE("(VkDevice device = 0x%X, VkDescriptorPool descriptorPool = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1192 device, descriptorPool, pAllocator);
1194 vk::destroy(descriptorPool, pAllocator);
1197 VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
1199 TRACE("(VkDevice device = 0x%X, VkDescriptorPool descriptorPool = 0x%X, VkDescriptorPoolResetFlags flags = 0x%X)",
1200 device, descriptorPool, flags);
1204 UNIMPLEMENTED("flags");
1207 return vk::Cast(descriptorPool)->reset();
1210 VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
1212 TRACE("(VkDevice device = 0x%X, const VkDescriptorSetAllocateInfo* pAllocateInfo = 0x%X, VkDescriptorSet* pDescriptorSets = 0x%X)",
1213 device, pAllocateInfo, pDescriptorSets);
1215 if(pAllocateInfo->pNext)
1217 UNIMPLEMENTED("pAllocateInfo->pNext");
1220 return vk::Cast(pAllocateInfo->descriptorPool)->allocateSets(
1221 pAllocateInfo->descriptorSetCount, pAllocateInfo->pSetLayouts, pDescriptorSets);
1224 VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
1226 TRACE("(VkDevice device = 0x%X, VkDescriptorPool descriptorPool = 0x%X, uint32_t descriptorSetCount = %d, const VkDescriptorSet* pDescriptorSets = 0x%X)",
1227 device, descriptorPool, descriptorSetCount, pDescriptorSets);
1229 vk::Cast(descriptorPool)->freeSets(descriptorSetCount, pDescriptorSets);
1234 VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
1236 TRACE("(VkDevice device = 0x%X, uint32_t descriptorWriteCount = %d, const VkWriteDescriptorSet* pDescriptorWrites = 0x%X, uint32_t descriptorCopyCount = %d, const VkCopyDescriptorSet* pDescriptorCopies = 0x%X)",
1237 device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
1239 vk::Cast(device)->updateDescriptorSets(descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
1242 VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
1244 TRACE("(VkDevice device = 0x%X, const VkFramebufferCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkFramebuffer* pFramebuffer = 0x%X)",
1245 device, pCreateInfo, pAllocator, pFramebuffer);
1247 if(pCreateInfo->pNext || pCreateInfo->flags)
1249 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
1252 return vk::Framebuffer::Create(pAllocator, pCreateInfo, pFramebuffer);
1255 VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
1257 TRACE("(VkDevice device = 0x%X, VkFramebuffer framebuffer = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)");
1259 vk::destroy(framebuffer, pAllocator);
1262 VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass)
1264 TRACE("(VkDevice device = 0x%X, const VkRenderPassCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkRenderPass* pRenderPass = 0x%X)",
1265 device, pCreateInfo, pAllocator, pRenderPass);
1267 if(pCreateInfo->flags)
1269 UNIMPLEMENTED("pCreateInfo->flags");
1272 const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext);
1274 while(extensionCreateInfo)
1276 switch(extensionCreateInfo->sType)
1278 case VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO:
1280 const VkRenderPassInputAttachmentAspectCreateInfo* inputAttachmentAspectCreateInfo = reinterpret_cast<const VkRenderPassInputAttachmentAspectCreateInfo*>(extensionCreateInfo);
1282 for(uint32_t i = 0; i < inputAttachmentAspectCreateInfo->aspectReferenceCount; i++)
1284 const VkInputAttachmentAspectReference& aspectReference = inputAttachmentAspectCreateInfo->pAspectReferences[i];
1285 ASSERT(aspectReference.subpass < pCreateInfo->subpassCount);
1286 const VkSubpassDescription& subpassDescription = pCreateInfo->pSubpasses[aspectReference.subpass];
1287 ASSERT(aspectReference.inputAttachmentIndex < subpassDescription.inputAttachmentCount);
1288 const VkAttachmentReference& attachmentReference = subpassDescription.pInputAttachments[aspectReference.inputAttachmentIndex];
1289 if(attachmentReference.attachment != VK_ATTACHMENT_UNUSED)
1291 // If the pNext chain includes an instance of VkRenderPassInputAttachmentAspectCreateInfo, for any
1292 // element of the pInputAttachments member of any element of pSubpasses where the attachment member
1293 // is not VK_ATTACHMENT_UNUSED, the aspectMask member of the corresponding element of
1294 // VkRenderPassInputAttachmentAspectCreateInfo::pAspectReferences must only include aspects that are
1295 // present in images of the format specified by the element of pAttachments at attachment
1296 vk::Format format(pCreateInfo->pAttachments[attachmentReference.attachment].format);
1297 bool isDepth = format.isDepth();
1298 bool isStencil = format.isStencil();
1299 ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) || (!isDepth && !isStencil));
1300 ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) || isDepth);
1301 ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) || isStencil);
1306 case VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO:
1308 const VkRenderPassMultiviewCreateInfo* multiviewCreateInfo = reinterpret_cast<const VkRenderPassMultiviewCreateInfo*>(extensionCreateInfo);
1309 ASSERT((multiviewCreateInfo->subpassCount == 0) || (multiviewCreateInfo->subpassCount == pCreateInfo->subpassCount));
1310 ASSERT((multiviewCreateInfo->dependencyCount == 0) || (multiviewCreateInfo->dependencyCount == pCreateInfo->dependencyCount));
1312 bool zeroMask = (multiviewCreateInfo->pViewMasks[0] == 0);
1313 for(uint32_t i = 1; i < multiviewCreateInfo->subpassCount; i++)
1315 ASSERT((multiviewCreateInfo->pViewMasks[i] == 0) == zeroMask);
1320 ASSERT(multiviewCreateInfo->correlationMaskCount == 0);
1323 for(uint32_t i = 0; i < multiviewCreateInfo->dependencyCount; i++)
1325 const VkSubpassDependency &dependency = pCreateInfo->pDependencies[i];
1326 if(multiviewCreateInfo->pViewOffsets[i] != 0)
1328 ASSERT(dependency.srcSubpass != dependency.dstSubpass);
1329 ASSERT(dependency.dependencyFlags & VK_DEPENDENCY_VIEW_LOCAL_BIT);
1333 ASSERT(!(dependency.dependencyFlags & VK_DEPENDENCY_VIEW_LOCAL_BIT));
1337 // If the pNext chain includes an instance of VkRenderPassMultiviewCreateInfo,
1338 // each element of its pViewMask member must not include a bit at a position
1339 // greater than the value of VkPhysicalDeviceLimits::maxFramebufferLayers
1340 // pViewMask is a 32 bit value. If maxFramebufferLayers > 32, it's impossible
1341 // for pViewMask to contain a bit at an illegal position
1342 // Note: Verify pViewMask values instead if we hit this assert
1343 ASSERT(vk::Cast(vk::Cast(device)->getPhysicalDevice())->getProperties().limits.maxFramebufferLayers >= 32);
1347 UNIMPLEMENTED("extensionCreateInfo->sType");
1351 extensionCreateInfo = extensionCreateInfo->pNext;
1354 return vk::RenderPass::Create(pAllocator, pCreateInfo, pRenderPass);
1357 VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator)
1359 TRACE("(VkDevice device = 0x%X, VkRenderPass renderPass = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1360 device, renderPass, pAllocator);
1362 vk::destroy(renderPass, pAllocator);
1365 VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity)
1367 TRACE("(VkDevice device = 0x%X, VkRenderPass renderPass = 0x%X, VkExtent2D* pGranularity = 0x%X)",
1368 device, renderPass, pGranularity);
1370 vk::Cast(renderPass)->getRenderAreaGranularity(pGranularity);
1373 VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
1375 TRACE("(VkDevice device = 0x%X, const VkCommandPoolCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkCommandPool* pCommandPool = 0x%X)",
1376 device, pCreateInfo, pAllocator, pCommandPool);
1378 if(pCreateInfo->pNext)
1380 UNIMPLEMENTED("pCreateInfo->pNext");
1383 return vk::CommandPool::Create(pAllocator, pCreateInfo, pCommandPool);
1386 VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
1388 TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1389 device, commandPool, pAllocator);
1391 vk::destroy(commandPool, pAllocator);
1394 VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
1396 TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, VkCommandPoolResetFlags flags = %d )",
1397 device, commandPool, flags);
1399 return vk::Cast(commandPool)->reset(flags);
1402 VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers)
1404 TRACE("(VkDevice device = 0x%X, const VkCommandBufferAllocateInfo* pAllocateInfo = 0x%X, VkCommandBuffer* pCommandBuffers = 0x%X)",
1405 device, pAllocateInfo, pCommandBuffers);
1407 if(pAllocateInfo->pNext)
1409 UNIMPLEMENTED("pAllocateInfo->pNext");
1412 return vk::Cast(pAllocateInfo->commandPool)->allocateCommandBuffers(
1413 pAllocateInfo->level, pAllocateInfo->commandBufferCount, pCommandBuffers);
1416 VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers)
1418 TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, uint32_t commandBufferCount = %d, const VkCommandBuffer* pCommandBuffers = 0x%X)",
1419 device, commandPool, commandBufferCount, pCommandBuffers);
1421 vk::Cast(commandPool)->freeCommandBuffers(commandBufferCount, pCommandBuffers);
1424 VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo)
1426 TRACE("(VkCommandBuffer commandBuffer = 0x%X, const VkCommandBufferBeginInfo* pBeginInfo = 0x%X)",
1427 commandBuffer, pBeginInfo);
1429 if(pBeginInfo->pNext)
1431 UNIMPLEMENTED("pBeginInfo->pNext");
1434 return vk::Cast(commandBuffer)->begin(pBeginInfo->flags, pBeginInfo->pInheritanceInfo);
1437 VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer)
1439 TRACE("(VkCommandBuffer commandBuffer = 0x%X)", commandBuffer);
1441 return vk::Cast(commandBuffer)->end();
1444 VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags)
1446 TRACE("VkCommandBuffer commandBuffer = 0x%X, VkCommandBufferResetFlags flags = %d", commandBuffer, flags);
1448 return vk::Cast(commandBuffer)->reset(flags);
1451 VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
1453 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkPipelineBindPoint pipelineBindPoint = %d, VkPipeline pipeline = 0x%X)",
1454 commandBuffer, pipelineBindPoint, pipeline);
1456 vk::Cast(commandBuffer)->bindPipeline(pipelineBindPoint, pipeline);
1459 VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports)
1461 TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t firstViewport = %d, uint32_t viewportCount = %d, const VkViewport* pViewports = 0x%X)",
1462 commandBuffer, firstViewport, viewportCount, pViewports);
1464 vk::Cast(commandBuffer)->setViewport(firstViewport, viewportCount, pViewports);
1467 VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors)
1469 TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t firstScissor = %d, uint32_t scissorCount = %d, const VkRect2D* pScissors = 0x%X)",
1470 commandBuffer, firstScissor, scissorCount, pScissors);
1472 vk::Cast(commandBuffer)->setScissor(firstScissor, scissorCount, pScissors);
1475 VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth)
1477 TRACE("(VkCommandBuffer commandBuffer = 0x%X, float lineWidth = %f)", commandBuffer, lineWidth);
1479 vk::Cast(commandBuffer)->setLineWidth(lineWidth);
1482 VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor)
1484 TRACE("(VkCommandBuffer commandBuffer = 0x%X, float depthBiasConstantFactor = %f, float depthBiasClamp = %f, float depthBiasSlopeFactor = %f)",
1485 commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
1487 vk::Cast(commandBuffer)->setDepthBias(depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
1490 VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4])
1492 TRACE("(VkCommandBuffer commandBuffer = 0x%X, const float blendConstants[4] = {%f, %f, %f, %f})",
1493 commandBuffer, blendConstants[0], blendConstants[1], blendConstants[2], blendConstants[3]);
1495 vk::Cast(commandBuffer)->setBlendConstants(blendConstants);
1498 VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds)
1500 TRACE("(VkCommandBuffer commandBuffer = 0x%X, float minDepthBounds = %f, float maxDepthBounds = %f)",
1501 commandBuffer, minDepthBounds, maxDepthBounds);
1503 vk::Cast(commandBuffer)->setDepthBounds(minDepthBounds, maxDepthBounds);
1506 VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask)
1508 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkStencilFaceFlags faceMask = %d, uint32_t compareMask = %d)",
1509 commandBuffer, faceMask, compareMask);
1511 vk::Cast(commandBuffer)->setStencilCompareMask(faceMask, compareMask);
1514 VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask)
1516 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkStencilFaceFlags faceMask = %d, uint32_t writeMask = %d)",
1517 commandBuffer, faceMask, writeMask);
1519 vk::Cast(commandBuffer)->setStencilWriteMask(faceMask, writeMask);
1522 VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference)
1524 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkStencilFaceFlags faceMask = %d, uint32_t reference = %d)",
1525 commandBuffer, faceMask, reference);
1527 vk::Cast(commandBuffer)->setStencilReference(faceMask, reference);
1530 VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets)
1532 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkPipelineBindPoint pipelineBindPoint = %d, VkPipelineLayout layout = 0x%X, uint32_t firstSet = %d, uint32_t descriptorSetCount = %d, const VkDescriptorSet* pDescriptorSets = 0x%X, uint32_t dynamicOffsetCount = %d, const uint32_t* pDynamicOffsets = 0x%X)",
1533 commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
1535 vk::Cast(commandBuffer)->bindDescriptorSets(pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
1538 VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
1540 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer buffer = 0x%X, VkDeviceSize offset = %d, VkIndexType indexType = %d)",
1541 commandBuffer, buffer, offset, indexType);
1543 vk::Cast(commandBuffer)->bindIndexBuffer(buffer, offset, indexType);
1546 VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets)
1548 TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t firstBinding = %d, uint32_t bindingCount = %d, const VkBuffer* pBuffers = 0x%X, const VkDeviceSize* pOffsets = 0x%X)",
1549 commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets);
1551 vk::Cast(commandBuffer)->bindVertexBuffers(firstBinding, bindingCount, pBuffers, pOffsets);
1554 VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance)
1556 TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t vertexCount = %d, uint32_t instanceCount = %d, uint32_t firstVertex = %d, uint32_t firstInstance = %d)",
1557 commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
1559 vk::Cast(commandBuffer)->draw(vertexCount, instanceCount, firstVertex, firstInstance);
1562 VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance)
1564 TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t indexCount = %d, uint32_t instanceCount = %d, uint32_t firstIndex = %d, int32_t vertexOffset = %d, uint32_t firstInstance = %d)",
1565 commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
1567 vk::Cast(commandBuffer)->drawIndexed(indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
1570 VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
1572 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer buffer = 0x%X, VkDeviceSize offset = %d, uint32_t drawCount = %d, uint32_t stride = %d)",
1573 commandBuffer, buffer, offset, drawCount, stride);
1575 vk::Cast(commandBuffer)->drawIndirect(buffer, offset, drawCount, stride);
1578 VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
1580 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer buffer = 0x%X, VkDeviceSize offset = %d, uint32_t drawCount = %d, uint32_t stride = %d)",
1581 commandBuffer, buffer, offset, drawCount, stride);
1583 vk::Cast(commandBuffer)->drawIndexedIndirect(buffer, offset, drawCount, stride);
1586 VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ)
1588 TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t groupCountX = %d, uint32_t groupCountY = %d, uint32_t groupCountZ = %d)",
1589 commandBuffer, groupCountX, groupCountY, groupCountZ);
1591 vk::Cast(commandBuffer)->dispatch(groupCountX, groupCountY, groupCountZ);
1594 VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset)
1596 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer buffer = 0x%X, VkDeviceSize offset = %d)",
1597 commandBuffer, buffer, offset);
1599 vk::Cast(commandBuffer)->dispatchIndirect(buffer, offset);
1602 VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
1604 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer srcBuffer = 0x%X, VkBuffer dstBuffer = 0x%X, uint32_t regionCount = %d, const VkBufferCopy* pRegions = 0x%X)",
1605 commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
1607 vk::Cast(commandBuffer)->copyBuffer(srcBuffer, dstBuffer, regionCount, pRegions);
1610 VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions)
1612 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkImage srcImage = 0x%X, VkImageLayout srcImageLayout = %d, VkImage dstImage = 0x%X, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkImageCopy* pRegions = 0x%X)",
1613 commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
1615 vk::Cast(commandBuffer)->copyImage(srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
1618 VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter)
1620 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkImage srcImage = 0x%X, VkImageLayout srcImageLayout = %d, VkImage dstImage = 0x%X, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkImageBlit* pRegions = 0x%X, VkFilter filter = %d)",
1621 commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
1623 vk::Cast(commandBuffer)->blitImage(srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
1626 VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions)
1628 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer srcBuffer = 0x%X, VkImage dstImage = 0x%X, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkBufferImageCopy* pRegions = 0x%X)",
1629 commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
1631 vk::Cast(commandBuffer)->copyBufferToImage(srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
1634 VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions)
1636 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkImage srcImage = 0x%X, VkImageLayout srcImageLayout = %d, VkBuffer dstBuffer = 0x%X, uint32_t regionCount = %d, const VkBufferImageCopy* pRegions = 0x%X)",
1637 commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
1639 vk::Cast(commandBuffer)->copyImageToBuffer(srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
1642 VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData)
1644 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer dstBuffer = 0x%X, VkDeviceSize dstOffset = %d, VkDeviceSize dataSize = %d, const void* pData = 0x%X)",
1645 commandBuffer, dstBuffer, dstOffset, dataSize, pData);
1647 vk::Cast(commandBuffer)->updateBuffer(dstBuffer, dstOffset, dataSize, pData);
1650 VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data)
1652 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer dstBuffer = 0x%X, VkDeviceSize dstOffset = %d, VkDeviceSize size = %d, uint32_t data = %d)",
1653 commandBuffer, dstBuffer, dstOffset, size, data);
1655 vk::Cast(commandBuffer)->fillBuffer(dstBuffer, dstOffset, size, data);
1658 VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
1660 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkImage image = 0x%X, VkImageLayout imageLayout = %d, const VkClearColorValue* pColor = 0x%X, uint32_t rangeCount = %d, const VkImageSubresourceRange* pRanges = 0x%X)",
1661 commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
1663 vk::Cast(commandBuffer)->clearColorImage(image, imageLayout, pColor, rangeCount, pRanges);
1666 VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
1668 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkImage image = 0x%X, VkImageLayout imageLayout = %d, const VkClearDepthStencilValue* pDepthStencil = 0x%X, uint32_t rangeCount = %d, const VkImageSubresourceRange* pRanges = 0x%X)",
1669 commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
1671 vk::Cast(commandBuffer)->clearDepthStencilImage(image, imageLayout, pDepthStencil, rangeCount, pRanges);
1674 VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects)
1676 TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t attachmentCount = %d, const VkClearAttachment* pAttachments = 0x%X, uint32_t rectCount = %d, const VkClearRect* pRects = 0x%X)",
1677 commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
1679 vk::Cast(commandBuffer)->clearAttachments(attachmentCount, pAttachments, rectCount, pRects);
1682 VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions)
1684 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkImage srcImage = 0x%X, VkImageLayout srcImageLayout = %d, VkImage dstImage = 0x%X, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkImageResolve* pRegions = 0x%X)",
1685 commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
1687 vk::Cast(commandBuffer)->resolveImage(srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
1690 VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
1692 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkEvent event = 0x%X, VkPipelineStageFlags stageMask = %d)",
1693 commandBuffer, event, stageMask);
1695 vk::Cast(commandBuffer)->setEvent(event, stageMask);
1698 VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
1700 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkEvent event = 0x%X, VkPipelineStageFlags stageMask = %d)",
1701 commandBuffer, event, stageMask);
1703 vk::Cast(commandBuffer)->resetEvent(event, stageMask);
1706 VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers)
1708 TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t eventCount = %d, const VkEvent* pEvents = 0x%X, VkPipelineStageFlags srcStageMask = %d, VkPipelineStageFlags dstStageMask = %d, uint32_t memoryBarrierCount = %d, const VkMemoryBarrier* pMemoryBarriers = 0x%X, uint32_t bufferMemoryBarrierCount = %d, const VkBufferMemoryBarrier* pBufferMemoryBarriers = 0x%X, uint32_t imageMemoryBarrierCount = %d, const VkImageMemoryBarrier* pImageMemoryBarriers = 0x%X)",
1709 commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
1711 vk::Cast(commandBuffer)->waitEvents(eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
1714 VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers)
1716 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkPipelineStageFlags srcStageMask = 0x%X, VkPipelineStageFlags dstStageMask = 0x%X, VkDependencyFlags dependencyFlags = %d, uint32_t memoryBarrierCount = %d, onst VkMemoryBarrier* pMemoryBarriers = 0x%X,"
1717 " uint32_t bufferMemoryBarrierCount = %d, const VkBufferMemoryBarrier* pBufferMemoryBarriers = 0x%X, uint32_t imageMemoryBarrierCount = %d, const VkImageMemoryBarrier* pImageMemoryBarriers = 0x%X)",
1718 commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
1720 vk::Cast(commandBuffer)->pipelineBarrier(srcStageMask, dstStageMask, dependencyFlags,
1721 memoryBarrierCount, pMemoryBarriers,
1722 bufferMemoryBarrierCount, pBufferMemoryBarriers,
1723 imageMemoryBarrierCount, pImageMemoryBarriers);
1726 VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags)
1728 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkQueryPool queryPool = 0x%X, uint32_t query = %d, VkQueryControlFlags flags = %d)",
1729 commandBuffer, queryPool, query, flags);
1731 vk::Cast(commandBuffer)->beginQuery(queryPool, query, flags);
1734 VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query)
1736 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkQueryPool queryPool = 0x%X, uint32_t query = %d)",
1737 commandBuffer, queryPool, query);
1739 vk::Cast(commandBuffer)->endQuery(queryPool, query);
1742 VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
1744 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkQueryPool queryPool = 0x%X, uint32_t firstQuery = %d, uint32_t queryCount = %d)",
1745 commandBuffer, queryPool, firstQuery, queryCount);
1747 vk::Cast(commandBuffer)->resetQueryPool(queryPool, firstQuery, queryCount);
1750 VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query)
1752 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkPipelineStageFlagBits pipelineStage = %d, VkQueryPool queryPool = 0x%X, uint32_t query = %d)",
1753 commandBuffer, pipelineStage, queryPool, query);
1755 vk::Cast(commandBuffer)->writeTimestamp(pipelineStage, queryPool, query);
1758 VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags)
1760 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkQueryPool queryPool = 0x%X, uint32_t firstQuery = %d, uint32_t queryCount = %d, VkBuffer dstBuffer = 0x%X, VkDeviceSize dstOffset = %d, VkDeviceSize stride = %d, VkQueryResultFlags flags = %d)",
1761 commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
1763 vk::Cast(commandBuffer)->copyQueryPoolResults(queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
1766 VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues)
1768 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkPipelineLayout layout = 0x%X, VkShaderStageFlags stageFlags = %d, uint32_t offset = %d, uint32_t size = %d, const void* pValues = 0x%X)",
1769 commandBuffer, layout, stageFlags, offset, size, pValues);
1771 vk::Cast(commandBuffer)->pushConstants(layout, stageFlags, offset, size, pValues);
1774 VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents)
1776 TRACE("(VkCommandBuffer commandBuffer = 0x%X, const VkRenderPassBeginInfo* pRenderPassBegin = 0x%X, VkSubpassContents contents = %d)",
1777 commandBuffer, pRenderPassBegin, contents);
1779 if(pRenderPassBegin->pNext)
1781 UNIMPLEMENTED("pRenderPassBegin->pNext");
1784 vk::Cast(commandBuffer)->beginRenderPass(pRenderPassBegin->renderPass, pRenderPassBegin->framebuffer,
1785 pRenderPassBegin->renderArea, pRenderPassBegin->clearValueCount,
1786 pRenderPassBegin->pClearValues, contents);
1789 VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents)
1791 TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkSubpassContents contents = %d)",
1792 commandBuffer, contents);
1794 vk::Cast(commandBuffer)->nextSubpass(contents);
1797 VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
1799 TRACE("(VkCommandBuffer commandBuffer = 0x%X)", commandBuffer);
1801 vk::Cast(commandBuffer)->endRenderPass();
1804 VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers)
1806 TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t commandBufferCount = %d, const VkCommandBuffer* pCommandBuffers = 0x%X)",
1807 commandBuffer, commandBufferCount, pCommandBuffers);
1809 vk::Cast(commandBuffer)->executeCommands(commandBufferCount, pCommandBuffers);
1812 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t* pApiVersion)
1814 TRACE("(uint32_t* pApiVersion = 0x%X)", pApiVersion);
1815 *pApiVersion = vk::API_VERSION;
1819 VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos)
1821 TRACE("(VkDevice device = 0x%X, uint32_t bindInfoCount = %d, const VkBindBufferMemoryInfo* pBindInfos = 0x%X)",
1822 device, bindInfoCount, pBindInfos);
1824 for(uint32_t i = 0; i < bindInfoCount; i++)
1826 if(pBindInfos[i].pNext)
1828 UNIMPLEMENTED("pBindInfos[%d].pNext", i);
1831 vk::Cast(pBindInfos[i].buffer)->bind(pBindInfos[i].memory, pBindInfos[i].memoryOffset);
1837 VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos)
1840 UNIMPLEMENTED("vkBindImageMemory2");
1844 VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures)
1846 TRACE("(VkDevice device = 0x%X, uint32_t heapIndex = %d, uint32_t localDeviceIndex = %d, uint32_t remoteDeviceIndex = %d, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures = 0x%X)",
1847 device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures);
1849 ASSERT(localDeviceIndex != remoteDeviceIndex); // "localDeviceIndex must not equal remoteDeviceIndex"
1850 UNREACHABLE("remoteDeviceIndex: %d", int(remoteDeviceIndex)); // Only one physical device is supported, and since the device indexes can't be equal, this should never be called.
1853 VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask)
1856 UNIMPLEMENTED("vkCmdSetDeviceMask");
1859 VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ)
1862 UNIMPLEMENTED("vkCmdDispatchBase");
1865 VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties)
1867 TRACE("VkInstance instance = 0x%X, uint32_t* pPhysicalDeviceGroupCount = 0x%X, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties = 0x%X",
1868 instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties);
1870 if(!pPhysicalDeviceGroupProperties)
1872 *pPhysicalDeviceGroupCount = vk::Cast(instance)->getPhysicalDeviceGroupCount();
1876 vk::Cast(instance)->getPhysicalDeviceGroups(*pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties);
1882 VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
1884 TRACE("(VkDevice device = 0x%X, const VkImageMemoryRequirementsInfo2* pInfo = 0x%X, VkMemoryRequirements2* pMemoryRequirements = 0x%X)",
1885 device, pInfo, pMemoryRequirements);
1887 if(pInfo->pNext || pMemoryRequirements->pNext)
1889 UNIMPLEMENTED("pInfo->pNext || pMemoryRequirements->pNext");
1892 vkGetImageMemoryRequirements(device, pInfo->image, &(pMemoryRequirements->memoryRequirements));
1895 VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
1897 TRACE("(VkDevice device = 0x%X, const VkBufferMemoryRequirementsInfo2* pInfo = 0x%X, VkMemoryRequirements2* pMemoryRequirements = 0x%X)",
1898 device, pInfo, pMemoryRequirements);
1902 UNIMPLEMENTED("pInfo->pNext");
1905 VkBaseOutStructure* extensionRequirements = reinterpret_cast<VkBaseOutStructure*>(pMemoryRequirements->pNext);
1906 while(extensionRequirements)
1908 switch(extensionRequirements->sType)
1910 case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS:
1912 auto& requirements = *reinterpret_cast<VkMemoryDedicatedRequirements*>(extensionRequirements);
1913 requirements.prefersDedicatedAllocation = VK_FALSE;
1914 requirements.requiresDedicatedAllocation = VK_FALSE;
1918 UNIMPLEMENTED("extensionRequirements->sType");
1922 extensionRequirements = extensionRequirements->pNext;
1925 vkGetBufferMemoryRequirements(device, pInfo->buffer, &(pMemoryRequirements->memoryRequirements));
1928 VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements)
1930 TRACE("(VkDevice device = 0x%X, const VkImageSparseMemoryRequirementsInfo2* pInfo = 0x%X, uint32_t* pSparseMemoryRequirementCount = 0x%X, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements = 0x%X)",
1931 device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
1933 if(pInfo->pNext || pSparseMemoryRequirements->pNext)
1935 UNIMPLEMENTED("pInfo->pNext || pSparseMemoryRequirements->pNext");
1938 vkGetImageSparseMemoryRequirements(device, pInfo->image, pSparseMemoryRequirementCount, &(pSparseMemoryRequirements->memoryRequirements));
1941 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures)
1943 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceFeatures2* pFeatures = 0x%X)", physicalDevice, pFeatures);
1945 VkBaseOutStructure* extensionFeatures = reinterpret_cast<VkBaseOutStructure*>(pFeatures->pNext);
1946 while(extensionFeatures)
1948 switch(extensionFeatures->sType)
1950 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES:
1952 auto& features = *reinterpret_cast<VkPhysicalDeviceSamplerYcbcrConversionFeatures*>(extensionFeatures);
1953 vk::Cast(physicalDevice)->getFeatures(&features);
1956 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES:
1958 auto& features = *reinterpret_cast<VkPhysicalDevice16BitStorageFeatures*>(extensionFeatures);
1959 vk::Cast(physicalDevice)->getFeatures(&features);
1962 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES:
1964 auto& features = *reinterpret_cast<VkPhysicalDeviceVariablePointerFeatures*>(extensionFeatures);
1965 vk::Cast(physicalDevice)->getFeatures(&features);
1968 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR:
1970 auto& features = *reinterpret_cast<VkPhysicalDevice8BitStorageFeaturesKHR*>(extensionFeatures);
1971 vk::Cast(physicalDevice)->getFeatures(&features);
1974 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES:
1976 auto& features = *reinterpret_cast<VkPhysicalDeviceMultiviewFeatures*>(extensionFeatures);
1977 vk::Cast(physicalDevice)->getFeatures(&features);
1980 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES:
1982 auto& features = *reinterpret_cast<VkPhysicalDeviceProtectedMemoryFeatures*>(extensionFeatures);
1983 vk::Cast(physicalDevice)->getFeatures(&features);
1987 // "the [driver] must skip over, without processing (other than reading the sType and pNext members) any structures in the chain with sType values not defined by [supported extenions]"
1988 UNIMPLEMENTED("extensionFeatures->sType"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
1992 extensionFeatures = extensionFeatures->pNext;
1995 vkGetPhysicalDeviceFeatures(physicalDevice, &(pFeatures->features));
1998 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties)
2000 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceProperties2* pProperties = 0x%X)", physicalDevice, pProperties);
2002 VkBaseOutStructure* extensionProperties = reinterpret_cast<VkBaseOutStructure*>(pProperties->pNext);
2003 while(extensionProperties)
2005 switch(extensionProperties->sType)
2007 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES:
2009 auto& properties = *reinterpret_cast<VkPhysicalDeviceIDProperties*>(extensionProperties);
2010 vk::Cast(physicalDevice)->getProperties(&properties);
2013 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES:
2015 auto& properties = *reinterpret_cast<VkPhysicalDeviceMaintenance3Properties*>(extensionProperties);
2016 vk::Cast(physicalDevice)->getProperties(&properties);
2019 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES:
2021 auto& properties = *reinterpret_cast<VkPhysicalDeviceMultiviewProperties*>(extensionProperties);
2022 vk::Cast(physicalDevice)->getProperties(&properties);
2025 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES:
2027 auto& properties = *reinterpret_cast<VkPhysicalDevicePointClippingProperties*>(extensionProperties);
2028 vk::Cast(physicalDevice)->getProperties(&properties);
2031 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES:
2033 auto& properties = *reinterpret_cast<VkPhysicalDeviceProtectedMemoryProperties*>(extensionProperties);
2034 vk::Cast(physicalDevice)->getProperties(&properties);
2037 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES:
2039 auto& properties = *reinterpret_cast<VkPhysicalDeviceSubgroupProperties*>(extensionProperties);
2040 vk::Cast(physicalDevice)->getProperties(&properties);
2043 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT:
2044 // Explicitly ignored, since VK_EXT_sample_locations is not supported
2045 ASSERT(!HasExtensionProperty(VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME, deviceExtensionProperties,
2046 sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0])));
2049 // "the [driver] must skip over, without processing (other than reading the sType and pNext members) any structures in the chain with sType values not defined by [supported extenions]"
2050 UNIMPLEMENTED("extensionProperties->sType"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
2054 extensionProperties = extensionProperties->pNext;
2057 vkGetPhysicalDeviceProperties(physicalDevice, &(pProperties->properties));
2060 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties)
2062 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkFormat format = %d, VkFormatProperties2* pFormatProperties = 0x%X)",
2063 physicalDevice, format, pFormatProperties);
2065 if(pFormatProperties->pNext)
2067 UNIMPLEMENTED("pFormatProperties->pNext");
2070 vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &(pFormatProperties->formatProperties));
2073 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties)
2075 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo = 0x%X, VkImageFormatProperties2* pImageFormatProperties = 0x%X)",
2076 physicalDevice, pImageFormatInfo, pImageFormatProperties);
2078 if(pImageFormatInfo->pNext || pImageFormatProperties->pNext)
2080 UNIMPLEMENTED("pImageFormatInfo->pNext || pImageFormatProperties->pNext");
2083 return vkGetPhysicalDeviceImageFormatProperties(physicalDevice,
2084 pImageFormatInfo->format,
2085 pImageFormatInfo->type,
2086 pImageFormatInfo->tiling,
2087 pImageFormatInfo->usage,
2088 pImageFormatInfo->flags,
2089 &(pImageFormatProperties->imageFormatProperties));
2092 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties)
2094 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, uint32_t* pQueueFamilyPropertyCount = 0x%X, VkQueueFamilyProperties2* pQueueFamilyProperties = 0x%X)",
2095 physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
2097 if(pQueueFamilyProperties && pQueueFamilyProperties->pNext)
2099 UNIMPLEMENTED("pQueueFamilyProperties->pNext");
2102 vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount,
2103 pQueueFamilyProperties ? &(pQueueFamilyProperties->queueFamilyProperties) : nullptr);
2106 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties)
2108 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceMemoryProperties2* pMemoryProperties = 0x%X)", physicalDevice, pMemoryProperties);
2110 if(pMemoryProperties->pNext)
2112 UNIMPLEMENTED("pMemoryProperties->pNext");
2115 vkGetPhysicalDeviceMemoryProperties(physicalDevice, &(pMemoryProperties->memoryProperties));
2118 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties)
2120 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo = 0x%X, uint32_t* pPropertyCount = 0x%X, VkSparseImageFormatProperties2* pProperties = 0x%X)",
2121 physicalDevice, pFormatInfo, pPropertyCount, pProperties);
2123 if(pProperties && pProperties->pNext)
2125 UNIMPLEMENTED("pProperties->pNext");
2128 vkGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, pFormatInfo->format, pFormatInfo->type,
2129 pFormatInfo->samples, pFormatInfo->usage, pFormatInfo->tiling,
2130 pPropertyCount, pProperties ? &(pProperties->properties) : nullptr);
2133 VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags)
2135 TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, VkCommandPoolTrimFlags flags = %d)",
2136 device, commandPool, flags);
2138 vk::Cast(commandPool)->trim(flags);
2141 VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue)
2143 TRACE("(VkDevice device = 0x%X, const VkDeviceQueueInfo2* pQueueInfo = 0x%X, VkQueue* pQueue = 0x%X)",
2144 device, pQueueInfo, pQueue);
2146 if(pQueueInfo->pNext)
2148 UNIMPLEMENTED("pQueueInfo->pNext");
2151 // The only flag that can be set here is VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT
2152 // According to the Vulkan spec, 4.3.1. Queue Family Properties:
2153 // "VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT specifies that the device queue is a
2154 // protected-capable queue. If the protected memory feature is not enabled,
2155 // the VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT bit of flags must not be set."
2156 if(pQueueInfo->flags)
2158 *pQueue = VK_NULL_HANDLE;
2162 vkGetDeviceQueue(device, pQueueInfo->queueFamilyIndex, pQueueInfo->queueIndex, pQueue);
2166 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
2169 UNIMPLEMENTED("vkCreateSamplerYcbcrConversion");
2173 VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
2176 UNIMPLEMENTED("vkDestroySamplerYcbcrConversion");
2179 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
2181 TRACE("(VkDevice device = 0x%X, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate = 0x%X)",
2182 device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate);
2184 if(pCreateInfo->pNext || pCreateInfo->flags || (pCreateInfo->templateType != VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET))
2186 UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags || (pCreateInfo->templateType != VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET)");
2189 return vk::DescriptorUpdateTemplate::Create(pAllocator, pCreateInfo, pDescriptorUpdateTemplate);
2192 VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator)
2194 TRACE("(VkDevice device = 0x%X, VkDescriptorUpdateTemplate descriptorUpdateTemplate = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
2195 device, descriptorUpdateTemplate, pAllocator);
2197 vk::destroy(descriptorUpdateTemplate, pAllocator);
2200 VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData)
2202 TRACE("(VkDevice device = 0x%X, VkDescriptorSet descriptorSet = 0x%X, VkDescriptorUpdateTemplate descriptorUpdateTemplate = 0x%X, const void* pData = 0x%X)",
2203 device, descriptorSet, descriptorUpdateTemplate, pData);
2205 vk::Cast(descriptorUpdateTemplate)->updateDescriptorSet(descriptorSet, pData);
2208 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties)
2210 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo = 0x%X, VkExternalBufferProperties* pExternalBufferProperties = 0x%X)",
2211 physicalDevice, pExternalBufferInfo, pExternalBufferProperties);
2213 UNIMPLEMENTED("vkGetPhysicalDeviceExternalBufferProperties");
2216 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties)
2218 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo = 0x%X, VkExternalFenceProperties* pExternalFenceProperties = 0x%X)",
2219 physicalDevice, pExternalFenceInfo, pExternalFenceProperties);
2221 UNIMPLEMENTED("vkGetPhysicalDeviceExternalFenceProperties");
2224 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties)
2226 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo = 0x%X, VkExternalSemaphoreProperties* pExternalSemaphoreProperties = 0x%X)",
2227 physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties);
2229 UNIMPLEMENTED("vkGetPhysicalDeviceExternalSemaphoreProperties");
2232 VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)
2234 TRACE("(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)",
2235 device, pCreateInfo, pSupport);
2237 vk::Cast(device)->getDescriptorSetLayoutSupport(pCreateInfo, pSupport);
2240 #ifdef VK_USE_PLATFORM_XLIB_KHR
2241 VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface)
2243 TRACE("(VkInstance instance = 0x%X, VkXlibSurfaceCreateInfoKHR* pCreateInfo = 0x%X, VkAllocationCallbacks* pAllocator = 0x%X, VkSurface* pSurface = 0x%X)",
2244 instance, pCreateInfo, pAllocator, pSurface);
2246 return vk::XlibSurfaceKHR::Create(pAllocator, pCreateInfo, pSurface);
2251 VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator)
2253 TRACE("(VkInstance instance = 0x%X, VkSurfaceKHR surface = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
2254 instance, surface, pAllocator);
2256 vk::destroy(surface, pAllocator);
2259 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported)
2261 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, uint32_t queueFamilyIndex = 0x%X, VkSurface surface = 0x%X, VKBool32* pSupported = 0x%X)",
2262 physicalDevice, queueFamilyIndex, surface, pSupported);
2264 *pSupported = VK_TRUE;
2269 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities)
2271 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkSurfaceKHR surface = 0x%X, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities = 0x%X)",
2272 physicalDevice, surface, pSurfaceCapabilities);
2274 vk::Cast(surface)->getSurfaceCapabilities(pSurfaceCapabilities);
2278 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats)
2280 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkSurfaceKHR surface = 0x%X. uint32_t* pSurfaceFormatCount = 0x%X, VkSurfaceFormatKHR* pSurfaceFormats)",
2281 physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats);
2283 if(!pSurfaceFormats)
2285 *pSurfaceFormatCount = vk::Cast(surface)->getSurfaceFormatsCount();
2289 return vk::Cast(surface)->getSurfaceFormats(pSurfaceFormatCount, pSurfaceFormats);
2292 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes)
2294 TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkSurfaceKHR surface = 0x%X uint32_t* pPresentModeCount = 0x%X, VkPresentModeKHR* pPresentModes = 0x%X)",
2295 physicalDevice, surface, pPresentModeCount, pPresentModes);
2299 *pPresentModeCount = vk::Cast(surface)->getPresentModeCount();
2303 return vk::Cast(surface)->getPresentModes(pPresentModeCount, pPresentModes);
2306 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain)
2308 TRACE("(VkDevice device = 0x%X, const VkSwapchainCreateInfoKHR* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkSwapchainKHR* pSwapchain = 0x%X)",
2309 device, pCreateInfo, pAllocator, pSwapchain);
2311 if(pCreateInfo->oldSwapchain)
2313 vk::Cast(pCreateInfo->oldSwapchain)->retire();
2316 if(vk::Cast(pCreateInfo->surface)->getAssociatedSwapchain() != VK_NULL_HANDLE)
2318 return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR;
2321 VkResult status = vk::SwapchainKHR::Create(pAllocator, pCreateInfo, pSwapchain);
2323 if(status != VK_SUCCESS)
2328 status = vk::Cast(*pSwapchain)->createImages(device);
2330 if(status != VK_SUCCESS)
2332 vk::destroy(*pSwapchain, pAllocator);
2336 vk::Cast(pCreateInfo->surface)->associateSwapchain(*pSwapchain);
2341 VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator)
2343 TRACE("(VkDevice device = 0x%X, VkSwapchainKHR swapchain = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
2344 device, swapchain, pAllocator);
2346 vk::destroy(swapchain, pAllocator);
2349 VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages)
2351 TRACE("(VkDevice device = 0x%X, VkSwapchainKHR swapchain = 0x%X, uint32_t* pSwapchainImageCount = 0x%X, VkImage* pSwapchainImages = 0x%X)",
2352 device, swapchain, pSwapchainImageCount, pSwapchainImages);
2354 if(!pSwapchainImages)
2356 *pSwapchainImageCount = vk::Cast(swapchain)->getImageCount();
2360 return vk::Cast(swapchain)->getImages(pSwapchainImageCount, pSwapchainImages);
2363 VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex)
2365 TRACE("(VkDevice device = 0x%X, VkSwapchainKHR swapchain = 0x%X, uint64_t timeout = 0x%X, VkSemaphore semaphore = 0x%X, VkFence fence = 0x%X, uint32_t* pImageIndex = 0x%X)",
2366 device, swapchain, timeout, semaphore, fence, pImageIndex);
2368 return vk::Cast(swapchain)->getNextImage(timeout, semaphore, fence, pImageIndex);
2371 VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo)
2373 TRACE("(VkQueue queue = 0x%X, const VkPresentInfoKHR* pPresentInfo = 0x%X)",
2374 queue, pPresentInfo);
2376 vk::Cast(queue)->present(pPresentInfo);
2380 #endif // ! __ANDROID__