Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 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 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 15 | #include "VkBuffer.hpp" |
| 16 | #include "VkBufferView.hpp" |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 17 | #include "VkCommandBuffer.hpp" |
Alexis Hetu | 9c4ecae | 2018-11-20 16:26:10 -0500 | [diff] [blame] | 18 | #include "VkCommandPool.hpp" |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 19 | #include "VkConfig.h" |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 20 | #include "VkDebug.hpp" |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 21 | #include "VkDescriptorPool.hpp" |
| 22 | #include "VkDescriptorSetLayout.hpp" |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 23 | #include "VkDescriptorUpdateTemplate.hpp" |
Alexis Hetu | e70c351 | 2018-10-17 13:18:04 -0400 | [diff] [blame] | 24 | #include "VkDestroy.h" |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 25 | #include "VkDevice.hpp" |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 26 | #include "VkDeviceMemory.hpp" |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 27 | #include "VkEvent.hpp" |
| 28 | #include "VkFence.hpp" |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 29 | #include "VkFramebuffer.hpp" |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 30 | #include "VkGetProcAddress.h" |
Alexis Hetu | f62f375 | 2018-11-15 14:51:15 -0500 | [diff] [blame] | 31 | #include "VkImage.hpp" |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 32 | #include "VkImageView.hpp" |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 33 | #include "VkInstance.hpp" |
| 34 | #include "VkPhysicalDevice.hpp" |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 35 | #include "VkPipeline.hpp" |
Alexis Hetu | 18a8425 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 36 | #include "VkPipelineCache.hpp" |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 37 | #include "VkPipelineLayout.hpp" |
Alexis Hetu | 86f8bdb | 2019-01-22 12:07:24 -0500 | [diff] [blame] | 38 | #include "VkQueryPool.hpp" |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 39 | #include "VkQueue.hpp" |
Alexis Hetu | 5174c57 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 40 | #include "VkSampler.hpp" |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 41 | #include "VkSemaphore.hpp" |
Alexis Hetu | 259ad3d | 2018-11-15 13:44:31 -0500 | [diff] [blame] | 42 | #include "VkShaderModule.hpp" |
Alexis Hetu | b16f989 | 2018-11-15 15:18:41 -0500 | [diff] [blame] | 43 | #include "VkRenderPass.hpp" |
Nicolas Capens | 50b1059 | 2018-10-26 10:34:20 -0400 | [diff] [blame] | 44 | |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 45 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
| 46 | #include "WSI/MacOSSurfaceMVK.h" |
| 47 | #endif |
| 48 | |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 49 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 50 | #include "WSI/XlibSurfaceKHR.hpp" |
| 51 | #endif |
| 52 | |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 53 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 54 | #include "WSI/Win32SurfaceKHR.hpp" |
| 55 | #endif |
| 56 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 57 | #ifdef __ANDROID__ |
| 58 | #include <vulkan/vk_android_native_buffer.h> |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 59 | #include "System/GrallocAndroid.hpp" |
Chris Forbes | 93ad3b8 | 2019-06-03 08:02:47 -0700 | [diff] [blame] | 60 | #include <sync/sync.h> |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 61 | #endif |
| 62 | |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 63 | #include "WSI/VkSwapchainKHR.hpp" |
| 64 | |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 65 | #include "Reactor/Nucleus.hpp" |
| 66 | |
Ben Clayton | d6c6136 | 2019-08-14 18:16:01 +0100 | [diff] [blame] | 67 | #include "Yarn/Scheduler.hpp" |
| 68 | #include "Yarn/Thread.hpp" |
| 69 | |
| 70 | #include "System/CPUID.hpp" |
| 71 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 72 | #include <algorithm> |
Chris Forbes | 3d27f2e | 2018-09-26 09:24:39 -0700 | [diff] [blame] | 73 | #include <cstring> |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 74 | #include <string> |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 75 | #include <map> |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 76 | |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 77 | namespace |
| 78 | { |
| 79 | |
| 80 | bool HasExtensionProperty(const char* extensionName, const VkExtensionProperties* extensionProperties, uint32_t extensionPropertiesCount) |
| 81 | { |
| 82 | for(uint32_t j = 0; j < extensionPropertiesCount; ++j) |
| 83 | { |
| 84 | if(strcmp(extensionName, extensionProperties[j].extensionName) == 0) |
| 85 | { |
| 86 | return true; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | return false; |
| 91 | } |
| 92 | |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 93 | // setReactorDefaultConfig() sets the default configuration for Vulkan's use of |
| 94 | // Reactor. |
| 95 | void setReactorDefaultConfig() |
| 96 | { |
| 97 | auto cfg = rr::Config::Edit() |
Ben Clayton | fc7bb8f | 2019-07-10 00:50:49 +0100 | [diff] [blame] | 98 | .set(rr::Optimization::Level::Default) |
| 99 | .clearOptimizationPasses() |
| 100 | .add(rr::Optimization::Pass::ScalarReplAggregates) |
| 101 | .add(rr::Optimization::Pass::SCCP) |
| 102 | .add(rr::Optimization::Pass::CFGSimplification) |
| 103 | .add(rr::Optimization::Pass::EarlyCSEPass) |
| 104 | .add(rr::Optimization::Pass::CFGSimplification) |
| 105 | .add(rr::Optimization::Pass::InstructionCombining); |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 106 | |
| 107 | rr::Nucleus::adjustDefaultConfig(cfg); |
| 108 | } |
| 109 | |
Ben Clayton | d6c6136 | 2019-08-14 18:16:01 +0100 | [diff] [blame] | 110 | void setCPUDefaults() |
| 111 | { |
| 112 | sw::CPUID::setEnableSSE4_1(true); |
| 113 | sw::CPUID::setEnableSSSE3(true); |
| 114 | sw::CPUID::setEnableSSE3(true); |
| 115 | sw::CPUID::setEnableSSE2(true); |
| 116 | sw::CPUID::setEnableSSE(true); |
| 117 | } |
| 118 | |
| 119 | yarn::Scheduler* getOrCreateScheduler() |
| 120 | { |
| 121 | static auto scheduler = std::unique_ptr<yarn::Scheduler>(new yarn::Scheduler()); |
| 122 | scheduler->setThreadInitializer([] { |
| 123 | sw::CPUID::setFlushToZero(true); |
| 124 | sw::CPUID::setDenormalsAreZero(true); |
| 125 | }); |
| 126 | scheduler->setWorkerThreadCount(std::min<size_t>(yarn::Thread::numLogicalCPUs(), 16)); |
| 127 | return scheduler.get(); |
| 128 | } |
| 129 | |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 130 | // initializeLibrary() is called by vkCreateInstance() to perform one-off global |
| 131 | // initialization of the swiftshader driver. |
| 132 | void initializeLibrary() |
| 133 | { |
| 134 | static bool doOnce = [] { |
| 135 | setReactorDefaultConfig(); |
Ben Clayton | d6c6136 | 2019-08-14 18:16:01 +0100 | [diff] [blame] | 136 | setCPUDefaults(); |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 137 | return true; |
| 138 | }(); |
| 139 | (void)doOnce; |
| 140 | } |
| 141 | |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 142 | } |
| 143 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 144 | extern "C" |
| 145 | { |
David 'Digit' Turner | e725619 | 2019-06-19 07:08:04 +0200 | [diff] [blame] | 146 | VK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 147 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 148 | TRACE("(VkInstance instance = %p, const char* pName = %p)", instance, pName); |
Nicolas Capens | dc85364 | 2018-11-19 15:50:18 -0500 | [diff] [blame] | 149 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 150 | return vk::GetInstanceProcAddr(vk::Cast(instance), pName); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 151 | } |
| 152 | |
David 'Digit' Turner | e725619 | 2019-06-19 07:08:04 +0200 | [diff] [blame] | 153 | VK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion) |
Hernan Liatis | b2841fe | 2019-02-21 12:57:52 -0800 | [diff] [blame] | 154 | { |
| 155 | *pSupportedVersion = 3; |
| 156 | return VK_SUCCESS; |
| 157 | } |
| 158 | |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 159 | static const VkExtensionProperties instanceExtensionProperties[] = |
| 160 | { |
| 161 | { VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME, VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION }, |
| 162 | { VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION }, |
| 163 | { VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION }, |
| 164 | { VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION }, |
| 165 | { VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION }, |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 166 | #ifndef __ANDROID__ |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 167 | { VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_SPEC_VERSION }, |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 168 | #endif |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 169 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 170 | { VK_KHR_XLIB_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_SPEC_VERSION }, |
| 171 | #endif |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 172 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
| 173 | { VK_MVK_MACOS_SURFACE_EXTENSION_NAME, VK_MVK_MACOS_SURFACE_SPEC_VERSION }, |
| 174 | #endif |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 175 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 176 | { VK_KHR_WIN32_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_SPEC_VERSION }, |
| 177 | #endif |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | static const VkExtensionProperties deviceExtensionProperties[] = |
| 181 | { |
| 182 | { VK_KHR_16BIT_STORAGE_EXTENSION_NAME, VK_KHR_16BIT_STORAGE_SPEC_VERSION }, |
| 183 | { VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, VK_KHR_BIND_MEMORY_2_SPEC_VERSION }, |
| 184 | { VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION }, |
| 185 | { VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME, VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION }, |
| 186 | { VK_KHR_DEVICE_GROUP_EXTENSION_NAME, VK_KHR_DEVICE_GROUP_SPEC_VERSION }, |
| 187 | { VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME, VK_KHR_EXTERNAL_FENCE_SPEC_VERSION }, |
| 188 | { VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION }, |
| 189 | { VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION }, |
| 190 | { VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION }, |
| 191 | { VK_KHR_MAINTENANCE1_EXTENSION_NAME, VK_KHR_MAINTENANCE1_SPEC_VERSION }, |
| 192 | { VK_KHR_MAINTENANCE2_EXTENSION_NAME, VK_KHR_MAINTENANCE2_SPEC_VERSION }, |
| 193 | { VK_KHR_MAINTENANCE3_EXTENSION_NAME, VK_KHR_MAINTENANCE3_SPEC_VERSION }, |
| 194 | { VK_KHR_MULTIVIEW_EXTENSION_NAME, VK_KHR_MULTIVIEW_SPEC_VERSION }, |
| 195 | { VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME, VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION }, |
| 196 | { VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION }, |
Chris Forbes | 83cdd25 | 2019-08-26 09:29:27 -0700 | [diff] [blame] | 197 | // Only 1.1 core version of this is supported. The extension has additional requirements |
| 198 | //{ VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION }, |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 199 | { VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME, VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION }, |
Chris Forbes | 83cdd25 | 2019-08-26 09:29:27 -0700 | [diff] [blame] | 200 | // Only 1.1 core version of this is supported. The extension has additional requirements |
| 201 | //{ VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME, VK_KHR_VARIABLE_POINTERS_SPEC_VERSION }, |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 202 | #ifndef __ANDROID__ |
Hernan Liatis | cff8c00 | 2019-02-25 15:56:36 -0800 | [diff] [blame] | 203 | { VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_SWAPCHAIN_SPEC_VERSION }, |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 204 | #else |
| 205 | { VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME, VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION }, |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 206 | #endif |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 207 | }; |
| 208 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 209 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) |
| 210 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 211 | TRACE("(const VkInstanceCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkInstance* pInstance = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 212 | pCreateInfo, pAllocator, pInstance); |
| 213 | |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 214 | initializeLibrary(); |
| 215 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 216 | if(pCreateInfo->enabledLayerCount) |
| 217 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 218 | UNIMPLEMENTED("pCreateInfo->enabledLayerCount"); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 219 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 220 | |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 221 | uint32_t extensionPropertiesCount = sizeof(instanceExtensionProperties) / sizeof(instanceExtensionProperties[0]); |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 222 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 223 | { |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 224 | if (!HasExtensionProperty(pCreateInfo->ppEnabledExtensionNames[i], instanceExtensionProperties, extensionPropertiesCount)) |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 225 | { |
| 226 | return VK_ERROR_EXTENSION_NOT_PRESENT; |
| 227 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | if(pCreateInfo->pNext) |
| 231 | { |
| 232 | switch(*reinterpret_cast<const VkStructureType*>(pCreateInfo->pNext)) |
| 233 | { |
| 234 | case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO: |
| 235 | // According to the Vulkan spec, section 2.7.2. Implicit Valid Usage: |
| 236 | // "The values VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO and |
| 237 | // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO are reserved for |
| 238 | // internal use by the loader, and do not have corresponding |
| 239 | // Vulkan structures in this Specification." |
| 240 | break; |
| 241 | default: |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 242 | UNIMPLEMENTED("pCreateInfo->pNext"); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 243 | } |
| 244 | } |
| 245 | |
| 246 | *pInstance = VK_NULL_HANDLE; |
| 247 | VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; |
| 248 | |
| 249 | VkResult result = vk::DispatchablePhysicalDevice::Create(pAllocator, pCreateInfo, &physicalDevice); |
| 250 | if(result != VK_SUCCESS) |
| 251 | { |
| 252 | return result; |
| 253 | } |
| 254 | |
Nicolas Capens | 0c73680 | 2019-05-27 12:53:31 -0400 | [diff] [blame] | 255 | result = vk::DispatchableInstance::Create(pAllocator, pCreateInfo, pInstance, physicalDevice); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 256 | if(result != VK_SUCCESS) |
| 257 | { |
| 258 | vk::destroy(physicalDevice, pAllocator); |
| 259 | return result; |
| 260 | } |
| 261 | |
| 262 | return result; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator) |
| 266 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 267 | TRACE("(VkInstance instance = %p, const VkAllocationCallbacks* pAllocator = %p)", instance, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 268 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 269 | vk::destroy(instance, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) |
| 273 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 274 | TRACE("(VkInstance instance = %p, uint32_t* pPhysicalDeviceCount = %p, VkPhysicalDevice* pPhysicalDevices = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 275 | instance, pPhysicalDeviceCount, pPhysicalDevices); |
| 276 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 277 | return vk::Cast(instance)->getPhysicalDevices(pPhysicalDeviceCount, pPhysicalDevices); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) |
| 281 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 282 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceFeatures* pFeatures = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 283 | physicalDevice, pFeatures); |
| 284 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 285 | *pFeatures = vk::Cast(physicalDevice)->getFeatures(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties) |
| 289 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 290 | TRACE("GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice = %p, VkFormat format = %d, VkFormatProperties* pFormatProperties = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 291 | physicalDevice, (int)format, pFormatProperties); |
| 292 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 293 | vk::Cast(physicalDevice)->getFormatProperties(format, pFormatProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties) |
| 297 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 298 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkFormat format = %d, VkImageType type = %d, VkImageTiling tiling = %d, VkImageUsageFlags usage = %d, VkImageCreateFlags flags = %d, VkImageFormatProperties* pImageFormatProperties = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 299 | physicalDevice, (int)format, (int)type, (int)tiling, usage, flags, pImageFormatProperties); |
| 300 | |
Nicolas Capens | 7e01e4e | 2019-05-18 08:19:07 -0400 | [diff] [blame] | 301 | // "If the combination of parameters to vkGetPhysicalDeviceImageFormatProperties is not supported by the implementation |
| 302 | // for use in vkCreateImage, then all members of VkImageFormatProperties will be filled with zero." |
| 303 | memset(pImageFormatProperties, 0, sizeof(VkImageFormatProperties)); |
| 304 | |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 305 | VkFormatProperties properties; |
| 306 | vk::Cast(physicalDevice)->getFormatProperties(format, &properties); |
| 307 | |
Chris Forbes | 1bc7731 | 2019-05-09 14:02:26 -0700 | [diff] [blame] | 308 | VkFormatFeatureFlags features; |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 309 | switch (tiling) |
| 310 | { |
| 311 | case VK_IMAGE_TILING_LINEAR: |
Chris Forbes | 1bc7731 | 2019-05-09 14:02:26 -0700 | [diff] [blame] | 312 | features = properties.linearTilingFeatures; |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 313 | break; |
| 314 | |
| 315 | case VK_IMAGE_TILING_OPTIMAL: |
Chris Forbes | 1bc7731 | 2019-05-09 14:02:26 -0700 | [diff] [blame] | 316 | features = properties.optimalTilingFeatures; |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 317 | break; |
| 318 | |
| 319 | default: |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 320 | UNIMPLEMENTED("tiling"); |
Chris Forbes | 1bc7731 | 2019-05-09 14:02:26 -0700 | [diff] [blame] | 321 | features = 0; |
| 322 | } |
| 323 | |
| 324 | if (features == 0) |
| 325 | { |
| 326 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 327 | } |
| 328 | |
| 329 | // Check for usage conflict with features |
| 330 | if ((usage & VK_IMAGE_USAGE_SAMPLED_BIT) && !(features & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) |
| 331 | { |
| 332 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 333 | } |
| 334 | |
Chris Forbes | 0559bc4 | 2019-05-11 10:47:11 -0700 | [diff] [blame] | 335 | if ((usage & VK_IMAGE_USAGE_STORAGE_BIT) && !(features & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)) |
| 336 | { |
| 337 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 338 | } |
| 339 | |
| 340 | if ((usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) && !(features & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) |
| 341 | { |
| 342 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 343 | } |
| 344 | |
| 345 | if ((usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) && !(features & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) |
| 346 | { |
| 347 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 348 | } |
| 349 | |
| 350 | if ((usage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) && !(features & (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))) |
| 351 | { |
| 352 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 353 | } |
| 354 | |
| 355 | if ((usage & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) && !(features & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT)) |
| 356 | { |
| 357 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 358 | } |
| 359 | |
| 360 | if ((usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT) && !(features & VK_FORMAT_FEATURE_TRANSFER_DST_BIT)) |
| 361 | { |
| 362 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 363 | } |
| 364 | |
| 365 | auto allRecognizedUsageBits = VK_IMAGE_USAGE_SAMPLED_BIT | |
| 366 | VK_IMAGE_USAGE_STORAGE_BIT | |
| 367 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | |
| 368 | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | |
| 369 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | |
| 370 | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | |
| 371 | VK_IMAGE_USAGE_TRANSFER_DST_BIT | |
| 372 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; |
| 373 | ASSERT(!(usage & ~(allRecognizedUsageBits))); |
| 374 | |
Nicolas Capens | 7e01e4e | 2019-05-18 08:19:07 -0400 | [diff] [blame] | 375 | // "Images created with tiling equal to VK_IMAGE_TILING_LINEAR have further restrictions on their limits and capabilities |
| 376 | // compared to images created with tiling equal to VK_IMAGE_TILING_OPTIMAL." |
| 377 | if(tiling == VK_IMAGE_TILING_LINEAR) |
| 378 | { |
| 379 | if(type != VK_IMAGE_TYPE_2D) |
| 380 | { |
| 381 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 382 | } |
| 383 | |
| 384 | if(vk::Format(format).isDepth() || vk::Format(format).isStencil()) |
| 385 | { |
| 386 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 387 | } |
| 388 | } |
| 389 | |
Hernan Liatis | bd18d58 | 2019-05-29 15:38:58 -0700 | [diff] [blame] | 390 | // "Images created with a format from one of those listed in Formats requiring sampler Y'CBCR conversion for VK_IMAGE_ASPECT_COLOR_BIT image views |
Nicolas Capens | 7e01e4e | 2019-05-18 08:19:07 -0400 | [diff] [blame] | 391 | // have further restrictions on their limits and capabilities compared to images created with other formats." |
| 392 | if(vk::Format(format).isYcbcrFormat()) |
| 393 | { |
| 394 | if(type != VK_IMAGE_TYPE_2D) |
| 395 | { |
| 396 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 397 | } |
| 398 | } |
| 399 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 400 | vk::Cast(physicalDevice)->getImageFormatProperties(format, type, tiling, usage, flags, pImageFormatProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 401 | |
| 402 | return VK_SUCCESS; |
| 403 | } |
| 404 | |
| 405 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties) |
| 406 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 407 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceProperties* pProperties = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 408 | physicalDevice, pProperties); |
| 409 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 410 | *pProperties = vk::Cast(physicalDevice)->getProperties(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties) |
| 414 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 415 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t* pQueueFamilyPropertyCount = %p, VkQueueFamilyProperties* pQueueFamilyProperties = %p))", physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 416 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 417 | if(!pQueueFamilyProperties) |
| 418 | { |
| 419 | *pQueueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount(); |
| 420 | } |
| 421 | else |
| 422 | { |
| 423 | vk::Cast(physicalDevice)->getQueueFamilyProperties(*pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 424 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 425 | } |
| 426 | |
| 427 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties) |
| 428 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 429 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceMemoryProperties* pMemoryProperties = %p)", physicalDevice, pMemoryProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 430 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 431 | *pMemoryProperties = vk::Cast(physicalDevice)->getMemoryProperties(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 432 | } |
| 433 | |
Saman Sami | f4d2a44 | 2019-05-21 15:04:41 -0400 | [diff] [blame] | 434 | VK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* pName) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 435 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 436 | TRACE("(VkInstance instance = %p, const char* pName = %p)", instance, pName); |
Nicolas Capens | dc85364 | 2018-11-19 15:50:18 -0500 | [diff] [blame] | 437 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 438 | return vk::GetInstanceProcAddr(vk::Cast(instance), pName); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* pName) |
| 442 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 443 | TRACE("(VkDevice device = %p, const char* pName = %p)", device, pName); |
Nicolas Capens | dc85364 | 2018-11-19 15:50:18 -0500 | [diff] [blame] | 444 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 445 | return vk::GetDeviceProcAddr(vk::Cast(device), pName); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 446 | } |
| 447 | |
| 448 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) |
| 449 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 450 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkDeviceCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkDevice* pDevice = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 451 | physicalDevice, pCreateInfo, pAllocator, pDevice); |
| 452 | |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 453 | if(pCreateInfo->enabledLayerCount) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 454 | { |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 455 | // "The ppEnabledLayerNames and enabledLayerCount members of VkDeviceCreateInfo are deprecated and their values must be ignored by implementations." |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 456 | UNIMPLEMENTED("pCreateInfo->enabledLayerCount"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here. |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 457 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 458 | |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 459 | uint32_t extensionPropertiesCount = sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]); |
Hernan Liatis | cff8c00 | 2019-02-25 15:56:36 -0800 | [diff] [blame] | 460 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i) |
| 461 | { |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 462 | if (!HasExtensionProperty(pCreateInfo->ppEnabledExtensionNames[i], deviceExtensionProperties, extensionPropertiesCount)) |
Hernan Liatis | cff8c00 | 2019-02-25 15:56:36 -0800 | [diff] [blame] | 463 | { |
| 464 | return VK_ERROR_EXTENSION_NOT_PRESENT; |
| 465 | } |
| 466 | } |
| 467 | |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 468 | const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext); |
| 469 | |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 470 | const VkPhysicalDeviceFeatures *enabledFeatures = pCreateInfo->pEnabledFeatures; |
| 471 | |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 472 | while(extensionCreateInfo) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 473 | { |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 474 | switch(extensionCreateInfo->sType) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 475 | { |
| 476 | case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO: |
| 477 | // According to the Vulkan spec, section 2.7.2. Implicit Valid Usage: |
| 478 | // "The values VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO and |
| 479 | // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO are reserved for |
| 480 | // internal use by the loader, and do not have corresponding |
| 481 | // Vulkan structures in this Specification." |
| 482 | break; |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 483 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2: |
| 484 | { |
| 485 | ASSERT(!pCreateInfo->pEnabledFeatures); // "If the pNext chain includes a VkPhysicalDeviceFeatures2 structure, then pEnabledFeatures must be NULL" |
| 486 | |
| 487 | const VkPhysicalDeviceFeatures2* physicalDeviceFeatures2 = reinterpret_cast<const VkPhysicalDeviceFeatures2*>(extensionCreateInfo); |
| 488 | |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 489 | enabledFeatures = &physicalDeviceFeatures2->features; |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 490 | } |
| 491 | break; |
| 492 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: |
| 493 | { |
| 494 | const VkPhysicalDeviceSamplerYcbcrConversionFeatures* samplerYcbcrConversionFeatures = reinterpret_cast<const VkPhysicalDeviceSamplerYcbcrConversionFeatures*>(extensionCreateInfo); |
| 495 | |
Nicolas Capens | e2f5da4 | 2019-05-16 11:01:31 -0400 | [diff] [blame] | 496 | // YCbCr conversion is supported. |
| 497 | // samplerYcbcrConversionFeatures->samplerYcbcrConversion can be VK_TRUE or VK_FALSE. |
| 498 | // No action needs to be taken on our end in either case; it's the apps responsibility that |
Hernan Liatis | bd18d58 | 2019-05-29 15:38:58 -0700 | [diff] [blame] | 499 | // "To create a sampler Y'CbCr conversion, the samplerYcbcrConversion feature must be enabled." |
Nicolas Capens | e2f5da4 | 2019-05-16 11:01:31 -0400 | [diff] [blame] | 500 | (void)samplerYcbcrConversionFeatures->samplerYcbcrConversion; |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 501 | } |
| 502 | break; |
| 503 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: |
| 504 | { |
| 505 | const VkPhysicalDevice16BitStorageFeatures* storage16BitFeatures = reinterpret_cast<const VkPhysicalDevice16BitStorageFeatures*>(extensionCreateInfo); |
| 506 | |
| 507 | if(storage16BitFeatures->storageBuffer16BitAccess == VK_TRUE || |
| 508 | storage16BitFeatures->uniformAndStorageBuffer16BitAccess == VK_TRUE || |
| 509 | storage16BitFeatures->storagePushConstant16 == VK_TRUE || |
| 510 | storage16BitFeatures->storageInputOutput16 == VK_TRUE) |
| 511 | { |
| 512 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 513 | } |
| 514 | } |
| 515 | break; |
| 516 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: |
| 517 | { |
| 518 | const VkPhysicalDeviceVariablePointerFeatures* variablePointerFeatures = reinterpret_cast<const VkPhysicalDeviceVariablePointerFeatures*>(extensionCreateInfo); |
| 519 | |
| 520 | if(variablePointerFeatures->variablePointersStorageBuffer == VK_TRUE || |
| 521 | variablePointerFeatures->variablePointers == VK_TRUE) |
| 522 | { |
| 523 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 524 | } |
| 525 | } |
| 526 | break; |
Alexis Hetu | 5ebd2c0 | 2019-01-22 17:17:27 -0500 | [diff] [blame] | 527 | case VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO: |
| 528 | { |
| 529 | const VkDeviceGroupDeviceCreateInfo* groupDeviceCreateInfo = reinterpret_cast<const VkDeviceGroupDeviceCreateInfo*>(extensionCreateInfo); |
| 530 | |
| 531 | if((groupDeviceCreateInfo->physicalDeviceCount != 1) || |
| 532 | (groupDeviceCreateInfo->pPhysicalDevices[0] != physicalDevice)) |
| 533 | { |
| 534 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 535 | } |
| 536 | } |
| 537 | break; |
Chris Forbes | aad8cfc | 2019-08-15 19:09:16 -0700 | [diff] [blame] | 538 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: |
| 539 | { |
| 540 | const VkPhysicalDeviceMultiviewFeatures* multiviewFeatures = reinterpret_cast<const VkPhysicalDeviceMultiviewFeatures*>(extensionCreateInfo); |
| 541 | |
Chris Forbes | 02d4c0d | 2019-08-21 12:04:34 -0700 | [diff] [blame] | 542 | if (multiviewFeatures->multiviewGeometryShader || |
Chris Forbes | aad8cfc | 2019-08-15 19:09:16 -0700 | [diff] [blame] | 543 | multiviewFeatures->multiviewTessellationShader) |
| 544 | { |
| 545 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 546 | } |
| 547 | } |
| 548 | break; |
Chris Forbes | d335302 | 2019-08-15 19:21:55 -0700 | [diff] [blame] | 549 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES: |
| 550 | { |
| 551 | const VkPhysicalDeviceShaderDrawParametersFeatures* shaderDrawParametersFeatures = reinterpret_cast<const VkPhysicalDeviceShaderDrawParametersFeatures*>(extensionCreateInfo); |
| 552 | |
| 553 | if (shaderDrawParametersFeatures->shaderDrawParameters) |
| 554 | { |
| 555 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 556 | } |
| 557 | } |
| 558 | break; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 559 | default: |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 560 | // "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]" |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 561 | UNIMPLEMENTED("extensionCreateInfo->sType %d", int(extensionCreateInfo->sType)); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here. |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 562 | break; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 563 | } |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 564 | |
| 565 | extensionCreateInfo = extensionCreateInfo->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 566 | } |
| 567 | |
| 568 | ASSERT(pCreateInfo->queueCreateInfoCount > 0); |
| 569 | |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 570 | if(enabledFeatures) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 571 | { |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 572 | if(!vk::Cast(physicalDevice)->hasFeatures(*enabledFeatures)) |
Nicolas Capens | d5f1489 | 2018-11-13 14:06:37 -0500 | [diff] [blame] | 573 | { |
| 574 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 575 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 576 | } |
| 577 | |
| 578 | uint32_t queueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount(); |
| 579 | |
| 580 | for(uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++) |
| 581 | { |
| 582 | const VkDeviceQueueCreateInfo& queueCreateInfo = pCreateInfo->pQueueCreateInfos[i]; |
| 583 | if(queueCreateInfo.pNext || queueCreateInfo.flags) |
| 584 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 585 | UNIMPLEMENTED("queueCreateInfo.pNext || queueCreateInfo.flags"); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | ASSERT(queueCreateInfo.queueFamilyIndex < queueFamilyPropertyCount); |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 589 | (void)queueFamilyPropertyCount; // Silence unused variable warning |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 590 | } |
| 591 | |
Ben Clayton | d6c6136 | 2019-08-14 18:16:01 +0100 | [diff] [blame] | 592 | auto scheduler = getOrCreateScheduler(); |
| 593 | return vk::DispatchableDevice::Create(pAllocator, pCreateInfo, pDevice, vk::Cast(physicalDevice), enabledFeatures, scheduler); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 594 | } |
| 595 | |
| 596 | VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator) |
| 597 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 598 | TRACE("(VkDevice device = %p, const VkAllocationCallbacks* pAllocator = %p)", device, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 599 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 600 | vk::destroy(device, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 601 | } |
| 602 | |
| 603 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) |
| 604 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 605 | TRACE("(const char* pLayerName = %p, uint32_t* pPropertyCount = %p, VkExtensionProperties* pProperties = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 606 | pLayerName, pPropertyCount, pProperties); |
| 607 | |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 608 | uint32_t extensionPropertiesCount = sizeof(instanceExtensionProperties) / sizeof(instanceExtensionProperties[0]); |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 609 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 610 | if(!pProperties) |
| 611 | { |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 612 | *pPropertyCount = extensionPropertiesCount; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 613 | return VK_SUCCESS; |
| 614 | } |
| 615 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 616 | auto toCopy = std::min(*pPropertyCount, extensionPropertiesCount); |
| 617 | for(uint32_t i = 0; i < toCopy; i++) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 618 | { |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 619 | pProperties[i] = instanceExtensionProperties[i]; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 620 | } |
| 621 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 622 | *pPropertyCount = toCopy; |
| 623 | return (toCopy < extensionPropertiesCount) ? VK_INCOMPLETE : VK_SUCCESS; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 624 | } |
| 625 | |
| 626 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties) |
| 627 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 628 | TRACE("(VkPhysicalDevice physicalDevice = %p, const char* pLayerName, uint32_t* pPropertyCount = %p, VkExtensionProperties* pProperties = %p)", physicalDevice, pPropertyCount, pProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 629 | |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 630 | uint32_t extensionPropertiesCount = sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]); |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 631 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 632 | if(!pProperties) |
| 633 | { |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 634 | *pPropertyCount = extensionPropertiesCount; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 635 | return VK_SUCCESS; |
| 636 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 637 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 638 | auto toCopy = std::min(*pPropertyCount, extensionPropertiesCount); |
| 639 | for(uint32_t i = 0; i < toCopy; i++) |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 640 | { |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 641 | pProperties[i] = deviceExtensionProperties[i]; |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 642 | } |
| 643 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 644 | *pPropertyCount = toCopy; |
| 645 | return (toCopy < extensionPropertiesCount) ? VK_INCOMPLETE : VK_SUCCESS; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 646 | } |
| 647 | |
| 648 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties) |
| 649 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 650 | TRACE("(uint32_t* pPropertyCount = %p, VkLayerProperties* pProperties = %p)", pPropertyCount, pProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 651 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 652 | if(!pProperties) |
| 653 | { |
| 654 | *pPropertyCount = 0; |
| 655 | return VK_SUCCESS; |
| 656 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 657 | |
| 658 | return VK_SUCCESS; |
| 659 | } |
| 660 | |
| 661 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties) |
| 662 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 663 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t* pPropertyCount = %p, VkLayerProperties* pProperties = %p)", physicalDevice, pPropertyCount, pProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 664 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 665 | if(!pProperties) |
| 666 | { |
| 667 | *pPropertyCount = 0; |
| 668 | return VK_SUCCESS; |
| 669 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 670 | |
| 671 | return VK_SUCCESS; |
| 672 | } |
| 673 | |
| 674 | VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue) |
| 675 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 676 | TRACE("(VkDevice device = %p, uint32_t queueFamilyIndex = %d, uint32_t queueIndex = %d, VkQueue* pQueue = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 677 | device, queueFamilyIndex, queueIndex, pQueue); |
| 678 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 679 | *pQueue = vk::Cast(device)->getQueue(queueFamilyIndex, queueIndex); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 680 | } |
| 681 | |
| 682 | VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence) |
| 683 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 684 | TRACE("(VkQueue queue = %p, uint32_t submitCount = %d, const VkSubmitInfo* pSubmits = %p, VkFence fence = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 685 | queue, submitCount, pSubmits, static_cast<void*>(fence)); |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 686 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 687 | return vk::Cast(queue)->submit(submitCount, pSubmits, vk::Cast(fence)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 688 | } |
| 689 | |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 690 | VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) |
| 691 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 692 | TRACE("(VkQueue queue = %p)", queue); |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 693 | |
Alexis Hetu | e1f51b9 | 2019-04-23 15:34:34 -0400 | [diff] [blame] | 694 | return vk::Cast(queue)->waitIdle(); |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) |
| 698 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 699 | TRACE("(VkDevice device = %p)", device); |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 700 | |
Alexis Hetu | e1f51b9 | 2019-04-23 15:34:34 -0400 | [diff] [blame] | 701 | return vk::Cast(device)->waitIdle(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 702 | } |
| 703 | |
| 704 | VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) |
| 705 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 706 | TRACE("(VkDevice device = %p, const VkMemoryAllocateInfo* pAllocateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkDeviceMemory* pMemory = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 707 | device, pAllocateInfo, pAllocator, pMemory); |
| 708 | |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 709 | const VkBaseInStructure* allocationInfo = reinterpret_cast<const VkBaseInStructure*>(pAllocateInfo->pNext); |
Alexis Hetu | 7ca9f4a | 2019-01-17 14:51:43 -0500 | [diff] [blame] | 710 | while(allocationInfo) |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 711 | { |
Alexis Hetu | 7ca9f4a | 2019-01-17 14:51:43 -0500 | [diff] [blame] | 712 | switch(allocationInfo->sType) |
| 713 | { |
| 714 | case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO: |
| 715 | // This can safely be ignored, as the Vulkan spec mentions: |
| 716 | // "If the pNext chain includes a VkMemoryDedicatedAllocateInfo structure, then that structure |
| 717 | // includes a handle of the sole buffer or image resource that the memory *can* be bound to." |
| 718 | break; |
Alexis Hetu | 026ceef | 2019-05-07 17:35:11 -0400 | [diff] [blame] | 719 | case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO: |
| 720 | // This extension controls on which physical devices the memory gets allocated. |
| 721 | // SwiftShader only has a single physical device, so this extension does nothing in this case. |
| 722 | break; |
Alexis Hetu | 7ca9f4a | 2019-01-17 14:51:43 -0500 | [diff] [blame] | 723 | default: |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 724 | UNIMPLEMENTED("allocationInfo->sType"); |
Alexis Hetu | 7ca9f4a | 2019-01-17 14:51:43 -0500 | [diff] [blame] | 725 | break; |
| 726 | } |
| 727 | |
| 728 | allocationInfo = allocationInfo->pNext; |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 729 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 730 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 731 | VkResult result = vk::DeviceMemory::Create(pAllocator, pAllocateInfo, pMemory); |
| 732 | if(result != VK_SUCCESS) |
| 733 | { |
| 734 | return result; |
| 735 | } |
| 736 | |
| 737 | // Make sure the memory allocation is done now so that OOM errors can be checked now |
| 738 | result = vk::Cast(*pMemory)->allocate(); |
| 739 | if(result != VK_SUCCESS) |
| 740 | { |
| 741 | vk::destroy(*pMemory, pAllocator); |
| 742 | *pMemory = VK_NULL_HANDLE; |
| 743 | } |
| 744 | |
| 745 | return result; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 746 | } |
| 747 | |
| 748 | VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator) |
| 749 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 750 | TRACE("(VkDevice device = %p, VkDeviceMemory memory = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 751 | device, static_cast<void*>(memory), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 752 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 753 | vk::destroy(memory, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 754 | } |
| 755 | |
| 756 | VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData) |
| 757 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 758 | TRACE("(VkDevice device = %p, VkDeviceMemory memory = %p, VkDeviceSize offset = %d, VkDeviceSize size = %d, VkMemoryMapFlags flags = %d, void** ppData = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 759 | device, static_cast<void*>(memory), int(offset), int(size), flags, ppData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 760 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 761 | return vk::Cast(memory)->map(offset, size, ppData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 762 | } |
| 763 | |
| 764 | VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory) |
| 765 | { |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 766 | TRACE("(VkDevice device = %p, VkDeviceMemory memory = %p)", device, static_cast<void*>(memory)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 767 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 768 | // Noop, memory will be released when the DeviceMemory object is released |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 769 | } |
| 770 | |
| 771 | VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) |
| 772 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 773 | TRACE("(VkDevice device = %p, uint32_t memoryRangeCount = %d, const VkMappedMemoryRange* pMemoryRanges = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 774 | device, memoryRangeCount, pMemoryRanges); |
| 775 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 776 | // Noop, host and device memory are the same to SwiftShader |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 777 | |
| 778 | return VK_SUCCESS; |
| 779 | } |
| 780 | |
| 781 | VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges) |
| 782 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 783 | TRACE("(VkDevice device = %p, uint32_t memoryRangeCount = %d, const VkMappedMemoryRange* pMemoryRanges = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 784 | device, memoryRangeCount, pMemoryRanges); |
| 785 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 786 | // Noop, host and device memory are the same to SwiftShader |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 787 | |
| 788 | return VK_SUCCESS; |
| 789 | } |
| 790 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 791 | VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice pDevice, VkDeviceMemory pMemory, VkDeviceSize* pCommittedMemoryInBytes) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 792 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 793 | TRACE("(VkDevice device = %p, VkDeviceMemory memory = %p, VkDeviceSize* pCommittedMemoryInBytes = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 794 | pDevice, static_cast<void*>(pMemory), pCommittedMemoryInBytes); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 795 | |
| 796 | auto memory = vk::Cast(pMemory); |
| 797 | |
| 798 | #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
Nicolas Capens | 0c73680 | 2019-05-27 12:53:31 -0400 | [diff] [blame] | 799 | const auto& memoryProperties = vk::Cast(pDevice)->getPhysicalDevice()->getMemoryProperties(); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 800 | uint32_t typeIndex = memory->getMemoryTypeIndex(); |
| 801 | ASSERT(typeIndex < memoryProperties.memoryTypeCount); |
| 802 | ASSERT(memoryProperties.memoryTypes[typeIndex].propertyFlags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT); |
| 803 | #endif |
| 804 | |
| 805 | *pCommittedMemoryInBytes = memory->getCommittedMemoryInBytes(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) |
| 809 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 810 | TRACE("(VkDevice device = %p, VkBuffer buffer = %p, VkDeviceMemory memory = %p, VkDeviceSize memoryOffset = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 811 | device, static_cast<void*>(buffer), static_cast<void*>(memory), int(memoryOffset)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 812 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 813 | vk::Cast(buffer)->bind(vk::Cast(memory), memoryOffset); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 814 | |
| 815 | return VK_SUCCESS; |
| 816 | } |
| 817 | |
| 818 | VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) |
| 819 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 820 | TRACE("(VkDevice device = %p, VkImage image = %p, VkDeviceMemory memory = %p, VkDeviceSize memoryOffset = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 821 | device, static_cast<void*>(image), static_cast<void*>(memory), int(memoryOffset)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 822 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 823 | vk::Cast(image)->bind(vk::Cast(memory), memoryOffset); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 824 | |
| 825 | return VK_SUCCESS; |
| 826 | } |
| 827 | |
| 828 | VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements) |
| 829 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 830 | TRACE("(VkDevice device = %p, VkBuffer buffer = %p, VkMemoryRequirements* pMemoryRequirements = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 831 | device, static_cast<void*>(buffer), pMemoryRequirements); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 832 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 833 | *pMemoryRequirements = vk::Cast(buffer)->getMemoryRequirements(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 834 | } |
| 835 | |
| 836 | VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements) |
| 837 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 838 | TRACE("(VkDevice device = %p, VkImage image = %p, VkMemoryRequirements* pMemoryRequirements = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 839 | device, static_cast<void*>(image), pMemoryRequirements); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 840 | |
Alexis Hetu | a233cea | 2018-12-07 11:53:19 -0500 | [diff] [blame] | 841 | *pMemoryRequirements = vk::Cast(image)->getMemoryRequirements(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 842 | } |
| 843 | |
| 844 | VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements) |
| 845 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 846 | TRACE("(VkDevice device = %p, VkImage image = %p, uint32_t* pSparseMemoryRequirementCount = %p, VkSparseImageMemoryRequirements* pSparseMemoryRequirements = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 847 | device, static_cast<void*>(image), pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 848 | |
Nicolas Capens | 5028a58 | 2018-11-13 15:03:35 -0500 | [diff] [blame] | 849 | // The 'sparseBinding' feature is not supported, so images can not be created with the VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag. |
| 850 | // "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." |
| 851 | *pSparseMemoryRequirementCount = 0; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 852 | } |
| 853 | |
| 854 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties) |
| 855 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 856 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkFormat format = %d, VkImageType type = %d, VkSampleCountFlagBits samples = %d, VkImageUsageFlags usage = %d, VkImageTiling tiling = %d, uint32_t* pPropertyCount = %p, VkSparseImageFormatProperties* pProperties = %p)", |
Chris Forbes | 2c25b14 | 2019-03-05 14:47:16 -0800 | [diff] [blame] | 857 | physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties); |
| 858 | |
| 859 | // We do not support sparse images. |
| 860 | *pPropertyCount = 0; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 861 | } |
| 862 | |
| 863 | VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) |
| 864 | { |
| 865 | TRACE("()"); |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 866 | UNIMPLEMENTED("vkQueueBindSparse"); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 867 | return VK_SUCCESS; |
| 868 | } |
| 869 | |
| 870 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence) |
| 871 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 872 | TRACE("(VkDevice device = %p, const VkFenceCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkFence* pFence = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 873 | device, pCreateInfo, pAllocator, pFence); |
| 874 | |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 875 | if(pCreateInfo->pNext) |
| 876 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 877 | UNIMPLEMENTED("pCreateInfo->pNext"); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 878 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 879 | |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 880 | return vk::Fence::Create(pAllocator, pCreateInfo, pFence); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 881 | } |
| 882 | |
| 883 | VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator) |
| 884 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 885 | TRACE("(VkDevice device = %p, VkFence fence = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 886 | device, static_cast<void*>(fence), pAllocator); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 887 | |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 888 | vk::destroy(fence, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 889 | } |
| 890 | |
| 891 | VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences) |
| 892 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 893 | TRACE("(VkDevice device = %p, uint32_t fenceCount = %d, const VkFence* pFences = %p)", |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 894 | device, fenceCount, pFences); |
| 895 | |
| 896 | for(uint32_t i = 0; i < fenceCount; i++) |
| 897 | { |
| 898 | vk::Cast(pFences[i])->reset(); |
| 899 | } |
| 900 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 901 | return VK_SUCCESS; |
| 902 | } |
| 903 | |
| 904 | VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence) |
| 905 | { |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 906 | TRACE("(VkDevice device = %p, VkFence fence = %p)", device, static_cast<void*>(fence)); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 907 | |
| 908 | return vk::Cast(fence)->getStatus(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 909 | } |
| 910 | |
| 911 | VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout) |
| 912 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 913 | TRACE("(VkDevice device = %p, uint32_t fenceCount = %d, const VkFence* pFences = %p, VkBool32 waitAll = %d, uint64_t timeout = %d)", |
| 914 | device, int(fenceCount), pFences, int(waitAll), int(timeout)); |
Alexis Hetu | c4bd9df | 2018-12-07 11:28:40 -0500 | [diff] [blame] | 915 | |
Alexis Hetu | e1f51b9 | 2019-04-23 15:34:34 -0400 | [diff] [blame] | 916 | return vk::Cast(device)->waitForFences(fenceCount, pFences, waitAll, timeout); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 917 | } |
| 918 | |
| 919 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore) |
| 920 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 921 | TRACE("(VkDevice device = %p, const VkSemaphoreCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkSemaphore* pSemaphore = %p)", |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 922 | device, pCreateInfo, pAllocator, pSemaphore); |
| 923 | |
| 924 | if(pCreateInfo->pNext || pCreateInfo->flags) |
| 925 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 926 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 927 | } |
| 928 | |
| 929 | return vk::Semaphore::Create(pAllocator, pCreateInfo, pSemaphore); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 930 | } |
| 931 | |
| 932 | VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator) |
| 933 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 934 | TRACE("(VkDevice device = %p, VkSemaphore semaphore = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 935 | device, static_cast<void*>(semaphore), pAllocator); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 936 | |
| 937 | vk::destroy(semaphore, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 938 | } |
| 939 | |
| 940 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent) |
| 941 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 942 | TRACE("(VkDevice device = %p, const VkEventCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkEvent* pEvent = %p)", |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 943 | device, pCreateInfo, pAllocator, pEvent); |
| 944 | |
| 945 | if(pCreateInfo->pNext || pCreateInfo->flags) |
| 946 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 947 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 948 | } |
| 949 | |
| 950 | return vk::Event::Create(pAllocator, pCreateInfo, pEvent); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 951 | } |
| 952 | |
| 953 | VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator) |
| 954 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 955 | TRACE("(VkDevice device = %p, VkEvent event = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 956 | device, static_cast<void*>(event), pAllocator); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 957 | |
| 958 | vk::destroy(event, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 959 | } |
| 960 | |
| 961 | VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event) |
| 962 | { |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 963 | TRACE("(VkDevice device = %p, VkEvent event = %p)", device, static_cast<void*>(event)); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 964 | |
| 965 | return vk::Cast(event)->getStatus(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 966 | } |
| 967 | |
| 968 | VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event) |
| 969 | { |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 970 | TRACE("(VkDevice device = %p, VkEvent event = %p)", device, static_cast<void*>(event)); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 971 | |
| 972 | vk::Cast(event)->signal(); |
| 973 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 974 | return VK_SUCCESS; |
| 975 | } |
| 976 | |
| 977 | VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event) |
| 978 | { |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 979 | TRACE("(VkDevice device = %p, VkEvent event = %p)", device, static_cast<void*>(event)); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 980 | |
| 981 | vk::Cast(event)->reset(); |
| 982 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 983 | return VK_SUCCESS; |
| 984 | } |
| 985 | |
| 986 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool) |
| 987 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 988 | TRACE("(VkDevice device = %p, const VkQueryPoolCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkQueryPool* pQueryPool = %p)", |
Alexis Hetu | 86f8bdb | 2019-01-22 12:07:24 -0500 | [diff] [blame] | 989 | device, pCreateInfo, pAllocator, pQueryPool); |
| 990 | |
| 991 | if(pCreateInfo->pNext || pCreateInfo->flags) |
| 992 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 993 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); |
Alexis Hetu | 86f8bdb | 2019-01-22 12:07:24 -0500 | [diff] [blame] | 994 | } |
| 995 | |
| 996 | return vk::QueryPool::Create(pAllocator, pCreateInfo, pQueryPool); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 997 | } |
| 998 | |
| 999 | VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator) |
| 1000 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1001 | TRACE("(VkDevice device = %p, VkQueryPool queryPool = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1002 | device, static_cast<void*>(queryPool), pAllocator); |
Alexis Hetu | 86f8bdb | 2019-01-22 12:07:24 -0500 | [diff] [blame] | 1003 | |
| 1004 | vk::destroy(queryPool, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1005 | } |
| 1006 | |
| 1007 | 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) |
| 1008 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1009 | TRACE("(VkDevice device = %p, VkQueryPool queryPool = %p, uint32_t firstQuery = %d, uint32_t queryCount = %d, size_t dataSize = %d, void* pData = %p, VkDeviceSize stride = %d, VkQueryResultFlags flags = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1010 | device, static_cast<void*>(queryPool), int(firstQuery), int(queryCount), int(dataSize), pData, int(stride), flags); |
Alexis Hetu | 86f8bdb | 2019-01-22 12:07:24 -0500 | [diff] [blame] | 1011 | |
Alexis Hetu | f0aa9d5 | 2019-04-01 17:06:47 -0400 | [diff] [blame] | 1012 | return vk::Cast(queryPool)->getResults(firstQuery, queryCount, dataSize, pData, stride, flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1013 | } |
| 1014 | |
| 1015 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer) |
| 1016 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1017 | TRACE("(VkDevice device = %p, const VkBufferCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkBuffer* pBuffer = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1018 | device, pCreateInfo, pAllocator, pBuffer); |
| 1019 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1020 | if(pCreateInfo->pNext) |
| 1021 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1022 | UNIMPLEMENTED("pCreateInfo->pNext"); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1023 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1024 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1025 | return vk::Buffer::Create(pAllocator, pCreateInfo, pBuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1026 | } |
| 1027 | |
| 1028 | VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator) |
| 1029 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1030 | TRACE("(VkDevice device = %p, VkBuffer buffer = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1031 | device, static_cast<void*>(buffer), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1032 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1033 | vk::destroy(buffer, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1034 | } |
| 1035 | |
| 1036 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView) |
| 1037 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1038 | TRACE("(VkDevice device = %p, const VkBufferViewCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkBufferView* pView = %p)", |
Alexis Hetu | 1424ef6 | 2019-04-05 18:03:53 -0400 | [diff] [blame] | 1039 | device, pCreateInfo, pAllocator, pView); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1040 | |
| 1041 | if(pCreateInfo->pNext || pCreateInfo->flags) |
| 1042 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1043 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1044 | } |
| 1045 | |
| 1046 | return vk::BufferView::Create(pAllocator, pCreateInfo, pView); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1047 | } |
| 1048 | |
| 1049 | VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator) |
| 1050 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1051 | TRACE("(VkDevice device = %p, VkBufferView bufferView = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1052 | device, static_cast<void*>(bufferView), pAllocator); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1053 | |
| 1054 | vk::destroy(bufferView, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1055 | } |
| 1056 | |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1057 | #ifdef __ANDROID__ |
| 1058 | struct BackingMemory { |
| 1059 | buffer_handle_t nativeHandle; |
| 1060 | int stride; |
Hernan Liatis | 3c73507 | 2019-06-10 15:07:18 -0700 | [diff] [blame] | 1061 | vk::DeviceMemory* imageMemory; |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1062 | VkSwapchainImageUsageFlagsANDROID androidUsage; |
| 1063 | }; |
| 1064 | |
| 1065 | static std::map<VkImage, BackingMemory> androidSwapchainMap; |
| 1066 | #endif |
| 1067 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1068 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage) |
| 1069 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1070 | TRACE("(VkDevice device = %p, const VkImageCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkImage* pImage = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1071 | device, pCreateInfo, pAllocator, pImage); |
| 1072 | |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1073 | const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext); |
| 1074 | |
| 1075 | #ifdef __ANDROID__ |
| 1076 | BackingMemory backmem; |
| 1077 | bool swapchainImage = false; |
| 1078 | #endif |
| 1079 | |
| 1080 | while(extensionCreateInfo) |
Alexis Hetu | f62f375 | 2018-11-15 14:51:15 -0500 | [diff] [blame] | 1081 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1082 | switch((long)(extensionCreateInfo->sType)) |
| 1083 | { |
| 1084 | #ifdef __ANDROID__ |
| 1085 | case VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID: |
| 1086 | { |
| 1087 | const VkSwapchainImageCreateInfoANDROID* swapImageCreateInfo = reinterpret_cast<const VkSwapchainImageCreateInfoANDROID*>(extensionCreateInfo); |
| 1088 | backmem.androidUsage = swapImageCreateInfo->usage; |
| 1089 | } |
| 1090 | break; |
| 1091 | case VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID: |
| 1092 | { |
| 1093 | const VkNativeBufferANDROID* nativeBufferInfo = reinterpret_cast<const VkNativeBufferANDROID*>(extensionCreateInfo); |
| 1094 | backmem.nativeHandle = nativeBufferInfo->handle; |
| 1095 | backmem.stride = nativeBufferInfo->stride; |
Hernan Liatis | cae8cde | 2019-05-22 14:24:45 -0700 | [diff] [blame] | 1096 | swapchainImage = true; |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1097 | } |
| 1098 | break; |
| 1099 | #endif |
| 1100 | default: |
| 1101 | // "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]" |
| 1102 | UNIMPLEMENTED("extensionCreateInfo->sType"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here. |
| 1103 | break; |
| 1104 | } |
| 1105 | |
| 1106 | extensionCreateInfo = extensionCreateInfo->pNext; |
Alexis Hetu | f62f375 | 2018-11-15 14:51:15 -0500 | [diff] [blame] | 1107 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1108 | |
Nicolas Capens | 0c73680 | 2019-05-27 12:53:31 -0400 | [diff] [blame] | 1109 | VkResult result = vk::Image::Create(pAllocator, pCreateInfo, pImage, vk::Cast(device)); |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1110 | |
| 1111 | #ifdef __ANDROID__ |
| 1112 | if (swapchainImage) |
| 1113 | { |
| 1114 | if (result != VK_SUCCESS) |
| 1115 | { |
| 1116 | return result; |
| 1117 | } |
| 1118 | |
| 1119 | VkMemoryRequirements memRequirements = vk::Cast(*pImage)->getMemoryRequirements(); |
| 1120 | |
| 1121 | VkMemoryAllocateInfo allocInfo = {}; |
| 1122 | allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; |
| 1123 | allocInfo.allocationSize = memRequirements.size; |
| 1124 | allocInfo.memoryTypeIndex = 0; |
| 1125 | |
Alexis Hetu | 82feec7 | 2019-06-19 12:42:38 -0400 | [diff] [blame] | 1126 | VkDeviceMemory devmem = { VK_NULL_HANDLE }; |
Hernan Liatis | 3c73507 | 2019-06-10 15:07:18 -0700 | [diff] [blame] | 1127 | result = vkAllocateMemory(device, &allocInfo, nullptr, &devmem); |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1128 | if(result != VK_SUCCESS) |
| 1129 | { |
| 1130 | return result; |
| 1131 | } |
| 1132 | |
Hernan Liatis | 3c73507 | 2019-06-10 15:07:18 -0700 | [diff] [blame] | 1133 | backmem.imageMemory = vk::Cast(devmem); |
| 1134 | vkBindImageMemory(device, *pImage, devmem, 0); |
| 1135 | |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1136 | androidSwapchainMap[*pImage] = backmem; |
| 1137 | } |
| 1138 | #endif |
| 1139 | |
| 1140 | return result; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1141 | } |
| 1142 | |
| 1143 | VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator) |
| 1144 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1145 | TRACE("(VkDevice device = %p, VkImage image = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1146 | device, static_cast<void*>(image), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1147 | |
Alexis Hetu | f62f375 | 2018-11-15 14:51:15 -0500 | [diff] [blame] | 1148 | vk::destroy(image, pAllocator); |
Hernan Liatis | f988cb5 | 2019-05-22 15:06:19 -0700 | [diff] [blame] | 1149 | |
| 1150 | #ifdef __ANDROID__ |
| 1151 | auto it = androidSwapchainMap.find(image); |
| 1152 | |
| 1153 | if (it != androidSwapchainMap.end()) |
| 1154 | { |
Hernan Liatis | 3c73507 | 2019-06-10 15:07:18 -0700 | [diff] [blame] | 1155 | vk::destroy(static_cast<VkDeviceMemory>(*((it->second).imageMemory)), nullptr); |
Hernan Liatis | f988cb5 | 2019-05-22 15:06:19 -0700 | [diff] [blame] | 1156 | androidSwapchainMap.erase(it); |
| 1157 | } |
| 1158 | #endif |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1159 | } |
| 1160 | |
| 1161 | VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout) |
| 1162 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1163 | TRACE("(VkDevice device = %p, VkImage image = %p, const VkImageSubresource* pSubresource = %p, VkSubresourceLayout* pLayout = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1164 | device, static_cast<void*>(image), pSubresource, pLayout); |
Alexis Hetu | 6ab37b0 | 2019-01-24 17:02:45 -0500 | [diff] [blame] | 1165 | |
| 1166 | vk::Cast(image)->getSubresourceLayout(pSubresource, pLayout); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1167 | } |
| 1168 | |
| 1169 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView) |
| 1170 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1171 | TRACE("(VkDevice device = %p, const VkImageViewCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkImageView* pView = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1172 | device, pCreateInfo, pAllocator, pView); |
| 1173 | |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1174 | if(pCreateInfo->flags) |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1175 | { |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1176 | UNIMPLEMENTED("pCreateInfo->flags"); |
| 1177 | } |
| 1178 | |
| 1179 | const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext); |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1180 | const vk::SamplerYcbcrConversion *ycbcrConversion = nullptr; |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1181 | |
| 1182 | while(extensionCreateInfo) |
| 1183 | { |
| 1184 | switch(extensionCreateInfo->sType) |
| 1185 | { |
| 1186 | case VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR: |
| 1187 | { |
| 1188 | const VkImageViewUsageCreateInfo* multiviewCreateInfo = reinterpret_cast<const VkImageViewUsageCreateInfo*>(extensionCreateInfo); |
| 1189 | ASSERT(!(~vk::Cast(pCreateInfo->image)->getUsage() & multiviewCreateInfo->usage)); |
| 1190 | } |
| 1191 | break; |
| 1192 | case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO: |
| 1193 | { |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1194 | const VkSamplerYcbcrConversionInfo* samplerYcbcrConversionInfo = reinterpret_cast<const VkSamplerYcbcrConversionInfo*>(extensionCreateInfo); |
| 1195 | ycbcrConversion = vk::Cast(samplerYcbcrConversionInfo->conversion); |
| 1196 | |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1197 | if(ycbcrConversion) |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1198 | { |
| 1199 | ASSERT((pCreateInfo->components.r == VK_COMPONENT_SWIZZLE_IDENTITY) && |
| 1200 | (pCreateInfo->components.g == VK_COMPONENT_SWIZZLE_IDENTITY) && |
| 1201 | (pCreateInfo->components.b == VK_COMPONENT_SWIZZLE_IDENTITY) && |
| 1202 | (pCreateInfo->components.a == VK_COMPONENT_SWIZZLE_IDENTITY)); |
| 1203 | } |
| 1204 | } |
| 1205 | break; |
| 1206 | default: |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1207 | UNIMPLEMENTED("extensionCreateInfo->sType %d", int(extensionCreateInfo->sType)); |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1208 | break; |
| 1209 | } |
| 1210 | |
| 1211 | extensionCreateInfo = extensionCreateInfo->pNext; |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1212 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1213 | |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1214 | return vk::ImageView::Create(pAllocator, pCreateInfo, pView, ycbcrConversion); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1215 | } |
| 1216 | |
| 1217 | VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator) |
| 1218 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1219 | TRACE("(VkDevice device = %p, VkImageView imageView = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1220 | device, static_cast<void*>(imageView), pAllocator); |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1221 | |
| 1222 | vk::destroy(imageView, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1223 | } |
| 1224 | |
| 1225 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule) |
| 1226 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1227 | TRACE("(VkDevice device = %p, const VkShaderModuleCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkShaderModule* pShaderModule = %p)", |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1228 | device, pCreateInfo, pAllocator, pShaderModule); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1229 | |
Alexis Hetu | 259ad3d | 2018-11-15 13:44:31 -0500 | [diff] [blame] | 1230 | if(pCreateInfo->pNext || pCreateInfo->flags) |
| 1231 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1232 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); |
Alexis Hetu | 259ad3d | 2018-11-15 13:44:31 -0500 | [diff] [blame] | 1233 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1234 | |
Alexis Hetu | 259ad3d | 2018-11-15 13:44:31 -0500 | [diff] [blame] | 1235 | return vk::ShaderModule::Create(pAllocator, pCreateInfo, pShaderModule); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1236 | } |
| 1237 | |
| 1238 | VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator) |
| 1239 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1240 | TRACE("(VkDevice device = %p, VkShaderModule shaderModule = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1241 | device, static_cast<void*>(shaderModule), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1242 | |
Alexis Hetu | 259ad3d | 2018-11-15 13:44:31 -0500 | [diff] [blame] | 1243 | vk::destroy(shaderModule, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1244 | } |
| 1245 | |
| 1246 | VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache) |
| 1247 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1248 | TRACE("(VkDevice device = %p, const VkPipelineCacheCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkPipelineCache* pPipelineCache = %p)", |
Alexis Hetu | 1424ef6 | 2019-04-05 18:03:53 -0400 | [diff] [blame] | 1249 | device, pCreateInfo, pAllocator, pPipelineCache); |
Alexis Hetu | 18a8425 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1250 | |
| 1251 | if(pCreateInfo->pNext || pCreateInfo->flags) |
| 1252 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1253 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); |
Alexis Hetu | 18a8425 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1254 | } |
| 1255 | |
| 1256 | return vk::PipelineCache::Create(pAllocator, pCreateInfo, pPipelineCache); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1257 | } |
| 1258 | |
| 1259 | VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator) |
| 1260 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1261 | TRACE("(VkDevice device = %p, VkPipelineCache pipelineCache = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1262 | device, static_cast<void*>(pipelineCache), pAllocator); |
Alexis Hetu | 18a8425 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1263 | |
| 1264 | vk::destroy(pipelineCache, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1265 | } |
| 1266 | |
| 1267 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData) |
| 1268 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1269 | TRACE("(VkDevice device = %p, VkPipelineCache pipelineCache = %p, size_t* pDataSize = %p, void* pData = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1270 | device, static_cast<void*>(pipelineCache), pDataSize, pData); |
Alexis Hetu | 1424ef6 | 2019-04-05 18:03:53 -0400 | [diff] [blame] | 1271 | |
| 1272 | return vk::Cast(pipelineCache)->getData(pDataSize, pData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1273 | } |
| 1274 | |
| 1275 | VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) |
| 1276 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1277 | TRACE("(VkDevice device = %p, VkPipelineCache dstCache = %p, uint32_t srcCacheCount = %d, const VkPipelineCache* pSrcCaches = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1278 | device, static_cast<void*>(dstCache), int(srcCacheCount), pSrcCaches); |
Alexis Hetu | 1424ef6 | 2019-04-05 18:03:53 -0400 | [diff] [blame] | 1279 | |
| 1280 | return vk::Cast(dstCache)->merge(srcCacheCount, pSrcCaches); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1281 | } |
| 1282 | |
| 1283 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) |
| 1284 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1285 | TRACE("(VkDevice device = %p, VkPipelineCache pipelineCache = %p, uint32_t createInfoCount = %d, const VkGraphicsPipelineCreateInfo* pCreateInfos = %p, const VkAllocationCallbacks* pAllocator = %p, VkPipeline* pPipelines = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1286 | device, static_cast<void*>(pipelineCache), int(createInfoCount), pCreateInfos, pAllocator, pPipelines); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1287 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1288 | VkResult errorResult = VK_SUCCESS; |
| 1289 | for(uint32_t i = 0; i < createInfoCount; i++) |
| 1290 | { |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 1291 | VkResult result = vk::GraphicsPipeline::Create(pAllocator, &pCreateInfos[i], &pPipelines[i], vk::Cast(device)); |
| 1292 | |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 1293 | if(result == VK_SUCCESS) |
| 1294 | { |
Alexis Hetu | 52edb17 | 2019-06-26 10:17:18 -0400 | [diff] [blame] | 1295 | static_cast<vk::GraphicsPipeline*>(vk::Cast(pPipelines[i]))->compileShaders(pAllocator, &pCreateInfos[i], vk::Cast(pipelineCache)); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 1296 | } |
| 1297 | else |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1298 | { |
| 1299 | // According to the Vulkan spec, section 9.4. Multiple Pipeline Creation |
| 1300 | // "When an application attempts to create many pipelines in a single command, |
| 1301 | // it is possible that some subset may fail creation. In that case, the |
| 1302 | // corresponding entries in the pPipelines output array will be filled with |
| 1303 | // VK_NULL_HANDLE values. If any pipeline fails creation (for example, due to |
| 1304 | // out of memory errors), the vkCreate*Pipelines commands will return an |
| 1305 | // error code. The implementation will attempt to create all pipelines, and |
| 1306 | // only return VK_NULL_HANDLE values for those that actually failed." |
| 1307 | pPipelines[i] = VK_NULL_HANDLE; |
| 1308 | errorResult = result; |
| 1309 | } |
| 1310 | } |
| 1311 | |
| 1312 | return errorResult; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1313 | } |
| 1314 | |
| 1315 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) |
| 1316 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1317 | TRACE("(VkDevice device = %p, VkPipelineCache pipelineCache = %p, uint32_t createInfoCount = %d, const VkComputePipelineCreateInfo* pCreateInfos = %p, const VkAllocationCallbacks* pAllocator = %p, VkPipeline* pPipelines = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1318 | device, static_cast<void*>(pipelineCache), int(createInfoCount), pCreateInfos, pAllocator, pPipelines); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1319 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1320 | VkResult errorResult = VK_SUCCESS; |
| 1321 | for(uint32_t i = 0; i < createInfoCount; i++) |
| 1322 | { |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 1323 | VkResult result = vk::ComputePipeline::Create(pAllocator, &pCreateInfos[i], &pPipelines[i], vk::Cast(device)); |
| 1324 | |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 1325 | if(result == VK_SUCCESS) |
| 1326 | { |
Alexis Hetu | 52edb17 | 2019-06-26 10:17:18 -0400 | [diff] [blame] | 1327 | static_cast<vk::ComputePipeline*>(vk::Cast(pPipelines[i]))->compileShaders(pAllocator, &pCreateInfos[i], vk::Cast(pipelineCache)); |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 1328 | } |
| 1329 | else |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1330 | { |
| 1331 | // According to the Vulkan spec, section 9.4. Multiple Pipeline Creation |
| 1332 | // "When an application attempts to create many pipelines in a single command, |
| 1333 | // it is possible that some subset may fail creation. In that case, the |
| 1334 | // corresponding entries in the pPipelines output array will be filled with |
| 1335 | // VK_NULL_HANDLE values. If any pipeline fails creation (for example, due to |
| 1336 | // out of memory errors), the vkCreate*Pipelines commands will return an |
| 1337 | // error code. The implementation will attempt to create all pipelines, and |
| 1338 | // only return VK_NULL_HANDLE values for those that actually failed." |
| 1339 | pPipelines[i] = VK_NULL_HANDLE; |
| 1340 | errorResult = result; |
| 1341 | } |
| 1342 | } |
| 1343 | |
| 1344 | return errorResult; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1345 | } |
| 1346 | |
| 1347 | VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator) |
| 1348 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1349 | TRACE("(VkDevice device = %p, VkPipeline pipeline = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1350 | device, static_cast<void*>(pipeline), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1351 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1352 | vk::destroy(pipeline, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1353 | } |
| 1354 | |
| 1355 | VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout) |
| 1356 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1357 | TRACE("(VkDevice device = %p, const VkPipelineLayoutCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkPipelineLayout* pPipelineLayout = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1358 | device, pCreateInfo, pAllocator, pPipelineLayout); |
| 1359 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1360 | if(pCreateInfo->pNext || pCreateInfo->flags) |
| 1361 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1362 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1363 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1364 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1365 | return vk::PipelineLayout::Create(pAllocator, pCreateInfo, pPipelineLayout); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1366 | } |
| 1367 | |
| 1368 | VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator) |
| 1369 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1370 | TRACE("(VkDevice device = %p, VkPipelineLayout pipelineLayout = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1371 | device, static_cast<void*>(pipelineLayout), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1372 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1373 | vk::destroy(pipelineLayout, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1374 | } |
| 1375 | |
| 1376 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler) |
| 1377 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1378 | TRACE("(VkDevice device = %p, const VkSamplerCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkSampler* pSampler = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1379 | device, pCreateInfo, pAllocator, pSampler); |
| 1380 | |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1381 | if(pCreateInfo->flags) |
Alexis Hetu | 5174c57 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1382 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1383 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); |
Alexis Hetu | 5174c57 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1384 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1385 | |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1386 | const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext); |
| 1387 | const vk::SamplerYcbcrConversion *ycbcrConversion = nullptr; |
| 1388 | |
| 1389 | while(extensionCreateInfo) |
| 1390 | { |
| 1391 | switch(extensionCreateInfo->sType) |
| 1392 | { |
| 1393 | case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO: |
| 1394 | { |
| 1395 | const VkSamplerYcbcrConversionInfo* samplerYcbcrConversionInfo = reinterpret_cast<const VkSamplerYcbcrConversionInfo*>(extensionCreateInfo); |
| 1396 | ycbcrConversion = vk::Cast(samplerYcbcrConversionInfo->conversion); |
| 1397 | } |
| 1398 | break; |
| 1399 | default: |
| 1400 | UNIMPLEMENTED("extensionCreateInfo->sType %d", int(extensionCreateInfo->sType)); |
| 1401 | break; |
| 1402 | } |
| 1403 | |
| 1404 | extensionCreateInfo = extensionCreateInfo->pNext; |
| 1405 | } |
| 1406 | |
| 1407 | return vk::Sampler::Create(pAllocator, pCreateInfo, pSampler, ycbcrConversion); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1408 | } |
| 1409 | |
| 1410 | VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator) |
| 1411 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1412 | TRACE("(VkDevice device = %p, VkSampler sampler = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1413 | device, static_cast<void*>(sampler), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1414 | |
Alexis Hetu | 5174c57 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1415 | vk::destroy(sampler, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1416 | } |
| 1417 | |
| 1418 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout) |
| 1419 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1420 | TRACE("(VkDevice device = %p, const VkDescriptorSetLayoutCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkDescriptorSetLayout* pSetLayout = %p)", |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1421 | device, pCreateInfo, pAllocator, pSetLayout); |
| 1422 | |
Alexis Hetu | 1300ba1 | 2019-05-07 15:47:11 -0400 | [diff] [blame] | 1423 | const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext); |
| 1424 | |
| 1425 | while(extensionCreateInfo) |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1426 | { |
Alexis Hetu | 1300ba1 | 2019-05-07 15:47:11 -0400 | [diff] [blame] | 1427 | switch(extensionCreateInfo->sType) |
| 1428 | { |
| 1429 | case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT: |
Alexis Hetu | 352791e | 2019-05-17 16:42:34 -0400 | [diff] [blame] | 1430 | ASSERT(!vk::Cast(device)->hasExtension(VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME)); |
Alexis Hetu | 1300ba1 | 2019-05-07 15:47:11 -0400 | [diff] [blame] | 1431 | break; |
| 1432 | default: |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1433 | UNIMPLEMENTED("extensionCreateInfo->sType %d", int(extensionCreateInfo->sType)); |
Alexis Hetu | 1300ba1 | 2019-05-07 15:47:11 -0400 | [diff] [blame] | 1434 | break; |
| 1435 | } |
| 1436 | |
| 1437 | extensionCreateInfo = extensionCreateInfo->pNext; |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1438 | } |
| 1439 | |
| 1440 | return vk::DescriptorSetLayout::Create(pAllocator, pCreateInfo, pSetLayout); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1441 | } |
| 1442 | |
| 1443 | VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator) |
| 1444 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1445 | TRACE("(VkDevice device = %p, VkDescriptorSetLayout descriptorSetLayout = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1446 | device, static_cast<void*>(descriptorSetLayout), pAllocator); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1447 | |
| 1448 | vk::destroy(descriptorSetLayout, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1449 | } |
| 1450 | |
| 1451 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool) |
| 1452 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1453 | TRACE("(VkDevice device = %p, const VkDescriptorPoolCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkDescriptorPool* pDescriptorPool = %p)", |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1454 | device, pCreateInfo, pAllocator, pDescriptorPool); |
| 1455 | |
| 1456 | if(pCreateInfo->pNext) |
| 1457 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1458 | UNIMPLEMENTED("pCreateInfo->pNext"); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1459 | } |
| 1460 | |
| 1461 | return vk::DescriptorPool::Create(pAllocator, pCreateInfo, pDescriptorPool); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1462 | } |
| 1463 | |
| 1464 | VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator) |
| 1465 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1466 | TRACE("(VkDevice device = %p, VkDescriptorPool descriptorPool = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1467 | device, static_cast<void*>(descriptorPool), pAllocator); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1468 | |
| 1469 | vk::destroy(descriptorPool, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1470 | } |
| 1471 | |
| 1472 | VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) |
| 1473 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1474 | TRACE("(VkDevice device = %p, VkDescriptorPool descriptorPool = %p, VkDescriptorPoolResetFlags flags = 0x%x)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1475 | device, static_cast<void*>(descriptorPool), int(flags)); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1476 | |
| 1477 | if(flags) |
| 1478 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1479 | UNIMPLEMENTED("flags"); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1480 | } |
| 1481 | |
| 1482 | return vk::Cast(descriptorPool)->reset(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1483 | } |
| 1484 | |
| 1485 | VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets) |
| 1486 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1487 | TRACE("(VkDevice device = %p, const VkDescriptorSetAllocateInfo* pAllocateInfo = %p, VkDescriptorSet* pDescriptorSets = %p)", |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1488 | device, pAllocateInfo, pDescriptorSets); |
| 1489 | |
| 1490 | if(pAllocateInfo->pNext) |
| 1491 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1492 | UNIMPLEMENTED("pAllocateInfo->pNext"); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1493 | } |
| 1494 | |
| 1495 | return vk::Cast(pAllocateInfo->descriptorPool)->allocateSets( |
| 1496 | pAllocateInfo->descriptorSetCount, pAllocateInfo->pSetLayouts, pDescriptorSets); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1497 | } |
| 1498 | |
| 1499 | VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets) |
| 1500 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1501 | TRACE("(VkDevice device = %p, VkDescriptorPool descriptorPool = %p, uint32_t descriptorSetCount = %d, const VkDescriptorSet* pDescriptorSets = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1502 | device, static_cast<void*>(descriptorPool), descriptorSetCount, pDescriptorSets); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1503 | |
| 1504 | vk::Cast(descriptorPool)->freeSets(descriptorSetCount, pDescriptorSets); |
| 1505 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1506 | return VK_SUCCESS; |
| 1507 | } |
| 1508 | |
| 1509 | VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies) |
| 1510 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1511 | TRACE("(VkDevice device = %p, uint32_t descriptorWriteCount = %d, const VkWriteDescriptorSet* pDescriptorWrites = %p, uint32_t descriptorCopyCount = %d, const VkCopyDescriptorSet* pDescriptorCopies = %p)", |
Alexis Hetu | 048974f | 2019-02-15 15:28:37 -0500 | [diff] [blame] | 1512 | device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
| 1513 | |
| 1514 | vk::Cast(device)->updateDescriptorSets(descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1515 | } |
| 1516 | |
| 1517 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer) |
| 1518 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1519 | TRACE("(VkDevice device = %p, const VkFramebufferCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkFramebuffer* pFramebuffer = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1520 | device, pCreateInfo, pAllocator, pFramebuffer); |
| 1521 | |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 1522 | if(pCreateInfo->pNext || pCreateInfo->flags) |
| 1523 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1524 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags"); |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 1525 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1526 | |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 1527 | return vk::Framebuffer::Create(pAllocator, pCreateInfo, pFramebuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1528 | } |
| 1529 | |
| 1530 | VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator) |
| 1531 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1532 | TRACE("(VkDevice device = %p, VkFramebuffer framebuffer = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1533 | device, static_cast<void*>(framebuffer), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1534 | |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 1535 | vk::destroy(framebuffer, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1536 | } |
| 1537 | |
| 1538 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass) |
| 1539 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1540 | TRACE("(VkDevice device = %p, const VkRenderPassCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkRenderPass* pRenderPass = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1541 | device, pCreateInfo, pAllocator, pRenderPass); |
| 1542 | |
Alexis Hetu | 67806a1 | 2019-04-05 14:12:27 -0400 | [diff] [blame] | 1543 | if(pCreateInfo->flags) |
Alexis Hetu | b16f989 | 2018-11-15 15:18:41 -0500 | [diff] [blame] | 1544 | { |
Alexis Hetu | 67806a1 | 2019-04-05 14:12:27 -0400 | [diff] [blame] | 1545 | UNIMPLEMENTED("pCreateInfo->flags"); |
| 1546 | } |
| 1547 | |
| 1548 | const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext); |
| 1549 | |
| 1550 | while(extensionCreateInfo) |
| 1551 | { |
| 1552 | switch(extensionCreateInfo->sType) |
| 1553 | { |
| 1554 | case VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO: |
| 1555 | { |
| 1556 | const VkRenderPassInputAttachmentAspectCreateInfo* inputAttachmentAspectCreateInfo = reinterpret_cast<const VkRenderPassInputAttachmentAspectCreateInfo*>(extensionCreateInfo); |
| 1557 | |
| 1558 | for(uint32_t i = 0; i < inputAttachmentAspectCreateInfo->aspectReferenceCount; i++) |
| 1559 | { |
| 1560 | const VkInputAttachmentAspectReference& aspectReference = inputAttachmentAspectCreateInfo->pAspectReferences[i]; |
| 1561 | ASSERT(aspectReference.subpass < pCreateInfo->subpassCount); |
| 1562 | const VkSubpassDescription& subpassDescription = pCreateInfo->pSubpasses[aspectReference.subpass]; |
| 1563 | ASSERT(aspectReference.inputAttachmentIndex < subpassDescription.inputAttachmentCount); |
| 1564 | const VkAttachmentReference& attachmentReference = subpassDescription.pInputAttachments[aspectReference.inputAttachmentIndex]; |
| 1565 | if(attachmentReference.attachment != VK_ATTACHMENT_UNUSED) |
| 1566 | { |
| 1567 | // If the pNext chain includes an instance of VkRenderPassInputAttachmentAspectCreateInfo, for any |
| 1568 | // element of the pInputAttachments member of any element of pSubpasses where the attachment member |
| 1569 | // is not VK_ATTACHMENT_UNUSED, the aspectMask member of the corresponding element of |
| 1570 | // VkRenderPassInputAttachmentAspectCreateInfo::pAspectReferences must only include aspects that are |
| 1571 | // present in images of the format specified by the element of pAttachments at attachment |
| 1572 | vk::Format format(pCreateInfo->pAttachments[attachmentReference.attachment].format); |
| 1573 | bool isDepth = format.isDepth(); |
| 1574 | bool isStencil = format.isStencil(); |
| 1575 | ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) || (!isDepth && !isStencil)); |
| 1576 | ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) || isDepth); |
| 1577 | ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) || isStencil); |
| 1578 | } |
| 1579 | } |
| 1580 | } |
| 1581 | break; |
| 1582 | case VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO: |
| 1583 | { |
| 1584 | const VkRenderPassMultiviewCreateInfo* multiviewCreateInfo = reinterpret_cast<const VkRenderPassMultiviewCreateInfo*>(extensionCreateInfo); |
| 1585 | ASSERT((multiviewCreateInfo->subpassCount == 0) || (multiviewCreateInfo->subpassCount == pCreateInfo->subpassCount)); |
| 1586 | ASSERT((multiviewCreateInfo->dependencyCount == 0) || (multiviewCreateInfo->dependencyCount == pCreateInfo->dependencyCount)); |
| 1587 | |
| 1588 | bool zeroMask = (multiviewCreateInfo->pViewMasks[0] == 0); |
| 1589 | for(uint32_t i = 1; i < multiviewCreateInfo->subpassCount; i++) |
| 1590 | { |
| 1591 | ASSERT((multiviewCreateInfo->pViewMasks[i] == 0) == zeroMask); |
| 1592 | } |
| 1593 | |
| 1594 | if(zeroMask) |
| 1595 | { |
| 1596 | ASSERT(multiviewCreateInfo->correlationMaskCount == 0); |
| 1597 | } |
| 1598 | |
| 1599 | for(uint32_t i = 0; i < multiviewCreateInfo->dependencyCount; i++) |
| 1600 | { |
| 1601 | const VkSubpassDependency &dependency = pCreateInfo->pDependencies[i]; |
| 1602 | if(multiviewCreateInfo->pViewOffsets[i] != 0) |
| 1603 | { |
| 1604 | ASSERT(dependency.srcSubpass != dependency.dstSubpass); |
| 1605 | ASSERT(dependency.dependencyFlags & VK_DEPENDENCY_VIEW_LOCAL_BIT); |
| 1606 | } |
| 1607 | if(zeroMask) |
| 1608 | { |
| 1609 | ASSERT(!(dependency.dependencyFlags & VK_DEPENDENCY_VIEW_LOCAL_BIT)); |
| 1610 | } |
| 1611 | } |
| 1612 | |
| 1613 | // If the pNext chain includes an instance of VkRenderPassMultiviewCreateInfo, |
| 1614 | // each element of its pViewMask member must not include a bit at a position |
| 1615 | // greater than the value of VkPhysicalDeviceLimits::maxFramebufferLayers |
| 1616 | // pViewMask is a 32 bit value. If maxFramebufferLayers > 32, it's impossible |
| 1617 | // for pViewMask to contain a bit at an illegal position |
| 1618 | // Note: Verify pViewMask values instead if we hit this assert |
Nicolas Capens | 0c73680 | 2019-05-27 12:53:31 -0400 | [diff] [blame] | 1619 | ASSERT(vk::Cast(device)->getPhysicalDevice()->getProperties().limits.maxFramebufferLayers >= 32); |
Alexis Hetu | 67806a1 | 2019-04-05 14:12:27 -0400 | [diff] [blame] | 1620 | } |
| 1621 | break; |
| 1622 | default: |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1623 | UNIMPLEMENTED("extensionCreateInfo->sType %d", int(extensionCreateInfo->sType)); |
Alexis Hetu | 67806a1 | 2019-04-05 14:12:27 -0400 | [diff] [blame] | 1624 | break; |
| 1625 | } |
| 1626 | |
| 1627 | extensionCreateInfo = extensionCreateInfo->pNext; |
Alexis Hetu | b16f989 | 2018-11-15 15:18:41 -0500 | [diff] [blame] | 1628 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1629 | |
Alexis Hetu | b16f989 | 2018-11-15 15:18:41 -0500 | [diff] [blame] | 1630 | return vk::RenderPass::Create(pAllocator, pCreateInfo, pRenderPass); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1631 | } |
| 1632 | |
| 1633 | VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator) |
| 1634 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1635 | TRACE("(VkDevice device = %p, VkRenderPass renderPass = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1636 | device, static_cast<void*>(renderPass), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1637 | |
Alexis Hetu | b16f989 | 2018-11-15 15:18:41 -0500 | [diff] [blame] | 1638 | vk::destroy(renderPass, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1639 | } |
| 1640 | |
| 1641 | VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity) |
| 1642 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1643 | TRACE("(VkDevice device = %p, VkRenderPass renderPass = %p, VkExtent2D* pGranularity = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1644 | device, static_cast<void*>(renderPass), pGranularity); |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 1645 | |
Alexis Hetu | 6d74ab8 | 2019-02-15 14:42:38 -0500 | [diff] [blame] | 1646 | vk::Cast(renderPass)->getRenderAreaGranularity(pGranularity); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1647 | } |
| 1648 | |
| 1649 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool) |
| 1650 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1651 | TRACE("(VkDevice device = %p, const VkCommandPoolCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkCommandPool* pCommandPool = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1652 | device, pCreateInfo, pAllocator, pCommandPool); |
| 1653 | |
Alexis Hetu | 9c4ecae | 2018-11-20 16:26:10 -0500 | [diff] [blame] | 1654 | if(pCreateInfo->pNext) |
| 1655 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1656 | UNIMPLEMENTED("pCreateInfo->pNext"); |
Alexis Hetu | 9c4ecae | 2018-11-20 16:26:10 -0500 | [diff] [blame] | 1657 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1658 | |
Alexis Hetu | 9c4ecae | 2018-11-20 16:26:10 -0500 | [diff] [blame] | 1659 | return vk::CommandPool::Create(pAllocator, pCreateInfo, pCommandPool); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1660 | } |
| 1661 | |
| 1662 | VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator) |
| 1663 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1664 | TRACE("(VkDevice device = %p, VkCommandPool commandPool = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1665 | device, static_cast<void*>(commandPool), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1666 | |
Alexis Hetu | 9c4ecae | 2018-11-20 16:26:10 -0500 | [diff] [blame] | 1667 | vk::destroy(commandPool, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1668 | } |
| 1669 | |
| 1670 | VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) |
| 1671 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1672 | TRACE("(VkDevice device = %p, VkCommandPool commandPool = %p, VkCommandPoolResetFlags flags = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1673 | device, static_cast<void*>(commandPool), int(flags)); |
Alexis Hetu | cd610c9 | 2019-02-01 16:47:51 -0500 | [diff] [blame] | 1674 | |
| 1675 | return vk::Cast(commandPool)->reset(flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1676 | } |
| 1677 | |
| 1678 | VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers) |
| 1679 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1680 | TRACE("(VkDevice device = %p, const VkCommandBufferAllocateInfo* pAllocateInfo = %p, VkCommandBuffer* pCommandBuffers = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1681 | device, pAllocateInfo, pCommandBuffers); |
| 1682 | |
Alexis Hetu | bffee5e | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1683 | if(pAllocateInfo->pNext) |
| 1684 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1685 | UNIMPLEMENTED("pAllocateInfo->pNext"); |
Alexis Hetu | bffee5e | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1686 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1687 | |
Alexis Hetu | bffee5e | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1688 | return vk::Cast(pAllocateInfo->commandPool)->allocateCommandBuffers( |
| 1689 | pAllocateInfo->level, pAllocateInfo->commandBufferCount, pCommandBuffers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1690 | } |
| 1691 | |
| 1692 | VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) |
| 1693 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1694 | TRACE("(VkDevice device = %p, VkCommandPool commandPool = %p, uint32_t commandBufferCount = %d, const VkCommandBuffer* pCommandBuffers = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1695 | device, static_cast<void*>(commandPool), int(commandBufferCount), pCommandBuffers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1696 | |
Alexis Hetu | bffee5e | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1697 | vk::Cast(commandPool)->freeCommandBuffers(commandBufferCount, pCommandBuffers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1698 | } |
| 1699 | |
| 1700 | VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo) |
| 1701 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1702 | TRACE("(VkCommandBuffer commandBuffer = %p, const VkCommandBufferBeginInfo* pBeginInfo = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1703 | commandBuffer, pBeginInfo); |
| 1704 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1705 | if(pBeginInfo->pNext) |
| 1706 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 1707 | UNIMPLEMENTED("pBeginInfo->pNext"); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1708 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1709 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1710 | return vk::Cast(commandBuffer)->begin(pBeginInfo->flags, pBeginInfo->pInheritanceInfo); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1711 | } |
| 1712 | |
| 1713 | VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer) |
| 1714 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1715 | TRACE("(VkCommandBuffer commandBuffer = %p)", commandBuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1716 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1717 | return vk::Cast(commandBuffer)->end(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1718 | } |
| 1719 | |
| 1720 | VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) |
| 1721 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1722 | TRACE("VkCommandBuffer commandBuffer = %p, VkCommandBufferResetFlags flags = %d", commandBuffer, int(flags)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1723 | |
| 1724 | return vk::Cast(commandBuffer)->reset(flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1725 | } |
| 1726 | |
| 1727 | VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) |
| 1728 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1729 | TRACE("(VkCommandBuffer commandBuffer = %p, VkPipelineBindPoint pipelineBindPoint = %d, VkPipeline pipeline = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1730 | commandBuffer, int(pipelineBindPoint), static_cast<void*>(pipeline)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1731 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1732 | vk::Cast(commandBuffer)->bindPipeline(pipelineBindPoint, vk::Cast(pipeline)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1733 | } |
| 1734 | |
| 1735 | VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) |
| 1736 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1737 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t firstViewport = %d, uint32_t viewportCount = %d, const VkViewport* pViewports = %p)", |
| 1738 | commandBuffer, int(firstViewport), int(viewportCount), pViewports); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1739 | |
| 1740 | vk::Cast(commandBuffer)->setViewport(firstViewport, viewportCount, pViewports); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1741 | } |
| 1742 | |
| 1743 | VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) |
| 1744 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1745 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t firstScissor = %d, uint32_t scissorCount = %d, const VkRect2D* pScissors = %p)", |
| 1746 | commandBuffer, int(firstScissor), int(scissorCount), pScissors); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1747 | |
| 1748 | vk::Cast(commandBuffer)->setScissor(firstScissor, scissorCount, pScissors); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1749 | } |
| 1750 | |
| 1751 | VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) |
| 1752 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1753 | TRACE("(VkCommandBuffer commandBuffer = %p, float lineWidth = %f)", commandBuffer, lineWidth); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1754 | |
| 1755 | vk::Cast(commandBuffer)->setLineWidth(lineWidth); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1756 | } |
| 1757 | |
| 1758 | VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) |
| 1759 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1760 | TRACE("(VkCommandBuffer commandBuffer = %p, float depthBiasConstantFactor = %f, float depthBiasClamp = %f, float depthBiasSlopeFactor = %f)", |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1761 | commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
| 1762 | |
| 1763 | vk::Cast(commandBuffer)->setDepthBias(depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1764 | } |
| 1765 | |
| 1766 | VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) |
| 1767 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1768 | TRACE("(VkCommandBuffer commandBuffer = %p, const float blendConstants[4] = {%f, %f, %f, %f})", |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1769 | commandBuffer, blendConstants[0], blendConstants[1], blendConstants[2], blendConstants[3]); |
| 1770 | |
| 1771 | vk::Cast(commandBuffer)->setBlendConstants(blendConstants); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1772 | } |
| 1773 | |
| 1774 | VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) |
| 1775 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1776 | TRACE("(VkCommandBuffer commandBuffer = %p, float minDepthBounds = %f, float maxDepthBounds = %f)", |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1777 | commandBuffer, minDepthBounds, maxDepthBounds); |
| 1778 | |
| 1779 | vk::Cast(commandBuffer)->setDepthBounds(minDepthBounds, maxDepthBounds); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1780 | } |
| 1781 | |
| 1782 | VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) |
| 1783 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1784 | TRACE("(VkCommandBuffer commandBuffer = %p, VkStencilFaceFlags faceMask = %d, uint32_t compareMask = %d)", |
| 1785 | commandBuffer, int(faceMask), int(compareMask)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1786 | |
| 1787 | vk::Cast(commandBuffer)->setStencilCompareMask(faceMask, compareMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1788 | } |
| 1789 | |
| 1790 | VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) |
| 1791 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1792 | TRACE("(VkCommandBuffer commandBuffer = %p, VkStencilFaceFlags faceMask = %d, uint32_t writeMask = %d)", |
| 1793 | commandBuffer, int(faceMask), int(writeMask)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1794 | |
| 1795 | vk::Cast(commandBuffer)->setStencilWriteMask(faceMask, writeMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1796 | } |
| 1797 | |
| 1798 | VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) |
| 1799 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1800 | TRACE("(VkCommandBuffer commandBuffer = %p, VkStencilFaceFlags faceMask = %d, uint32_t reference = %d)", |
| 1801 | commandBuffer, int(faceMask), int(reference)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1802 | |
| 1803 | vk::Cast(commandBuffer)->setStencilReference(faceMask, reference); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1804 | } |
| 1805 | |
| 1806 | 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) |
| 1807 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1808 | TRACE("(VkCommandBuffer commandBuffer = %p, VkPipelineBindPoint pipelineBindPoint = %d, VkPipelineLayout layout = %p, uint32_t firstSet = %d, uint32_t descriptorSetCount = %d, const VkDescriptorSet* pDescriptorSets = %p, uint32_t dynamicOffsetCount = %d, const uint32_t* pDynamicOffsets = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1809 | commandBuffer, int(pipelineBindPoint), static_cast<void*>(layout), int(firstSet), int(descriptorSetCount), pDescriptorSets, int(dynamicOffsetCount), pDynamicOffsets); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1810 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1811 | vk::Cast(commandBuffer)->bindDescriptorSets(pipelineBindPoint, vk::Cast(layout), firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1812 | } |
| 1813 | |
| 1814 | VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) |
| 1815 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1816 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer buffer = %p, VkDeviceSize offset = %d, VkIndexType indexType = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1817 | commandBuffer, static_cast<void*>(buffer), int(offset), int(indexType)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1818 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1819 | vk::Cast(commandBuffer)->bindIndexBuffer(vk::Cast(buffer), offset, indexType); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1820 | } |
| 1821 | |
| 1822 | VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) |
| 1823 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1824 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t firstBinding = %d, uint32_t bindingCount = %d, const VkBuffer* pBuffers = %p, const VkDeviceSize* pOffsets = %p)", |
| 1825 | commandBuffer, int(firstBinding), int(bindingCount), pBuffers, pOffsets); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1826 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1827 | vk::Cast(commandBuffer)->bindVertexBuffers(firstBinding, bindingCount, pBuffers, pOffsets); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1828 | } |
| 1829 | |
| 1830 | VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) |
| 1831 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1832 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t vertexCount = %d, uint32_t instanceCount = %d, uint32_t firstVertex = %d, uint32_t firstInstance = %d)", |
| 1833 | commandBuffer, int(vertexCount), int(instanceCount), int(firstVertex), int(firstInstance)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1834 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1835 | vk::Cast(commandBuffer)->draw(vertexCount, instanceCount, firstVertex, firstInstance); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1836 | } |
| 1837 | |
| 1838 | VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) |
| 1839 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1840 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t indexCount = %d, uint32_t instanceCount = %d, uint32_t firstIndex = %d, int32_t vertexOffset = %d, uint32_t firstInstance = %d)", |
| 1841 | commandBuffer, int(indexCount), int(instanceCount), int(firstIndex), int(vertexOffset), int(firstInstance)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1842 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1843 | vk::Cast(commandBuffer)->drawIndexed(indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1844 | } |
| 1845 | |
| 1846 | VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) |
| 1847 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1848 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer buffer = %p, VkDeviceSize offset = %d, uint32_t drawCount = %d, uint32_t stride = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1849 | commandBuffer, static_cast<void*>(buffer), int(offset), int(drawCount), int(stride)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1850 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1851 | vk::Cast(commandBuffer)->drawIndirect(vk::Cast(buffer), offset, drawCount, stride); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1852 | } |
| 1853 | |
| 1854 | VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) |
| 1855 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1856 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer buffer = %p, VkDeviceSize offset = %d, uint32_t drawCount = %d, uint32_t stride = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1857 | commandBuffer, static_cast<void*>(buffer), int(offset), int(drawCount), int(stride)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1858 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1859 | vk::Cast(commandBuffer)->drawIndexedIndirect(vk::Cast(buffer), offset, drawCount, stride); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1860 | } |
| 1861 | |
| 1862 | VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) |
| 1863 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1864 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t groupCountX = %d, uint32_t groupCountY = %d, uint32_t groupCountZ = %d)", |
| 1865 | commandBuffer, int(groupCountX), int(groupCountY), int(groupCountZ)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1866 | |
| 1867 | vk::Cast(commandBuffer)->dispatch(groupCountX, groupCountY, groupCountZ); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1868 | } |
| 1869 | |
| 1870 | VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) |
| 1871 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1872 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer buffer = %p, VkDeviceSize offset = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1873 | commandBuffer, static_cast<void*>(buffer), int(offset)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1874 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1875 | vk::Cast(commandBuffer)->dispatchIndirect(vk::Cast(buffer), offset); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1876 | } |
| 1877 | |
| 1878 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) |
| 1879 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1880 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer srcBuffer = %p, VkBuffer dstBuffer = %p, uint32_t regionCount = %d, const VkBufferCopy* pRegions = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1881 | commandBuffer, static_cast<void*>(srcBuffer), static_cast<void*>(dstBuffer), int(regionCount), pRegions); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1882 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1883 | vk::Cast(commandBuffer)->copyBuffer(vk::Cast(srcBuffer), vk::Cast(dstBuffer), regionCount, pRegions); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1884 | } |
| 1885 | |
| 1886 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) |
| 1887 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1888 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage srcImage = %p, VkImageLayout srcImageLayout = %d, VkImage dstImage = %p, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkImageCopy* pRegions = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1889 | commandBuffer, static_cast<void*>(srcImage), srcImageLayout, static_cast<void*>(dstImage), dstImageLayout, int(regionCount), pRegions); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1890 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1891 | vk::Cast(commandBuffer)->copyImage(vk::Cast(srcImage), srcImageLayout, vk::Cast(dstImage), dstImageLayout, regionCount, pRegions); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1892 | } |
| 1893 | |
| 1894 | VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter) |
| 1895 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1896 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage srcImage = %p, VkImageLayout srcImageLayout = %d, VkImage dstImage = %p, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkImageBlit* pRegions = %p, VkFilter filter = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1897 | commandBuffer, static_cast<void*>(srcImage), srcImageLayout, static_cast<void*>(dstImage), dstImageLayout, int(regionCount), pRegions, filter); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1898 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1899 | vk::Cast(commandBuffer)->blitImage(vk::Cast(srcImage), srcImageLayout, vk::Cast(dstImage), dstImageLayout, regionCount, pRegions, filter); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1900 | } |
| 1901 | |
| 1902 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions) |
| 1903 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1904 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer srcBuffer = %p, VkImage dstImage = %p, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkBufferImageCopy* pRegions = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1905 | commandBuffer, static_cast<void*>(srcBuffer), static_cast<void*>(dstImage), dstImageLayout, int(regionCount), pRegions); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1906 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1907 | vk::Cast(commandBuffer)->copyBufferToImage(vk::Cast(srcBuffer), vk::Cast(dstImage), dstImageLayout, regionCount, pRegions); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1908 | } |
| 1909 | |
| 1910 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) |
| 1911 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1912 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage srcImage = %p, VkImageLayout srcImageLayout = %d, VkBuffer dstBuffer = %p, uint32_t regionCount = %d, const VkBufferImageCopy* pRegions = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1913 | commandBuffer, static_cast<void*>(srcImage), int(srcImageLayout), static_cast<void*>(dstBuffer), int(regionCount), pRegions); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1914 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1915 | vk::Cast(commandBuffer)->copyImageToBuffer(vk::Cast(srcImage), srcImageLayout, vk::Cast(dstBuffer), regionCount, pRegions); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1916 | } |
| 1917 | |
| 1918 | VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData) |
| 1919 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1920 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer dstBuffer = %p, VkDeviceSize dstOffset = %d, VkDeviceSize dataSize = %d, const void* pData = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1921 | commandBuffer, static_cast<void*>(dstBuffer), int(dstOffset), int(dataSize), pData); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1922 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1923 | vk::Cast(commandBuffer)->updateBuffer(vk::Cast(dstBuffer), dstOffset, dataSize, pData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1924 | } |
| 1925 | |
| 1926 | VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) |
| 1927 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1928 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer dstBuffer = %p, VkDeviceSize dstOffset = %d, VkDeviceSize size = %d, uint32_t data = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1929 | commandBuffer, static_cast<void*>(dstBuffer), int(dstOffset), int(size), data); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1930 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1931 | vk::Cast(commandBuffer)->fillBuffer(vk::Cast(dstBuffer), dstOffset, size, data); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1932 | } |
| 1933 | |
| 1934 | VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) |
| 1935 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1936 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage image = %p, VkImageLayout imageLayout = %d, const VkClearColorValue* pColor = %p, uint32_t rangeCount = %d, const VkImageSubresourceRange* pRanges = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1937 | commandBuffer, static_cast<void*>(image), int(imageLayout), pColor, int(rangeCount), pRanges); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1938 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1939 | vk::Cast(commandBuffer)->clearColorImage(vk::Cast(image), imageLayout, pColor, rangeCount, pRanges); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1940 | } |
| 1941 | |
| 1942 | VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges) |
| 1943 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1944 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage image = %p, VkImageLayout imageLayout = %d, const VkClearDepthStencilValue* pDepthStencil = %p, uint32_t rangeCount = %d, const VkImageSubresourceRange* pRanges = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1945 | commandBuffer, static_cast<void*>(image), int(imageLayout), pDepthStencil, int(rangeCount), pRanges); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1946 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1947 | vk::Cast(commandBuffer)->clearDepthStencilImage(vk::Cast(image), imageLayout, pDepthStencil, rangeCount, pRanges); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1948 | } |
| 1949 | |
| 1950 | VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects) |
| 1951 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1952 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t attachmentCount = %d, const VkClearAttachment* pAttachments = %p, uint32_t rectCount = %d, const VkClearRect* pRects = %p)", |
| 1953 | commandBuffer, int(attachmentCount), pAttachments, int(rectCount), pRects); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1954 | |
| 1955 | vk::Cast(commandBuffer)->clearAttachments(attachmentCount, pAttachments, rectCount, pRects); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1956 | } |
| 1957 | |
| 1958 | VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions) |
| 1959 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1960 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage srcImage = %p, VkImageLayout srcImageLayout = %d, VkImage dstImage = %p, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkImageResolve* pRegions = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1961 | commandBuffer, static_cast<void*>(srcImage), int(srcImageLayout), static_cast<void*>(dstImage), int(dstImageLayout), regionCount, pRegions); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1962 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1963 | vk::Cast(commandBuffer)->resolveImage(vk::Cast(srcImage), srcImageLayout, vk::Cast(dstImage), dstImageLayout, regionCount, pRegions); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1964 | } |
| 1965 | |
| 1966 | VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) |
| 1967 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1968 | TRACE("(VkCommandBuffer commandBuffer = %p, VkEvent event = %p, VkPipelineStageFlags stageMask = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1969 | commandBuffer, static_cast<void*>(event), int(stageMask)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1970 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1971 | vk::Cast(commandBuffer)->setEvent(vk::Cast(event), stageMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1972 | } |
| 1973 | |
| 1974 | VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) |
| 1975 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1976 | TRACE("(VkCommandBuffer commandBuffer = %p, VkEvent event = %p, VkPipelineStageFlags stageMask = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 1977 | commandBuffer, static_cast<void*>(event), int(stageMask)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1978 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1979 | vk::Cast(commandBuffer)->resetEvent(vk::Cast(event), stageMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1980 | } |
| 1981 | |
| 1982 | 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) |
| 1983 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1984 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t eventCount = %d, const VkEvent* pEvents = %p, VkPipelineStageFlags srcStageMask = 0x%x, VkPipelineStageFlags dstStageMask = 0x%x, uint32_t memoryBarrierCount = %d, const VkMemoryBarrier* pMemoryBarriers = %p, uint32_t bufferMemoryBarrierCount = %d, const VkBufferMemoryBarrier* pBufferMemoryBarriers = %p, uint32_t imageMemoryBarrierCount = %d, const VkImageMemoryBarrier* pImageMemoryBarriers = %p)", |
| 1985 | commandBuffer, int(eventCount), pEvents, int(srcStageMask), int(dstStageMask), int(memoryBarrierCount), pMemoryBarriers, int(bufferMemoryBarrierCount), pBufferMemoryBarriers, int(imageMemoryBarrierCount), pImageMemoryBarriers); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1986 | |
| 1987 | vk::Cast(commandBuffer)->waitEvents(eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1988 | } |
| 1989 | |
| 1990 | 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) |
| 1991 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1992 | TRACE("(VkCommandBuffer commandBuffer = %p, VkPipelineStageFlags srcStageMask = 0x%x, VkPipelineStageFlags dstStageMask = 0x%x, VkDependencyFlags dependencyFlags = %d, uint32_t memoryBarrierCount = %d, onst VkMemoryBarrier* pMemoryBarriers = %p," |
| 1993 | " uint32_t bufferMemoryBarrierCount = %d, const VkBufferMemoryBarrier* pBufferMemoryBarriers = %p, uint32_t imageMemoryBarrierCount = %d, const VkImageMemoryBarrier* pImageMemoryBarriers = %p)", |
| 1994 | commandBuffer, int(srcStageMask), int(dstStageMask), dependencyFlags, int(memoryBarrierCount), pMemoryBarriers, int(bufferMemoryBarrierCount), pBufferMemoryBarriers, int(imageMemoryBarrierCount), pImageMemoryBarriers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1995 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 1996 | vk::Cast(commandBuffer)->pipelineBarrier(srcStageMask, dstStageMask, dependencyFlags, |
| 1997 | memoryBarrierCount, pMemoryBarriers, |
| 1998 | bufferMemoryBarrierCount, pBufferMemoryBarriers, |
| 1999 | imageMemoryBarrierCount, pImageMemoryBarriers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2000 | } |
| 2001 | |
| 2002 | VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) |
| 2003 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2004 | TRACE("(VkCommandBuffer commandBuffer = %p, VkQueryPool queryPool = %p, uint32_t query = %d, VkQueryControlFlags flags = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2005 | commandBuffer, static_cast<void*>(queryPool), query, int(flags)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2006 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2007 | vk::Cast(commandBuffer)->beginQuery(vk::Cast(queryPool), query, flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2008 | } |
| 2009 | |
| 2010 | VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query) |
| 2011 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2012 | TRACE("(VkCommandBuffer commandBuffer = %p, VkQueryPool queryPool = %p, uint32_t query = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2013 | commandBuffer, static_cast<void*>(queryPool), int(query)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2014 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2015 | vk::Cast(commandBuffer)->endQuery(vk::Cast(queryPool), query); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2016 | } |
| 2017 | |
| 2018 | VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) |
| 2019 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2020 | TRACE("(VkCommandBuffer commandBuffer = %p, VkQueryPool queryPool = %p, uint32_t firstQuery = %d, uint32_t queryCount = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2021 | commandBuffer, static_cast<void*>(queryPool), int(firstQuery), int(queryCount)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2022 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2023 | vk::Cast(commandBuffer)->resetQueryPool(vk::Cast(queryPool), firstQuery, queryCount); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2024 | } |
| 2025 | |
| 2026 | VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) |
| 2027 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2028 | TRACE("(VkCommandBuffer commandBuffer = %p, VkPipelineStageFlagBits pipelineStage = %d, VkQueryPool queryPool = %p, uint32_t query = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2029 | commandBuffer, int(pipelineStage), static_cast<void*>(queryPool), int(query)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2030 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2031 | vk::Cast(commandBuffer)->writeTimestamp(pipelineStage, vk::Cast(queryPool), query); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2032 | } |
| 2033 | |
| 2034 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) |
| 2035 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2036 | TRACE("(VkCommandBuffer commandBuffer = %p, VkQueryPool queryPool = %p, uint32_t firstQuery = %d, uint32_t queryCount = %d, VkBuffer dstBuffer = %p, VkDeviceSize dstOffset = %d, VkDeviceSize stride = %d, VkQueryResultFlags flags = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2037 | commandBuffer, static_cast<void*>(queryPool), int(firstQuery), int(queryCount), static_cast<void*>(dstBuffer), int(dstOffset), int(stride), int(flags)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2038 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2039 | vk::Cast(commandBuffer)->copyQueryPoolResults(vk::Cast(queryPool), firstQuery, queryCount, vk::Cast(dstBuffer), dstOffset, stride, flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2040 | } |
| 2041 | |
| 2042 | VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues) |
| 2043 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2044 | TRACE("(VkCommandBuffer commandBuffer = %p, VkPipelineLayout layout = %p, VkShaderStageFlags stageFlags = %d, uint32_t offset = %d, uint32_t size = %d, const void* pValues = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2045 | commandBuffer, static_cast<void*>(layout), stageFlags, offset, size, pValues); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2046 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2047 | vk::Cast(commandBuffer)->pushConstants(vk::Cast(layout), stageFlags, offset, size, pValues); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2048 | } |
| 2049 | |
| 2050 | VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents) |
| 2051 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2052 | TRACE("(VkCommandBuffer commandBuffer = %p, const VkRenderPassBeginInfo* pRenderPassBegin = %p, VkSubpassContents contents = %d)", |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 2053 | commandBuffer, pRenderPassBegin, contents); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2054 | |
Alexis Hetu | 026ceef | 2019-05-07 17:35:11 -0400 | [diff] [blame] | 2055 | const VkBaseInStructure* renderPassBeginInfo = reinterpret_cast<const VkBaseInStructure*>(pRenderPassBegin->pNext); |
| 2056 | while(renderPassBeginInfo) |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2057 | { |
Alexis Hetu | 026ceef | 2019-05-07 17:35:11 -0400 | [diff] [blame] | 2058 | switch(renderPassBeginInfo->sType) |
| 2059 | { |
| 2060 | case VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO: |
Chris Forbes | 3e51144 | 2019-05-09 08:38:59 -0700 | [diff] [blame] | 2061 | // This extension controls which render area is used on which physical device, |
| 2062 | // in order to distribute rendering between multiple physical devices. |
Alexis Hetu | 026ceef | 2019-05-07 17:35:11 -0400 | [diff] [blame] | 2063 | // SwiftShader only has a single physical device, so this extension does nothing in this case. |
| 2064 | break; |
| 2065 | default: |
| 2066 | UNIMPLEMENTED("renderPassBeginInfo->sType"); |
| 2067 | break; |
| 2068 | } |
| 2069 | |
| 2070 | renderPassBeginInfo = renderPassBeginInfo->pNext; |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2071 | } |
| 2072 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2073 | vk::Cast(commandBuffer)->beginRenderPass(vk::Cast(pRenderPassBegin->renderPass), vk::Cast(pRenderPassBegin->framebuffer), |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2074 | pRenderPassBegin->renderArea, pRenderPassBegin->clearValueCount, |
| 2075 | pRenderPassBegin->pClearValues, contents); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2076 | } |
| 2077 | |
| 2078 | VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) |
| 2079 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2080 | TRACE("(VkCommandBuffer commandBuffer = %p, VkSubpassContents contents = %d)", |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2081 | commandBuffer, contents); |
| 2082 | |
| 2083 | vk::Cast(commandBuffer)->nextSubpass(contents); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2084 | } |
| 2085 | |
| 2086 | VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer) |
| 2087 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2088 | TRACE("(VkCommandBuffer commandBuffer = %p)", commandBuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2089 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2090 | vk::Cast(commandBuffer)->endRenderPass(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2091 | } |
| 2092 | |
| 2093 | VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) |
| 2094 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2095 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t commandBufferCount = %d, const VkCommandBuffer* pCommandBuffers = %p)", |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2096 | commandBuffer, commandBufferCount, pCommandBuffers); |
| 2097 | |
| 2098 | vk::Cast(commandBuffer)->executeCommands(commandBufferCount, pCommandBuffers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2099 | } |
| 2100 | |
| 2101 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t* pApiVersion) |
| 2102 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2103 | TRACE("(uint32_t* pApiVersion = %p)", pApiVersion); |
Nicolas Capens | ee841c5 | 2018-11-13 14:18:26 -0500 | [diff] [blame] | 2104 | *pApiVersion = vk::API_VERSION; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2105 | return VK_SUCCESS; |
| 2106 | } |
| 2107 | |
| 2108 | VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos) |
| 2109 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2110 | TRACE("(VkDevice device = %p, uint32_t bindInfoCount = %d, const VkBindBufferMemoryInfo* pBindInfos = %p)", |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 2111 | device, bindInfoCount, pBindInfos); |
| 2112 | |
| 2113 | for(uint32_t i = 0; i < bindInfoCount; i++) |
| 2114 | { |
| 2115 | if(pBindInfos[i].pNext) |
| 2116 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2117 | UNIMPLEMENTED("pBindInfos[%d].pNext", i); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 2118 | } |
| 2119 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2120 | vk::Cast(pBindInfos[i].buffer)->bind(vk::Cast(pBindInfos[i].memory), pBindInfos[i].memoryOffset); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 2121 | } |
| 2122 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2123 | return VK_SUCCESS; |
| 2124 | } |
| 2125 | |
| 2126 | VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos) |
| 2127 | { |
Alexis Hetu | f18f0c1 | 2019-05-07 14:34:15 -0400 | [diff] [blame] | 2128 | TRACE("(VkDevice device = %p, uint32_t bindInfoCount = %d, const VkBindImageMemoryInfo* pBindInfos = %p)", |
| 2129 | device, bindInfoCount, pBindInfos); |
Nicolas Capens | 71c012b | 2019-05-22 13:31:52 -0400 | [diff] [blame] | 2130 | |
Alexis Hetu | f18f0c1 | 2019-05-07 14:34:15 -0400 | [diff] [blame] | 2131 | for(uint32_t i = 0; i < bindInfoCount; i++) |
| 2132 | { |
| 2133 | if(pBindInfos[i].pNext) |
| 2134 | { |
| 2135 | UNIMPLEMENTED("pBindInfos[%d].pNext", i); |
| 2136 | } |
| 2137 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2138 | vk::Cast(pBindInfos[i].image)->bind(vk::Cast(pBindInfos[i].memory), pBindInfos[i].memoryOffset); |
Alexis Hetu | f18f0c1 | 2019-05-07 14:34:15 -0400 | [diff] [blame] | 2139 | } |
| 2140 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2141 | return VK_SUCCESS; |
| 2142 | } |
| 2143 | |
| 2144 | VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures) |
| 2145 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2146 | TRACE("(VkDevice device = %p, uint32_t heapIndex = %d, uint32_t localDeviceIndex = %d, uint32_t remoteDeviceIndex = %d, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2147 | device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures); |
| 2148 | |
Nicolas Capens | 5028a58 | 2018-11-13 15:03:35 -0500 | [diff] [blame] | 2149 | ASSERT(localDeviceIndex != remoteDeviceIndex); // "localDeviceIndex must not equal remoteDeviceIndex" |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2150 | UNREACHABLE("remoteDeviceIndex: %d", int(remoteDeviceIndex)); // Only one physical device is supported, and since the device indexes can't be equal, this should never be called. |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2151 | } |
| 2152 | |
| 2153 | VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask) |
| 2154 | { |
Alexis Hetu | 026ceef | 2019-05-07 17:35:11 -0400 | [diff] [blame] | 2155 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t deviceMask = %d", commandBuffer, deviceMask); |
| 2156 | |
| 2157 | vk::Cast(commandBuffer)->setDeviceMask(deviceMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2158 | } |
| 2159 | |
| 2160 | 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) |
| 2161 | { |
Chris Forbes | 4a4c259 | 2019-05-13 08:53:36 -0700 | [diff] [blame] | 2162 | TRACE("(VkCommandBuffer commandBuffer = %p, baseGroupX = %u, baseGroupY = %u, baseGroupZ = %u, groupCountX = %u, groupCountY = %u, groupCountZ = %u)", |
| 2163 | commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ); |
| 2164 | |
| 2165 | vk::Cast(commandBuffer)->dispatchBase(baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2166 | } |
| 2167 | |
| 2168 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties) |
| 2169 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2170 | TRACE("VkInstance instance = %p, uint32_t* pPhysicalDeviceGroupCount = %p, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties = %p", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2171 | instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties); |
| 2172 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 2173 | return vk::Cast(instance)->getPhysicalDeviceGroups(pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2174 | } |
| 2175 | |
| 2176 | VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) |
| 2177 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2178 | TRACE("(VkDevice device = %p, const VkImageMemoryRequirementsInfo2* pInfo = %p, VkMemoryRequirements2* pMemoryRequirements = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2179 | device, pInfo, pMemoryRequirements); |
| 2180 | |
Alexis Hetu | 42761d2 | 2019-04-08 11:25:59 -0400 | [diff] [blame] | 2181 | if(pInfo->pNext) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2182 | { |
Alexis Hetu | 42761d2 | 2019-04-08 11:25:59 -0400 | [diff] [blame] | 2183 | UNIMPLEMENTED("pInfo->pNext"); |
| 2184 | } |
| 2185 | |
| 2186 | VkBaseOutStructure* extensionRequirements = reinterpret_cast<VkBaseOutStructure*>(pMemoryRequirements->pNext); |
| 2187 | while(extensionRequirements) |
| 2188 | { |
| 2189 | switch(extensionRequirements->sType) |
| 2190 | { |
| 2191 | case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: |
| 2192 | { |
| 2193 | auto& requirements = *reinterpret_cast<VkMemoryDedicatedRequirements*>(extensionRequirements); |
| 2194 | requirements.prefersDedicatedAllocation = VK_FALSE; |
| 2195 | requirements.requiresDedicatedAllocation = VK_FALSE; |
| 2196 | } |
| 2197 | break; |
| 2198 | default: |
| 2199 | UNIMPLEMENTED("extensionRequirements->sType"); |
| 2200 | break; |
| 2201 | } |
| 2202 | |
| 2203 | extensionRequirements = extensionRequirements->pNext; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2204 | } |
| 2205 | |
| 2206 | vkGetImageMemoryRequirements(device, pInfo->image, &(pMemoryRequirements->memoryRequirements)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2207 | } |
| 2208 | |
| 2209 | VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) |
| 2210 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2211 | TRACE("(VkDevice device = %p, const VkBufferMemoryRequirementsInfo2* pInfo = %p, VkMemoryRequirements2* pMemoryRequirements = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2212 | device, pInfo, pMemoryRequirements); |
| 2213 | |
Alexis Hetu | 1e6a989 | 2019-03-15 12:12:00 -0400 | [diff] [blame] | 2214 | if(pInfo->pNext) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2215 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2216 | UNIMPLEMENTED("pInfo->pNext"); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2217 | } |
| 2218 | |
Alexis Hetu | 1e6a989 | 2019-03-15 12:12:00 -0400 | [diff] [blame] | 2219 | VkBaseOutStructure* extensionRequirements = reinterpret_cast<VkBaseOutStructure*>(pMemoryRequirements->pNext); |
| 2220 | while(extensionRequirements) |
| 2221 | { |
| 2222 | switch(extensionRequirements->sType) |
| 2223 | { |
| 2224 | case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: |
| 2225 | { |
| 2226 | auto& requirements = *reinterpret_cast<VkMemoryDedicatedRequirements*>(extensionRequirements); |
| 2227 | requirements.prefersDedicatedAllocation = VK_FALSE; |
| 2228 | requirements.requiresDedicatedAllocation = VK_FALSE; |
| 2229 | } |
| 2230 | break; |
| 2231 | default: |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2232 | UNIMPLEMENTED("extensionRequirements->sType"); |
Alexis Hetu | 1e6a989 | 2019-03-15 12:12:00 -0400 | [diff] [blame] | 2233 | break; |
| 2234 | } |
| 2235 | |
| 2236 | extensionRequirements = extensionRequirements->pNext; |
| 2237 | } |
| 2238 | |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2239 | vkGetBufferMemoryRequirements(device, pInfo->buffer, &(pMemoryRequirements->memoryRequirements)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2240 | } |
| 2241 | |
| 2242 | VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements) |
| 2243 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2244 | TRACE("(VkDevice device = %p, const VkImageSparseMemoryRequirementsInfo2* pInfo = %p, uint32_t* pSparseMemoryRequirementCount = %p, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2245 | device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 2246 | |
| 2247 | if(pInfo->pNext || pSparseMemoryRequirements->pNext) |
| 2248 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2249 | UNIMPLEMENTED("pInfo->pNext || pSparseMemoryRequirements->pNext"); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2250 | } |
| 2251 | |
| 2252 | vkGetImageSparseMemoryRequirements(device, pInfo->image, pSparseMemoryRequirementCount, &(pSparseMemoryRequirements->memoryRequirements)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2253 | } |
| 2254 | |
| 2255 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures) |
| 2256 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2257 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceFeatures2* pFeatures = %p)", physicalDevice, pFeatures); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2258 | |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2259 | VkBaseOutStructure* extensionFeatures = reinterpret_cast<VkBaseOutStructure*>(pFeatures->pNext); |
| 2260 | while(extensionFeatures) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2261 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2262 | switch(extensionFeatures->sType) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2263 | { |
| 2264 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: |
| 2265 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2266 | auto& features = *reinterpret_cast<VkPhysicalDeviceSamplerYcbcrConversionFeatures*>(extensionFeatures); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2267 | vk::Cast(physicalDevice)->getFeatures(&features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2268 | } |
| 2269 | break; |
| 2270 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: |
| 2271 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2272 | auto& features = *reinterpret_cast<VkPhysicalDevice16BitStorageFeatures*>(extensionFeatures); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2273 | vk::Cast(physicalDevice)->getFeatures(&features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2274 | } |
| 2275 | break; |
| 2276 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: |
| 2277 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2278 | auto& features = *reinterpret_cast<VkPhysicalDeviceVariablePointerFeatures*>(extensionFeatures); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2279 | vk::Cast(physicalDevice)->getFeatures(&features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2280 | } |
| 2281 | break; |
| 2282 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR: |
| 2283 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2284 | auto& features = *reinterpret_cast<VkPhysicalDevice8BitStorageFeaturesKHR*>(extensionFeatures); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2285 | vk::Cast(physicalDevice)->getFeatures(&features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2286 | } |
| 2287 | break; |
| 2288 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: |
| 2289 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2290 | auto& features = *reinterpret_cast<VkPhysicalDeviceMultiviewFeatures*>(extensionFeatures); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2291 | vk::Cast(physicalDevice)->getFeatures(&features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2292 | } |
| 2293 | break; |
| 2294 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES: |
| 2295 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2296 | auto& features = *reinterpret_cast<VkPhysicalDeviceProtectedMemoryFeatures*>(extensionFeatures); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2297 | vk::Cast(physicalDevice)->getFeatures(&features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2298 | } |
| 2299 | break; |
Chris Forbes | 6408c55 | 2019-04-15 12:59:34 -0700 | [diff] [blame] | 2300 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES: |
| 2301 | { |
| 2302 | auto& features = *reinterpret_cast<VkPhysicalDeviceShaderDrawParameterFeatures*>(extensionFeatures); |
| 2303 | vk::Cast(physicalDevice)->getFeatures(&features); |
| 2304 | } |
| 2305 | break; |
Chris Forbes | c0c6ccf | 2019-05-17 17:38:19 -0700 | [diff] [blame] | 2306 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: |
| 2307 | ASSERT(!HasExtensionProperty(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME, deviceExtensionProperties, |
| 2308 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2309 | break; |
| 2310 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT: |
| 2311 | ASSERT(!HasExtensionProperty(VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME, deviceExtensionProperties, |
| 2312 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2313 | break; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2314 | default: |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2315 | // "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]" |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2316 | UNIMPLEMENTED("extensionFeatures->sType"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here. |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2317 | break; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2318 | } |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2319 | |
| 2320 | extensionFeatures = extensionFeatures->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2321 | } |
| 2322 | |
| 2323 | vkGetPhysicalDeviceFeatures(physicalDevice, &(pFeatures->features)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2324 | } |
| 2325 | |
| 2326 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties) |
| 2327 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2328 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceProperties2* pProperties = %p)", physicalDevice, pProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2329 | |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2330 | VkBaseOutStructure* extensionProperties = reinterpret_cast<VkBaseOutStructure*>(pProperties->pNext); |
| 2331 | while(extensionProperties) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2332 | { |
Hernan Liatis | 83a3eb4 | 2019-04-29 17:16:10 -0700 | [diff] [blame] | 2333 | // Casting to a long since some structures, such as VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID |
| 2334 | // are not enumerated in the official Vulkan header |
| 2335 | switch((long)(extensionProperties->sType)) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2336 | { |
| 2337 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES: |
| 2338 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2339 | auto& properties = *reinterpret_cast<VkPhysicalDeviceIDProperties*>(extensionProperties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2340 | vk::Cast(physicalDevice)->getProperties(&properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2341 | } |
| 2342 | break; |
| 2343 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES: |
| 2344 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2345 | auto& properties = *reinterpret_cast<VkPhysicalDeviceMaintenance3Properties*>(extensionProperties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2346 | vk::Cast(physicalDevice)->getProperties(&properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2347 | } |
| 2348 | break; |
| 2349 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES: |
| 2350 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2351 | auto& properties = *reinterpret_cast<VkPhysicalDeviceMultiviewProperties*>(extensionProperties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2352 | vk::Cast(physicalDevice)->getProperties(&properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2353 | } |
| 2354 | break; |
| 2355 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: |
| 2356 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2357 | auto& properties = *reinterpret_cast<VkPhysicalDevicePointClippingProperties*>(extensionProperties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2358 | vk::Cast(physicalDevice)->getProperties(&properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2359 | } |
| 2360 | break; |
| 2361 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES: |
| 2362 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2363 | auto& properties = *reinterpret_cast<VkPhysicalDeviceProtectedMemoryProperties*>(extensionProperties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2364 | vk::Cast(physicalDevice)->getProperties(&properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2365 | } |
| 2366 | break; |
| 2367 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES: |
| 2368 | { |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2369 | auto& properties = *reinterpret_cast<VkPhysicalDeviceSubgroupProperties*>(extensionProperties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2370 | vk::Cast(physicalDevice)->getProperties(&properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2371 | } |
| 2372 | break; |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 2373 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT: |
| 2374 | // Explicitly ignored, since VK_EXT_sample_locations is not supported |
| 2375 | ASSERT(!HasExtensionProperty(VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME, deviceExtensionProperties, |
| 2376 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2377 | break; |
Alexis Hetu | d5ed0a3 | 2019-05-07 16:07:34 -0400 | [diff] [blame] | 2378 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT: |
| 2379 | ASSERT(!HasExtensionProperty(VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME, deviceExtensionProperties, |
| 2380 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2381 | break; |
Hernan Liatis | 83a3eb4 | 2019-04-29 17:16:10 -0700 | [diff] [blame] | 2382 | #ifdef __ANDROID__ |
| 2383 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: |
| 2384 | { |
| 2385 | auto& properties = *reinterpret_cast<VkPhysicalDevicePresentationPropertiesANDROID*>(extensionProperties); |
| 2386 | vk::Cast(physicalDevice)->getProperties(&properties); |
| 2387 | } |
| 2388 | break; |
| 2389 | #endif |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2390 | default: |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2391 | // "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]" |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2392 | UNIMPLEMENTED("extensionProperties->sType"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here. |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2393 | break; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2394 | } |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2395 | |
| 2396 | extensionProperties = extensionProperties->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2397 | } |
| 2398 | |
| 2399 | vkGetPhysicalDeviceProperties(physicalDevice, &(pProperties->properties)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2400 | } |
| 2401 | |
| 2402 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties) |
| 2403 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2404 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkFormat format = %d, VkFormatProperties2* pFormatProperties = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2405 | physicalDevice, format, pFormatProperties); |
| 2406 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2407 | if(pFormatProperties->pNext) |
| 2408 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2409 | UNIMPLEMENTED("pFormatProperties->pNext"); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2410 | } |
| 2411 | |
| 2412 | vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &(pFormatProperties->formatProperties)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2413 | } |
| 2414 | |
| 2415 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties) |
| 2416 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2417 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo = %p, VkImageFormatProperties2* pImageFormatProperties = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2418 | physicalDevice, pImageFormatInfo, pImageFormatProperties); |
| 2419 | |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 2420 | const VkBaseInStructure* extensionFormatInfo = reinterpret_cast<const VkBaseInStructure*>(pImageFormatInfo->pNext); |
| 2421 | |
| 2422 | const VkExternalMemoryHandleTypeFlagBits* handleType = nullptr; |
| 2423 | while(extensionFormatInfo) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2424 | { |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 2425 | switch(extensionFormatInfo->sType) |
| 2426 | { |
| 2427 | case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR: |
| 2428 | { |
| 2429 | // Explicitly ignored, since VK_KHR_image_format_list is not supported |
| 2430 | ASSERT(!HasExtensionProperty(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME, deviceExtensionProperties, |
| 2431 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2432 | } |
| 2433 | break; |
| 2434 | case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO_EXT: |
| 2435 | { |
| 2436 | // Explicitly ignored, since VK_EXT_separate_stencil_usage is not supported |
| 2437 | ASSERT(!HasExtensionProperty(VK_EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME, deviceExtensionProperties, |
| 2438 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2439 | } |
| 2440 | break; |
| 2441 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO: |
| 2442 | { |
| 2443 | const VkPhysicalDeviceExternalImageFormatInfo* imageFormatInfo = reinterpret_cast<const VkPhysicalDeviceExternalImageFormatInfo*>(extensionFormatInfo); |
| 2444 | handleType = &(imageFormatInfo->handleType); |
| 2445 | } |
| 2446 | break; |
| 2447 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT: |
| 2448 | { |
| 2449 | // Explicitly ignored, since VK_EXT_image_drm_format_modifier is not supported |
| 2450 | ASSERT(!HasExtensionProperty(VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME, deviceExtensionProperties, |
| 2451 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2452 | } |
| 2453 | break; |
| 2454 | default: |
| 2455 | UNIMPLEMENTED("extensionFormatInfo->sType"); |
| 2456 | break; |
| 2457 | } |
| 2458 | |
| 2459 | extensionFormatInfo = extensionFormatInfo->pNext; |
| 2460 | } |
| 2461 | |
| 2462 | VkBaseOutStructure* extensionProperties = reinterpret_cast<VkBaseOutStructure*>(pImageFormatProperties->pNext); |
| 2463 | |
| 2464 | while(extensionProperties) |
| 2465 | { |
| 2466 | switch(extensionProperties->sType) |
| 2467 | { |
| 2468 | case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES: |
| 2469 | { |
| 2470 | auto& properties = *reinterpret_cast<VkExternalImageFormatProperties*>(extensionProperties); |
| 2471 | vk::Cast(physicalDevice)->getProperties(handleType, &properties); |
| 2472 | } |
| 2473 | break; |
| 2474 | case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES: |
| 2475 | { |
| 2476 | auto& properties = *reinterpret_cast<VkSamplerYcbcrConversionImageFormatProperties*>(extensionProperties); |
| 2477 | vk::Cast(physicalDevice)->getProperties(&properties); |
| 2478 | } |
| 2479 | break; |
| 2480 | case VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD: |
| 2481 | { |
| 2482 | // Explicitly ignored, since VK_AMD_texture_gather_bias_lod is not supported |
| 2483 | ASSERT(!HasExtensionProperty(VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME, deviceExtensionProperties, |
| 2484 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2485 | } |
| 2486 | break; |
| 2487 | default: |
| 2488 | UNIMPLEMENTED("extensionProperties->sType"); |
| 2489 | break; |
| 2490 | } |
| 2491 | |
| 2492 | extensionProperties = extensionProperties->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2493 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2494 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2495 | return vkGetPhysicalDeviceImageFormatProperties(physicalDevice, |
| 2496 | pImageFormatInfo->format, |
| 2497 | pImageFormatInfo->type, |
| 2498 | pImageFormatInfo->tiling, |
| 2499 | pImageFormatInfo->usage, |
| 2500 | pImageFormatInfo->flags, |
| 2501 | &(pImageFormatProperties->imageFormatProperties)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2502 | } |
| 2503 | |
| 2504 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties) |
| 2505 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2506 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t* pQueueFamilyPropertyCount = %p, VkQueueFamilyProperties2* pQueueFamilyProperties = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2507 | physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 2508 | |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2509 | if(pQueueFamilyProperties && pQueueFamilyProperties->pNext) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2510 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2511 | UNIMPLEMENTED("pQueueFamilyProperties->pNext"); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2512 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2513 | |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2514 | vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, |
| 2515 | pQueueFamilyProperties ? &(pQueueFamilyProperties->queueFamilyProperties) : nullptr); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2516 | } |
| 2517 | |
| 2518 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties) |
| 2519 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2520 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceMemoryProperties2* pMemoryProperties = %p)", physicalDevice, pMemoryProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2521 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2522 | if(pMemoryProperties->pNext) |
| 2523 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2524 | UNIMPLEMENTED("pMemoryProperties->pNext"); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2525 | } |
| 2526 | |
| 2527 | vkGetPhysicalDeviceMemoryProperties(physicalDevice, &(pMemoryProperties->memoryProperties)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2528 | } |
| 2529 | |
| 2530 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties) |
| 2531 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2532 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo = %p, uint32_t* pPropertyCount = %p, VkSparseImageFormatProperties2* pProperties = %p)", |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2533 | physicalDevice, pFormatInfo, pPropertyCount, pProperties); |
| 2534 | |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2535 | if(pProperties && pProperties->pNext) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2536 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2537 | UNIMPLEMENTED("pProperties->pNext"); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2538 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2539 | |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2540 | vkGetPhysicalDeviceSparseImageFormatProperties(physicalDevice, pFormatInfo->format, pFormatInfo->type, |
| 2541 | pFormatInfo->samples, pFormatInfo->usage, pFormatInfo->tiling, |
| 2542 | pPropertyCount, pProperties ? &(pProperties->properties) : nullptr); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2543 | } |
| 2544 | |
| 2545 | VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) |
| 2546 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2547 | TRACE("(VkDevice device = %p, VkCommandPool commandPool = %p, VkCommandPoolTrimFlags flags = %d)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2548 | device, static_cast<void*>(commandPool), flags); |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 2549 | |
Alexis Hetu | cd610c9 | 2019-02-01 16:47:51 -0500 | [diff] [blame] | 2550 | vk::Cast(commandPool)->trim(flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2551 | } |
| 2552 | |
| 2553 | VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue) |
| 2554 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2555 | TRACE("(VkDevice device = %p, const VkDeviceQueueInfo2* pQueueInfo = %p, VkQueue* pQueue = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2556 | device, pQueueInfo, pQueue); |
| 2557 | |
| 2558 | if(pQueueInfo->pNext) |
| 2559 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2560 | UNIMPLEMENTED("pQueueInfo->pNext"); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2561 | } |
| 2562 | |
Nicolas Capens | 50b1059 | 2018-10-26 10:34:20 -0400 | [diff] [blame] | 2563 | // The only flag that can be set here is VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2564 | // According to the Vulkan spec, 4.3.1. Queue Family Properties: |
| 2565 | // "VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT specifies that the device queue is a |
| 2566 | // protected-capable queue. If the protected memory feature is not enabled, |
| 2567 | // the VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT bit of flags must not be set." |
| 2568 | if(pQueueInfo->flags) |
| 2569 | { |
| 2570 | *pQueue = VK_NULL_HANDLE; |
| 2571 | } |
| 2572 | else |
| 2573 | { |
| 2574 | vkGetDeviceQueue(device, pQueueInfo->queueFamilyIndex, pQueueInfo->queueIndex, pQueue); |
| 2575 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2576 | } |
| 2577 | |
| 2578 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion) |
| 2579 | { |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 2580 | TRACE("(VkDevice device = %p, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkSamplerYcbcrConversion* pYcbcrConversion = %p)", |
| 2581 | device, pCreateInfo, pAllocator, pYcbcrConversion); |
| 2582 | |
| 2583 | if(pCreateInfo->pNext) |
| 2584 | { |
| 2585 | UNIMPLEMENTED("pCreateInfo->pNext"); |
| 2586 | } |
| 2587 | |
| 2588 | return vk::SamplerYcbcrConversion::Create(pAllocator, pCreateInfo, pYcbcrConversion); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2589 | } |
| 2590 | |
| 2591 | VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator) |
| 2592 | { |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 2593 | TRACE("(VkDevice device = %p, VkSamplerYcbcrConversion ycbcrConversion = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2594 | device, static_cast<void*>(ycbcrConversion), pAllocator); |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 2595 | |
| 2596 | vk::destroy(ycbcrConversion, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2597 | } |
| 2598 | |
| 2599 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate) |
| 2600 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2601 | TRACE("(VkDevice device = %p, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate = %p)", |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 2602 | device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); |
| 2603 | |
| 2604 | if(pCreateInfo->pNext || pCreateInfo->flags || (pCreateInfo->templateType != VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET)) |
| 2605 | { |
Ben Clayton | 00424c1 | 2019-03-17 17:29:30 +0000 | [diff] [blame] | 2606 | UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags || (pCreateInfo->templateType != VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET)"); |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 2607 | } |
| 2608 | |
| 2609 | return vk::DescriptorUpdateTemplate::Create(pAllocator, pCreateInfo, pDescriptorUpdateTemplate); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2610 | } |
| 2611 | |
| 2612 | VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator) |
| 2613 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2614 | TRACE("(VkDevice device = %p, VkDescriptorUpdateTemplate descriptorUpdateTemplate = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2615 | device, static_cast<void*>(descriptorUpdateTemplate), pAllocator); |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 2616 | |
| 2617 | vk::destroy(descriptorUpdateTemplate, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2618 | } |
| 2619 | |
| 2620 | VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData) |
| 2621 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2622 | TRACE("(VkDevice device = %p, VkDescriptorSet descriptorSet = %p, VkDescriptorUpdateTemplate descriptorUpdateTemplate = %p, const void* pData = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2623 | device, static_cast<void*>(descriptorSet), static_cast<void*>(descriptorUpdateTemplate), pData); |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 2624 | |
Alexis Hetu | 6448bd6 | 2019-06-11 15:58:59 -0400 | [diff] [blame] | 2625 | vk::Cast(descriptorUpdateTemplate)->updateDescriptorSet(vk::Cast(device), descriptorSet, pData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2626 | } |
| 2627 | |
| 2628 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties) |
| 2629 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2630 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo = %p, VkExternalBufferProperties* pExternalBufferProperties = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2631 | physicalDevice, pExternalBufferInfo, pExternalBufferProperties); |
| 2632 | |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 2633 | vk::Cast(physicalDevice)->getProperties(pExternalBufferInfo, pExternalBufferProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2634 | } |
| 2635 | |
| 2636 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties) |
| 2637 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2638 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo = %p, VkExternalFenceProperties* pExternalFenceProperties = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2639 | physicalDevice, pExternalFenceInfo, pExternalFenceProperties); |
| 2640 | |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 2641 | vk::Cast(physicalDevice)->getProperties(pExternalFenceInfo, pExternalFenceProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2642 | } |
| 2643 | |
| 2644 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties) |
| 2645 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2646 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo = %p, VkExternalSemaphoreProperties* pExternalSemaphoreProperties = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2647 | physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties); |
| 2648 | |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 2649 | vk::Cast(physicalDevice)->getProperties(pExternalSemaphoreInfo, pExternalSemaphoreProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2650 | } |
| 2651 | |
| 2652 | VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport) |
| 2653 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2654 | TRACE("(VkDevice device = %p, const VkDescriptorSetLayoutCreateInfo* pCreateInfo = %p, VkDescriptorSetLayoutSupport* pSupport = %p)", |
Alexis Hetu | 1424ef6 | 2019-04-05 18:03:53 -0400 | [diff] [blame] | 2655 | device, pCreateInfo, pSupport); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2656 | |
| 2657 | vk::Cast(device)->getDescriptorSetLayoutSupport(pCreateInfo, pSupport); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2658 | } |
| 2659 | |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 2660 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 2661 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) |
| 2662 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2663 | TRACE("(VkInstance instance = %p, VkXlibSurfaceCreateInfoKHR* pCreateInfo = %p, VkAllocationCallbacks* pAllocator = %p, VkSurface* pSurface = %p)", |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 2664 | instance, pCreateInfo, pAllocator, pSurface); |
| 2665 | |
| 2666 | return vk::XlibSurfaceKHR::Create(pAllocator, pCreateInfo, pSurface); |
| 2667 | } |
Hernan Liatis | bd18d58 | 2019-05-29 15:38:58 -0700 | [diff] [blame] | 2668 | |
| 2669 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID) |
| 2670 | { |
| 2671 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t queueFamilyIndex = %d, Display* dpy = %p, VisualID visualID = %lu)", |
| 2672 | physicalDevice, int(queueFamilyIndex), dpy, visualID); |
| 2673 | |
| 2674 | return VK_TRUE; |
| 2675 | } |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 2676 | #endif |
| 2677 | |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 2678 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
| 2679 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) |
| 2680 | { |
| 2681 | TRACE("(VkInstance instance = %p, VkMacOSSurfaceCreateInfoMVK* pCreateInfo = %p, VkAllocationCallbacks* pAllocator = %p, VkSurface* pSurface = %p)", |
| 2682 | instance, pCreateInfo, pAllocator, pSurface); |
| 2683 | |
| 2684 | return vk::MacOSSurfaceMVK::Create(pAllocator, pCreateInfo, pSurface); |
| 2685 | } |
| 2686 | #endif |
| 2687 | |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 2688 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 2689 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface) |
| 2690 | { |
| 2691 | TRACE("(VkInstance instance = %p, VkWin32SurfaceCreateInfoKHR* pCreateInfo = %p, VkAllocationCallbacks* pAllocator = %p, VkSurface* pSurface = %p)", |
| 2692 | instance, pCreateInfo, pAllocator, pSurface); |
| 2693 | |
| 2694 | return vk::Win32SurfaceKHR::Create(pAllocator, pCreateInfo, pSurface); |
| 2695 | } |
| 2696 | #endif |
| 2697 | |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 2698 | #ifndef __ANDROID__ |
| 2699 | VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator) |
| 2700 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2701 | TRACE("(VkInstance instance = %p, VkSurfaceKHR surface = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2702 | instance, static_cast<void*>(surface), pAllocator); |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 2703 | |
| 2704 | vk::destroy(surface, pAllocator); |
| 2705 | } |
| 2706 | |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 2707 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported) |
| 2708 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2709 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t queueFamilyIndex = %d, VkSurface surface = %p, VKBool32* pSupported = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2710 | physicalDevice, int(queueFamilyIndex), static_cast<void*>(surface), pSupported); |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 2711 | |
| 2712 | *pSupported = VK_TRUE; |
| 2713 | return VK_SUCCESS; |
| 2714 | } |
| 2715 | |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 2716 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) |
| 2717 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2718 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkSurfaceKHR surface = %p, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2719 | physicalDevice, static_cast<void*>(surface), pSurfaceCapabilities); |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 2720 | |
| 2721 | vk::Cast(surface)->getSurfaceCapabilities(pSurfaceCapabilities); |
| 2722 | return VK_SUCCESS; |
| 2723 | } |
| 2724 | |
| 2725 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats) |
| 2726 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2727 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkSurfaceKHR surface = %p. uint32_t* pSurfaceFormatCount = %p, VkSurfaceFormatKHR* pSurfaceFormats = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2728 | physicalDevice, static_cast<void*>(surface), pSurfaceFormatCount, pSurfaceFormats); |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 2729 | |
| 2730 | if(!pSurfaceFormats) |
| 2731 | { |
| 2732 | *pSurfaceFormatCount = vk::Cast(surface)->getSurfaceFormatsCount(); |
| 2733 | return VK_SUCCESS; |
| 2734 | } |
| 2735 | |
| 2736 | return vk::Cast(surface)->getSurfaceFormats(pSurfaceFormatCount, pSurfaceFormats); |
| 2737 | } |
| 2738 | |
| 2739 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes) |
| 2740 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2741 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkSurfaceKHR surface = %p uint32_t* pPresentModeCount = %p, VkPresentModeKHR* pPresentModes = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2742 | physicalDevice, static_cast<void*>(surface), pPresentModeCount, pPresentModes); |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 2743 | |
| 2744 | if(!pPresentModes) |
| 2745 | { |
| 2746 | *pPresentModeCount = vk::Cast(surface)->getPresentModeCount(); |
| 2747 | return VK_SUCCESS; |
| 2748 | } |
| 2749 | |
| 2750 | return vk::Cast(surface)->getPresentModes(pPresentModeCount, pPresentModes); |
| 2751 | } |
| 2752 | |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 2753 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) |
| 2754 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2755 | TRACE("(VkDevice device = %p, const VkSwapchainCreateInfoKHR* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkSwapchainKHR* pSwapchain = %p)", |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 2756 | device, pCreateInfo, pAllocator, pSwapchain); |
| 2757 | |
Hernan Liatis | 43be716 | 2019-03-08 17:57:41 -0800 | [diff] [blame] | 2758 | if(pCreateInfo->oldSwapchain) |
| 2759 | { |
| 2760 | vk::Cast(pCreateInfo->oldSwapchain)->retire(); |
| 2761 | } |
| 2762 | |
Alexis Hetu | 63ae924 | 2019-06-06 13:52:15 -0400 | [diff] [blame] | 2763 | if(vk::Cast(pCreateInfo->surface)->hasAssociatedSwapchain()) |
Hernan Liatis | 43be716 | 2019-03-08 17:57:41 -0800 | [diff] [blame] | 2764 | { |
| 2765 | return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR; |
| 2766 | } |
| 2767 | |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 2768 | VkResult status = vk::SwapchainKHR::Create(pAllocator, pCreateInfo, pSwapchain); |
| 2769 | |
| 2770 | if(status != VK_SUCCESS) |
| 2771 | { |
| 2772 | return status; |
| 2773 | } |
| 2774 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2775 | auto swapchain = vk::Cast(*pSwapchain); |
| 2776 | status = swapchain->createImages(device, pCreateInfo); |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 2777 | |
| 2778 | if(status != VK_SUCCESS) |
| 2779 | { |
| 2780 | vk::destroy(*pSwapchain, pAllocator); |
| 2781 | return status; |
| 2782 | } |
| 2783 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2784 | vk::Cast(pCreateInfo->surface)->associateSwapchain(swapchain); |
Hernan Liatis | 43be716 | 2019-03-08 17:57:41 -0800 | [diff] [blame] | 2785 | |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 2786 | return VK_SUCCESS; |
| 2787 | } |
| 2788 | |
| 2789 | VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator) |
| 2790 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2791 | TRACE("(VkDevice device = %p, VkSwapchainKHR swapchain = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2792 | device, static_cast<void*>(swapchain), pAllocator); |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 2793 | |
| 2794 | vk::destroy(swapchain, pAllocator); |
| 2795 | } |
| 2796 | |
Hernan Liatis | d00375a | 2019-02-26 11:19:27 -0800 | [diff] [blame] | 2797 | VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages) |
| 2798 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2799 | TRACE("(VkDevice device = %p, VkSwapchainKHR swapchain = %p, uint32_t* pSwapchainImageCount = %p, VkImage* pSwapchainImages = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2800 | device, static_cast<void*>(swapchain), pSwapchainImageCount, pSwapchainImages); |
Hernan Liatis | d00375a | 2019-02-26 11:19:27 -0800 | [diff] [blame] | 2801 | |
| 2802 | if(!pSwapchainImages) |
| 2803 | { |
| 2804 | *pSwapchainImageCount = vk::Cast(swapchain)->getImageCount(); |
| 2805 | return VK_SUCCESS; |
| 2806 | } |
| 2807 | |
| 2808 | return vk::Cast(swapchain)->getImages(pSwapchainImageCount, pSwapchainImages); |
| 2809 | } |
| 2810 | |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 2811 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex) |
| 2812 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2813 | TRACE("(VkDevice device = %p, VkSwapchainKHR swapchain = %p, uint64_t timeout = %d, VkSemaphore semaphore = %p, VkFence fence = %p, uint32_t* pImageIndex = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2814 | device, static_cast<void*>(swapchain), int(timeout), static_cast<void*>(semaphore), static_cast<void*>(fence), pImageIndex); |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 2815 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2816 | return vk::Cast(swapchain)->getNextImage(timeout, vk::Cast(semaphore), vk::Cast(fence), pImageIndex); |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 2817 | } |
| 2818 | |
| 2819 | VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo) |
| 2820 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2821 | TRACE("(VkQueue queue = %p, const VkPresentInfoKHR* pPresentInfo = %p)", |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 2822 | queue, pPresentInfo); |
| 2823 | |
| 2824 | vk::Cast(queue)->present(pPresentInfo); |
| 2825 | |
| 2826 | return VK_SUCCESS; |
| 2827 | } |
Chris Forbes | f993de3 | 2019-04-15 09:45:34 -0700 | [diff] [blame] | 2828 | |
| 2829 | VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pDeviceGroupPresentCapabilities) |
| 2830 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2831 | TRACE("(VkDevice device = %p, VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities = %p)", |
Chris Forbes | f993de3 | 2019-04-15 09:45:34 -0700 | [diff] [blame] | 2832 | device, pDeviceGroupPresentCapabilities); |
| 2833 | |
| 2834 | for (int i = 0; i < VK_MAX_DEVICE_GROUP_SIZE; i++) |
| 2835 | { |
| 2836 | // The only real physical device in the presentation group is device 0, |
| 2837 | // and it can present to itself. |
| 2838 | pDeviceGroupPresentCapabilities->presentMask[i] = (i == 0) ? 1 : 0; |
| 2839 | } |
| 2840 | |
| 2841 | pDeviceGroupPresentCapabilities->modes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR; |
| 2842 | |
| 2843 | return VK_SUCCESS; |
| 2844 | } |
| 2845 | |
| 2846 | VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR *pModes) |
| 2847 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2848 | TRACE("(VkDevice device = %p, VkSurfaceKHR surface = %p, VkDeviceGroupPresentModeFlagsKHR *pModes = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2849 | device, static_cast<void*>(surface), pModes); |
Chris Forbes | f993de3 | 2019-04-15 09:45:34 -0700 | [diff] [blame] | 2850 | |
| 2851 | *pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR; |
| 2852 | return VK_SUCCESS; |
| 2853 | } |
| 2854 | |
Chris Forbes | b52384b | 2019-08-28 12:01:29 -0700 | [diff] [blame] | 2855 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pRectCount, VkRect2D* pRects) |
| 2856 | { |
| 2857 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkSurfaceKHR surface = %p, uint32_t* pRectCount = %p, VkRect2D* pRects = %p)", |
| 2858 | physicalDevice, static_cast<void*>(surface), pRectCount, pRects); |
| 2859 | |
| 2860 | return vk::Cast(surface)->getPresentRectangles(pRectCount, pRects); |
| 2861 | } |
| 2862 | |
| 2863 | |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 2864 | #endif // ! __ANDROID__ |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 2865 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 2866 | #ifdef __ANDROID__ |
| 2867 | |
| 2868 | VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage2ANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, VkSwapchainImageUsageFlagsANDROID swapchainUsage, uint64_t* grallocConsumerUsage, uint64_t* grallocProducerUsage) |
| 2869 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 2870 | TRACE("(VkDevice device = %p, VkFormat format = %d, VkImageUsageFlags imageUsage = %d, VkSwapchainImageUsageFlagsANDROID swapchainUsage = %d, uint64_t* grallocConsumerUsage = %p, uin64_t* grallocProducerUsage = %p)", |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 2871 | device, format, imageUsage, swapchainUsage, grallocConsumerUsage, grallocProducerUsage); |
| 2872 | |
Hernan Liatis | 788ea9f | 2019-05-01 11:10:36 -0700 | [diff] [blame] | 2873 | *grallocConsumerUsage = 0; |
| 2874 | *grallocProducerUsage = GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN; |
| 2875 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 2876 | return VK_SUCCESS; |
| 2877 | } |
| 2878 | |
| 2879 | VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int* grallocUsage) |
| 2880 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 2881 | TRACE("(VkDevice device = %p, VkFormat format = %d, VkImageUsageFlags imageUsage = %d, int* grallocUsage = %p)", |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 2882 | device, format, imageUsage, grallocUsage); |
| 2883 | |
Hernan Liatis | 3429bb5 | 2019-05-29 18:42:11 -0700 | [diff] [blame] | 2884 | *grallocUsage = GRALLOC_USAGE_SW_WRITE_OFTEN; |
| 2885 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 2886 | return VK_SUCCESS; |
| 2887 | } |
| 2888 | |
| 2889 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence) |
| 2890 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 2891 | TRACE("(VkDevice device = %p, VkImage image = %p, int nativeFenceFd = %d, VkSemaphore semaphore = %p, VkFence fence = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2892 | device, static_cast<void*>(image), nativeFenceFd, static_cast<void*>(semaphore), static_cast<void*>(fence)); |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 2893 | |
Hernan Liatis | d5f462c | 2019-05-24 15:45:05 -0700 | [diff] [blame] | 2894 | if(nativeFenceFd >= 0) |
| 2895 | { |
| 2896 | sync_wait(nativeFenceFd, -1); |
| 2897 | close(nativeFenceFd); |
| 2898 | } |
| 2899 | |
| 2900 | if(fence != VK_NULL_HANDLE) |
| 2901 | { |
| 2902 | vk::Cast(fence)->complete(); |
| 2903 | } |
| 2904 | |
| 2905 | if(semaphore != VK_NULL_HANDLE) |
| 2906 | { |
| 2907 | vk::Cast(semaphore)->signal(); |
| 2908 | } |
| 2909 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 2910 | return VK_SUCCESS; |
| 2911 | } |
| 2912 | |
| 2913 | VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int* pNativeFenceFd) |
| 2914 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 2915 | TRACE("(VkQueue queue = %p, uint32_t waitSemaphoreCount = %d, const VkSemaphore* pWaitSemaphores = %p, VkImage image = %p, int* pNativeFenceFd = %p)", |
Alexis Hetu | 2d77aea | 2019-06-17 13:43:50 -0400 | [diff] [blame] | 2916 | queue, waitSemaphoreCount, pWaitSemaphores, static_cast<void*>(image), pNativeFenceFd); |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 2917 | |
Hernan Liatis | d61595f | 2019-05-10 16:30:07 -0700 | [diff] [blame] | 2918 | // This is a hack to deal with screen tearing for now. |
| 2919 | // Need to correctly implement threading using VkSemaphore |
| 2920 | // to get rid of it. b/132458423 |
| 2921 | vkQueueWaitIdle(queue); |
| 2922 | |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 2923 | GrallocModule* grallocMod = GrallocModule::getInstance(); |
| 2924 | void* nativeBuffer; |
| 2925 | |
| 2926 | auto it = androidSwapchainMap.find(image); |
| 2927 | |
| 2928 | if (it == androidSwapchainMap.end()) |
| 2929 | ABORT("ANDROID: Swapchain image not found"); |
| 2930 | |
| 2931 | BackingMemory backmem = it->second; |
| 2932 | |
Chris Forbes | 4963b95 | 2019-05-29 14:37:57 -0700 | [diff] [blame] | 2933 | VkExtent3D extent = vk::Cast(image)->getMipLevelExtent(VK_IMAGE_ASPECT_COLOR_BIT, 0); |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 2934 | grallocMod->lock(backmem.nativeHandle, GRALLOC_USAGE_SW_WRITE_OFTEN, 0, 0, extent.width, extent.height, &nativeBuffer); |
| 2935 | |
Hernan Liatis | 3c73507 | 2019-06-10 15:07:18 -0700 | [diff] [blame] | 2936 | char* buffer = static_cast<char*>(backmem.imageMemory->getOffsetPointer(0)); |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 2937 | int imageRowBytes = vk::Cast(image)->rowPitchBytes(VK_IMAGE_ASPECT_COLOR_BIT, 0); |
| 2938 | int colorBytes = vk::Cast(image)->getFormat().bytes(); |
| 2939 | |
| 2940 | for(int i = 0; i < extent.height; i++) |
| 2941 | { |
| 2942 | memcpy((void*)((char*)nativeBuffer + (i * backmem.stride * colorBytes)), buffer + (i * imageRowBytes), imageRowBytes); |
| 2943 | } |
| 2944 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 2945 | return VK_SUCCESS; |
| 2946 | } |
| 2947 | #endif // __ANDROID__ |
| 2948 | |
Chris Forbes | 3d27f2e | 2018-09-26 09:24:39 -0700 | [diff] [blame] | 2949 | } |