OSDN Git Service

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