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