OSDN Git Service

vkGetRenderAreaGranularity implementation
[android-x86/external-swiftshader.git] / src / Vulkan / libVulkan.cpp
1 // Copyright 2018 The SwiftShader Authors. All Rights Reserved.
2 //
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
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
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.
14
15 #include "VkBuffer.hpp"
16 #include "VkBufferView.hpp"
17 #include "VkCommandBuffer.hpp"
18 #include "VkCommandPool.hpp"
19 #include "VkConfig.h"
20 #include "VkDebug.hpp"
21 #include "VkDescriptorPool.hpp"
22 #include "VkDescriptorSetLayout.hpp"
23 #include "VkDestroy.h"
24 #include "VkDevice.hpp"
25 #include "VkDeviceMemory.hpp"
26 #include "VkEvent.hpp"
27 #include "VkFence.hpp"
28 #include "VkFramebuffer.hpp"
29 #include "VkGetProcAddress.h"
30 #include "VkImage.hpp"
31 #include "VkImageView.hpp"
32 #include "VkInstance.hpp"
33 #include "VkPhysicalDevice.hpp"
34 #include "VkPipeline.hpp"
35 #include "VkPipelineCache.hpp"
36 #include "VkPipelineLayout.hpp"
37 #include "VkQueryPool.hpp"
38 #include "VkQueue.hpp"
39 #include "VkSampler.hpp"
40 #include "VkSemaphore.hpp"
41 #include "VkShaderModule.hpp"
42 #include "VkRenderPass.hpp"
43
44 #include <algorithm>
45 #include <cstring>
46 #include <string>
47
48 extern "C"
49 {
50 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName)
51 {
52         TRACE("(VkInstance instance = 0x%X, const char* pName = 0x%X)", instance, pName);
53
54         return vk::GetInstanceProcAddr(instance, pName);
55 }
56
57 static const VkExtensionProperties instanceExtensionProperties[] =
58 {
59         { VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME, VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION },
60         { VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION },
61         { VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION },
62         { VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION },
63         { VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION },
64         { VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_SPEC_VERSION },
65 #ifdef VK_USE_PLATFORM_XLIB_KHR
66         { VK_KHR_XLIB_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_SPEC_VERSION },
67 #endif
68 };
69
70 static const VkExtensionProperties deviceExtensionProperties[] =
71 {
72         { VK_KHR_16BIT_STORAGE_EXTENSION_NAME, VK_KHR_16BIT_STORAGE_SPEC_VERSION },
73         { VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, VK_KHR_BIND_MEMORY_2_SPEC_VERSION },
74         { VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION },
75         { VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME, VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION },
76         { VK_KHR_DEVICE_GROUP_EXTENSION_NAME,  VK_KHR_DEVICE_GROUP_SPEC_VERSION },
77         { VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME, VK_KHR_EXTERNAL_FENCE_SPEC_VERSION },
78         { VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION },
79         { VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION },
80         { VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION },
81         { VK_KHR_MAINTENANCE1_EXTENSION_NAME, VK_KHR_MAINTENANCE1_SPEC_VERSION },
82         { VK_KHR_MAINTENANCE2_EXTENSION_NAME, VK_KHR_MAINTENANCE2_SPEC_VERSION },
83         { VK_KHR_MAINTENANCE3_EXTENSION_NAME, VK_KHR_MAINTENANCE3_SPEC_VERSION },
84         { VK_KHR_MULTIVIEW_EXTENSION_NAME, VK_KHR_MULTIVIEW_SPEC_VERSION },
85         { VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME, VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION },
86         { VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION },
87         { VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION },
88         { VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME, VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION },
89         { VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME, VK_KHR_VARIABLE_POINTERS_SPEC_VERSION },
90 };
91
92 VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
93 {
94         TRACE("(const VkInstanceCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkInstance* pInstance = 0x%X)",
95                         pCreateInfo, pAllocator, pInstance);
96
97         if(pCreateInfo->enabledLayerCount)
98         {
99                 UNIMPLEMENTED();
100         }
101
102         for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i)
103         {
104                 const char* currentExtensionName = *(pCreateInfo->ppEnabledExtensionNames);
105                 uint32_t extensionPropertiesCount = sizeof(instanceExtensionProperties) / sizeof(instanceExtensionProperties[0]);
106                 bool foundExtension = false;
107
108                 for (uint32_t j = 0; j < extensionPropertiesCount; ++j)
109                 {
110                         if (strcmp(currentExtensionName, instanceExtensionProperties[j].extensionName) == 0)
111                         {
112                                 foundExtension = true;
113                                 break;
114                         }
115                 }
116
117                 if (!foundExtension)
118                 {
119                         return VK_ERROR_EXTENSION_NOT_PRESENT;
120                 }
121         }
122
123         if(pCreateInfo->pNext)
124         {
125                 switch(*reinterpret_cast<const VkStructureType*>(pCreateInfo->pNext))
126                 {
127                 case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO:
128                         // According to the Vulkan spec, section 2.7.2. Implicit Valid Usage:
129                         // "The values VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO and
130                         //  VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO are reserved for
131                         //  internal use by the loader, and do not have corresponding
132                         //  Vulkan structures in this Specification."
133                         break;
134                 default:
135                         UNIMPLEMENTED();
136                 }
137         }
138
139         *pInstance = VK_NULL_HANDLE;
140         VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
141
142         VkResult result = vk::DispatchablePhysicalDevice::Create(pAllocator, pCreateInfo, &physicalDevice);
143         if(result != VK_SUCCESS)
144         {
145                 return result;
146         }
147
148         vk::Instance::CreateInfo info =
149         {
150                 pCreateInfo,
151                 physicalDevice
152         };
153
154         result = vk::DispatchableInstance::Create(pAllocator, &info, pInstance);
155         if(result != VK_SUCCESS)
156         {
157                 vk::destroy(physicalDevice, pAllocator);
158                 return result;
159         }
160
161         return result;
162 }
163
164 VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator)
165 {
166         TRACE("(VkInstance instance = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)", instance, pAllocator);
167
168         vk::destroy(instance, pAllocator);
169 }
170
171 VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices)
172 {
173         TRACE("(VkInstance instance = 0x%X, uint32_t* pPhysicalDeviceCount = 0x%X, VkPhysicalDevice* pPhysicalDevices = 0x%X)",
174                     instance, pPhysicalDeviceCount, pPhysicalDevices);
175
176         if(!pPhysicalDevices)
177         {
178                 *pPhysicalDeviceCount = vk::Cast(instance)->getPhysicalDeviceCount();
179         }
180         else
181         {
182                 vk::Cast(instance)->getPhysicalDevices(*pPhysicalDeviceCount, pPhysicalDevices);
183         }
184
185         return VK_SUCCESS;
186 }
187
188 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures)
189 {
190         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceFeatures* pFeatures = 0x%X)",
191                         physicalDevice, pFeatures);
192
193         *pFeatures = vk::Cast(physicalDevice)->getFeatures();
194 }
195
196 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties)
197 {
198         TRACE("GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice = 0x%X, VkFormat format = %d, VkFormatProperties* pFormatProperties = 0x%X)",
199                         physicalDevice, (int)format, pFormatProperties);
200
201         vk::Cast(physicalDevice)->getFormatProperties(format, pFormatProperties);
202 }
203
204 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties)
205 {
206         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkFormat format = %d, VkImageType type = %d, VkImageTiling tiling = %d, VkImageUsageFlags usage = %d, VkImageCreateFlags flags = %d, VkImageFormatProperties* pImageFormatProperties = 0x%X)",
207                         physicalDevice, (int)format, (int)type, (int)tiling, usage, flags, pImageFormatProperties);
208
209         VkFormatProperties properties;
210         vk::Cast(physicalDevice)->getFormatProperties(format, &properties);
211
212         switch (tiling)
213         {
214         case VK_IMAGE_TILING_LINEAR:
215                 if (properties.linearTilingFeatures == 0) return VK_ERROR_FORMAT_NOT_SUPPORTED;
216                 break;
217
218         case VK_IMAGE_TILING_OPTIMAL:
219                 if (properties.optimalTilingFeatures == 0) return VK_ERROR_FORMAT_NOT_SUPPORTED;
220                 break;
221
222         default:
223                 UNIMPLEMENTED();
224         }
225
226         vk::Cast(physicalDevice)->getImageFormatProperties(format, type, tiling, usage, flags, pImageFormatProperties);
227
228         return VK_SUCCESS;
229 }
230
231 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties)
232 {
233         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceProperties* pProperties = 0x%X)",
234                     physicalDevice, pProperties);
235
236         *pProperties = vk::Cast(physicalDevice)->getProperties();
237 }
238
239 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties)
240 {
241         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, uint32_t* pQueueFamilyPropertyCount = 0x%X, VkQueueFamilyProperties* pQueueFamilyProperties = 0x%X))", physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
242
243         if(!pQueueFamilyProperties)
244         {
245                 *pQueueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount();
246         }
247         else
248         {
249                 vk::Cast(physicalDevice)->getQueueFamilyProperties(*pQueueFamilyPropertyCount, pQueueFamilyProperties);
250         }
251 }
252
253 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties)
254 {
255         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceMemoryProperties* pMemoryProperties = 0x%X)", physicalDevice, pMemoryProperties);
256
257         *pMemoryProperties = vk::Cast(physicalDevice)->getMemoryProperties();
258 }
259
260 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* pName)
261 {
262         TRACE("(VkInstance instance = 0x%X, const char* pName = 0x%X)", instance, pName);
263
264         return vk::GetInstanceProcAddr(instance, pName);
265 }
266
267 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* pName)
268 {
269         TRACE("(VkDevice device = 0x%X, const char* pName = 0x%X)", device, pName);
270
271         return vk::GetDeviceProcAddr(device, pName);
272 }
273
274 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice)
275 {
276         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkDeviceCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkDevice* pDevice = 0x%X)",
277                 physicalDevice, pCreateInfo, pAllocator, pDevice);
278
279         if(pCreateInfo->enabledLayerCount)
280         {
281                 // "The ppEnabledLayerNames and enabledLayerCount members of VkDeviceCreateInfo are deprecated and their values must be ignored by implementations."
282                 UNIMPLEMENTED();   // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
283         }
284
285         const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext);
286
287         while(extensionCreateInfo)
288         {
289                 switch(extensionCreateInfo->sType)
290                 {
291                 case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO:
292                         // According to the Vulkan spec, section 2.7.2. Implicit Valid Usage:
293                         // "The values VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO and
294                         //  VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO are reserved for
295                         //  internal use by the loader, and do not have corresponding
296                         //  Vulkan structures in this Specification."
297                         break;
298                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2:
299                         {
300                                 ASSERT(!pCreateInfo->pEnabledFeatures);   // "If the pNext chain includes a VkPhysicalDeviceFeatures2 structure, then pEnabledFeatures must be NULL"
301
302                                 const VkPhysicalDeviceFeatures2* physicalDeviceFeatures2 = reinterpret_cast<const VkPhysicalDeviceFeatures2*>(extensionCreateInfo);
303
304                                 if(!vk::Cast(physicalDevice)->hasFeatures(physicalDeviceFeatures2->features))
305                                 {
306                                         return VK_ERROR_FEATURE_NOT_PRESENT;
307                                 }
308                         }
309                         break;
310                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES:
311                         {
312                                 const VkPhysicalDeviceSamplerYcbcrConversionFeatures* samplerYcbcrConversionFeatures = reinterpret_cast<const VkPhysicalDeviceSamplerYcbcrConversionFeatures*>(extensionCreateInfo);
313
314                                 if(samplerYcbcrConversionFeatures->samplerYcbcrConversion == VK_TRUE)
315                                 {
316                                         return VK_ERROR_FEATURE_NOT_PRESENT;
317                                 }
318                         }
319                         break;
320                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES:
321                         {
322                                 const VkPhysicalDevice16BitStorageFeatures* storage16BitFeatures = reinterpret_cast<const VkPhysicalDevice16BitStorageFeatures*>(extensionCreateInfo);
323
324                                 if(storage16BitFeatures->storageBuffer16BitAccess == VK_TRUE ||
325                                    storage16BitFeatures->uniformAndStorageBuffer16BitAccess == VK_TRUE ||
326                                    storage16BitFeatures->storagePushConstant16 == VK_TRUE ||
327                                    storage16BitFeatures->storageInputOutput16 == VK_TRUE)
328                                 {
329                                         return VK_ERROR_FEATURE_NOT_PRESENT;
330                                 }
331                         }
332                         break;
333                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES:
334                         {
335                                 const VkPhysicalDeviceVariablePointerFeatures* variablePointerFeatures = reinterpret_cast<const VkPhysicalDeviceVariablePointerFeatures*>(extensionCreateInfo);
336
337                                 if(variablePointerFeatures->variablePointersStorageBuffer == VK_TRUE ||
338                                    variablePointerFeatures->variablePointers == VK_TRUE)
339                                 {
340                                         return VK_ERROR_FEATURE_NOT_PRESENT;
341                                 }
342                         }
343                         break;
344                 case VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO:
345                         {
346                                 const VkDeviceGroupDeviceCreateInfo* groupDeviceCreateInfo = reinterpret_cast<const VkDeviceGroupDeviceCreateInfo*>(extensionCreateInfo);
347
348                                 if((groupDeviceCreateInfo->physicalDeviceCount != 1) ||
349                                    (groupDeviceCreateInfo->pPhysicalDevices[0] != physicalDevice))
350                                 {
351                                         return VK_ERROR_FEATURE_NOT_PRESENT;
352                                 }
353                         }
354                         break;
355                 default:
356                         // "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]"
357                         UNIMPLEMENTED();   // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
358                         break;
359                 }
360
361                 extensionCreateInfo = extensionCreateInfo->pNext;
362         }
363
364         ASSERT(pCreateInfo->queueCreateInfoCount > 0);
365
366         if(pCreateInfo->pEnabledFeatures)
367         {
368                 if(!vk::Cast(physicalDevice)->hasFeatures(*(pCreateInfo->pEnabledFeatures)))
369                 {
370                         UNIMPLEMENTED();
371                         return VK_ERROR_FEATURE_NOT_PRESENT;
372                 }
373         }
374
375         uint32_t queueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount();
376
377         for(uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++)
378         {
379                 const VkDeviceQueueCreateInfo& queueCreateInfo = pCreateInfo->pQueueCreateInfos[i];
380                 if(queueCreateInfo.pNext || queueCreateInfo.flags)
381                 {
382                         UNIMPLEMENTED();
383                 }
384
385                 ASSERT(queueCreateInfo.queueFamilyIndex < queueFamilyPropertyCount);
386                 (void)queueFamilyPropertyCount; // Silence unused variable warning
387         }
388
389         vk::Device::CreateInfo deviceCreateInfo =
390         {
391                 pCreateInfo,
392                 physicalDevice
393         };
394
395         return vk::DispatchableDevice::Create(pAllocator, &deviceCreateInfo, pDevice);
396 }
397
398 VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator)
399 {
400         TRACE("(VkDevice device = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)", device, pAllocator);
401
402         vk::destroy(device, pAllocator);
403 }
404
405 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
406 {
407         TRACE("(const char* pLayerName = 0x%X, uint32_t* pPropertyCount = 0x%X, VkExtensionProperties* pProperties = 0x%X)",
408               pLayerName, pPropertyCount, pProperties);
409
410         uint32_t extensionPropertiesCount = sizeof(instanceExtensionProperties) / sizeof(instanceExtensionProperties[0]);
411
412         if(!pProperties)
413         {
414                 *pPropertyCount = extensionPropertiesCount;
415                 return VK_SUCCESS;
416         }
417
418         for(uint32_t i = 0; i < std::min(*pPropertyCount, extensionPropertiesCount); i++)
419         {
420                 pProperties[i] = instanceExtensionProperties[i];
421         }
422
423         return (*pPropertyCount < extensionPropertiesCount) ? VK_INCOMPLETE : VK_SUCCESS;
424 }
425
426 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
427 {
428         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const char* pLayerName, uint32_t* pPropertyCount = 0x%X, VkExtensionProperties* pProperties = 0x%X)", physicalDevice, pPropertyCount, pProperties);
429
430         uint32_t extensionPropertiesCount = sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]);
431
432         if(!pProperties)
433         {
434                 *pPropertyCount = extensionPropertiesCount;
435                 return VK_SUCCESS;
436         }
437
438         for(uint32_t i = 0; i < std::min(*pPropertyCount, extensionPropertiesCount); i++)
439         {
440                 pProperties[i] = deviceExtensionProperties[i];
441         }
442
443         return (*pPropertyCount < extensionPropertiesCount) ? VK_INCOMPLETE : VK_SUCCESS;
444 }
445
446 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties)
447 {
448         TRACE("(uint32_t* pPropertyCount = 0x%X, VkLayerProperties* pProperties = 0x%X)", pPropertyCount, pProperties);
449
450         if(!pProperties)
451         {
452                 *pPropertyCount = 0;
453                 return VK_SUCCESS;
454         }
455
456         return VK_SUCCESS;
457 }
458
459 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties)
460 {
461         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, uint32_t* pPropertyCount = 0x%X, VkLayerProperties* pProperties = 0x%X)", physicalDevice, pPropertyCount, pProperties);
462
463         if(!pProperties)
464         {
465                 *pPropertyCount = 0;
466                 return VK_SUCCESS;
467         }
468
469         return VK_SUCCESS;
470 }
471
472 VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue)
473 {
474         TRACE("(VkDevice device = 0x%X, uint32_t queueFamilyIndex = %d, uint32_t queueIndex = %d, VkQueue* pQueue = 0x%X)",
475                     device, queueFamilyIndex, queueIndex, pQueue);
476
477         *pQueue = vk::Cast(device)->getQueue(queueFamilyIndex, queueIndex);
478 }
479
480 VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence)
481 {
482         TRACE("(VkQueue queue = 0x%X, uint32_t submitCount = %d, const VkSubmitInfo* pSubmits = 0x%X, VkFence fence = 0x%X)",
483               queue, submitCount, pSubmits, fence);
484
485         vk::Cast(queue)->submit(submitCount, pSubmits, fence);
486
487         return VK_SUCCESS;
488 }
489
490 VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue)
491 {
492         TRACE("(VkQueue queue = 0x%X)", queue);
493
494         vk::Cast(queue)->waitIdle();
495
496         return VK_SUCCESS;
497 }
498
499 VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device)
500 {
501         TRACE("(VkDevice device = 0x%X)", device);
502
503         vk::Cast(device)->waitIdle();
504
505         return VK_SUCCESS;
506 }
507
508 VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory)
509 {
510         TRACE("(VkDevice device = 0x%X, const VkMemoryAllocateInfo* pAllocateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkDeviceMemory* pMemory = 0x%X)",
511                     device, pAllocateInfo, pAllocator, pMemory);
512
513         const VkBaseOutStructure* allocationInfo = reinterpret_cast<const VkBaseOutStructure*>(pAllocateInfo->pNext);
514         while(allocationInfo)
515         {
516                 switch(allocationInfo->sType)
517                 {
518                 case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO:
519                         // This can safely be ignored, as the Vulkan spec mentions:
520                         // "If the pNext chain includes a VkMemoryDedicatedAllocateInfo structure, then that structure
521                         //  includes a handle of the sole buffer or image resource that the memory *can* be bound to."
522                         break;
523                 default:
524                         UNIMPLEMENTED();
525                         break;
526                 }
527
528                 allocationInfo = allocationInfo->pNext;
529         }
530
531         VkResult result = vk::DeviceMemory::Create(pAllocator, pAllocateInfo, pMemory);
532         if(result != VK_SUCCESS)
533         {
534                 return result;
535         }
536
537         // Make sure the memory allocation is done now so that OOM errors can be checked now
538         result = vk::Cast(*pMemory)->allocate();
539         if(result != VK_SUCCESS)
540         {
541                 vk::destroy(*pMemory, pAllocator);
542                 *pMemory = VK_NULL_HANDLE;
543         }
544
545         return result;
546 }
547
548 VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator)
549 {
550         TRACE("(VkDevice device = 0x%X, VkDeviceMemory memory = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
551                     device, memory, pAllocator);
552
553         vk::destroy(memory, pAllocator);
554 }
555
556 VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData)
557 {
558         TRACE("(VkDevice device = 0x%X, VkDeviceMemory memory = 0x%X, VkDeviceSize offset = %d, VkDeviceSize size = %d, VkMemoryMapFlags flags = 0x%X, void** ppData = 0x%X)",
559                     device, memory, offset, size, flags, ppData);
560
561         return vk::Cast(memory)->map(offset, size, ppData);
562 }
563
564 VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory)
565 {
566         TRACE("(VkDevice device = 0x%X, VkDeviceMemory memory = 0x%X)", device, memory);
567
568         // Noop, memory will be released when the DeviceMemory object is released
569 }
570
571 VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
572 {
573         TRACE("(VkDevice device = 0x%X, uint32_t memoryRangeCount = %d, const VkMappedMemoryRange* pMemoryRanges = 0x%X)",
574                     device, memoryRangeCount, pMemoryRanges);
575
576         // Noop, host and device memory are the same to SwiftShader
577
578         return VK_SUCCESS;
579 }
580
581 VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges)
582 {
583         TRACE("(VkDevice device = 0x%X, uint32_t memoryRangeCount = %d, const VkMappedMemoryRange* pMemoryRanges = 0x%X)",
584                     device, memoryRangeCount, pMemoryRanges);
585
586         // Noop, host and device memory are the same to SwiftShader
587
588         return VK_SUCCESS;
589 }
590
591 VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice pDevice, VkDeviceMemory pMemory, VkDeviceSize* pCommittedMemoryInBytes)
592 {
593         TRACE("(VkDevice device = 0x%X, VkDeviceMemory memory = 0x%X, VkDeviceSize* pCommittedMemoryInBytes = 0x%X)",
594               pDevice, pMemory, pCommittedMemoryInBytes);
595
596         auto memory = vk::Cast(pMemory);
597
598 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
599         const auto& memoryProperties = vk::Cast(vk::Cast(pDevice)->getPhysicalDevice())->getMemoryProperties();
600         uint32_t typeIndex = memory->getMemoryTypeIndex();
601         ASSERT(typeIndex < memoryProperties.memoryTypeCount);
602         ASSERT(memoryProperties.memoryTypes[typeIndex].propertyFlags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT);
603 #endif
604
605         *pCommittedMemoryInBytes = memory->getCommittedMemoryInBytes();
606 }
607
608 VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset)
609 {
610         TRACE("(VkDevice device = 0x%X, VkBuffer buffer = 0x%X, VkDeviceMemory memory = 0x%X, VkDeviceSize memoryOffset = %d)",
611                     device, buffer, memory, memoryOffset);
612
613         vk::Cast(buffer)->bind(memory, memoryOffset);
614
615         return VK_SUCCESS;
616 }
617
618 VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset)
619 {
620         TRACE("(VkDevice device = 0x%X, VkImage image = 0x%X, VkDeviceMemory memory = 0x%X, VkDeviceSize memoryOffset = %d)",
621                     device, image, memory, memoryOffset);
622
623         vk::Cast(image)->bind(memory, memoryOffset);
624
625         return VK_SUCCESS;
626 }
627
628 VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
629 {
630         TRACE("(VkDevice device = 0x%X, VkBuffer buffer = 0x%X, VkMemoryRequirements* pMemoryRequirements = 0x%X)",
631                     device, buffer, pMemoryRequirements);
632
633         *pMemoryRequirements = vk::Cast(buffer)->getMemoryRequirements();
634 }
635
636 VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements)
637 {
638         TRACE("(VkDevice device = 0x%X, VkImage image = 0x%X, VkMemoryRequirements* pMemoryRequirements = 0x%X)",
639                     device, image, pMemoryRequirements);
640
641         *pMemoryRequirements = vk::Cast(image)->getMemoryRequirements();
642 }
643
644 VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
645 {
646         TRACE("(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements)",
647               device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
648
649         // The 'sparseBinding' feature is not supported, so images can not be created with the VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag.
650         // "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."
651         *pSparseMemoryRequirementCount = 0;
652 }
653
654 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties)
655 {
656         TRACE("()");
657         UNIMPLEMENTED();
658 }
659
660 VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence)
661 {
662         TRACE("()");
663         UNIMPLEMENTED();
664         return VK_SUCCESS;
665 }
666
667 VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
668 {
669         TRACE("(VkDevice device = 0x%X, const VkFenceCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkFence* pFence = 0x%X)",
670                     device, pCreateInfo, pAllocator, pFence);
671
672         if(pCreateInfo->pNext)
673         {
674                 UNIMPLEMENTED();
675         }
676
677         return vk::Fence::Create(pAllocator, pCreateInfo, pFence);
678 }
679
680 VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
681 {
682         TRACE("(VkDevice device = 0x%X, VkFence fence = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
683                     device, fence, pAllocator);
684
685
686         vk::destroy(fence, pAllocator);
687 }
688
689 VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences)
690 {
691         TRACE("(VkDevice device = 0x%X, uint32_t fenceCount = %d, const VkFence* pFences = 0x%X)",
692               device, fenceCount, pFences);
693
694         for(uint32_t i = 0; i < fenceCount; i++)
695         {
696                 vk::Cast(pFences[i])->reset();
697         }
698
699         return VK_SUCCESS;
700 }
701
702 VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence)
703 {
704         TRACE("(VkDevice device = 0x%X, VkFence fence = 0x%X)", device, fence);
705
706         return vk::Cast(fence)->getStatus();
707 }
708
709 VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
710 {
711         TRACE("(VkDevice device = 0x%X, uint32_t fenceCount = %d, const VkFence* pFences = 0x%X, VkBool32 waitAll = %d, uint64_t timeout = %d)",
712                 device, fenceCount, pFences, waitAll, timeout);
713
714         vk::Cast(device)->waitForFences(fenceCount, pFences, waitAll, timeout);
715
716         return VK_SUCCESS;
717 }
718
719 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore)
720 {
721         TRACE("(VkDevice device = 0x%X, const VkSemaphoreCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkSemaphore* pSemaphore = 0x%X)",
722               device, pCreateInfo, pAllocator, pSemaphore);
723
724         if(pCreateInfo->pNext || pCreateInfo->flags)
725         {
726                 UNIMPLEMENTED();
727         }
728
729         return vk::Semaphore::Create(pAllocator, pCreateInfo, pSemaphore);
730 }
731
732 VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator)
733 {
734         TRACE("(VkDevice device = 0x%X, VkSemaphore semaphore = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
735               device, semaphore, pAllocator);
736
737         vk::destroy(semaphore, pAllocator);
738 }
739
740 VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
741 {
742         TRACE("(VkDevice device = 0x%X, const VkEventCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkEvent* pEvent = 0x%X)",
743               device, pCreateInfo, pAllocator, pEvent);
744
745         if(pCreateInfo->pNext || pCreateInfo->flags)
746         {
747                 UNIMPLEMENTED();
748         }
749
750         return vk::Event::Create(pAllocator, pCreateInfo, pEvent);
751 }
752
753 VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
754 {
755         TRACE("(VkDevice device = 0x%X, VkEvent event = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
756               device, event, pAllocator);
757
758         vk::destroy(event, pAllocator);
759 }
760
761 VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event)
762 {
763         TRACE("(VkDevice device = 0x%X, VkEvent event = 0x%X)", device, event);
764
765         return vk::Cast(event)->getStatus();
766 }
767
768 VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event)
769 {
770         TRACE("(VkDevice device = 0x%X, VkEvent event = 0x%X)", device, event);
771
772         vk::Cast(event)->signal();
773
774         return VK_SUCCESS;
775 }
776
777 VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event)
778 {
779         TRACE("(VkDevice device = 0x%X, VkEvent event = 0x%X)", device, event);
780
781         vk::Cast(event)->reset();
782
783         return VK_SUCCESS;
784 }
785
786 VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
787 {
788         TRACE("(VkDevice device = 0x%X, const VkQueryPoolCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkQueryPool* pQueryPool = 0x%X)",
789               device, pCreateInfo, pAllocator, pQueryPool);
790
791         if(pCreateInfo->pNext || pCreateInfo->flags)
792         {
793                 UNIMPLEMENTED();
794         }
795
796         return vk::QueryPool::Create(pAllocator, pCreateInfo, pQueryPool);
797 }
798
799 VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
800 {
801         TRACE("(VkDevice device = 0x%X, VkQueryPool queryPool = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
802               device, queryPool, pAllocator);
803
804         vk::destroy(queryPool, pAllocator);
805 }
806
807 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)
808 {
809         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)",
810               device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
811
812         vk::Cast(queryPool)->getResults(firstQuery, queryCount, dataSize, pData, stride, flags);
813
814         return VK_SUCCESS;
815 }
816
817 VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer)
818 {
819         TRACE("(VkDevice device = 0x%X, const VkBufferCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkBuffer* pBuffer = 0x%X)",
820                     device, pCreateInfo, pAllocator, pBuffer);
821
822         if(pCreateInfo->pNext)
823         {
824                 UNIMPLEMENTED();
825         }
826
827         return vk::Buffer::Create(pAllocator, pCreateInfo, pBuffer);
828 }
829
830 VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator)
831 {
832         TRACE("(VkDevice device = 0x%X, VkBuffer buffer = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
833                     device, buffer, pAllocator);
834
835         vk::destroy(buffer, pAllocator);
836 }
837
838 VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
839 {
840         TRACE("(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)",
841                 device, pCreateInfo, pAllocator, pView);
842
843         if(pCreateInfo->pNext || pCreateInfo->flags)
844         {
845                 UNIMPLEMENTED();
846         }
847
848         return vk::BufferView::Create(pAllocator, pCreateInfo, pView);
849 }
850
851 VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
852 {
853         TRACE("(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)",
854               device, bufferView, pAllocator);
855
856         vk::destroy(bufferView, pAllocator);
857 }
858
859 VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage)
860 {
861         TRACE("(VkDevice device = 0x%X, const VkImageCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkImage* pImage = 0x%X)",
862                     device, pCreateInfo, pAllocator, pImage);
863
864         if(pCreateInfo->pNext)
865         {
866                 UNIMPLEMENTED();
867         }
868
869         return vk::Image::Create(pAllocator, pCreateInfo, pImage);
870 }
871
872 VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator)
873 {
874         TRACE("(VkDevice device = 0x%X, VkImage image = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
875                     device, image, pAllocator);
876
877         vk::destroy(image, pAllocator);
878 }
879
880 VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)
881 {
882         TRACE("(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout)",
883                 device, image, pSubresource, pLayout);
884
885         vk::Cast(image)->getSubresourceLayout(pSubresource, pLayout);
886 }
887
888 VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
889 {
890         TRACE("(VkDevice device = 0x%X, const VkImageViewCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkImageView* pView = 0x%X)",
891                     device, pCreateInfo, pAllocator, pView);
892
893         if(pCreateInfo->pNext || pCreateInfo->flags)
894         {
895                 UNIMPLEMENTED();
896         }
897
898         return vk::ImageView::Create(pAllocator, pCreateInfo, pView);
899 }
900
901 VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
902 {
903         TRACE("(VkDevice device = 0x%X, VkImageView imageView = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
904               device, imageView, pAllocator);
905
906         vk::destroy(imageView, pAllocator);
907 }
908
909 VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
910 {
911         TRACE("(VkDevice device = 0x%X, const VkShaderModuleCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkShaderModule* pShaderModule = 0x%X)",
912                     device, pCreateInfo, pAllocator, pShaderModule);
913
914         if(pCreateInfo->pNext || pCreateInfo->flags)
915         {
916                 UNIMPLEMENTED();
917         }
918
919         return vk::ShaderModule::Create(pAllocator, pCreateInfo, pShaderModule);
920 }
921
922 VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
923 {
924         TRACE("(VkDevice device = 0x%X, VkShaderModule shaderModule = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
925                     device, shaderModule, pAllocator);
926
927         vk::destroy(shaderModule, pAllocator);
928 }
929
930 VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
931 {
932         TRACE("(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)",
933               device, pCreateInfo, pAllocator, pPipelineCache);
934
935         if(pCreateInfo->pNext || pCreateInfo->flags)
936         {
937                 UNIMPLEMENTED();
938         }
939
940         return vk::PipelineCache::Create(pAllocator, pCreateInfo, pPipelineCache);
941 }
942
943 VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
944 {
945         TRACE("(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)",
946               device, pipelineCache, pAllocator);
947
948         vk::destroy(pipelineCache, pAllocator);
949 }
950
951 VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
952 {
953         TRACE("()");
954         UNIMPLEMENTED();
955         return VK_SUCCESS;
956 }
957
958 VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
959 {
960         TRACE("()");
961         UNIMPLEMENTED();
962         return VK_SUCCESS;
963 }
964
965 VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines)
966 {
967         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)",
968                     device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
969
970         // TODO (b/123588002): Optimize based on pipelineCache.
971
972         VkResult errorResult = VK_SUCCESS;
973         for(uint32_t i = 0; i < createInfoCount; i++)
974         {
975                 VkResult result = vk::GraphicsPipeline::Create(pAllocator, &pCreateInfos[i], &pPipelines[i]);
976                 if(result != VK_SUCCESS)
977                 {
978                         // According to the Vulkan spec, section 9.4. Multiple Pipeline Creation
979                         // "When an application attempts to create many pipelines in a single command,
980                         //  it is possible that some subset may fail creation. In that case, the
981                         //  corresponding entries in the pPipelines output array will be filled with
982                         //  VK_NULL_HANDLE values. If any pipeline fails creation (for example, due to
983                         //  out of memory errors), the vkCreate*Pipelines commands will return an
984                         //  error code. The implementation will attempt to create all pipelines, and
985                         //  only return VK_NULL_HANDLE values for those that actually failed."
986                         pPipelines[i] = VK_NULL_HANDLE;
987                         errorResult = result;
988                 }
989                 else
990                 {
991                         static_cast<vk::GraphicsPipeline*>(vk::Cast(pPipelines[i]))->compileShaders(pAllocator, &pCreateInfos[i]);
992                 }
993         }
994
995         return errorResult;
996 }
997
998 VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines)
999 {
1000         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)",
1001                 device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
1002
1003         // TODO (b/123588002): Optimize based on pipelineCache.
1004
1005         VkResult errorResult = VK_SUCCESS;
1006         for(uint32_t i = 0; i < createInfoCount; i++)
1007         {
1008                 VkResult result = vk::ComputePipeline::Create(pAllocator, &pCreateInfos[i], &pPipelines[i]);
1009                 if(result != VK_SUCCESS)
1010                 {
1011                         // According to the Vulkan spec, section 9.4. Multiple Pipeline Creation
1012                         // "When an application attempts to create many pipelines in a single command,
1013                         //  it is possible that some subset may fail creation. In that case, the
1014                         //  corresponding entries in the pPipelines output array will be filled with
1015                         //  VK_NULL_HANDLE values. If any pipeline fails creation (for example, due to
1016                         //  out of memory errors), the vkCreate*Pipelines commands will return an
1017                         //  error code. The implementation will attempt to create all pipelines, and
1018                         //  only return VK_NULL_HANDLE values for those that actually failed."
1019                         pPipelines[i] = VK_NULL_HANDLE;
1020                         errorResult = result;
1021                 }
1022         }
1023
1024         return errorResult;
1025 }
1026
1027 VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator)
1028 {
1029         TRACE("(VkDevice device = 0x%X, VkPipeline pipeline = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1030                     device, pipeline, pAllocator);
1031
1032         vk::destroy(pipeline, pAllocator);
1033 }
1034
1035 VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
1036 {
1037         TRACE("(VkDevice device = 0x%X, const VkPipelineLayoutCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkPipelineLayout* pPipelineLayout = 0x%X)",
1038                     device, pCreateInfo, pAllocator, pPipelineLayout);
1039
1040         if(pCreateInfo->pNext || pCreateInfo->flags)
1041         {
1042                 UNIMPLEMENTED();
1043         }
1044
1045         return vk::PipelineLayout::Create(pAllocator, pCreateInfo, pPipelineLayout);
1046 }
1047
1048 VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
1049 {
1050         TRACE("(VkDevice device = 0x%X, VkPipelineLayout pipelineLayout = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1051                     device, pipelineLayout, pAllocator);
1052
1053         vk::destroy(pipelineLayout, pAllocator);
1054 }
1055
1056 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
1057 {
1058         TRACE("(VkDevice device = 0x%X, const VkSamplerCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkSampler* pSampler = 0x%X)",
1059                     device, pCreateInfo, pAllocator, pSampler);
1060
1061         if(pCreateInfo->pNext || pCreateInfo->flags)
1062         {
1063                 UNIMPLEMENTED();
1064         }
1065
1066         return vk::Sampler::Create(pAllocator, pCreateInfo, pSampler);
1067 }
1068
1069 VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
1070 {
1071         TRACE("(VkDevice device = 0x%X, VkSampler sampler = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1072                     device, sampler, pAllocator);
1073
1074         vk::destroy(sampler, pAllocator);
1075 }
1076
1077 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
1078 {
1079         TRACE("(VkDevice device = 0x%X, const VkDescriptorSetLayoutCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkDescriptorSetLayout* pSetLayout = 0x%X)",
1080               device, pCreateInfo, pAllocator, pSetLayout);
1081
1082         if(pCreateInfo->pNext)
1083         {
1084                 UNIMPLEMENTED();
1085         }
1086
1087         return vk::DescriptorSetLayout::Create(pAllocator, pCreateInfo, pSetLayout);
1088 }
1089
1090 VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
1091 {
1092         TRACE("(VkDevice device = 0x%X, VkDescriptorSetLayout descriptorSetLayout = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1093               device, descriptorSetLayout, pAllocator);
1094
1095         vk::destroy(descriptorSetLayout, pAllocator);
1096 }
1097
1098 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
1099 {
1100         TRACE("(VkDevice device = 0x%X, const VkDescriptorPoolCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkDescriptorPool* pDescriptorPool = 0x%X)",
1101               device, pCreateInfo, pAllocator, pDescriptorPool);
1102
1103         if(pCreateInfo->pNext)
1104         {
1105                 UNIMPLEMENTED();
1106         }
1107
1108         return vk::DescriptorPool::Create(pAllocator, pCreateInfo, pDescriptorPool);
1109 }
1110
1111 VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
1112 {
1113         TRACE("(VkDevice device = 0x%X, VkDescriptorPool descriptorPool = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1114               device, descriptorPool, pAllocator);
1115
1116         vk::destroy(descriptorPool, pAllocator);
1117 }
1118
1119 VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
1120 {
1121         TRACE("(VkDevice device = 0x%X, VkDescriptorPool descriptorPool = 0x%X, VkDescriptorPoolResetFlags flags = 0x%X)",
1122                 device, descriptorPool, flags);
1123
1124         if(flags)
1125         {
1126                 UNIMPLEMENTED();
1127         }
1128
1129         return vk::Cast(descriptorPool)->reset();
1130 }
1131
1132 VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
1133 {
1134         TRACE("(VkDevice device = 0x%X, const VkDescriptorSetAllocateInfo* pAllocateInfo = 0x%X, VkDescriptorSet* pDescriptorSets = 0x%X)",
1135                 device, pAllocateInfo, pDescriptorSets);
1136
1137         if(pAllocateInfo->pNext)
1138         {
1139                 UNIMPLEMENTED();
1140         }
1141
1142         return vk::Cast(pAllocateInfo->descriptorPool)->allocateSets(
1143                 pAllocateInfo->descriptorSetCount, pAllocateInfo->pSetLayouts, pDescriptorSets);
1144 }
1145
1146 VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
1147 {
1148         TRACE("(VkDevice device = 0x%X, VkDescriptorPool descriptorPool = 0x%X, uint32_t descriptorSetCount = %d, const VkDescriptorSet* pDescriptorSets = 0x%X)",
1149                 device, descriptorPool, descriptorSetCount, pDescriptorSets);
1150
1151         vk::Cast(descriptorPool)->freeSets(descriptorSetCount, pDescriptorSets);
1152
1153         return VK_SUCCESS;
1154 }
1155
1156 VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
1157 {
1158         TRACE("()");
1159         UNIMPLEMENTED();
1160 }
1161
1162 VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
1163 {
1164         TRACE("(VkDevice device = 0x%X, const VkFramebufferCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkFramebuffer* pFramebuffer = 0x%X)",
1165                     device, pCreateInfo, pAllocator, pFramebuffer);
1166
1167         if(pCreateInfo->pNext || pCreateInfo->flags)
1168         {
1169                 UNIMPLEMENTED();
1170         }
1171
1172         return vk::Framebuffer::Create(pAllocator, pCreateInfo, pFramebuffer);
1173 }
1174
1175 VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
1176 {
1177         TRACE("(VkDevice device = 0x%X, VkFramebuffer framebuffer = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)");
1178
1179         vk::destroy(framebuffer, pAllocator);
1180 }
1181
1182 VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass)
1183 {
1184         TRACE("(VkDevice device = 0x%X, const VkRenderPassCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkRenderPass* pRenderPass = 0x%X)",
1185                     device, pCreateInfo, pAllocator, pRenderPass);
1186
1187         if(pCreateInfo->pNext || pCreateInfo->flags)
1188         {
1189                 UNIMPLEMENTED();
1190         }
1191
1192         return vk::RenderPass::Create(pAllocator, pCreateInfo, pRenderPass);
1193 }
1194
1195 VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator)
1196 {
1197         TRACE("(VkDevice device = 0x%X, VkRenderPass renderPass = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1198                     device, renderPass, pAllocator);
1199
1200         vk::destroy(renderPass, pAllocator);
1201 }
1202
1203 VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity)
1204 {
1205         TRACE("(VkDevice device = 0x%X, VkRenderPass renderPass = 0x%X, VkExtent2D* pGranularity = 0x%X)",\r
1206               device, renderPass, pGranularity);\r
1207 \r
1208         vk::Cast(renderPass)->getRenderAreaGranularity(pGranularity);
1209 }
1210
1211 VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
1212 {
1213         TRACE("(VkDevice device = 0x%X, const VkCommandPoolCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkCommandPool* pCommandPool = 0x%X)",
1214                     device, pCreateInfo, pAllocator, pCommandPool);
1215
1216         if(pCreateInfo->pNext)
1217         {
1218                 UNIMPLEMENTED();
1219         }
1220
1221         return vk::CommandPool::Create(pAllocator, pCreateInfo, pCommandPool);
1222 }
1223
1224 VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
1225 {
1226         TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
1227                     device, commandPool, pAllocator);
1228
1229         vk::destroy(commandPool, pAllocator);
1230 }
1231
1232 VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
1233 {
1234         TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, VkCommandPoolResetFlags flags = %d )",
1235                 device, commandPool, flags);
1236
1237         return vk::Cast(commandPool)->reset(flags);
1238 }
1239
1240 VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers)
1241 {
1242         TRACE("(VkDevice device = 0x%X, const VkCommandBufferAllocateInfo* pAllocateInfo = 0x%X, VkCommandBuffer* pCommandBuffers = 0x%X)",
1243                     device, pAllocateInfo, pCommandBuffers);
1244
1245         if(pAllocateInfo->pNext)
1246         {
1247                 UNIMPLEMENTED();
1248         }
1249
1250         return vk::Cast(pAllocateInfo->commandPool)->allocateCommandBuffers(
1251                 pAllocateInfo->level, pAllocateInfo->commandBufferCount, pCommandBuffers);
1252 }
1253
1254 VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers)
1255 {
1256         TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, uint32_t commandBufferCount = %d, const VkCommandBuffer* pCommandBuffers = 0x%X)",
1257                     device, commandPool, commandBufferCount, pCommandBuffers);
1258
1259         vk::Cast(commandPool)->freeCommandBuffers(commandBufferCount, pCommandBuffers);
1260 }
1261
1262 VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo)
1263 {
1264         TRACE("(VkCommandBuffer commandBuffer = 0x%X, const VkCommandBufferBeginInfo* pBeginInfo = 0x%X)",
1265                     commandBuffer, pBeginInfo);
1266
1267         if(pBeginInfo->pNext)
1268         {
1269                 UNIMPLEMENTED();
1270         }
1271
1272         return vk::Cast(commandBuffer)->begin(pBeginInfo->flags, pBeginInfo->pInheritanceInfo);
1273 }
1274
1275 VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer)
1276 {
1277         TRACE("(VkCommandBuffer commandBuffer = 0x%X)", commandBuffer);
1278
1279         return vk::Cast(commandBuffer)->end();
1280 }
1281
1282 VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags)
1283 {
1284         TRACE("VkCommandBuffer commandBuffer = 0x%X, VkCommandBufferResetFlags flags = %d", commandBuffer, flags);
1285
1286         return vk::Cast(commandBuffer)->reset(flags);
1287 }
1288
1289 VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
1290 {
1291         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkPipelineBindPoint pipelineBindPoint = %d, VkPipeline pipeline = 0x%X)",
1292                     commandBuffer, pipelineBindPoint, pipeline);
1293
1294         vk::Cast(commandBuffer)->bindPipeline(pipelineBindPoint, pipeline);
1295 }
1296
1297 VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports)
1298 {
1299         TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t firstViewport = %d, uint32_t viewportCount = %d, const VkViewport* pViewports = 0x%X)",
1300               commandBuffer, firstViewport, viewportCount, pViewports);
1301
1302         vk::Cast(commandBuffer)->setViewport(firstViewport, viewportCount, pViewports);
1303 }
1304
1305 VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors)
1306 {
1307         TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t firstScissor = %d, uint32_t scissorCount = %d, const VkRect2D* pScissors = 0x%X)",
1308               commandBuffer, firstScissor, scissorCount, pScissors);
1309
1310         vk::Cast(commandBuffer)->setScissor(firstScissor, scissorCount, pScissors);
1311 }
1312
1313 VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth)
1314 {
1315         TRACE("(VkCommandBuffer commandBuffer = 0x%X, float lineWidth = %f)", commandBuffer, lineWidth);
1316
1317         vk::Cast(commandBuffer)->setLineWidth(lineWidth);
1318 }
1319
1320 VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor)
1321 {
1322         TRACE("(VkCommandBuffer commandBuffer = 0x%X, float depthBiasConstantFactor = %f, float depthBiasClamp = %f, float depthBiasSlopeFactor = %f)",
1323               commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
1324
1325         vk::Cast(commandBuffer)->setDepthBias(depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
1326 }
1327
1328 VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4])
1329 {
1330         TRACE("(VkCommandBuffer commandBuffer = 0x%X, const float blendConstants[4] = {%f, %f, %f, %f})",
1331               commandBuffer, blendConstants[0], blendConstants[1], blendConstants[2], blendConstants[3]);
1332
1333         vk::Cast(commandBuffer)->setBlendConstants(blendConstants);
1334 }
1335
1336 VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds)
1337 {
1338         TRACE("(VkCommandBuffer commandBuffer = 0x%X, float minDepthBounds = %f, float maxDepthBounds = %f)",
1339               commandBuffer, minDepthBounds, maxDepthBounds);
1340
1341         vk::Cast(commandBuffer)->setDepthBounds(minDepthBounds, maxDepthBounds);
1342 }
1343
1344 VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask)
1345 {
1346         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkStencilFaceFlags faceMask = %d, uint32_t compareMask = %d)",
1347               commandBuffer, faceMask, compareMask);
1348
1349         vk::Cast(commandBuffer)->setStencilCompareMask(faceMask, compareMask);
1350 }
1351
1352 VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask)
1353 {
1354         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkStencilFaceFlags faceMask = %d, uint32_t writeMask = %d)",
1355               commandBuffer, faceMask, writeMask);
1356
1357         vk::Cast(commandBuffer)->setStencilWriteMask(faceMask, writeMask);
1358 }
1359
1360 VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference)
1361 {
1362         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkStencilFaceFlags faceMask = %d, uint32_t reference = %d)",
1363               commandBuffer, faceMask, reference);
1364
1365         vk::Cast(commandBuffer)->setStencilReference(faceMask, reference);
1366 }
1367
1368 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)
1369 {
1370         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)",
1371               commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
1372
1373         vk::Cast(commandBuffer)->bindDescriptorSets(pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
1374 }
1375
1376 VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
1377 {
1378         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer buffer = 0x%X, VkDeviceSize offset = %d, VkIndexType indexType = %d)",
1379               commandBuffer, buffer, offset, indexType);
1380
1381         vk::Cast(commandBuffer)->bindIndexBuffer(buffer, offset, indexType);
1382 }
1383
1384 VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets)
1385 {
1386         TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t firstBinding = %d, uint32_t bindingCount = %d, const VkBuffer* pBuffers = 0x%X, const VkDeviceSize* pOffsets = 0x%X)",
1387                     commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets);
1388
1389         vk::Cast(commandBuffer)->bindVertexBuffers(firstBinding, bindingCount, pBuffers, pOffsets);
1390 }
1391
1392 VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance)
1393 {
1394         TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t vertexCount = %d, uint32_t instanceCount = %d, uint32_t firstVertex = %d, uint32_t firstInstance = %d)",
1395                     commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
1396
1397         vk::Cast(commandBuffer)->draw(vertexCount, instanceCount, firstVertex, firstInstance);
1398 }
1399
1400 VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance)
1401 {
1402         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)",
1403                     commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
1404
1405         vk::Cast(commandBuffer)->drawIndexed(indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
1406 }
1407
1408 VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
1409 {
1410         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer buffer = 0x%X, VkDeviceSize offset = %d, uint32_t drawCount = %d, uint32_t stride = %d)",
1411                     commandBuffer, buffer, offset, drawCount, stride);
1412
1413         vk::Cast(commandBuffer)->drawIndirect(buffer, offset, drawCount, stride);
1414 }
1415
1416 VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
1417 {
1418         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer buffer = 0x%X, VkDeviceSize offset = %d, uint32_t drawCount = %d, uint32_t stride = %d)",
1419                     commandBuffer, buffer, offset, drawCount, stride);
1420
1421         vk::Cast(commandBuffer)->drawIndexedIndirect(buffer, offset, drawCount, stride);
1422 }
1423
1424 VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ)
1425 {
1426         TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t groupCountX = %d, uint32_t groupCountY = %d, uint32_t groupCountZ = %d)",
1427               commandBuffer, groupCountX, groupCountY, groupCountZ);
1428
1429         vk::Cast(commandBuffer)->dispatch(groupCountX, groupCountY, groupCountZ);
1430 }
1431
1432 VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset)
1433 {
1434         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer buffer = 0x%X, VkDeviceSize offset = %d)",
1435               commandBuffer, buffer, offset);
1436
1437         vk::Cast(commandBuffer)->dispatchIndirect(buffer, offset);
1438 }
1439
1440 VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
1441 {
1442         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer srcBuffer = 0x%X, VkBuffer dstBuffer = 0x%X, uint32_t regionCount = %d, const VkBufferCopy* pRegions = 0x%X)",
1443               commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
1444
1445         vk::Cast(commandBuffer)->copyBuffer(srcBuffer, dstBuffer, regionCount, pRegions);
1446 }
1447
1448 VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions)
1449 {
1450         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)",
1451               commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
1452
1453         vk::Cast(commandBuffer)->copyImage(srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
1454 }
1455
1456 VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter)
1457 {
1458         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)",
1459               commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
1460
1461         vk::Cast(commandBuffer)->blitImage(srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
1462 }
1463
1464 VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions)
1465 {
1466         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)",
1467               commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
1468
1469         vk::Cast(commandBuffer)->copyBufferToImage(srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
1470 }
1471
1472 VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions)
1473 {
1474         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)",
1475                     commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
1476
1477         vk::Cast(commandBuffer)->copyImageToBuffer(srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
1478 }
1479
1480 VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData)
1481 {
1482         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer dstBuffer = 0x%X, VkDeviceSize dstOffset = %d, VkDeviceSize dataSize = %d, const void* pData = 0x%X)",
1483               commandBuffer, dstBuffer, dstOffset, dataSize, pData);
1484
1485         vk::Cast(commandBuffer)->updateBuffer(dstBuffer, dstOffset, dataSize, pData);
1486 }
1487
1488 VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data)
1489 {
1490         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkBuffer dstBuffer = 0x%X, VkDeviceSize dstOffset = %d, VkDeviceSize size = %d, uint32_t data = %d)",
1491               commandBuffer, dstBuffer, dstOffset, size, data);
1492
1493         vk::Cast(commandBuffer)->fillBuffer(dstBuffer, dstOffset, size, data);
1494 }
1495
1496 VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
1497 {
1498         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)",
1499               commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
1500
1501         vk::Cast(commandBuffer)->clearColorImage(image, imageLayout, pColor, rangeCount, pRanges);
1502 }
1503
1504 VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
1505 {
1506         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)",
1507               commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
1508
1509         vk::Cast(commandBuffer)->clearDepthStencilImage(image, imageLayout, pDepthStencil, rangeCount, pRanges);
1510 }
1511
1512 VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects)
1513 {
1514         TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t attachmentCount = %d, const VkClearAttachment* pAttachments = 0x%X, uint32_t rectCount = %d, const VkClearRect* pRects = 0x%X)",
1515               commandBuffer, attachmentCount, pAttachments, rectCount,  pRects);
1516
1517         vk::Cast(commandBuffer)->clearAttachments(attachmentCount, pAttachments, rectCount, pRects);
1518 }
1519
1520 VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions)
1521 {
1522         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)",
1523               commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
1524
1525         vk::Cast(commandBuffer)->resolveImage(srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
1526 }
1527
1528 VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
1529 {
1530         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkEvent event = 0x%X, VkPipelineStageFlags stageMask = %d)",
1531               commandBuffer, event, stageMask);
1532
1533         vk::Cast(commandBuffer)->setEvent(event, stageMask);
1534 }
1535
1536 VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask)
1537 {
1538         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkEvent event = 0x%X, VkPipelineStageFlags stageMask = %d)",
1539               commandBuffer, event, stageMask);
1540
1541         vk::Cast(commandBuffer)->resetEvent(event, stageMask);
1542 }
1543
1544 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)
1545 {
1546         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)",
1547               commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
1548
1549         vk::Cast(commandBuffer)->waitEvents(eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
1550 }
1551
1552 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)
1553 {
1554         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,"
1555               " uint32_t bufferMemoryBarrierCount = %d, const VkBufferMemoryBarrier* pBufferMemoryBarriers = 0x%X, uint32_t imageMemoryBarrierCount = %d, const VkImageMemoryBarrier* pImageMemoryBarriers = 0x%X)",
1556               commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
1557
1558         vk::Cast(commandBuffer)->pipelineBarrier(srcStageMask, dstStageMask, dependencyFlags,
1559                                                  memoryBarrierCount, pMemoryBarriers,
1560                                                  bufferMemoryBarrierCount, pBufferMemoryBarriers,
1561                                                  imageMemoryBarrierCount, pImageMemoryBarriers);
1562 }
1563
1564 VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags)
1565 {
1566         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkQueryPool queryPool = 0x%X, uint32_t query = %d, VkQueryControlFlags flags = %d)",
1567               commandBuffer, queryPool, query, flags);
1568
1569         vk::Cast(commandBuffer)->beginQuery(queryPool, query, flags);
1570 }
1571
1572 VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query)
1573 {
1574         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkQueryPool queryPool = 0x%X, uint32_t query = %d)",
1575               commandBuffer, queryPool, query);
1576
1577         vk::Cast(commandBuffer)->endQuery(queryPool, query);
1578 }
1579
1580 VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
1581 {
1582         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkQueryPool queryPool = 0x%X, uint32_t firstQuery = %d, uint32_t queryCount = %d)",
1583               commandBuffer, queryPool, firstQuery, queryCount);
1584
1585         vk::Cast(commandBuffer)->resetQueryPool(queryPool, firstQuery, queryCount);
1586 }
1587
1588 VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query)
1589 {
1590         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkPipelineStageFlagBits pipelineStage = %d, VkQueryPool queryPool = 0x%X, uint32_t query = %d)",
1591               commandBuffer, pipelineStage, queryPool, query);
1592
1593         vk::Cast(commandBuffer)->writeTimestamp(pipelineStage, queryPool, query);
1594 }
1595
1596 VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags)
1597 {
1598         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)",
1599               commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
1600
1601         vk::Cast(commandBuffer)->copyQueryPoolResults(queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
1602 }
1603
1604 VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues)
1605 {
1606         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)",
1607               commandBuffer, layout, stageFlags, offset, size, pValues);
1608
1609         vk::Cast(commandBuffer)->pushConstants(layout, stageFlags, offset, size, pValues);
1610 }
1611
1612 VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents)
1613 {
1614         TRACE("(VkCommandBuffer commandBuffer = 0x%X, const VkRenderPassBeginInfo* pRenderPassBegin = 0x%X, VkSubpassContents contents = %d)",
1615               commandBuffer, pRenderPassBegin, contents);
1616
1617         if(pRenderPassBegin->pNext)
1618         {
1619                 UNIMPLEMENTED();
1620         }
1621
1622         vk::Cast(commandBuffer)->beginRenderPass(pRenderPassBegin->renderPass, pRenderPassBegin->framebuffer,
1623                                                  pRenderPassBegin->renderArea, pRenderPassBegin->clearValueCount,
1624                                                  pRenderPassBegin->pClearValues, contents);
1625 }
1626
1627 VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents)
1628 {
1629         TRACE("(VkCommandBuffer commandBuffer = 0x%X, VkSubpassContents contents = %d)",
1630               commandBuffer, contents);
1631
1632         vk::Cast(commandBuffer)->nextSubpass(contents);
1633 }
1634
1635 VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
1636 {
1637         TRACE("(VkCommandBuffer commandBuffer = 0x%X)", commandBuffer);
1638
1639         vk::Cast(commandBuffer)->endRenderPass();
1640 }
1641
1642 VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers)
1643 {
1644         TRACE("(VkCommandBuffer commandBuffer = 0x%X, uint32_t commandBufferCount = %d, const VkCommandBuffer* pCommandBuffers = 0x%X)",
1645               commandBuffer, commandBufferCount, pCommandBuffers);
1646
1647         vk::Cast(commandBuffer)->executeCommands(commandBufferCount, pCommandBuffers);
1648 }
1649
1650 VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t* pApiVersion)
1651 {
1652         TRACE("(uint32_t* pApiVersion = 0x%X)", pApiVersion);
1653         *pApiVersion = vk::API_VERSION;
1654         return VK_SUCCESS;
1655 }
1656
1657 VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos)
1658 {
1659         TRACE("(VkDevice device = 0x%X, uint32_t bindInfoCount = %d, const VkBindBufferMemoryInfo* pBindInfos = 0x%X)",
1660               device, bindInfoCount, pBindInfos);
1661
1662         for(uint32_t i = 0; i < bindInfoCount; i++)
1663         {
1664                 if(pBindInfos[i].pNext)
1665                 {
1666                         UNIMPLEMENTED();
1667                 }
1668
1669                 vk::Cast(pBindInfos[i].buffer)->bind(pBindInfos[i].memory, pBindInfos[i].memoryOffset);
1670         }
1671
1672         return VK_SUCCESS;
1673 }
1674
1675 VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos)
1676 {
1677         TRACE("()");
1678         UNIMPLEMENTED();
1679         return VK_SUCCESS;
1680 }
1681
1682 VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures)
1683 {
1684         TRACE("(VkDevice device = 0x%X, uint32_t heapIndex = %d, uint32_t localDeviceIndex = %d, uint32_t remoteDeviceIndex = %d, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures = 0x%X)",
1685               device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures);
1686
1687         ASSERT(localDeviceIndex != remoteDeviceIndex); // "localDeviceIndex must not equal remoteDeviceIndex"
1688         UNREACHABLE(remoteDeviceIndex);   // Only one physical device is supported, and since the device indexes can't be equal, this should never be called.
1689 }
1690
1691 VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask)
1692 {
1693         TRACE("()");
1694         UNIMPLEMENTED();
1695 }
1696
1697 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)
1698 {
1699         TRACE("()");
1700         UNIMPLEMENTED();
1701 }
1702
1703 VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties)
1704 {
1705         TRACE("VkInstance instance = 0x%X, uint32_t* pPhysicalDeviceGroupCount = 0x%X, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties = 0x%X",
1706               instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties);
1707
1708         if(!pPhysicalDeviceGroupProperties)
1709         {
1710                 *pPhysicalDeviceGroupCount = vk::Cast(instance)->getPhysicalDeviceGroupCount();
1711         }
1712         else
1713         {
1714                 vk::Cast(instance)->getPhysicalDeviceGroups(*pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties);
1715         }
1716
1717         return VK_SUCCESS;
1718 }
1719
1720 VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
1721 {
1722         TRACE("(VkDevice device = 0x%X, const VkImageMemoryRequirementsInfo2* pInfo = 0x%X, VkMemoryRequirements2* pMemoryRequirements = 0x%X)",
1723               device, pInfo, pMemoryRequirements);
1724
1725         if(pInfo->pNext || pMemoryRequirements->pNext)
1726         {
1727                 UNIMPLEMENTED();
1728         }
1729
1730         vkGetImageMemoryRequirements(device, pInfo->image, &(pMemoryRequirements->memoryRequirements));
1731 }
1732
1733 VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements)
1734 {
1735         TRACE("(VkDevice device = 0x%X, const VkBufferMemoryRequirementsInfo2* pInfo = 0x%X, VkMemoryRequirements2* pMemoryRequirements = 0x%X)",
1736               device, pInfo, pMemoryRequirements);
1737
1738         if(pInfo->pNext || pMemoryRequirements->pNext)
1739         {
1740                 UNIMPLEMENTED();
1741         }
1742
1743         vkGetBufferMemoryRequirements(device, pInfo->buffer, &(pMemoryRequirements->memoryRequirements));
1744 }
1745
1746 VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements)
1747 {
1748         TRACE("(VkDevice device = 0x%X, const VkImageSparseMemoryRequirementsInfo2* pInfo = 0x%X, uint32_t* pSparseMemoryRequirementCount = 0x%X, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements = 0x%X)",
1749               device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
1750
1751         if(pInfo->pNext || pSparseMemoryRequirements->pNext)
1752         {
1753                 UNIMPLEMENTED();
1754         }
1755
1756         vkGetImageSparseMemoryRequirements(device, pInfo->image, pSparseMemoryRequirementCount, &(pSparseMemoryRequirements->memoryRequirements));
1757 }
1758
1759 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures)
1760 {
1761         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceFeatures2* pFeatures = 0x%X)", physicalDevice, pFeatures);
1762
1763         VkBaseOutStructure* extensionFeatures = reinterpret_cast<VkBaseOutStructure*>(pFeatures->pNext);
1764         while(extensionFeatures)
1765         {
1766                 switch(extensionFeatures->sType)
1767                 {
1768                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES:
1769                         {
1770                                 auto& features = *reinterpret_cast<VkPhysicalDeviceSamplerYcbcrConversionFeatures*>(extensionFeatures);
1771                                 vk::Cast(physicalDevice)->getFeatures(&features);
1772                         }
1773                         break;
1774                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES:
1775                         {
1776                                 auto& features = *reinterpret_cast<VkPhysicalDevice16BitStorageFeatures*>(extensionFeatures);
1777                                 vk::Cast(physicalDevice)->getFeatures(&features);
1778                         }
1779                         break;
1780                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES:
1781                         {
1782                                 auto& features = *reinterpret_cast<VkPhysicalDeviceVariablePointerFeatures*>(extensionFeatures);
1783                                 vk::Cast(physicalDevice)->getFeatures(&features);
1784                         }
1785                         break;
1786                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR:
1787                         {
1788                                 auto& features = *reinterpret_cast<VkPhysicalDevice8BitStorageFeaturesKHR*>(extensionFeatures);
1789                                 vk::Cast(physicalDevice)->getFeatures(&features);
1790                         }
1791                         break;
1792                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES:
1793                         {
1794                                 auto& features = *reinterpret_cast<VkPhysicalDeviceMultiviewFeatures*>(extensionFeatures);
1795                                 vk::Cast(physicalDevice)->getFeatures(&features);
1796                         }
1797                         break;
1798                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES:
1799                         {
1800                                 auto& features = *reinterpret_cast<VkPhysicalDeviceProtectedMemoryFeatures*>(extensionFeatures);
1801                                 vk::Cast(physicalDevice)->getFeatures(&features);
1802                         }
1803                         break;
1804                 default:
1805                         // "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]"
1806                         UNIMPLEMENTED();   // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
1807                         break;
1808                 }
1809
1810                 extensionFeatures = extensionFeatures->pNext;
1811         }
1812
1813         vkGetPhysicalDeviceFeatures(physicalDevice, &(pFeatures->features));
1814 }
1815
1816 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties)
1817 {
1818         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceProperties2* pProperties = 0x%X)", physicalDevice, pProperties);
1819
1820         VkBaseOutStructure* extensionProperties = reinterpret_cast<VkBaseOutStructure*>(pProperties->pNext);
1821         while(extensionProperties)
1822         {
1823                 switch(extensionProperties->sType)
1824                 {
1825                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES:
1826                         {
1827                                 auto& properties = *reinterpret_cast<VkPhysicalDeviceIDProperties*>(extensionProperties);
1828                                 vk::Cast(physicalDevice)->getProperties(&properties);
1829                         }
1830                         break;
1831                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES:
1832                         {
1833                                 auto& properties = *reinterpret_cast<VkPhysicalDeviceMaintenance3Properties*>(extensionProperties);
1834                                 vk::Cast(physicalDevice)->getProperties(&properties);
1835                         }
1836                         break;
1837                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES:
1838                         {
1839                                 auto& properties = *reinterpret_cast<VkPhysicalDeviceMultiviewProperties*>(extensionProperties);
1840                                 vk::Cast(physicalDevice)->getProperties(&properties);
1841                         }
1842                         break;
1843                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES:
1844                         {
1845                                 auto& properties = *reinterpret_cast<VkPhysicalDevicePointClippingProperties*>(extensionProperties);
1846                                 vk::Cast(physicalDevice)->getProperties(&properties);
1847                         }
1848                         break;
1849                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES:
1850                         {
1851                                 auto& properties = *reinterpret_cast<VkPhysicalDeviceProtectedMemoryProperties*>(extensionProperties);
1852                                 vk::Cast(physicalDevice)->getProperties(&properties);
1853                         }
1854                         break;
1855                 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES:
1856                         {
1857                                 auto& properties = *reinterpret_cast<VkPhysicalDeviceSubgroupProperties*>(extensionProperties);
1858                                 vk::Cast(physicalDevice)->getProperties(&properties);
1859                         }
1860                         break;
1861                 default:
1862                         // "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]"
1863                         UNIMPLEMENTED();   // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
1864                         break;
1865                 }
1866
1867                 extensionProperties = extensionProperties->pNext;
1868         }
1869
1870         vkGetPhysicalDeviceProperties(physicalDevice, &(pProperties->properties));
1871 }
1872
1873 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties)
1874 {
1875         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkFormat format = %d, VkFormatProperties2* pFormatProperties = 0x%X)",
1876                     physicalDevice, format, pFormatProperties);
1877
1878         if(pFormatProperties->pNext)
1879         {
1880                 UNIMPLEMENTED();
1881         }
1882
1883         vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &(pFormatProperties->formatProperties));
1884 }
1885
1886 VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties)
1887 {
1888         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo = 0x%X, VkImageFormatProperties2* pImageFormatProperties = 0x%X)",
1889                     physicalDevice, pImageFormatInfo, pImageFormatProperties);
1890
1891         if(pImageFormatInfo->pNext || pImageFormatProperties->pNext)
1892         {
1893                 UNIMPLEMENTED();
1894         }
1895
1896         return vkGetPhysicalDeviceImageFormatProperties(physicalDevice,
1897                                                             pImageFormatInfo->format,
1898                                                             pImageFormatInfo->type,
1899                                                             pImageFormatInfo->tiling,
1900                                                             pImageFormatInfo->usage,
1901                                                             pImageFormatInfo->flags,
1902                                                             &(pImageFormatProperties->imageFormatProperties));
1903 }
1904
1905 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties)
1906 {
1907         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, uint32_t* pQueueFamilyPropertyCount = 0x%X, VkQueueFamilyProperties2* pQueueFamilyProperties = 0x%X)",
1908                 physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties);
1909
1910         if(pQueueFamilyProperties && pQueueFamilyProperties->pNext)
1911         {
1912                 UNIMPLEMENTED();
1913         }
1914
1915         vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount,
1916                 pQueueFamilyProperties ? &(pQueueFamilyProperties->queueFamilyProperties) : nullptr);
1917 }
1918
1919 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties)
1920 {
1921         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, VkPhysicalDeviceMemoryProperties2* pMemoryProperties = 0x%X)", physicalDevice, pMemoryProperties);
1922
1923         if(pMemoryProperties->pNext)
1924         {
1925                 UNIMPLEMENTED();
1926         }
1927
1928         vkGetPhysicalDeviceMemoryProperties(physicalDevice, &(pMemoryProperties->memoryProperties));
1929 }
1930
1931 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties)
1932 {
1933         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo = 0x%X, uint32_t* pPropertyCount = 0x%X, VkSparseImageFormatProperties2* pProperties = 0x%X)",
1934              physicalDevice, pFormatInfo, pPropertyCount, pProperties);
1935
1936         if(pProperties && pProperties->pNext)
1937         {
1938                 UNIMPLEMENTED();
1939         }
1940
1941         vkGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, pFormatInfo->format, pFormatInfo->type,
1942                                                        pFormatInfo->samples, pFormatInfo->usage, pFormatInfo->tiling,
1943                                                        pPropertyCount, pProperties ? &(pProperties->properties) : nullptr);
1944 }
1945
1946 VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags)
1947 {
1948         TRACE("(VkDevice device = 0x%X, VkCommandPool commandPool = 0x%X, VkCommandPoolTrimFlags flags = %d)",
1949               device, commandPool, flags);
1950
1951         vk::Cast(commandPool)->trim(flags);
1952 }
1953
1954 VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue)
1955 {
1956         TRACE("(VkDevice device = 0x%X, const VkDeviceQueueInfo2* pQueueInfo = 0x%X, VkQueue* pQueue = 0x%X)",
1957               device, pQueueInfo, pQueue);
1958
1959         if(pQueueInfo->pNext)
1960         {
1961                 UNIMPLEMENTED();
1962         }
1963
1964         // The only flag that can be set here is VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT
1965         // According to the Vulkan spec, 4.3.1. Queue Family Properties:
1966         // "VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT specifies that the device queue is a
1967         //  protected-capable queue. If the protected memory feature is not enabled,
1968         //  the VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT bit of flags must not be set."
1969         if(pQueueInfo->flags)
1970         {
1971                 *pQueue = VK_NULL_HANDLE;
1972         }
1973         else
1974         {
1975                 vkGetDeviceQueue(device, pQueueInfo->queueFamilyIndex, pQueueInfo->queueIndex, pQueue);
1976         }
1977 }
1978
1979 VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
1980 {
1981         TRACE("()");
1982         UNIMPLEMENTED();
1983         return VK_SUCCESS;
1984 }
1985
1986 VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
1987 {
1988         TRACE("()");
1989         UNIMPLEMENTED();
1990 }
1991
1992 VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
1993 {
1994         TRACE("()");
1995         UNIMPLEMENTED();
1996         return VK_SUCCESS;
1997 }
1998
1999 VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator)
2000 {
2001         TRACE("()");
2002         UNIMPLEMENTED();
2003 }
2004
2005 VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData)
2006 {
2007         TRACE("()");
2008         UNIMPLEMENTED();
2009 }
2010
2011 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties)
2012 {
2013         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo = 0x%X, VkExternalBufferProperties* pExternalBufferProperties = 0x%X)",
2014               physicalDevice, pExternalBufferInfo, pExternalBufferProperties);
2015
2016         UNIMPLEMENTED();
2017 }
2018
2019 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties)
2020 {
2021         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo = 0x%X, VkExternalFenceProperties* pExternalFenceProperties = 0x%X)",
2022               physicalDevice, pExternalFenceInfo, pExternalFenceProperties);
2023
2024         UNIMPLEMENTED();
2025 }
2026
2027 VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties)
2028 {
2029         TRACE("(VkPhysicalDevice physicalDevice = 0x%X, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo = 0x%X, VkExternalSemaphoreProperties* pExternalSemaphoreProperties = 0x%X)",
2030               physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties);
2031
2032         UNIMPLEMENTED();
2033 }
2034
2035 VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)
2036 {
2037         TRACE("(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)",
2038               device, pCreateInfo, pSupport);
2039
2040         vk::Cast(device)->getDescriptorSetLayoutSupport(pCreateInfo, pSupport);
2041 }
2042
2043 }