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" |
Antonio Maiorano | 42fd159 | 2020-04-27 11:30:40 -0400 | [diff] [blame] | 19 | #include "VkConfig.hpp" |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 20 | #include "VkDescriptorPool.hpp" |
| 21 | #include "VkDescriptorSetLayout.hpp" |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 22 | #include "VkDescriptorUpdateTemplate.hpp" |
Antonio Maiorano | 42fd159 | 2020-04-27 11:30:40 -0400 | [diff] [blame] | 23 | #include "VkDestroy.hpp" |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 24 | #include "VkDevice.hpp" |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 25 | #include "VkDeviceMemory.hpp" |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 26 | #include "VkEvent.hpp" |
| 27 | #include "VkFence.hpp" |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 28 | #include "VkFramebuffer.hpp" |
Antonio Maiorano | 42fd159 | 2020-04-27 11:30:40 -0400 | [diff] [blame] | 29 | #include "VkGetProcAddress.hpp" |
Alexis Hetu | f62f375 | 2018-11-15 14:51:15 -0500 | [diff] [blame] | 30 | #include "VkImage.hpp" |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 31 | #include "VkImageView.hpp" |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 32 | #include "VkInstance.hpp" |
| 33 | #include "VkPhysicalDevice.hpp" |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 34 | #include "VkPipeline.hpp" |
Alexis Hetu | 18a8425 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 35 | #include "VkPipelineCache.hpp" |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 36 | #include "VkPipelineLayout.hpp" |
Alexis Hetu | 86f8bdb | 2019-01-22 12:07:24 -0500 | [diff] [blame] | 37 | #include "VkQueryPool.hpp" |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 38 | #include "VkQueue.hpp" |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 39 | #include "VkRenderPass.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" |
Sean Risser | e823bb0 | 2019-09-06 13:06:26 -0400 | [diff] [blame] | 43 | #include "VkStringify.hpp" |
Nicolas Capens | 50b1059 | 2018-10-26 10:34:20 -0400 | [diff] [blame] | 44 | |
Ben Clayton | 25e06e0 | 2020-02-07 11:19:08 +0000 | [diff] [blame] | 45 | #include "System/Debug.hpp" |
| 46 | |
Jonah Ryan-Davis | 215bc79 | 2019-10-31 17:23:49 -0400 | [diff] [blame] | 47 | #if defined(VK_USE_PLATFORM_METAL_EXT) || defined(VK_USE_PLATFORM_MACOS_MVK) |
Antonio Maiorano | 42fd159 | 2020-04-27 11:30:40 -0400 | [diff] [blame] | 48 | # include "WSI/MetalSurface.hpp" |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 49 | #endif |
| 50 | |
Ben Clayton | a9af883 | 2019-08-14 13:09:43 +0100 | [diff] [blame] | 51 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 52 | # include "WSI/XcbSurfaceKHR.hpp" |
Ben Clayton | a9af883 | 2019-08-14 13:09:43 +0100 | [diff] [blame] | 53 | #endif |
| 54 | |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 55 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 56 | # include "WSI/XlibSurfaceKHR.hpp" |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 57 | #endif |
| 58 | |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 59 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 60 | # include "WSI/Win32SurfaceKHR.hpp" |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 61 | #endif |
| 62 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 63 | #ifdef __ANDROID__ |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 64 | # include "commit.h" |
| 65 | # include "System/GrallocAndroid.hpp" |
| 66 | # include <android/log.h> |
Jason Macnak | 1de497c | 2020-04-08 11:31:50 -0700 | [diff] [blame] | 67 | # include <hardware/gralloc1.h> |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 68 | # include <sync/sync.h> |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 69 | #endif |
| 70 | |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 71 | #include "WSI/VkSwapchainKHR.hpp" |
| 72 | |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 73 | #include "Reactor/Nucleus.hpp" |
| 74 | |
Ben Clayton | 377573c | 2020-04-03 20:36:40 +0100 | [diff] [blame] | 75 | #include "marl/mutex.h" |
Alexis Hétu | 50038d6 | 2019-09-24 15:37:24 +0000 | [diff] [blame] | 76 | #include "marl/scheduler.h" |
| 77 | #include "marl/thread.h" |
Ben Clayton | 377573c | 2020-04-03 20:36:40 +0100 | [diff] [blame] | 78 | #include "marl/tsa.h" |
Alexis Hétu | 50038d6 | 2019-09-24 15:37:24 +0000 | [diff] [blame] | 79 | |
Ben Clayton | d6c6136 | 2019-08-14 18:16:01 +0100 | [diff] [blame] | 80 | #include "System/CPUID.hpp" |
| 81 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 82 | #include <algorithm> |
Chris Forbes | 3d27f2e | 2018-09-26 09:24:39 -0700 | [diff] [blame] | 83 | #include <cstring> |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 84 | #include <map> |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 85 | #include <string> |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 86 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 87 | namespace { |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 88 | |
Tim Van Patten | 9da287f | 2019-11-07 10:27:18 -0700 | [diff] [blame] | 89 | // Enable commit_id.py and #include commit.h for other platforms. |
| 90 | #if defined(__ANDROID__) && defined(ENABLE_BUILD_VERSION_OUTPUT) |
| 91 | void logBuildVersionInformation() |
| 92 | { |
| 93 | // TODO(b/144093703): Don't call __android_log_print() directly |
| 94 | __android_log_print(ANDROID_LOG_INFO, "SwiftShader", "SwiftShader Version: %s", SWIFTSHADER_VERSION_STRING); |
| 95 | } |
| 96 | #endif // __ANDROID__ && ENABLE_BUILD_VERSION_OUTPUT |
| 97 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 98 | bool HasExtensionProperty(const char *extensionName, const VkExtensionProperties *extensionProperties, uint32_t extensionPropertiesCount) |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 99 | { |
| 100 | for(uint32_t j = 0; j < extensionPropertiesCount; ++j) |
| 101 | { |
| 102 | if(strcmp(extensionName, extensionProperties[j].extensionName) == 0) |
| 103 | { |
| 104 | return true; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | return false; |
| 109 | } |
| 110 | |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 111 | // setReactorDefaultConfig() sets the default configuration for Vulkan's use of |
| 112 | // Reactor. |
| 113 | void setReactorDefaultConfig() |
| 114 | { |
| 115 | auto cfg = rr::Config::Edit() |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 116 | .set(rr::Optimization::Level::Default) |
| 117 | .clearOptimizationPasses() |
| 118 | .add(rr::Optimization::Pass::ScalarReplAggregates) |
| 119 | .add(rr::Optimization::Pass::SCCP) |
| 120 | .add(rr::Optimization::Pass::CFGSimplification) |
| 121 | .add(rr::Optimization::Pass::EarlyCSEPass) |
| 122 | .add(rr::Optimization::Pass::CFGSimplification) |
| 123 | .add(rr::Optimization::Pass::InstructionCombining); |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 124 | |
| 125 | rr::Nucleus::adjustDefaultConfig(cfg); |
| 126 | } |
| 127 | |
Ben Clayton | d6c6136 | 2019-08-14 18:16:01 +0100 | [diff] [blame] | 128 | void setCPUDefaults() |
| 129 | { |
| 130 | sw::CPUID::setEnableSSE4_1(true); |
| 131 | sw::CPUID::setEnableSSSE3(true); |
| 132 | sw::CPUID::setEnableSSE3(true); |
| 133 | sw::CPUID::setEnableSSE2(true); |
| 134 | sw::CPUID::setEnableSSE(true); |
| 135 | } |
| 136 | |
Ben Clayton | 6fff512 | 2019-10-03 16:41:21 +0100 | [diff] [blame] | 137 | std::shared_ptr<marl::Scheduler> getOrCreateScheduler() |
Alexis Hétu | 50038d6 | 2019-09-24 15:37:24 +0000 | [diff] [blame] | 138 | { |
Ben Clayton | 377573c | 2020-04-03 20:36:40 +0100 | [diff] [blame] | 139 | struct Scheduler |
Ben Clayton | 6fff512 | 2019-10-03 16:41:21 +0100 | [diff] [blame] | 140 | { |
Ben Clayton | 377573c | 2020-04-03 20:36:40 +0100 | [diff] [blame] | 141 | marl::mutex mutex; |
| 142 | std::weak_ptr<marl::Scheduler> weakptr GUARDED_BY(mutex); |
| 143 | }; |
| 144 | |
| 145 | static Scheduler scheduler; |
| 146 | |
| 147 | marl::lock lock(scheduler.mutex); |
| 148 | auto sptr = scheduler.weakptr.lock(); |
| 149 | if(!sptr) |
| 150 | { |
Ben Clayton | e817aaa | 2020-06-02 19:58:22 +0100 | [diff] [blame] | 151 | marl::Scheduler::Config cfg; |
| 152 | cfg.setWorkerThreadCount(std::min<size_t>(marl::Thread::numLogicalCPUs(), 16)); |
| 153 | cfg.setWorkerThreadInitializer([](int) { |
Ben Clayton | 6fff512 | 2019-10-03 16:41:21 +0100 | [diff] [blame] | 154 | sw::CPUID::setFlushToZero(true); |
| 155 | sw::CPUID::setDenormalsAreZero(true); |
| 156 | }); |
Ben Clayton | e817aaa | 2020-06-02 19:58:22 +0100 | [diff] [blame] | 157 | sptr = std::make_shared<marl::Scheduler>(cfg); |
Ben Clayton | 377573c | 2020-04-03 20:36:40 +0100 | [diff] [blame] | 158 | scheduler.weakptr = sptr; |
Ben Clayton | 6fff512 | 2019-10-03 16:41:21 +0100 | [diff] [blame] | 159 | } |
Ben Clayton | 377573c | 2020-04-03 20:36:40 +0100 | [diff] [blame] | 160 | return sptr; |
Alexis Hétu | 50038d6 | 2019-09-24 15:37:24 +0000 | [diff] [blame] | 161 | } |
| 162 | |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 163 | // initializeLibrary() is called by vkCreateInstance() to perform one-off global |
| 164 | // initialization of the swiftshader driver. |
| 165 | void initializeLibrary() |
| 166 | { |
| 167 | static bool doOnce = [] { |
Tim Van Patten | 9da287f | 2019-11-07 10:27:18 -0700 | [diff] [blame] | 168 | #if defined(__ANDROID__) && defined(ENABLE_BUILD_VERSION_OUTPUT) |
| 169 | logBuildVersionInformation(); |
| 170 | #endif // __ANDROID__ && ENABLE_BUILD_VERSION_OUTPUT |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 171 | setReactorDefaultConfig(); |
Ben Clayton | d6c6136 | 2019-08-14 18:16:01 +0100 | [diff] [blame] | 172 | setCPUDefaults(); |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 173 | return true; |
| 174 | }(); |
| 175 | (void)doOnce; |
| 176 | } |
| 177 | |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 178 | template<class T> |
| 179 | void ValidateRenderPassPNextChain(VkDevice device, const T *pCreateInfo) |
| 180 | { |
| 181 | const VkBaseInStructure *extensionCreateInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
| 182 | |
| 183 | while(extensionCreateInfo) |
| 184 | { |
| 185 | switch(extensionCreateInfo->sType) |
| 186 | { |
| 187 | case VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO: |
| 188 | { |
| 189 | const VkRenderPassInputAttachmentAspectCreateInfo *inputAttachmentAspectCreateInfo = reinterpret_cast<const VkRenderPassInputAttachmentAspectCreateInfo *>(extensionCreateInfo); |
| 190 | |
| 191 | for(uint32_t i = 0; i < inputAttachmentAspectCreateInfo->aspectReferenceCount; i++) |
| 192 | { |
| 193 | const auto &aspectReference = inputAttachmentAspectCreateInfo->pAspectReferences[i]; |
| 194 | ASSERT(aspectReference.subpass < pCreateInfo->subpassCount); |
| 195 | const auto &subpassDescription = pCreateInfo->pSubpasses[aspectReference.subpass]; |
| 196 | ASSERT(aspectReference.inputAttachmentIndex < subpassDescription.inputAttachmentCount); |
| 197 | const auto &attachmentReference = subpassDescription.pInputAttachments[aspectReference.inputAttachmentIndex]; |
| 198 | if(attachmentReference.attachment != VK_ATTACHMENT_UNUSED) |
| 199 | { |
| 200 | // If the pNext chain includes an instance of VkRenderPassInputAttachmentAspectCreateInfo, for any |
| 201 | // element of the pInputAttachments member of any element of pSubpasses where the attachment member |
| 202 | // is not VK_ATTACHMENT_UNUSED, the aspectMask member of the corresponding element of |
| 203 | // VkRenderPassInputAttachmentAspectCreateInfo::pAspectReferences must only include aspects that are |
| 204 | // present in images of the format specified by the element of pAttachments at attachment |
| 205 | vk::Format format(pCreateInfo->pAttachments[attachmentReference.attachment].format); |
| 206 | bool isDepth = format.isDepth(); |
| 207 | bool isStencil = format.isStencil(); |
| 208 | ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) || (!isDepth && !isStencil)); |
| 209 | ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) || isDepth); |
| 210 | ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) || isStencil); |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | break; |
| 215 | case VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO: |
| 216 | { |
| 217 | const VkRenderPassMultiviewCreateInfo *multiviewCreateInfo = reinterpret_cast<const VkRenderPassMultiviewCreateInfo *>(extensionCreateInfo); |
| 218 | ASSERT((multiviewCreateInfo->subpassCount == 0) || (multiviewCreateInfo->subpassCount == pCreateInfo->subpassCount)); |
| 219 | ASSERT((multiviewCreateInfo->dependencyCount == 0) || (multiviewCreateInfo->dependencyCount == pCreateInfo->dependencyCount)); |
| 220 | |
| 221 | bool zeroMask = (multiviewCreateInfo->pViewMasks[0] == 0); |
| 222 | for(uint32_t i = 1; i < multiviewCreateInfo->subpassCount; i++) |
| 223 | { |
| 224 | ASSERT((multiviewCreateInfo->pViewMasks[i] == 0) == zeroMask); |
| 225 | } |
| 226 | |
| 227 | if(zeroMask) |
| 228 | { |
| 229 | ASSERT(multiviewCreateInfo->correlationMaskCount == 0); |
| 230 | } |
| 231 | |
| 232 | for(uint32_t i = 0; i < multiviewCreateInfo->dependencyCount; i++) |
| 233 | { |
| 234 | const auto &dependency = pCreateInfo->pDependencies[i]; |
| 235 | if(multiviewCreateInfo->pViewOffsets[i] != 0) |
| 236 | { |
| 237 | ASSERT(dependency.srcSubpass != dependency.dstSubpass); |
| 238 | ASSERT(dependency.dependencyFlags & VK_DEPENDENCY_VIEW_LOCAL_BIT); |
| 239 | } |
| 240 | if(zeroMask) |
| 241 | { |
| 242 | ASSERT(!(dependency.dependencyFlags & VK_DEPENDENCY_VIEW_LOCAL_BIT)); |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | // If the pNext chain includes an instance of VkRenderPassMultiviewCreateInfo, |
| 247 | // each element of its pViewMask member must not include a bit at a position |
| 248 | // greater than the value of VkPhysicalDeviceLimits::maxFramebufferLayers |
| 249 | // pViewMask is a 32 bit value. If maxFramebufferLayers > 32, it's impossible |
| 250 | // for pViewMask to contain a bit at an illegal position |
| 251 | // Note: Verify pViewMask values instead if we hit this assert |
| 252 | ASSERT(vk::Cast(device)->getPhysicalDevice()->getProperties().limits.maxFramebufferLayers >= 32); |
| 253 | } |
| 254 | break; |
| 255 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 256 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extensionCreateInfo->sType).c_str()); |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 257 | break; |
| 258 | } |
| 259 | |
| 260 | extensionCreateInfo = extensionCreateInfo->pNext; |
| 261 | } |
| 262 | } |
| 263 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 264 | } // namespace |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 265 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 266 | extern "C" { |
| 267 | 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] | 268 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 269 | TRACE("(VkInstance instance = %p, const char* pName = %p)", instance, pName); |
Nicolas Capens | dc85364 | 2018-11-19 15:50:18 -0500 | [diff] [blame] | 270 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 271 | return vk::GetInstanceProcAddr(vk::Cast(instance), pName); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 272 | } |
| 273 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 274 | VK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion) |
Hernan Liatis | b2841fe | 2019-02-21 12:57:52 -0800 | [diff] [blame] | 275 | { |
| 276 | *pSupportedVersion = 3; |
| 277 | return VK_SUCCESS; |
| 278 | } |
| 279 | |
David 'Digit' Turner | 6e44504 | 2020-04-17 16:27:56 +0200 | [diff] [blame] | 280 | #if VK_USE_PLATFORM_FUCHSIA |
| 281 | |
| 282 | // This symbol must be exported by a Fuchsia Vulkan ICD. The Vulkan loader will |
| 283 | // call it, passing the address of a global function pointer that can later be |
| 284 | // used at runtime to connect to Fuchsia FIDL services, as required by certain |
| 285 | // extensions. See https://fxbug.dev/13095 for more details. |
| 286 | // |
| 287 | // NOTE: This entry point has not been upstreamed to Khronos yet, which reserves |
| 288 | // all symbols starting with vk_icd. See https://fxbug.dev/13074 which |
| 289 | // tracks upstreaming progress. |
| 290 | VK_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vk_icdInitializeConnectToServiceCallback( |
| 291 | PFN_vkConnectToService callback) |
| 292 | { |
| 293 | TRACE("(callback = %p)", callback); |
| 294 | vk::icdFuchsiaServiceConnectCallback = callback; |
| 295 | return VK_SUCCESS; |
| 296 | } |
| 297 | |
| 298 | #endif // VK_USE_PLATFORM_FUCHSIA |
| 299 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 300 | static const VkExtensionProperties instanceExtensionProperties[] = { |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 301 | { VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME, VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION }, |
| 302 | { VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION }, |
| 303 | { VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION }, |
| 304 | { VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION }, |
| 305 | { 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] | 306 | #ifndef __ANDROID__ |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 307 | { VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_SPEC_VERSION }, |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 308 | #endif |
Ben Clayton | a9af883 | 2019-08-14 13:09:43 +0100 | [diff] [blame] | 309 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 310 | { VK_KHR_XCB_SURFACE_EXTENSION_NAME, VK_KHR_XCB_SURFACE_SPEC_VERSION }, |
| 311 | #endif |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 312 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 313 | { VK_KHR_XLIB_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_SPEC_VERSION }, |
| 314 | #endif |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 315 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 316 | { VK_MVK_MACOS_SURFACE_EXTENSION_NAME, VK_MVK_MACOS_SURFACE_SPEC_VERSION }, |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 317 | #endif |
Jonah Ryan-Davis | 215bc79 | 2019-10-31 17:23:49 -0400 | [diff] [blame] | 318 | #ifdef VK_USE_PLATFORM_METAL_EXT |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 319 | { VK_EXT_METAL_SURFACE_EXTENSION_NAME, VK_EXT_METAL_SURFACE_SPEC_VERSION }, |
Jonah Ryan-Davis | 215bc79 | 2019-10-31 17:23:49 -0400 | [diff] [blame] | 320 | #endif |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 321 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 322 | { VK_KHR_WIN32_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_SPEC_VERSION }, |
| 323 | #endif |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 324 | }; |
| 325 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 326 | static const VkExtensionProperties deviceExtensionProperties[] = { |
Nicolas Capens | 657dd6c | 2018-11-16 17:41:37 -0500 | [diff] [blame] | 327 | { VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME, VK_KHR_DRIVER_PROPERTIES_SPEC_VERSION }, |
| 328 | // Vulkan 1.1 promoted extensions |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 329 | { VK_KHR_16BIT_STORAGE_EXTENSION_NAME, VK_KHR_16BIT_STORAGE_SPEC_VERSION }, |
| 330 | { VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, VK_KHR_BIND_MEMORY_2_SPEC_VERSION }, |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 331 | { VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME, VK_KHR_CREATE_RENDERPASS_2_SPEC_VERSION }, |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 332 | { VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION }, |
| 333 | { VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME, VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION }, |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 334 | { VK_KHR_DEVICE_GROUP_EXTENSION_NAME, VK_KHR_DEVICE_GROUP_SPEC_VERSION }, |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 335 | { VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME, VK_KHR_EXTERNAL_FENCE_SPEC_VERSION }, |
| 336 | { VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION }, |
| 337 | { VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION }, |
| 338 | { VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION }, |
| 339 | { VK_KHR_MAINTENANCE1_EXTENSION_NAME, VK_KHR_MAINTENANCE1_SPEC_VERSION }, |
| 340 | { VK_KHR_MAINTENANCE2_EXTENSION_NAME, VK_KHR_MAINTENANCE2_SPEC_VERSION }, |
| 341 | { VK_KHR_MAINTENANCE3_EXTENSION_NAME, VK_KHR_MAINTENANCE3_SPEC_VERSION }, |
| 342 | { VK_KHR_MULTIVIEW_EXTENSION_NAME, VK_KHR_MULTIVIEW_SPEC_VERSION }, |
| 343 | { VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME, VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION }, |
| 344 | { VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION }, |
Alexis Hetu | aabd085 | 2020-02-10 14:27:29 -0500 | [diff] [blame] | 345 | { VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_EXTENSION_NAME, VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_SPEC_VERSION }, |
Chris Forbes | 83cdd25 | 2019-08-26 09:29:27 -0700 | [diff] [blame] | 346 | // Only 1.1 core version of this is supported. The extension has additional requirements |
| 347 | //{ 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] | 348 | { 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] | 349 | // Only 1.1 core version of this is supported. The extension has additional requirements |
| 350 | //{ VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME, VK_KHR_VARIABLE_POINTERS_SPEC_VERSION }, |
Chris Forbes | 6b4b814 | 2019-09-26 13:33:11 -0700 | [diff] [blame] | 351 | { VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME, VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION }, |
Alexis Hetu | 23f9c25 | 2019-10-17 13:58:25 -0400 | [diff] [blame] | 352 | // The following extension is only used to add support for Bresenham lines |
| 353 | { VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME, VK_EXT_LINE_RASTERIZATION_SPEC_VERSION }, |
Alexis Hetu | 1ee36c9 | 2020-02-20 14:07:26 -0500 | [diff] [blame] | 354 | // The following extension is used by ANGLE to emulate blitting the stencil buffer |
| 355 | { VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME, VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION }, |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 356 | #ifndef __ANDROID__ |
Chris Forbes | 92577e5 | 2019-09-02 17:43:38 +0100 | [diff] [blame] | 357 | // We fully support the KHR_swapchain v70 additions, so just track the spec version. |
Hernan Liatis | cff8c00 | 2019-02-25 15:56:36 -0800 | [diff] [blame] | 358 | { VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_SWAPCHAIN_SPEC_VERSION }, |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 359 | #else |
Chris Forbes | 92577e5 | 2019-09-02 17:43:38 +0100 | [diff] [blame] | 360 | // We only support V7 of this extension. Missing functionality: in V8, |
| 361 | // it becomes possible to pass a VkNativeBufferANDROID structure to |
| 362 | // vkBindImageMemory2. Android's swapchain implementation does this in |
| 363 | // order to support passing VkBindImageMemorySwapchainInfoKHR |
| 364 | // (from KHR_swapchain v70) to vkBindImageMemory2. |
| 365 | { VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME, 7 }, |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 366 | #endif |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 367 | #if SWIFTSHADER_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER |
| 368 | { VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME, VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION }, |
| 369 | #endif |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 370 | #if SWIFTSHADER_EXTERNAL_SEMAPHORE_OPAQUE_FD |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 371 | { VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION }, |
| 372 | #endif |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 373 | #if SWIFTSHADER_EXTERNAL_MEMORY_OPAQUE_FD |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 374 | { VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION }, |
| 375 | #endif |
Jonah Ryan-Davis | f9f999f | 2020-01-08 14:41:28 -0500 | [diff] [blame] | 376 | |
| 377 | { VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME, VK_EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION }, |
| 378 | |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 379 | #if VK_USE_PLATFORM_FUCHSIA |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 380 | { VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME, VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION }, |
David 'Digit' Turner | e52e2db | 2019-09-09 17:58:46 +0200 | [diff] [blame] | 381 | { VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME, VK_FUCHSIA_EXTERNAL_MEMORY_SPEC_VERSION }, |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 382 | #endif |
Alexis Hetu | f8f6103 | 2019-10-10 16:45:30 -0400 | [diff] [blame] | 383 | { VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME, VK_EXT_PROVOKING_VERTEX_SPEC_VERSION }, |
Antonio Maiorano | d9ba4b7 | 2020-05-04 14:38:59 -0400 | [diff] [blame] | 384 | { VK_GOOGLE_SAMPLER_FILTERING_PRECISION_EXTENSION_NAME, VK_GOOGLE_SAMPLER_FILTERING_PRECISION_SPEC_VERSION }, |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 385 | }; |
| 386 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 387 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 388 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 389 | TRACE("(const VkInstanceCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkInstance* pInstance = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 390 | pCreateInfo, pAllocator, pInstance); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 391 | |
Ben Clayton | 056d692 | 2019-07-04 12:41:13 +0100 | [diff] [blame] | 392 | initializeLibrary(); |
| 393 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 394 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 395 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 396 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 397 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
| 398 | } |
| 399 | |
| 400 | if(pCreateInfo->enabledLayerCount != 0) |
| 401 | { |
Nicolas Capens | dd0e600 | 2020-01-24 01:21:47 -0500 | [diff] [blame] | 402 | UNIMPLEMENTED("b/148240133: pCreateInfo->enabledLayerCount != 0"); // FIXME(b/148240133) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 403 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 404 | |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 405 | uint32_t extensionPropertiesCount = sizeof(instanceExtensionProperties) / sizeof(instanceExtensionProperties[0]); |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 406 | for(uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 407 | { |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 408 | if(!HasExtensionProperty(pCreateInfo->ppEnabledExtensionNames[i], instanceExtensionProperties, extensionPropertiesCount)) |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 409 | { |
| 410 | return VK_ERROR_EXTENSION_NOT_PRESENT; |
| 411 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | if(pCreateInfo->pNext) |
| 415 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 416 | const VkBaseInStructure *createInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 417 | switch(createInfo->sType) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 418 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 419 | case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO: |
| 420 | // According to the Vulkan spec, section 2.7.2. Implicit Valid Usage: |
| 421 | // "The values VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO and |
| 422 | // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO are reserved for |
| 423 | // internal use by the loader, and do not have corresponding |
| 424 | // Vulkan structures in this Specification." |
| 425 | break; |
| 426 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 427 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(createInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 428 | break; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 429 | } |
| 430 | } |
| 431 | |
| 432 | *pInstance = VK_NULL_HANDLE; |
| 433 | VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; |
| 434 | |
| 435 | VkResult result = vk::DispatchablePhysicalDevice::Create(pAllocator, pCreateInfo, &physicalDevice); |
| 436 | if(result != VK_SUCCESS) |
| 437 | { |
| 438 | return result; |
| 439 | } |
| 440 | |
Nicolas Capens | 0c73680 | 2019-05-27 12:53:31 -0400 | [diff] [blame] | 441 | result = vk::DispatchableInstance::Create(pAllocator, pCreateInfo, pInstance, physicalDevice); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 442 | if(result != VK_SUCCESS) |
| 443 | { |
| 444 | vk::destroy(physicalDevice, pAllocator); |
| 445 | return result; |
| 446 | } |
| 447 | |
| 448 | return result; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 449 | } |
| 450 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 451 | VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 452 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 453 | TRACE("(VkInstance instance = %p, const VkAllocationCallbacks* pAllocator = %p)", instance, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 454 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 455 | vk::destroy(instance, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 456 | } |
| 457 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 458 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 459 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 460 | TRACE("(VkInstance instance = %p, uint32_t* pPhysicalDeviceCount = %p, VkPhysicalDevice* pPhysicalDevices = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 461 | instance, pPhysicalDeviceCount, pPhysicalDevices); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 462 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 463 | return vk::Cast(instance)->getPhysicalDevices(pPhysicalDeviceCount, pPhysicalDevices); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 464 | } |
| 465 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 466 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 467 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 468 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceFeatures* pFeatures = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 469 | physicalDevice, pFeatures); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 470 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 471 | *pFeatures = vk::Cast(physicalDevice)->getFeatures(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 472 | } |
| 473 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 474 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 475 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 476 | TRACE("GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice = %p, VkFormat format = %d, VkFormatProperties* pFormatProperties = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 477 | physicalDevice, (int)format, pFormatProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 478 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 479 | vk::Cast(physicalDevice)->getFormatProperties(format, pFormatProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 480 | } |
| 481 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 482 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 483 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 484 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkFormat format = %d, VkImageType type = %d, VkImageTiling tiling = %d, VkImageUsageFlags usage = %d, VkImageCreateFlags flags = %d, VkImageFormatProperties* pImageFormatProperties = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 485 | physicalDevice, (int)format, (int)type, (int)tiling, usage, flags, pImageFormatProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 486 | |
Nicolas Capens | 7e01e4e | 2019-05-18 08:19:07 -0400 | [diff] [blame] | 487 | // "If the combination of parameters to vkGetPhysicalDeviceImageFormatProperties is not supported by the implementation |
| 488 | // for use in vkCreateImage, then all members of VkImageFormatProperties will be filled with zero." |
| 489 | memset(pImageFormatProperties, 0, sizeof(VkImageFormatProperties)); |
| 490 | |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 491 | VkFormatProperties properties; |
| 492 | vk::Cast(physicalDevice)->getFormatProperties(format, &properties); |
| 493 | |
Chris Forbes | 1bc7731 | 2019-05-09 14:02:26 -0700 | [diff] [blame] | 494 | VkFormatFeatureFlags features; |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 495 | switch(tiling) |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 496 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 497 | case VK_IMAGE_TILING_LINEAR: |
| 498 | features = properties.linearTilingFeatures; |
| 499 | break; |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 500 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 501 | case VK_IMAGE_TILING_OPTIMAL: |
| 502 | features = properties.optimalTilingFeatures; |
| 503 | break; |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 504 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 505 | default: |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 506 | UNSUPPORTED("VkImageTiling %d", int(tiling)); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 507 | features = 0; |
Chris Forbes | 1bc7731 | 2019-05-09 14:02:26 -0700 | [diff] [blame] | 508 | } |
| 509 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 510 | if(features == 0) |
Chris Forbes | 1bc7731 | 2019-05-09 14:02:26 -0700 | [diff] [blame] | 511 | { |
| 512 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 513 | } |
| 514 | |
| 515 | // Check for usage conflict with features |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 516 | if((usage & VK_IMAGE_USAGE_SAMPLED_BIT) && !(features & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) |
Chris Forbes | 1bc7731 | 2019-05-09 14:02:26 -0700 | [diff] [blame] | 517 | { |
| 518 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
Chris Forbes | 5737833 | 2019-01-16 15:17:24 -0800 | [diff] [blame] | 519 | } |
| 520 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 521 | if((usage & VK_IMAGE_USAGE_STORAGE_BIT) && !(features & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)) |
Chris Forbes | 0559bc4 | 2019-05-11 10:47:11 -0700 | [diff] [blame] | 522 | { |
| 523 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 524 | } |
| 525 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 526 | if((usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) && !(features & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) |
Chris Forbes | 0559bc4 | 2019-05-11 10:47:11 -0700 | [diff] [blame] | 527 | { |
| 528 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 529 | } |
| 530 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 531 | if((usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) && !(features & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) |
Chris Forbes | 0559bc4 | 2019-05-11 10:47:11 -0700 | [diff] [blame] | 532 | { |
| 533 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 534 | } |
| 535 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 536 | if((usage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) && !(features & (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))) |
Chris Forbes | 0559bc4 | 2019-05-11 10:47:11 -0700 | [diff] [blame] | 537 | { |
| 538 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 539 | } |
| 540 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 541 | if((usage & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) && !(features & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT)) |
Chris Forbes | 0559bc4 | 2019-05-11 10:47:11 -0700 | [diff] [blame] | 542 | { |
| 543 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 544 | } |
| 545 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 546 | if((usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT) && !(features & VK_FORMAT_FEATURE_TRANSFER_DST_BIT)) |
Chris Forbes | 0559bc4 | 2019-05-11 10:47:11 -0700 | [diff] [blame] | 547 | { |
| 548 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 549 | } |
| 550 | |
| 551 | auto allRecognizedUsageBits = VK_IMAGE_USAGE_SAMPLED_BIT | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 552 | VK_IMAGE_USAGE_STORAGE_BIT | |
| 553 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | |
| 554 | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | |
| 555 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | |
| 556 | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | |
| 557 | VK_IMAGE_USAGE_TRANSFER_DST_BIT | |
| 558 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT; |
Chris Forbes | 0559bc4 | 2019-05-11 10:47:11 -0700 | [diff] [blame] | 559 | ASSERT(!(usage & ~(allRecognizedUsageBits))); |
| 560 | |
Nicolas Capens | 7e01e4e | 2019-05-18 08:19:07 -0400 | [diff] [blame] | 561 | // "Images created with tiling equal to VK_IMAGE_TILING_LINEAR have further restrictions on their limits and capabilities |
| 562 | // compared to images created with tiling equal to VK_IMAGE_TILING_OPTIMAL." |
| 563 | if(tiling == VK_IMAGE_TILING_LINEAR) |
| 564 | { |
| 565 | if(type != VK_IMAGE_TYPE_2D) |
| 566 | { |
| 567 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 568 | } |
| 569 | |
| 570 | if(vk::Format(format).isDepth() || vk::Format(format).isStencil()) |
| 571 | { |
| 572 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 573 | } |
| 574 | } |
| 575 | |
Hernan Liatis | bd18d58 | 2019-05-29 15:38:58 -0700 | [diff] [blame] | 576 | // "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] | 577 | // have further restrictions on their limits and capabilities compared to images created with other formats." |
| 578 | if(vk::Format(format).isYcbcrFormat()) |
| 579 | { |
| 580 | if(type != VK_IMAGE_TYPE_2D) |
| 581 | { |
| 582 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 583 | } |
| 584 | } |
| 585 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 586 | vk::Cast(physicalDevice)->getImageFormatProperties(format, type, tiling, usage, flags, pImageFormatProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 587 | |
| 588 | return VK_SUCCESS; |
| 589 | } |
| 590 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 591 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 592 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 593 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceProperties* pProperties = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 594 | physicalDevice, pProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 595 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 596 | *pProperties = vk::Cast(physicalDevice)->getProperties(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 597 | } |
| 598 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 599 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 600 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 601 | 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] | 602 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 603 | if(!pQueueFamilyProperties) |
| 604 | { |
| 605 | *pQueueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount(); |
| 606 | } |
| 607 | else |
| 608 | { |
| 609 | vk::Cast(physicalDevice)->getQueueFamilyProperties(*pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 610 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 611 | } |
| 612 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 613 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 614 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 615 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceMemoryProperties* pMemoryProperties = %p)", physicalDevice, pMemoryProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 616 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 617 | *pMemoryProperties = vk::Cast(physicalDevice)->getMemoryProperties(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 618 | } |
| 619 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 620 | 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] | 621 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 622 | TRACE("(VkInstance instance = %p, const char* pName = %p)", instance, pName); |
Nicolas Capens | dc85364 | 2018-11-19 15:50:18 -0500 | [diff] [blame] | 623 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 624 | return vk::GetInstanceProcAddr(vk::Cast(instance), pName); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 625 | } |
| 626 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 627 | VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *pName) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 628 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 629 | TRACE("(VkDevice device = %p, const char* pName = %p)", device, pName); |
Nicolas Capens | dc85364 | 2018-11-19 15:50:18 -0500 | [diff] [blame] | 630 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 631 | return vk::GetDeviceProcAddr(vk::Cast(device), pName); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 632 | } |
| 633 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 634 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 635 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 636 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkDeviceCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkDevice* pDevice = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 637 | physicalDevice, pCreateInfo, pAllocator, pDevice); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 638 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 639 | if(pCreateInfo->flags != 0) |
| 640 | { |
| 641 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 642 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
| 643 | } |
| 644 | |
| 645 | if(pCreateInfo->enabledLayerCount != 0) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 646 | { |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 647 | // "The ppEnabledLayerNames and enabledLayerCount members of VkDeviceCreateInfo are deprecated and their values must be ignored by implementations." |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 648 | UNSUPPORTED("pCreateInfo->enabledLayerCount != 0"); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 649 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 650 | |
Alexis Hetu | d6fae38 | 2019-04-05 13:19:46 -0400 | [diff] [blame] | 651 | uint32_t extensionPropertiesCount = sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]); |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 652 | for(uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i) |
Hernan Liatis | cff8c00 | 2019-02-25 15:56:36 -0800 | [diff] [blame] | 653 | { |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 654 | if(!HasExtensionProperty(pCreateInfo->ppEnabledExtensionNames[i], deviceExtensionProperties, extensionPropertiesCount)) |
Hernan Liatis | cff8c00 | 2019-02-25 15:56:36 -0800 | [diff] [blame] | 655 | { |
| 656 | return VK_ERROR_EXTENSION_NOT_PRESENT; |
| 657 | } |
| 658 | } |
| 659 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 660 | const VkBaseInStructure *extensionCreateInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 661 | |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 662 | const VkPhysicalDeviceFeatures *enabledFeatures = pCreateInfo->pEnabledFeatures; |
| 663 | |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 664 | while(extensionCreateInfo) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 665 | { |
Alexis Hetu | f8f6103 | 2019-10-10 16:45:30 -0400 | [diff] [blame] | 666 | // Casting to a long since some structures, such as |
| 667 | // VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT |
| 668 | // are not enumerated in the official Vulkan header |
| 669 | switch((long)(extensionCreateInfo->sType)) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 670 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 671 | case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO: |
| 672 | // According to the Vulkan spec, section 2.7.2. Implicit Valid Usage: |
| 673 | // "The values VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO and |
| 674 | // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO are reserved for |
| 675 | // internal use by the loader, and do not have corresponding |
| 676 | // Vulkan structures in this Specification." |
| 677 | break; |
| 678 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2: |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 679 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 680 | ASSERT(!pCreateInfo->pEnabledFeatures); // "If the pNext chain includes a VkPhysicalDeviceFeatures2 structure, then pEnabledFeatures must be NULL" |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 681 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 682 | const VkPhysicalDeviceFeatures2 *physicalDeviceFeatures2 = reinterpret_cast<const VkPhysicalDeviceFeatures2 *>(extensionCreateInfo); |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 683 | |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 684 | enabledFeatures = &physicalDeviceFeatures2->features; |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 685 | } |
| 686 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 687 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 688 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 689 | const VkPhysicalDeviceSamplerYcbcrConversionFeatures *samplerYcbcrConversionFeatures = reinterpret_cast<const VkPhysicalDeviceSamplerYcbcrConversionFeatures *>(extensionCreateInfo); |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 690 | |
Nicolas Capens | e2f5da4 | 2019-05-16 11:01:31 -0400 | [diff] [blame] | 691 | // YCbCr conversion is supported. |
| 692 | // samplerYcbcrConversionFeatures->samplerYcbcrConversion can be VK_TRUE or VK_FALSE. |
| 693 | // 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] | 694 | // "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] | 695 | (void)samplerYcbcrConversionFeatures->samplerYcbcrConversion; |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 696 | } |
| 697 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 698 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 699 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 700 | const VkPhysicalDevice16BitStorageFeatures *storage16BitFeatures = reinterpret_cast<const VkPhysicalDevice16BitStorageFeatures *>(extensionCreateInfo); |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 701 | |
Nicolas Capens | 8fff8c3 | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 702 | if(storage16BitFeatures->storageBuffer16BitAccess != VK_FALSE || |
| 703 | storage16BitFeatures->uniformAndStorageBuffer16BitAccess != VK_FALSE || |
| 704 | storage16BitFeatures->storagePushConstant16 != VK_FALSE || |
| 705 | storage16BitFeatures->storageInputOutput16 != VK_FALSE) |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 706 | { |
| 707 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 708 | } |
| 709 | } |
| 710 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 711 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 712 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 713 | const VkPhysicalDeviceVariablePointerFeatures *variablePointerFeatures = reinterpret_cast<const VkPhysicalDeviceVariablePointerFeatures *>(extensionCreateInfo); |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 714 | |
Nicolas Capens | 8fff8c3 | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 715 | if(variablePointerFeatures->variablePointersStorageBuffer != VK_FALSE || |
| 716 | variablePointerFeatures->variablePointers != VK_FALSE) |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 717 | { |
| 718 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 719 | } |
| 720 | } |
| 721 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 722 | case VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO: |
Alexis Hetu | 5ebd2c0 | 2019-01-22 17:17:27 -0500 | [diff] [blame] | 723 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 724 | const VkDeviceGroupDeviceCreateInfo *groupDeviceCreateInfo = reinterpret_cast<const VkDeviceGroupDeviceCreateInfo *>(extensionCreateInfo); |
Alexis Hetu | 5ebd2c0 | 2019-01-22 17:17:27 -0500 | [diff] [blame] | 725 | |
| 726 | if((groupDeviceCreateInfo->physicalDeviceCount != 1) || |
| 727 | (groupDeviceCreateInfo->pPhysicalDevices[0] != physicalDevice)) |
| 728 | { |
| 729 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 730 | } |
| 731 | } |
| 732 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 733 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: |
Chris Forbes | aad8cfc | 2019-08-15 19:09:16 -0700 | [diff] [blame] | 734 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 735 | const VkPhysicalDeviceMultiviewFeatures *multiviewFeatures = reinterpret_cast<const VkPhysicalDeviceMultiviewFeatures *>(extensionCreateInfo); |
Chris Forbes | aad8cfc | 2019-08-15 19:09:16 -0700 | [diff] [blame] | 736 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 737 | if(multiviewFeatures->multiviewGeometryShader || |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 738 | multiviewFeatures->multiviewTessellationShader) |
Chris Forbes | aad8cfc | 2019-08-15 19:09:16 -0700 | [diff] [blame] | 739 | { |
| 740 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 741 | } |
| 742 | } |
| 743 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 744 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES: |
Chris Forbes | d335302 | 2019-08-15 19:21:55 -0700 | [diff] [blame] | 745 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 746 | const VkPhysicalDeviceShaderDrawParametersFeatures *shaderDrawParametersFeatures = reinterpret_cast<const VkPhysicalDeviceShaderDrawParametersFeatures *>(extensionCreateInfo); |
Chris Forbes | d335302 | 2019-08-15 19:21:55 -0700 | [diff] [blame] | 747 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 748 | if(shaderDrawParametersFeatures->shaderDrawParameters) |
Chris Forbes | d335302 | 2019-08-15 19:21:55 -0700 | [diff] [blame] | 749 | { |
| 750 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 751 | } |
| 752 | } |
| 753 | break; |
Alexis Hetu | aabd085 | 2020-02-10 14:27:29 -0500 | [diff] [blame] | 754 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES_KHR: |
| 755 | { |
Ben Clayton | a0453d5 | 2020-02-11 18:05:41 +0000 | [diff] [blame] | 756 | const VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR *shaderDrawParametersFeatures = reinterpret_cast<const VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR *>(extensionCreateInfo); |
Alexis Hetu | aabd085 | 2020-02-10 14:27:29 -0500 | [diff] [blame] | 757 | |
| 758 | // Separate depth and stencil layouts is already supported |
| 759 | (void)(shaderDrawParametersFeatures->separateDepthStencilLayouts); |
| 760 | } |
| 761 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 762 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT: |
Alexis Hetu | 23f9c25 | 2019-10-17 13:58:25 -0400 | [diff] [blame] | 763 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 764 | const VkPhysicalDeviceLineRasterizationFeaturesEXT *lineRasterizationFeatures = reinterpret_cast<const VkPhysicalDeviceLineRasterizationFeaturesEXT *>(extensionCreateInfo); |
Nicolas Capens | 8fff8c3 | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 765 | if((lineRasterizationFeatures->smoothLines != VK_FALSE) || |
| 766 | (lineRasterizationFeatures->stippledBresenhamLines != VK_FALSE) || |
| 767 | (lineRasterizationFeatures->stippledRectangularLines != VK_FALSE) || |
| 768 | (lineRasterizationFeatures->stippledSmoothLines != VK_FALSE)) |
Alexis Hetu | 23f9c25 | 2019-10-17 13:58:25 -0400 | [diff] [blame] | 769 | { |
| 770 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 771 | } |
| 772 | } |
| 773 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 774 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT: |
Alexis Hetu | f8f6103 | 2019-10-10 16:45:30 -0400 | [diff] [blame] | 775 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 776 | const VkPhysicalDeviceProvokingVertexFeaturesEXT *provokingVertexFeatures = reinterpret_cast<const VkPhysicalDeviceProvokingVertexFeaturesEXT *>(extensionCreateInfo); |
Alexis Hetu | f8f6103 | 2019-10-10 16:45:30 -0400 | [diff] [blame] | 777 | |
| 778 | // Provoking vertex is supported. |
| 779 | // provokingVertexFeatures->provokingVertexLast can be VK_TRUE or VK_FALSE. |
| 780 | // No action needs to be taken on our end in either case; it's the apps responsibility to check |
| 781 | // that the provokingVertexLast feature is enabled before using the provoking vertex convention. |
| 782 | (void)provokingVertexFeatures->provokingVertexLast; |
| 783 | } |
Alexis Hetu | b07147b | 2019-10-29 12:49:24 -0400 | [diff] [blame] | 784 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 785 | default: |
| 786 | // "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]" |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 787 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extensionCreateInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 788 | break; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 789 | } |
Nicolas Capens | d689d1c | 2018-11-19 16:02:36 -0500 | [diff] [blame] | 790 | |
| 791 | extensionCreateInfo = extensionCreateInfo->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 792 | } |
| 793 | |
| 794 | ASSERT(pCreateInfo->queueCreateInfoCount > 0); |
| 795 | |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 796 | if(enabledFeatures) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 797 | { |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 798 | if(!vk::Cast(physicalDevice)->hasFeatures(*enabledFeatures)) |
Nicolas Capens | d5f1489 | 2018-11-13 14:06:37 -0500 | [diff] [blame] | 799 | { |
| 800 | return VK_ERROR_FEATURE_NOT_PRESENT; |
| 801 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 802 | } |
| 803 | |
| 804 | uint32_t queueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount(); |
| 805 | |
| 806 | for(uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++) |
| 807 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 808 | const VkDeviceQueueCreateInfo &queueCreateInfo = pCreateInfo->pQueueCreateInfos[i]; |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 809 | if(queueCreateInfo.flags != 0) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 810 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 811 | UNSUPPORTED("pCreateInfo->pQueueCreateInfos[%d]->flags %d", i, queueCreateInfo.flags); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 812 | } |
| 813 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 814 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(queueCreateInfo.pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 815 | while(extInfo) |
| 816 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 817 | LOG_TRAP("pCreateInfo->pQueueCreateInfos[%d].pNext sType = %s", i, vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 818 | extInfo = extInfo->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 819 | } |
| 820 | |
| 821 | ASSERT(queueCreateInfo.queueFamilyIndex < queueFamilyPropertyCount); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 822 | (void)queueFamilyPropertyCount; // Silence unused variable warning |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 823 | } |
| 824 | |
Alexis Hétu | 50038d6 | 2019-09-24 15:37:24 +0000 | [diff] [blame] | 825 | auto scheduler = getOrCreateScheduler(); |
Ben Clayton | d6c6136 | 2019-08-14 18:16:01 +0100 | [diff] [blame] | 826 | return vk::DispatchableDevice::Create(pAllocator, pCreateInfo, pDevice, vk::Cast(physicalDevice), enabledFeatures, scheduler); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 827 | } |
| 828 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 829 | VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 830 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 831 | TRACE("(VkDevice device = %p, const VkAllocationCallbacks* pAllocator = %p)", device, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 832 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 833 | vk::destroy(device, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 834 | } |
| 835 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 836 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 837 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 838 | TRACE("(const char* pLayerName = %p, uint32_t* pPropertyCount = %p, VkExtensionProperties* pProperties = %p)", |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 839 | pLayerName, pPropertyCount, pProperties); |
| 840 | |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 841 | uint32_t extensionPropertiesCount = sizeof(instanceExtensionProperties) / sizeof(instanceExtensionProperties[0]); |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 842 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 843 | if(!pProperties) |
| 844 | { |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 845 | *pPropertyCount = extensionPropertiesCount; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 846 | return VK_SUCCESS; |
| 847 | } |
| 848 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 849 | auto toCopy = std::min(*pPropertyCount, extensionPropertiesCount); |
| 850 | for(uint32_t i = 0; i < toCopy; i++) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 851 | { |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 852 | pProperties[i] = instanceExtensionProperties[i]; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 853 | } |
| 854 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 855 | *pPropertyCount = toCopy; |
| 856 | return (toCopy < extensionPropertiesCount) ? VK_INCOMPLETE : VK_SUCCESS; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 857 | } |
| 858 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 859 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 860 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 861 | 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] | 862 | |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 863 | uint32_t extensionPropertiesCount = sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]); |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 864 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 865 | if(!pProperties) |
| 866 | { |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 867 | *pPropertyCount = extensionPropertiesCount; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 868 | return VK_SUCCESS; |
| 869 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 870 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 871 | auto toCopy = std::min(*pPropertyCount, extensionPropertiesCount); |
| 872 | for(uint32_t i = 0; i < toCopy; i++) |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 873 | { |
Hernan Liatis | 2bb0864 | 2019-02-08 14:08:21 -0800 | [diff] [blame] | 874 | pProperties[i] = deviceExtensionProperties[i]; |
Chris Forbes | 5978150 | 2018-10-25 11:19:54 -0700 | [diff] [blame] | 875 | } |
| 876 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 877 | *pPropertyCount = toCopy; |
| 878 | return (toCopy < extensionPropertiesCount) ? VK_INCOMPLETE : VK_SUCCESS; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 879 | } |
| 880 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 881 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 882 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 883 | TRACE("(uint32_t* pPropertyCount = %p, VkLayerProperties* pProperties = %p)", pPropertyCount, pProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 884 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 885 | if(!pProperties) |
| 886 | { |
| 887 | *pPropertyCount = 0; |
| 888 | return VK_SUCCESS; |
| 889 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 890 | |
| 891 | return VK_SUCCESS; |
| 892 | } |
| 893 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 894 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 895 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 896 | 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] | 897 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 898 | if(!pProperties) |
| 899 | { |
| 900 | *pPropertyCount = 0; |
| 901 | return VK_SUCCESS; |
| 902 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 903 | |
| 904 | return VK_SUCCESS; |
| 905 | } |
| 906 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 907 | VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 908 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 909 | TRACE("(VkDevice device = %p, uint32_t queueFamilyIndex = %d, uint32_t queueIndex = %d, VkQueue* pQueue = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 910 | device, queueFamilyIndex, queueIndex, pQueue); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 911 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 912 | *pQueue = vk::Cast(device)->getQueue(queueFamilyIndex, queueIndex); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 913 | } |
| 914 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 915 | VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 916 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 917 | TRACE("(VkQueue queue = %p, uint32_t submitCount = %d, const VkSubmitInfo* pSubmits = %p, VkFence fence = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 918 | queue, submitCount, pSubmits, static_cast<void *>(fence)); |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 919 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 920 | return vk::Cast(queue)->submit(submitCount, pSubmits, vk::Cast(fence)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 921 | } |
| 922 | |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 923 | VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) |
| 924 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 925 | TRACE("(VkQueue queue = %p)", queue); |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 926 | |
Alexis Hetu | e1f51b9 | 2019-04-23 15:34:34 -0400 | [diff] [blame] | 927 | return vk::Cast(queue)->waitIdle(); |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 928 | } |
| 929 | |
| 930 | VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) |
| 931 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 932 | TRACE("(VkDevice device = %p)", device); |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 933 | |
Alexis Hetu | e1f51b9 | 2019-04-23 15:34:34 -0400 | [diff] [blame] | 934 | return vk::Cast(device)->waitIdle(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 935 | } |
| 936 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 937 | VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 938 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 939 | TRACE("(VkDevice device = %p, const VkMemoryAllocateInfo* pAllocateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkDeviceMemory* pMemory = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 940 | device, pAllocateInfo, pAllocator, pMemory); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 941 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 942 | const VkBaseInStructure *allocationInfo = reinterpret_cast<const VkBaseInStructure *>(pAllocateInfo->pNext); |
Alexis Hetu | 7ca9f4a | 2019-01-17 14:51:43 -0500 | [diff] [blame] | 943 | while(allocationInfo) |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 944 | { |
Alexis Hetu | 7ca9f4a | 2019-01-17 14:51:43 -0500 | [diff] [blame] | 945 | switch(allocationInfo->sType) |
| 946 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 947 | case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO: |
| 948 | // This can safely be ignored, as the Vulkan spec mentions: |
| 949 | // "If the pNext chain includes a VkMemoryDedicatedAllocateInfo structure, then that structure |
| 950 | // includes a handle of the sole buffer or image resource that the memory *can* be bound to." |
| 951 | break; |
| 952 | case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO: |
| 953 | // This extension controls on which physical devices the memory gets allocated. |
| 954 | // SwiftShader only has a single physical device, so this extension does nothing in this case. |
| 955 | break; |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 956 | #if SWIFTSHADER_EXTERNAL_MEMORY_OPAQUE_FD |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 957 | case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR: |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 958 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 959 | auto *importInfo = reinterpret_cast<const VkImportMemoryFdInfoKHR *>(allocationInfo); |
| 960 | if(importInfo->handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) |
| 961 | { |
| 962 | UNSUPPORTED("importInfo->handleType %u", importInfo->handleType); |
| 963 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 964 | } |
| 965 | break; |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 966 | } |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 967 | #endif // SWIFTSHADER_EXTERNAL_MEMORY_OPAQUE_FD |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 968 | case VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO: |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 969 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 970 | auto *exportInfo = reinterpret_cast<const VkExportMemoryAllocateInfo *>(allocationInfo); |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 971 | switch(exportInfo->handleTypes) |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 972 | { |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 973 | #if SWIFTSHADER_EXTERNAL_MEMORY_OPAQUE_FD |
| 974 | case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT: |
| 975 | break; |
| 976 | #endif |
| 977 | #if SWIFTSHADER_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER |
| 978 | case VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID: |
| 979 | break; |
| 980 | #endif |
David 'Digit' Turner | e52e2db | 2019-09-09 17:58:46 +0200 | [diff] [blame] | 981 | #if VK_USE_PLATFORM_FUCHSIA |
| 982 | case VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA: |
| 983 | break; |
| 984 | #endif |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 985 | default: |
| 986 | UNSUPPORTED("exportInfo->handleTypes %u", exportInfo->handleTypes); |
| 987 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 988 | } |
| 989 | break; |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 990 | } |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 991 | #if SWIFTSHADER_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER |
| 992 | case VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID: |
| 993 | // Ignore |
| 994 | break; |
| 995 | #endif // SWIFTSHADER_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER |
Jonah Ryan-Davis | f9f999f | 2020-01-08 14:41:28 -0500 | [diff] [blame] | 996 | case VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT: |
| 997 | { |
| 998 | auto *importInfo = reinterpret_cast<const VkImportMemoryHostPointerInfoEXT *>(allocationInfo); |
| 999 | if(importInfo->handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT && importInfo->handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT) |
| 1000 | { |
| 1001 | UNSUPPORTED("importInfo->handleType %u", importInfo->handleType); |
| 1002 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1003 | } |
| 1004 | break; |
| 1005 | } |
David 'Digit' Turner | e52e2db | 2019-09-09 17:58:46 +0200 | [diff] [blame] | 1006 | #if VK_USE_PLATFORM_FUCHSIA |
| 1007 | case VK_STRUCTURE_TYPE_TEMP_IMPORT_MEMORY_ZIRCON_HANDLE_INFO_FUCHSIA: |
| 1008 | { |
| 1009 | auto *importInfo = reinterpret_cast<const VkImportMemoryZirconHandleInfoFUCHSIA *>(allocationInfo); |
| 1010 | if(importInfo->handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA) |
| 1011 | { |
| 1012 | UNSUPPORTED("importInfo->handleType %u", importInfo->handleType); |
| 1013 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1014 | } |
| 1015 | break; |
| 1016 | } |
| 1017 | #endif // VK_USE_PLATFORM_FUCHSIA |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1018 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1019 | LOG_TRAP("pAllocateInfo->pNext sType = %s", vk::Stringify(allocationInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1020 | break; |
Alexis Hetu | 7ca9f4a | 2019-01-17 14:51:43 -0500 | [diff] [blame] | 1021 | } |
| 1022 | |
| 1023 | allocationInfo = allocationInfo->pNext; |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1024 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1025 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1026 | VkResult result = vk::DeviceMemory::Create(pAllocator, pAllocateInfo, pMemory); |
| 1027 | if(result != VK_SUCCESS) |
| 1028 | { |
| 1029 | return result; |
| 1030 | } |
| 1031 | |
| 1032 | // Make sure the memory allocation is done now so that OOM errors can be checked now |
| 1033 | result = vk::Cast(*pMemory)->allocate(); |
| 1034 | if(result != VK_SUCCESS) |
| 1035 | { |
| 1036 | vk::destroy(*pMemory, pAllocator); |
| 1037 | *pMemory = VK_NULL_HANDLE; |
| 1038 | } |
| 1039 | |
| 1040 | return result; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1041 | } |
| 1042 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1043 | VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1044 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1045 | TRACE("(VkDevice device = %p, VkDeviceMemory memory = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1046 | device, static_cast<void *>(memory), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1047 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1048 | vk::destroy(memory, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1049 | } |
| 1050 | |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 1051 | #if SWIFTSHADER_EXTERNAL_MEMORY_OPAQUE_FD |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1052 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdKHR(VkDevice device, const VkMemoryGetFdInfoKHR *getFdInfo, int *pFd) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1053 | { |
| 1054 | TRACE("(VkDevice device = %p, const VkMemoryGetFdInfoKHR* getFdInfo = %p, int* pFd = %p", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1055 | device, getFdInfo, pFd); |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1056 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1057 | if(getFdInfo->handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1058 | { |
| 1059 | UNSUPPORTED("pGetFdInfo->handleType %u", getFdInfo->handleType); |
| 1060 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1061 | } |
| 1062 | return vk::Cast(getFdInfo->memory)->exportFd(pFd); |
| 1063 | } |
| 1064 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1065 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, int fd, VkMemoryFdPropertiesKHR *pMemoryFdProperties) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1066 | { |
| 1067 | TRACE("(VkDevice device = %p, VkExternalMemoryHandleTypeFlagBits handleType = %x, int fd = %d, VkMemoryFdPropertiesKHR* pMemoryFdProperties = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1068 | device, handleType, fd, pMemoryFdProperties); |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1069 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1070 | if(handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1071 | { |
| 1072 | UNSUPPORTED("handleType %u", handleType); |
| 1073 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1074 | } |
| 1075 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1076 | if(fd < 0) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1077 | { |
| 1078 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1079 | } |
| 1080 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1081 | const VkPhysicalDeviceMemoryProperties &memoryProperties = |
| 1082 | vk::Cast(device)->getPhysicalDevice()->getMemoryProperties(); |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1083 | |
| 1084 | // All SwiftShader memory types support this! |
| 1085 | pMemoryFdProperties->memoryTypeBits = (1U << memoryProperties.memoryTypeCount) - 1U; |
| 1086 | |
| 1087 | return VK_SUCCESS; |
| 1088 | } |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 1089 | #endif // SWIFTSHADER_EXTERNAL_MEMORY_OPAQUE_FD |
David 'Digit' Turner | e52e2db | 2019-09-09 17:58:46 +0200 | [diff] [blame] | 1090 | #if VK_USE_PLATFORM_FUCHSIA |
| 1091 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandleFUCHSIA(VkDevice device, const VkMemoryGetZirconHandleInfoFUCHSIA *pGetHandleInfo, zx_handle_t *pHandle) |
| 1092 | { |
| 1093 | TRACE("(VkDevice device = %p, const VkMemoryGetZirconHandleInfoFUCHSIA* pGetHandleInfo = %p, zx_handle_t* pHandle = %p", |
| 1094 | device, pGetHandleInfo, pHandle); |
| 1095 | |
| 1096 | if(pGetHandleInfo->handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA) |
| 1097 | { |
| 1098 | UNSUPPORTED("pGetHandleInfo->handleType %u", pGetHandleInfo->handleType); |
| 1099 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1100 | } |
| 1101 | return vk::Cast(pGetHandleInfo->memory)->exportHandle(pHandle); |
| 1102 | } |
| 1103 | |
| 1104 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandlePropertiesFUCHSIA(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, zx_handle_t handle, VkMemoryZirconHandlePropertiesFUCHSIA *pMemoryZirconHandleProperties) |
| 1105 | { |
| 1106 | TRACE("(VkDevice device = %p, VkExternalMemoryHandleTypeFlagBits handleType = %x, zx_handle_t handle = %d, VkMemoryZirconHandlePropertiesFUCHSIA* pMemoryZirconHandleProperties = %p)", |
| 1107 | device, handleType, handle, pMemoryZirconHandleProperties); |
| 1108 | |
| 1109 | if(handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA) |
| 1110 | { |
| 1111 | UNSUPPORTED("handleType %u", handleType); |
| 1112 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1113 | } |
| 1114 | |
| 1115 | if(handle == ZX_HANDLE_INVALID) |
| 1116 | { |
| 1117 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1118 | } |
| 1119 | |
| 1120 | const VkPhysicalDeviceMemoryProperties &memoryProperties = |
| 1121 | vk::Cast(device)->getPhysicalDevice()->getMemoryProperties(); |
| 1122 | |
| 1123 | // All SwiftShader memory types support this! |
| 1124 | pMemoryZirconHandleProperties->memoryTypeBits = (1U << memoryProperties.memoryTypeCount) - 1U; |
| 1125 | |
| 1126 | return VK_SUCCESS; |
| 1127 | } |
| 1128 | #endif // VK_USE_PLATFORM_FUCHSIA |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1129 | |
Jonah Ryan-Davis | f9f999f | 2020-01-08 14:41:28 -0500 | [diff] [blame] | 1130 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryHostPointerPropertiesEXT(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void *pHostPointer, VkMemoryHostPointerPropertiesEXT *pMemoryHostPointerProperties) |
| 1131 | { |
| 1132 | TRACE("(VkDevice device = %p, VkExternalMemoryHandleTypeFlagBits handleType = %x, const void *pHostPointer = %p, VkMemoryHostPointerPropertiesEXT *pMemoryHostPointerProperties = %p)", |
| 1133 | device, handleType, pHostPointer, pMemoryHostPointerProperties); |
| 1134 | |
| 1135 | if(handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT && handleType != VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT) |
| 1136 | { |
| 1137 | UNSUPPORTED("handleType %u", handleType); |
| 1138 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1139 | } |
| 1140 | pMemoryHostPointerProperties->memoryTypeBits = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; |
| 1141 | |
| 1142 | return VK_SUCCESS; |
| 1143 | } |
| 1144 | |
Chris Forbes | 9f1e03b | 2020-01-09 11:45:28 -0800 | [diff] [blame] | 1145 | #if SWIFTSHADER_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER |
| 1146 | VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID *pInfo, struct AHardwareBuffer **pBuffer) |
| 1147 | { |
| 1148 | TRACE("(VkDevice device = %p, const VkMemoryGetAndroidHardwareBufferInfoANDROID *pInfo = %p, struct AHardwareBuffer **pBuffer = %p)", |
| 1149 | device, pInfo, pBuffer); |
| 1150 | |
| 1151 | return vk::Cast(pInfo->memory)->exportAhb(pBuffer); |
| 1152 | } |
| 1153 | |
| 1154 | VKAPI_ATTR VkResult VKAPI_CALL vkGetAndroidHardwareBufferPropertiesANDROID(VkDevice device, const struct AHardwareBuffer *buffer, VkAndroidHardwareBufferPropertiesANDROID *pProperties) |
| 1155 | { |
| 1156 | TRACE("(VkDevice device = %p, const struct AHardwareBuffer *buffer = %p, VkAndroidHardwareBufferPropertiesANDROID *pProperties = %p)", |
| 1157 | device, buffer, pProperties); |
| 1158 | |
| 1159 | return vk::DeviceMemory::getAhbProperties(buffer, pProperties); |
| 1160 | } |
| 1161 | #endif // SWIFTSHADER_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER |
| 1162 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1163 | VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1164 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1165 | TRACE("(VkDevice device = %p, VkDeviceMemory memory = %p, VkDeviceSize offset = %d, VkDeviceSize size = %d, VkMemoryMapFlags flags = %d, void** ppData = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1166 | device, static_cast<void *>(memory), int(offset), int(size), flags, ppData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1167 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1168 | if(flags != 0) |
| 1169 | { |
| 1170 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 1171 | UNSUPPORTED("flags %d", int(flags)); |
| 1172 | } |
| 1173 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1174 | return vk::Cast(memory)->map(offset, size, ppData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1175 | } |
| 1176 | |
| 1177 | VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory) |
| 1178 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1179 | TRACE("(VkDevice device = %p, VkDeviceMemory memory = %p)", device, static_cast<void *>(memory)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1180 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1181 | // Noop, memory will be released when the DeviceMemory object is released |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1182 | } |
| 1183 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1184 | VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1185 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1186 | TRACE("(VkDevice device = %p, uint32_t memoryRangeCount = %d, const VkMappedMemoryRange* pMemoryRanges = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1187 | device, memoryRangeCount, pMemoryRanges); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1188 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1189 | // Noop, host and device memory are the same to SwiftShader |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1190 | |
| 1191 | return VK_SUCCESS; |
| 1192 | } |
| 1193 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1194 | VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1195 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1196 | TRACE("(VkDevice device = %p, uint32_t memoryRangeCount = %d, const VkMappedMemoryRange* pMemoryRanges = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1197 | device, memoryRangeCount, pMemoryRanges); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1198 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1199 | // Noop, host and device memory are the same to SwiftShader |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1200 | |
| 1201 | return VK_SUCCESS; |
| 1202 | } |
| 1203 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1204 | VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice pDevice, VkDeviceMemory pMemory, VkDeviceSize *pCommittedMemoryInBytes) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1205 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1206 | TRACE("(VkDevice device = %p, VkDeviceMemory memory = %p, VkDeviceSize* pCommittedMemoryInBytes = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1207 | pDevice, static_cast<void *>(pMemory), pCommittedMemoryInBytes); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1208 | |
| 1209 | auto memory = vk::Cast(pMemory); |
| 1210 | |
| 1211 | #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1212 | const auto &memoryProperties = vk::Cast(pDevice)->getPhysicalDevice()->getMemoryProperties(); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1213 | uint32_t typeIndex = memory->getMemoryTypeIndex(); |
| 1214 | ASSERT(typeIndex < memoryProperties.memoryTypeCount); |
| 1215 | ASSERT(memoryProperties.memoryTypes[typeIndex].propertyFlags & VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT); |
| 1216 | #endif |
| 1217 | |
| 1218 | *pCommittedMemoryInBytes = memory->getCommittedMemoryInBytes(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1219 | } |
| 1220 | |
| 1221 | VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) |
| 1222 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1223 | TRACE("(VkDevice device = %p, VkBuffer buffer = %p, VkDeviceMemory memory = %p, VkDeviceSize memoryOffset = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1224 | device, static_cast<void *>(buffer), static_cast<void *>(memory), int(memoryOffset)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1225 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1226 | if(!vk::Cast(buffer)->canBindToMemory(vk::Cast(memory))) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1227 | { |
| 1228 | UNSUPPORTED("vkBindBufferMemory with invalid external memory"); |
| 1229 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1230 | } |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1231 | vk::Cast(buffer)->bind(vk::Cast(memory), memoryOffset); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1232 | return VK_SUCCESS; |
| 1233 | } |
| 1234 | |
| 1235 | VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) |
| 1236 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1237 | TRACE("(VkDevice device = %p, VkImage image = %p, VkDeviceMemory memory = %p, VkDeviceSize memoryOffset = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1238 | device, static_cast<void *>(image), static_cast<void *>(memory), int(memoryOffset)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1239 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1240 | if(!vk::Cast(image)->canBindToMemory(vk::Cast(memory))) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1241 | { |
| 1242 | UNSUPPORTED("vkBindImageMemory with invalid external memory"); |
| 1243 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 1244 | } |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 1245 | vk::Cast(image)->bind(vk::Cast(memory), memoryOffset); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1246 | return VK_SUCCESS; |
| 1247 | } |
| 1248 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1249 | VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements *pMemoryRequirements) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1250 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1251 | TRACE("(VkDevice device = %p, VkBuffer buffer = %p, VkMemoryRequirements* pMemoryRequirements = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1252 | device, static_cast<void *>(buffer), pMemoryRequirements); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1253 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1254 | *pMemoryRequirements = vk::Cast(buffer)->getMemoryRequirements(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1255 | } |
| 1256 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1257 | VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1258 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1259 | TRACE("(VkDevice device = %p, VkImage image = %p, VkMemoryRequirements* pMemoryRequirements = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1260 | device, static_cast<void *>(image), pMemoryRequirements); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1261 | |
Alexis Hetu | a233cea | 2018-12-07 11:53:19 -0500 | [diff] [blame] | 1262 | *pMemoryRequirements = vk::Cast(image)->getMemoryRequirements(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1263 | } |
| 1264 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1265 | VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements *pSparseMemoryRequirements) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1266 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1267 | TRACE("(VkDevice device = %p, VkImage image = %p, uint32_t* pSparseMemoryRequirementCount = %p, VkSparseImageMemoryRequirements* pSparseMemoryRequirements = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1268 | device, static_cast<void *>(image), pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 1269 | |
Nicolas Capens | 5028a58 | 2018-11-13 15:03:35 -0500 | [diff] [blame] | 1270 | // The 'sparseBinding' feature is not supported, so images can not be created with the VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag. |
| 1271 | // "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." |
| 1272 | *pSparseMemoryRequirementCount = 0; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1273 | } |
| 1274 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1275 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t *pPropertyCount, VkSparseImageFormatProperties *pProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1276 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1277 | 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)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1278 | physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties); |
Chris Forbes | 2c25b14 | 2019-03-05 14:47:16 -0800 | [diff] [blame] | 1279 | |
| 1280 | // We do not support sparse images. |
| 1281 | *pPropertyCount = 0; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1282 | } |
| 1283 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1284 | VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, VkFence fence) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1285 | { |
| 1286 | TRACE("()"); |
Nicolas Capens | 865f889 | 2020-01-21 14:27:10 -0500 | [diff] [blame] | 1287 | UNSUPPORTED("vkQueueBindSparse"); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1288 | return VK_SUCCESS; |
| 1289 | } |
| 1290 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1291 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1292 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1293 | TRACE("(VkDevice device = %p, const VkFenceCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkFence* pFence = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1294 | device, pCreateInfo, pAllocator, pFence); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1295 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1296 | auto *nextInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1297 | while(nextInfo) |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1298 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1299 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(nextInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1300 | nextInfo = nextInfo->pNext; |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1301 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1302 | |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1303 | return vk::Fence::Create(pAllocator, pCreateInfo, pFence); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1304 | } |
| 1305 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1306 | VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1307 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1308 | TRACE("(VkDevice device = %p, VkFence fence = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1309 | device, static_cast<void *>(fence), pAllocator); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 1310 | |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1311 | vk::destroy(fence, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1312 | } |
| 1313 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1314 | VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1315 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1316 | TRACE("(VkDevice device = %p, uint32_t fenceCount = %d, const VkFence* pFences = %p)", |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1317 | device, fenceCount, pFences); |
| 1318 | |
| 1319 | for(uint32_t i = 0; i < fenceCount; i++) |
| 1320 | { |
| 1321 | vk::Cast(pFences[i])->reset(); |
| 1322 | } |
| 1323 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1324 | return VK_SUCCESS; |
| 1325 | } |
| 1326 | |
| 1327 | VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence) |
| 1328 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1329 | TRACE("(VkDevice device = %p, VkFence fence = %p)", device, static_cast<void *>(fence)); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1330 | |
| 1331 | return vk::Cast(fence)->getStatus(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1332 | } |
| 1333 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1334 | VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1335 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1336 | TRACE("(VkDevice device = %p, uint32_t fenceCount = %d, const VkFence* pFences = %p, VkBool32 waitAll = %d, uint64_t timeout = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1337 | device, int(fenceCount), pFences, int(waitAll), int(timeout)); |
Alexis Hetu | c4bd9df | 2018-12-07 11:28:40 -0500 | [diff] [blame] | 1338 | |
Alexis Hetu | e1f51b9 | 2019-04-23 15:34:34 -0400 | [diff] [blame] | 1339 | return vk::Cast(device)->waitForFences(fenceCount, pFences, waitAll, timeout); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1340 | } |
| 1341 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1342 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1343 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1344 | 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] | 1345 | device, pCreateInfo, pAllocator, pSemaphore); |
| 1346 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1347 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1348 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1349 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 1350 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1351 | } |
| 1352 | |
David 'Digit' Turner | 43e3316 | 2019-11-22 14:18:49 +0100 | [diff] [blame] | 1353 | return vk::Semaphore::Create(pAllocator, pCreateInfo, pSemaphore, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1354 | } |
| 1355 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1356 | VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1357 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1358 | TRACE("(VkDevice device = %p, VkSemaphore semaphore = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1359 | device, static_cast<void *>(semaphore), pAllocator); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1360 | |
| 1361 | vk::destroy(semaphore, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1362 | } |
| 1363 | |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 1364 | #if SWIFTSHADER_EXTERNAL_SEMAPHORE_OPAQUE_FD |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1365 | VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR(VkDevice device, const VkSemaphoreGetFdInfoKHR *pGetFdInfo, int *pFd) |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 1366 | { |
| 1367 | TRACE("(VkDevice device = %p, const VkSemaphoreGetFdInfoKHR* pGetFdInfo = %p, int* pFd = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1368 | device, static_cast<const void *>(pGetFdInfo), static_cast<void *>(pFd)); |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 1369 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1370 | if(pGetFdInfo->handleType != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT) |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 1371 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1372 | UNSUPPORTED("pGetFdInfo->handleType %d", int(pGetFdInfo->handleType)); |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 1373 | } |
| 1374 | |
| 1375 | return vk::Cast(pGetFdInfo->semaphore)->exportFd(pFd); |
| 1376 | } |
| 1377 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1378 | VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFdKHR(VkDevice device, const VkImportSemaphoreFdInfoKHR *pImportSemaphoreInfo) |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 1379 | { |
| 1380 | TRACE("(VkDevice device = %p, const VkImportSemaphoreFdInfoKHR* pImportSemaphoreInfo = %p", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1381 | device, static_cast<const void *>(pImportSemaphoreInfo)); |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 1382 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1383 | if(pImportSemaphoreInfo->handleType != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT) |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 1384 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1385 | UNSUPPORTED("pImportSemaphoreInfo->handleType %d", int(pImportSemaphoreInfo->handleType)); |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 1386 | } |
| 1387 | bool temporaryImport = (pImportSemaphoreInfo->flags & VK_SEMAPHORE_IMPORT_TEMPORARY_BIT) != 0; |
| 1388 | |
| 1389 | return vk::Cast(pImportSemaphoreInfo->semaphore)->importFd(pImportSemaphoreInfo->fd, temporaryImport); |
| 1390 | } |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 1391 | #endif // SWIFTSHADER_EXTERNAL_SEMAPHORE_OPAQUE_FD |
David 'Digit' Turner | 7c4d0a0 | 2019-09-03 17:00:02 +0200 | [diff] [blame] | 1392 | |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 1393 | #if VK_USE_PLATFORM_FUCHSIA |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1394 | VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreZirconHandleFUCHSIA( |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1395 | VkDevice device, |
| 1396 | const VkImportSemaphoreZirconHandleInfoFUCHSIA *pImportSemaphoreZirconHandleInfo) |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1397 | { |
| 1398 | TRACE("(VkDevice device = %p, const VkImportSemaphoreZirconHandleInfoFUCHSIA* pImportSemaphoreZirconHandleInfo = %p)", |
| 1399 | device, pImportSemaphoreZirconHandleInfo); |
| 1400 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1401 | if(pImportSemaphoreZirconHandleInfo->handleType != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TEMP_ZIRCON_EVENT_BIT_FUCHSIA) |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1402 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1403 | UNSUPPORTED("pImportSemaphoreZirconHandleInfo->handleType %d", int(pImportSemaphoreZirconHandleInfo->handleType)); |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1404 | } |
| 1405 | bool temporaryImport = (pImportSemaphoreZirconHandleInfo->flags & VK_SEMAPHORE_IMPORT_TEMPORARY_BIT) != 0; |
| 1406 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1407 | return vk::Cast(pImportSemaphoreZirconHandleInfo->semaphore)->importHandle(pImportSemaphoreZirconHandleInfo->handle, temporaryImport); |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1408 | } |
| 1409 | |
| 1410 | VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreZirconHandleFUCHSIA( |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1411 | VkDevice device, |
| 1412 | const VkSemaphoreGetZirconHandleInfoFUCHSIA *pGetZirconHandleInfo, |
| 1413 | zx_handle_t *pZirconHandle) |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1414 | { |
| 1415 | TRACE("(VkDevice device = %p, const VkSemaphoreGetZirconHandleInfoFUCHSIA* pGetZirconHandleInfo = %p, zx_handle_t* pZirconHandle = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1416 | device, static_cast<const void *>(pGetZirconHandleInfo), static_cast<void *>(pZirconHandle)); |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1417 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1418 | if(pGetZirconHandleInfo->handleType != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TEMP_ZIRCON_EVENT_BIT_FUCHSIA) |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1419 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1420 | UNSUPPORTED("pGetZirconHandleInfo->handleType %d", int(pGetZirconHandleInfo->handleType)); |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1421 | } |
| 1422 | |
| 1423 | return vk::Cast(pGetZirconHandleInfo->semaphore)->exportHandle(pZirconHandle); |
| 1424 | } |
David 'Digit' Turner | 3a7101b | 2019-11-22 11:55:53 +0100 | [diff] [blame] | 1425 | #endif // VK_USE_PLATFORM_FUCHSIA |
David 'Digit' Turner | fda994c | 2019-09-04 16:36:36 +0200 | [diff] [blame] | 1426 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1427 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1428 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1429 | 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] | 1430 | device, pCreateInfo, pAllocator, pEvent); |
| 1431 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1432 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1433 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1434 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 1435 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1436 | } |
| 1437 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1438 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1439 | while(extInfo) |
| 1440 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1441 | // Vulkan 1.2: "pNext must be NULL" |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1442 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1443 | extInfo = extInfo->pNext; |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1444 | } |
| 1445 | |
| 1446 | return vk::Event::Create(pAllocator, pCreateInfo, pEvent); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1447 | } |
| 1448 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1449 | VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1450 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1451 | TRACE("(VkDevice device = %p, VkEvent event = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1452 | device, static_cast<void *>(event), pAllocator); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1453 | |
| 1454 | vk::destroy(event, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1455 | } |
| 1456 | |
| 1457 | VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event) |
| 1458 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1459 | TRACE("(VkDevice device = %p, VkEvent event = %p)", device, static_cast<void *>(event)); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1460 | |
| 1461 | return vk::Cast(event)->getStatus(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1462 | } |
| 1463 | |
| 1464 | VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event) |
| 1465 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1466 | TRACE("(VkDevice device = %p, VkEvent event = %p)", device, static_cast<void *>(event)); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1467 | |
| 1468 | vk::Cast(event)->signal(); |
| 1469 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1470 | return VK_SUCCESS; |
| 1471 | } |
| 1472 | |
| 1473 | VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event) |
| 1474 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1475 | TRACE("(VkDevice device = %p, VkEvent event = %p)", device, static_cast<void *>(event)); |
Alexis Hetu | 1f23d8c | 2018-10-16 14:40:19 -0400 | [diff] [blame] | 1476 | |
| 1477 | vk::Cast(event)->reset(); |
| 1478 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1479 | return VK_SUCCESS; |
| 1480 | } |
| 1481 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1482 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1483 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1484 | 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] | 1485 | device, pCreateInfo, pAllocator, pQueryPool); |
| 1486 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1487 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 86f8bdb | 2019-01-22 12:07:24 -0500 | [diff] [blame] | 1488 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1489 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 1490 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1491 | } |
| 1492 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1493 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1494 | while(extInfo) |
| 1495 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1496 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1497 | extInfo = extInfo->pNext; |
Alexis Hetu | 86f8bdb | 2019-01-22 12:07:24 -0500 | [diff] [blame] | 1498 | } |
| 1499 | |
| 1500 | return vk::QueryPool::Create(pAllocator, pCreateInfo, pQueryPool); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1501 | } |
| 1502 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1503 | VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1504 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1505 | TRACE("(VkDevice device = %p, VkQueryPool queryPool = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1506 | device, static_cast<void *>(queryPool), pAllocator); |
Alexis Hetu | 86f8bdb | 2019-01-22 12:07:24 -0500 | [diff] [blame] | 1507 | |
| 1508 | vk::destroy(queryPool, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1509 | } |
| 1510 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1511 | 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) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1512 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1513 | 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)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1514 | 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] | 1515 | |
Alexis Hetu | f0aa9d5 | 2019-04-01 17:06:47 -0400 | [diff] [blame] | 1516 | return vk::Cast(queryPool)->getResults(firstQuery, queryCount, dataSize, pData, stride, flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1517 | } |
| 1518 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1519 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1520 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1521 | TRACE("(VkDevice device = %p, const VkBufferCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkBuffer* pBuffer = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1522 | device, pCreateInfo, pAllocator, pBuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1523 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1524 | auto *nextInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1525 | while(nextInfo) |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1526 | { |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1527 | switch(nextInfo->sType) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1528 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1529 | case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO: |
| 1530 | // Do nothing. Should be handled by vk::Buffer::Create(). |
| 1531 | break; |
| 1532 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1533 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(nextInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1534 | break; |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1535 | } |
| 1536 | nextInfo = nextInfo->pNext; |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1537 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1538 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1539 | return vk::Buffer::Create(pAllocator, pCreateInfo, pBuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1540 | } |
| 1541 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1542 | VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1543 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1544 | TRACE("(VkDevice device = %p, VkBuffer buffer = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1545 | device, static_cast<void *>(buffer), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1546 | |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1547 | vk::destroy(buffer, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1548 | } |
| 1549 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1550 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBufferView *pView) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1551 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1552 | TRACE("(VkDevice device = %p, const VkBufferViewCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkBufferView* pView = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1553 | device, pCreateInfo, pAllocator, pView); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1554 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1555 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1556 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1557 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 1558 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1559 | } |
| 1560 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1561 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1562 | while(extInfo) |
| 1563 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1564 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1565 | extInfo = extInfo->pNext; |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1566 | } |
| 1567 | |
| 1568 | return vk::BufferView::Create(pAllocator, pCreateInfo, pView); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1569 | } |
| 1570 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1571 | VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1572 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1573 | TRACE("(VkDevice device = %p, VkBufferView bufferView = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1574 | device, static_cast<void *>(bufferView), pAllocator); |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 1575 | |
| 1576 | vk::destroy(bufferView, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1577 | } |
| 1578 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1579 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1580 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1581 | TRACE("(VkDevice device = %p, const VkImageCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkImage* pImage = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1582 | device, pCreateInfo, pAllocator, pImage); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1583 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1584 | const VkBaseInStructure *extensionCreateInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1585 | |
| 1586 | #ifdef __ANDROID__ |
Alexis Hetu | 5244595 | 2019-10-31 17:51:07 -0400 | [diff] [blame] | 1587 | vk::BackingMemory backmem; |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1588 | bool swapchainImage = false; |
| 1589 | #endif |
| 1590 | |
| 1591 | while(extensionCreateInfo) |
Alexis Hetu | f62f375 | 2018-11-15 14:51:15 -0500 | [diff] [blame] | 1592 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1593 | switch((long)(extensionCreateInfo->sType)) |
| 1594 | { |
| 1595 | #ifdef __ANDROID__ |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1596 | case VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID: |
| 1597 | { |
| 1598 | const VkSwapchainImageCreateInfoANDROID *swapImageCreateInfo = reinterpret_cast<const VkSwapchainImageCreateInfoANDROID *>(extensionCreateInfo); |
| 1599 | backmem.androidUsage = swapImageCreateInfo->usage; |
| 1600 | } |
| 1601 | break; |
| 1602 | case VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID: |
| 1603 | { |
| 1604 | const VkNativeBufferANDROID *nativeBufferInfo = reinterpret_cast<const VkNativeBufferANDROID *>(extensionCreateInfo); |
| 1605 | backmem.nativeHandle = nativeBufferInfo->handle; |
| 1606 | backmem.stride = nativeBufferInfo->stride; |
| 1607 | swapchainImage = true; |
| 1608 | } |
| 1609 | break; |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1610 | #endif |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1611 | case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO: |
| 1612 | // Do nothing. Should be handled by vk::Image::Create() |
| 1613 | break; |
| 1614 | case VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR: |
| 1615 | /* Do nothing. We don't actually need the swapchain handle yet; we'll do all the work in vkBindImageMemory2. */ |
| 1616 | break; |
| 1617 | default: |
| 1618 | // "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]" |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1619 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extensionCreateInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1620 | break; |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1621 | } |
| 1622 | |
| 1623 | extensionCreateInfo = extensionCreateInfo->pNext; |
Alexis Hetu | f62f375 | 2018-11-15 14:51:15 -0500 | [diff] [blame] | 1624 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1625 | |
Nicolas Capens | 0c73680 | 2019-05-27 12:53:31 -0400 | [diff] [blame] | 1626 | VkResult result = vk::Image::Create(pAllocator, pCreateInfo, pImage, vk::Cast(device)); |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1627 | |
| 1628 | #ifdef __ANDROID__ |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1629 | if(swapchainImage) |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1630 | { |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 1631 | if(result != VK_SUCCESS) |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1632 | { |
| 1633 | return result; |
| 1634 | } |
| 1635 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1636 | vk::Image *image = vk::Cast(*pImage); |
Alexis Hetu | 5244595 | 2019-10-31 17:51:07 -0400 | [diff] [blame] | 1637 | VkMemoryRequirements memRequirements = image->getMemoryRequirements(); |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1638 | |
| 1639 | VkMemoryAllocateInfo allocInfo = {}; |
| 1640 | allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; |
| 1641 | allocInfo.allocationSize = memRequirements.size; |
| 1642 | allocInfo.memoryTypeIndex = 0; |
| 1643 | |
Alexis Hetu | 82feec7 | 2019-06-19 12:42:38 -0400 | [diff] [blame] | 1644 | VkDeviceMemory devmem = { VK_NULL_HANDLE }; |
Alexis Hetu | 5244595 | 2019-10-31 17:51:07 -0400 | [diff] [blame] | 1645 | result = vkAllocateMemory(device, &allocInfo, pAllocator, &devmem); |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1646 | if(result != VK_SUCCESS) |
| 1647 | { |
| 1648 | return result; |
| 1649 | } |
| 1650 | |
Hernan Liatis | 3c73507 | 2019-06-10 15:07:18 -0700 | [diff] [blame] | 1651 | vkBindImageMemory(device, *pImage, devmem, 0); |
Alexis Hetu | 5244595 | 2019-10-31 17:51:07 -0400 | [diff] [blame] | 1652 | backmem.externalMemory = true; |
Hernan Liatis | 3c73507 | 2019-06-10 15:07:18 -0700 | [diff] [blame] | 1653 | |
Alexis Hetu | 5244595 | 2019-10-31 17:51:07 -0400 | [diff] [blame] | 1654 | image->setBackingMemory(backmem); |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 1655 | } |
| 1656 | #endif |
| 1657 | |
| 1658 | return result; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1659 | } |
| 1660 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1661 | VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1662 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1663 | TRACE("(VkDevice device = %p, VkImage image = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1664 | device, static_cast<void *>(image), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1665 | |
Hernan Liatis | f988cb5 | 2019-05-22 15:06:19 -0700 | [diff] [blame] | 1666 | #ifdef __ANDROID__ |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1667 | vk::Image *img = vk::Cast(image); |
Alexis Hetu | 5244595 | 2019-10-31 17:51:07 -0400 | [diff] [blame] | 1668 | if(img && img->hasExternalMemory()) |
Hernan Liatis | f988cb5 | 2019-05-22 15:06:19 -0700 | [diff] [blame] | 1669 | { |
Alexis Hetu | 5244595 | 2019-10-31 17:51:07 -0400 | [diff] [blame] | 1670 | vk::destroy(img->getExternalMemory(), pAllocator); |
Hernan Liatis | f988cb5 | 2019-05-22 15:06:19 -0700 | [diff] [blame] | 1671 | } |
| 1672 | #endif |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 1673 | |
| 1674 | vk::destroy(image, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1675 | } |
| 1676 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1677 | VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, VkSubresourceLayout *pLayout) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1678 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1679 | TRACE("(VkDevice device = %p, VkImage image = %p, const VkImageSubresource* pSubresource = %p, VkSubresourceLayout* pLayout = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1680 | device, static_cast<void *>(image), pSubresource, pLayout); |
Alexis Hetu | 6ab37b0 | 2019-01-24 17:02:45 -0500 | [diff] [blame] | 1681 | |
| 1682 | vk::Cast(image)->getSubresourceLayout(pSubresource, pLayout); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1683 | } |
| 1684 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1685 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImageView *pView) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1686 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1687 | TRACE("(VkDevice device = %p, const VkImageViewCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkImageView* pView = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1688 | device, pCreateInfo, pAllocator, pView); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1689 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1690 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1691 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1692 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1693 | } |
| 1694 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1695 | const VkBaseInStructure *extensionCreateInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1696 | const vk::SamplerYcbcrConversion *ycbcrConversion = nullptr; |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1697 | |
| 1698 | while(extensionCreateInfo) |
| 1699 | { |
| 1700 | switch(extensionCreateInfo->sType) |
| 1701 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1702 | case VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR: |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1703 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1704 | const VkImageViewUsageCreateInfo *multiviewCreateInfo = reinterpret_cast<const VkImageViewUsageCreateInfo *>(extensionCreateInfo); |
| 1705 | ASSERT(!(~vk::Cast(pCreateInfo->image)->getUsage() & multiviewCreateInfo->usage)); |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1706 | } |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1707 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1708 | case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO: |
| 1709 | { |
| 1710 | const VkSamplerYcbcrConversionInfo *samplerYcbcrConversionInfo = reinterpret_cast<const VkSamplerYcbcrConversionInfo *>(extensionCreateInfo); |
| 1711 | ycbcrConversion = vk::Cast(samplerYcbcrConversionInfo->conversion); |
| 1712 | |
| 1713 | if(ycbcrConversion) |
| 1714 | { |
| 1715 | ASSERT((pCreateInfo->components.r == VK_COMPONENT_SWIZZLE_IDENTITY) && |
| 1716 | (pCreateInfo->components.g == VK_COMPONENT_SWIZZLE_IDENTITY) && |
| 1717 | (pCreateInfo->components.b == VK_COMPONENT_SWIZZLE_IDENTITY) && |
| 1718 | (pCreateInfo->components.a == VK_COMPONENT_SWIZZLE_IDENTITY)); |
| 1719 | } |
| 1720 | } |
| 1721 | break; |
| 1722 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1723 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extensionCreateInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1724 | break; |
Alexis Hetu | 60da158 | 2019-04-05 16:34:38 -0400 | [diff] [blame] | 1725 | } |
| 1726 | |
| 1727 | extensionCreateInfo = extensionCreateInfo->pNext; |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1728 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1729 | |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1730 | return vk::ImageView::Create(pAllocator, pCreateInfo, pView, ycbcrConversion); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1731 | } |
| 1732 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1733 | VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1734 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1735 | TRACE("(VkDevice device = %p, VkImageView imageView = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1736 | device, static_cast<void *>(imageView), pAllocator); |
Alexis Hetu | 9fbaf69 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1737 | |
| 1738 | vk::destroy(imageView, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1739 | } |
| 1740 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1741 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1742 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1743 | TRACE("(VkDevice device = %p, const VkShaderModuleCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkShaderModule* pShaderModule = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1744 | device, pCreateInfo, pAllocator, pShaderModule); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1745 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1746 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 259ad3d | 2018-11-15 13:44:31 -0500 | [diff] [blame] | 1747 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1748 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 1749 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1750 | } |
| 1751 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1752 | auto *nextInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1753 | while(nextInfo) |
| 1754 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1755 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(nextInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1756 | nextInfo = nextInfo->pNext; |
Alexis Hetu | 259ad3d | 2018-11-15 13:44:31 -0500 | [diff] [blame] | 1757 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1758 | |
Alexis Hetu | 259ad3d | 2018-11-15 13:44:31 -0500 | [diff] [blame] | 1759 | return vk::ShaderModule::Create(pAllocator, pCreateInfo, pShaderModule); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1760 | } |
| 1761 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1762 | VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1763 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1764 | TRACE("(VkDevice device = %p, VkShaderModule shaderModule = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1765 | device, static_cast<void *>(shaderModule), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1766 | |
Alexis Hetu | 259ad3d | 2018-11-15 13:44:31 -0500 | [diff] [blame] | 1767 | vk::destroy(shaderModule, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1768 | } |
| 1769 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1770 | VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1771 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1772 | TRACE("(VkDevice device = %p, const VkPipelineCacheCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkPipelineCache* pPipelineCache = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1773 | device, pCreateInfo, pAllocator, pPipelineCache); |
Alexis Hetu | 18a8425 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1774 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1775 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 18a8425 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1776 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1777 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 1778 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1779 | } |
| 1780 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1781 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1782 | while(extInfo) |
| 1783 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1784 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1785 | extInfo = extInfo->pNext; |
Alexis Hetu | 18a8425 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1786 | } |
| 1787 | |
| 1788 | return vk::PipelineCache::Create(pAllocator, pCreateInfo, pPipelineCache); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1789 | } |
| 1790 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1791 | VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1792 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1793 | TRACE("(VkDevice device = %p, VkPipelineCache pipelineCache = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1794 | device, static_cast<void *>(pipelineCache), pAllocator); |
Alexis Hetu | 18a8425 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1795 | |
| 1796 | vk::destroy(pipelineCache, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1797 | } |
| 1798 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1799 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, void *pData) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1800 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1801 | TRACE("(VkDevice device = %p, VkPipelineCache pipelineCache = %p, size_t* pDataSize = %p, void* pData = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1802 | device, static_cast<void *>(pipelineCache), pDataSize, pData); |
Alexis Hetu | 1424ef6 | 2019-04-05 18:03:53 -0400 | [diff] [blame] | 1803 | |
| 1804 | return vk::Cast(pipelineCache)->getData(pDataSize, pData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1805 | } |
| 1806 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1807 | VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1808 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1809 | TRACE("(VkDevice device = %p, VkPipelineCache dstCache = %p, uint32_t srcCacheCount = %d, const VkPipelineCache* pSrcCaches = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1810 | device, static_cast<void *>(dstCache), int(srcCacheCount), pSrcCaches); |
Alexis Hetu | 1424ef6 | 2019-04-05 18:03:53 -0400 | [diff] [blame] | 1811 | |
| 1812 | return vk::Cast(dstCache)->merge(srcCacheCount, pSrcCaches); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1813 | } |
| 1814 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1815 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1816 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1817 | TRACE("(VkDevice device = %p, VkPipelineCache pipelineCache = %p, uint32_t createInfoCount = %d, const VkGraphicsPipelineCreateInfo* pCreateInfos = %p, const VkAllocationCallbacks* pAllocator = %p, VkPipeline* pPipelines = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1818 | device, static_cast<void *>(pipelineCache), int(createInfoCount), pCreateInfos, pAllocator, pPipelines); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1819 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1820 | VkResult errorResult = VK_SUCCESS; |
| 1821 | for(uint32_t i = 0; i < createInfoCount; i++) |
| 1822 | { |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 1823 | VkResult result = vk::GraphicsPipeline::Create(pAllocator, &pCreateInfos[i], &pPipelines[i], vk::Cast(device)); |
| 1824 | |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 1825 | if(result == VK_SUCCESS) |
| 1826 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1827 | 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] | 1828 | } |
| 1829 | else |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1830 | { |
| 1831 | // According to the Vulkan spec, section 9.4. Multiple Pipeline Creation |
| 1832 | // "When an application attempts to create many pipelines in a single command, |
| 1833 | // it is possible that some subset may fail creation. In that case, the |
| 1834 | // corresponding entries in the pPipelines output array will be filled with |
| 1835 | // VK_NULL_HANDLE values. If any pipeline fails creation (for example, due to |
| 1836 | // out of memory errors), the vkCreate*Pipelines commands will return an |
| 1837 | // error code. The implementation will attempt to create all pipelines, and |
| 1838 | // only return VK_NULL_HANDLE values for those that actually failed." |
| 1839 | pPipelines[i] = VK_NULL_HANDLE; |
| 1840 | errorResult = result; |
| 1841 | } |
| 1842 | } |
| 1843 | |
| 1844 | return errorResult; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1845 | } |
| 1846 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1847 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1848 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1849 | TRACE("(VkDevice device = %p, VkPipelineCache pipelineCache = %p, uint32_t createInfoCount = %d, const VkComputePipelineCreateInfo* pCreateInfos = %p, const VkAllocationCallbacks* pAllocator = %p, VkPipeline* pPipelines = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1850 | device, static_cast<void *>(pipelineCache), int(createInfoCount), pCreateInfos, pAllocator, pPipelines); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1851 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1852 | VkResult errorResult = VK_SUCCESS; |
| 1853 | for(uint32_t i = 0; i < createInfoCount; i++) |
| 1854 | { |
Nicolas Capens | a29aa77 | 2019-06-26 00:36:28 -0400 | [diff] [blame] | 1855 | VkResult result = vk::ComputePipeline::Create(pAllocator, &pCreateInfos[i], &pPipelines[i], vk::Cast(device)); |
| 1856 | |
Ben Clayton | f2be26a | 2019-03-08 12:02:05 +0000 | [diff] [blame] | 1857 | if(result == VK_SUCCESS) |
| 1858 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1859 | 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] | 1860 | } |
| 1861 | else |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1862 | { |
| 1863 | // According to the Vulkan spec, section 9.4. Multiple Pipeline Creation |
| 1864 | // "When an application attempts to create many pipelines in a single command, |
| 1865 | // it is possible that some subset may fail creation. In that case, the |
| 1866 | // corresponding entries in the pPipelines output array will be filled with |
| 1867 | // VK_NULL_HANDLE values. If any pipeline fails creation (for example, due to |
| 1868 | // out of memory errors), the vkCreate*Pipelines commands will return an |
| 1869 | // error code. The implementation will attempt to create all pipelines, and |
| 1870 | // only return VK_NULL_HANDLE values for those that actually failed." |
| 1871 | pPipelines[i] = VK_NULL_HANDLE; |
| 1872 | errorResult = result; |
| 1873 | } |
| 1874 | } |
| 1875 | |
| 1876 | return errorResult; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1877 | } |
| 1878 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1879 | VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1880 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1881 | TRACE("(VkDevice device = %p, VkPipeline pipeline = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1882 | device, static_cast<void *>(pipeline), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1883 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1884 | vk::destroy(pipeline, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1885 | } |
| 1886 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1887 | VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1888 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1889 | TRACE("(VkDevice device = %p, const VkPipelineLayoutCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkPipelineLayout* pPipelineLayout = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1890 | device, pCreateInfo, pAllocator, pPipelineLayout); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1891 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1892 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1893 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1894 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 1895 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1896 | } |
| 1897 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1898 | auto *nextInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1899 | while(nextInfo) |
| 1900 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1901 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(nextInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 1902 | nextInfo = nextInfo->pNext; |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1903 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1904 | |
Alexis Hetu | 000df8b | 2018-10-24 15:22:41 -0400 | [diff] [blame] | 1905 | return vk::PipelineLayout::Create(pAllocator, pCreateInfo, pPipelineLayout); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1906 | } |
| 1907 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1908 | VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1909 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1910 | TRACE("(VkDevice device = %p, VkPipelineLayout pipelineLayout = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1911 | device, static_cast<void *>(pipelineLayout), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1912 | |
Trevor David Black | 3ad285a | 2020-05-26 19:28:05 +0000 | [diff] [blame] | 1913 | vk::release(pipelineLayout, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1914 | } |
| 1915 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1916 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1917 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1918 | TRACE("(VkDevice device = %p, const VkSamplerCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkSampler* pSampler = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1919 | device, pCreateInfo, pAllocator, pSampler); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1920 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1921 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 5174c57 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1922 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 1923 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 5174c57 | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 1924 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1925 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1926 | const VkBaseInStructure *extensionCreateInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1927 | const vk::SamplerYcbcrConversion *ycbcrConversion = nullptr; |
Antonio Maiorano | d9ba4b7 | 2020-05-04 14:38:59 -0400 | [diff] [blame] | 1928 | VkSamplerFilteringPrecisionModeGOOGLE filteringPrecision = VK_SAMPLER_FILTERING_PRECISION_MODE_LOW_GOOGLE; |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1929 | |
| 1930 | while(extensionCreateInfo) |
| 1931 | { |
Antonio Maiorano | d9ba4b7 | 2020-05-04 14:38:59 -0400 | [diff] [blame] | 1932 | switch(static_cast<long>(extensionCreateInfo->sType)) |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1933 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1934 | case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO: |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1935 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1936 | const VkSamplerYcbcrConversionInfo *samplerYcbcrConversionInfo = reinterpret_cast<const VkSamplerYcbcrConversionInfo *>(extensionCreateInfo); |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1937 | ycbcrConversion = vk::Cast(samplerYcbcrConversionInfo->conversion); |
| 1938 | } |
| 1939 | break; |
Antonio Maiorano | d9ba4b7 | 2020-05-04 14:38:59 -0400 | [diff] [blame] | 1940 | case VK_STRUCTURE_TYPE_SAMPLER_FILTERING_PRECISION_GOOGLE: |
| 1941 | { |
| 1942 | const VkSamplerFilteringPrecisionGOOGLE *filteringInfo = |
| 1943 | reinterpret_cast<const VkSamplerFilteringPrecisionGOOGLE *>(extensionCreateInfo); |
| 1944 | filteringPrecision = filteringInfo->samplerFilteringPrecisionMode; |
| 1945 | } |
| 1946 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1947 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1948 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extensionCreateInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1949 | break; |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 1950 | } |
| 1951 | |
| 1952 | extensionCreateInfo = extensionCreateInfo->pNext; |
| 1953 | } |
| 1954 | |
Antonio Maiorano | d9ba4b7 | 2020-05-04 14:38:59 -0400 | [diff] [blame] | 1955 | vk::SamplerState samplerState(pCreateInfo, ycbcrConversion, filteringPrecision); |
Nicolas Capens | 73c4a0c | 2020-03-17 17:29:11 -0400 | [diff] [blame] | 1956 | uint32_t samplerID = vk::Cast(device)->indexSampler(samplerState); |
| 1957 | |
| 1958 | VkResult result = vk::Sampler::Create(pAllocator, pCreateInfo, pSampler, samplerState, samplerID); |
| 1959 | |
| 1960 | if(*pSampler == VK_NULL_HANDLE) |
| 1961 | { |
| 1962 | ASSERT(result != VK_SUCCESS); |
| 1963 | vk::Cast(device)->removeSampler(samplerState); |
| 1964 | } |
| 1965 | |
| 1966 | return result; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1967 | } |
| 1968 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1969 | VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1970 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1971 | TRACE("(VkDevice device = %p, VkSampler sampler = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1972 | device, static_cast<void *>(sampler), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1973 | |
Nicolas Capens | 73c4a0c | 2020-03-17 17:29:11 -0400 | [diff] [blame] | 1974 | if(sampler != VK_NULL_HANDLE) |
| 1975 | { |
| 1976 | vk::Cast(device)->removeSampler(*vk::Cast(sampler)); |
| 1977 | |
| 1978 | vk::destroy(sampler, pAllocator); |
| 1979 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1980 | } |
| 1981 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1982 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 1983 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 1984 | 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] | 1985 | device, pCreateInfo, pAllocator, pSetLayout); |
| 1986 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1987 | const VkBaseInStructure *extensionCreateInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Alexis Hetu | 1300ba1 | 2019-05-07 15:47:11 -0400 | [diff] [blame] | 1988 | |
| 1989 | while(extensionCreateInfo) |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 1990 | { |
Alexis Hetu | 1300ba1 | 2019-05-07 15:47:11 -0400 | [diff] [blame] | 1991 | switch(extensionCreateInfo->sType) |
| 1992 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1993 | case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT: |
| 1994 | ASSERT(!vk::Cast(device)->hasExtension(VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME)); |
| 1995 | break; |
| 1996 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 1997 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extensionCreateInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 1998 | break; |
Alexis Hetu | 1300ba1 | 2019-05-07 15:47:11 -0400 | [diff] [blame] | 1999 | } |
| 2000 | |
| 2001 | extensionCreateInfo = extensionCreateInfo->pNext; |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2002 | } |
| 2003 | |
| 2004 | return vk::DescriptorSetLayout::Create(pAllocator, pCreateInfo, pSetLayout); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2005 | } |
| 2006 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2007 | VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2008 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2009 | TRACE("(VkDevice device = %p, VkDescriptorSetLayout descriptorSetLayout = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2010 | device, static_cast<void *>(descriptorSetLayout), pAllocator); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2011 | |
| 2012 | vk::destroy(descriptorSetLayout, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2013 | } |
| 2014 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2015 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2016 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2017 | 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] | 2018 | device, pCreateInfo, pAllocator, pDescriptorPool); |
| 2019 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2020 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2021 | while(extInfo) |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2022 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2023 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2024 | extInfo = extInfo->pNext; |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2025 | } |
| 2026 | |
| 2027 | return vk::DescriptorPool::Create(pAllocator, pCreateInfo, pDescriptorPool); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2028 | } |
| 2029 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2030 | VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2031 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2032 | TRACE("(VkDevice device = %p, VkDescriptorPool descriptorPool = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2033 | device, static_cast<void *>(descriptorPool), pAllocator); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2034 | |
| 2035 | vk::destroy(descriptorPool, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2036 | } |
| 2037 | |
| 2038 | VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) |
| 2039 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2040 | TRACE("(VkDevice device = %p, VkDescriptorPool descriptorPool = %p, VkDescriptorPoolResetFlags flags = 0x%x)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2041 | device, static_cast<void *>(descriptorPool), int(flags)); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2042 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 2043 | if(flags != 0) |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2044 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 2045 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 2046 | UNSUPPORTED("flags %d", int(flags)); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2047 | } |
| 2048 | |
| 2049 | return vk::Cast(descriptorPool)->reset(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2050 | } |
| 2051 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2052 | VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2053 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2054 | TRACE("(VkDevice device = %p, const VkDescriptorSetAllocateInfo* pAllocateInfo = %p, VkDescriptorSet* pDescriptorSets = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2055 | device, pAllocateInfo, pDescriptorSets); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2056 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2057 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pAllocateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2058 | while(extInfo) |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2059 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2060 | LOG_TRAP("pAllocateInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2061 | extInfo = extInfo->pNext; |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2062 | } |
| 2063 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2064 | return vk::Cast(pAllocateInfo->descriptorPool)->allocateSets(pAllocateInfo->descriptorSetCount, pAllocateInfo->pSetLayouts, pDescriptorSets); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2065 | } |
| 2066 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2067 | VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2068 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2069 | TRACE("(VkDevice device = %p, VkDescriptorPool descriptorPool = %p, uint32_t descriptorSetCount = %d, const VkDescriptorSet* pDescriptorSets = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2070 | device, static_cast<void *>(descriptorPool), descriptorSetCount, pDescriptorSets); |
Alexis Hetu | c817663 | 2019-01-22 17:01:28 -0500 | [diff] [blame] | 2071 | |
| 2072 | vk::Cast(descriptorPool)->freeSets(descriptorSetCount, pDescriptorSets); |
| 2073 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2074 | return VK_SUCCESS; |
| 2075 | } |
| 2076 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2077 | VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2078 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2079 | 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] | 2080 | device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
| 2081 | |
| 2082 | vk::Cast(device)->updateDescriptorSets(descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2083 | } |
| 2084 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2085 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2086 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2087 | TRACE("(VkDevice device = %p, const VkFramebufferCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkFramebuffer* pFramebuffer = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2088 | device, pCreateInfo, pAllocator, pFramebuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2089 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 2090 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 2091 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 2092 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2093 | } |
| 2094 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2095 | auto *nextInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2096 | while(nextInfo) |
| 2097 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2098 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(nextInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2099 | nextInfo = nextInfo->pNext; |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 2100 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2101 | |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 2102 | return vk::Framebuffer::Create(pAllocator, pCreateInfo, pFramebuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2103 | } |
| 2104 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2105 | VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2106 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2107 | TRACE("(VkDevice device = %p, VkFramebuffer framebuffer = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2108 | device, static_cast<void *>(framebuffer), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2109 | |
Alexis Hetu | 8f631c8 | 2018-11-15 15:11:36 -0500 | [diff] [blame] | 2110 | vk::destroy(framebuffer, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2111 | } |
| 2112 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2113 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2114 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2115 | TRACE("(VkDevice device = %p, const VkRenderPassCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkRenderPass* pRenderPass = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2116 | device, pCreateInfo, pAllocator, pRenderPass); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2117 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 2118 | if(pCreateInfo->flags != 0) |
Alexis Hetu | b16f989 | 2018-11-15 15:18:41 -0500 | [diff] [blame] | 2119 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 2120 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 2121 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | 67806a1 | 2019-04-05 14:12:27 -0400 | [diff] [blame] | 2122 | } |
| 2123 | |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 2124 | ValidateRenderPassPNextChain(device, pCreateInfo); |
Alexis Hetu | 67806a1 | 2019-04-05 14:12:27 -0400 | [diff] [blame] | 2125 | |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 2126 | return vk::RenderPass::Create(pAllocator, pCreateInfo, pRenderPass); |
| 2127 | } |
| 2128 | |
| 2129 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) |
| 2130 | { |
| 2131 | TRACE("(VkDevice device = %p, const VkRenderPassCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkRenderPass* pRenderPass = %p)", |
| 2132 | device, pCreateInfo, pAllocator, pRenderPass); |
| 2133 | |
| 2134 | if(pCreateInfo->flags != 0) |
Alexis Hetu | 67806a1 | 2019-04-05 14:12:27 -0400 | [diff] [blame] | 2135 | { |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 2136 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 2137 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
Alexis Hetu | b16f989 | 2018-11-15 15:18:41 -0500 | [diff] [blame] | 2138 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2139 | |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 2140 | ValidateRenderPassPNextChain(device, pCreateInfo); |
| 2141 | |
Alexis Hetu | b16f989 | 2018-11-15 15:18:41 -0500 | [diff] [blame] | 2142 | return vk::RenderPass::Create(pAllocator, pCreateInfo, pRenderPass); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2143 | } |
| 2144 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2145 | VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2146 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2147 | TRACE("(VkDevice device = %p, VkRenderPass renderPass = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2148 | device, static_cast<void *>(renderPass), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2149 | |
Alexis Hetu | b16f989 | 2018-11-15 15:18:41 -0500 | [diff] [blame] | 2150 | vk::destroy(renderPass, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2151 | } |
| 2152 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2153 | VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2154 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2155 | TRACE("(VkDevice device = %p, VkRenderPass renderPass = %p, VkExtent2D* pGranularity = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2156 | device, static_cast<void *>(renderPass), pGranularity); |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 2157 | |
Alexis Hetu | 6d74ab8 | 2019-02-15 14:42:38 -0500 | [diff] [blame] | 2158 | vk::Cast(renderPass)->getRenderAreaGranularity(pGranularity); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2159 | } |
| 2160 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2161 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2162 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2163 | TRACE("(VkDevice device = %p, const VkCommandPoolCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkCommandPool* pCommandPool = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2164 | device, pCreateInfo, pAllocator, pCommandPool); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2165 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2166 | auto *nextInfo = reinterpret_cast<const VkBaseInStructure *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2167 | while(nextInfo) |
Alexis Hetu | 9c4ecae | 2018-11-20 16:26:10 -0500 | [diff] [blame] | 2168 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2169 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(nextInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2170 | nextInfo = nextInfo->pNext; |
Alexis Hetu | 9c4ecae | 2018-11-20 16:26:10 -0500 | [diff] [blame] | 2171 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2172 | |
Alexis Hetu | 9c4ecae | 2018-11-20 16:26:10 -0500 | [diff] [blame] | 2173 | return vk::CommandPool::Create(pAllocator, pCreateInfo, pCommandPool); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2174 | } |
| 2175 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2176 | VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2177 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2178 | TRACE("(VkDevice device = %p, VkCommandPool commandPool = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2179 | device, static_cast<void *>(commandPool), pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2180 | |
Alexis Hetu | 9c4ecae | 2018-11-20 16:26:10 -0500 | [diff] [blame] | 2181 | vk::destroy(commandPool, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2182 | } |
| 2183 | |
| 2184 | VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) |
| 2185 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2186 | TRACE("(VkDevice device = %p, VkCommandPool commandPool = %p, VkCommandPoolResetFlags flags = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2187 | device, static_cast<void *>(commandPool), int(flags)); |
Alexis Hetu | cd610c9 | 2019-02-01 16:47:51 -0500 | [diff] [blame] | 2188 | |
| 2189 | return vk::Cast(commandPool)->reset(flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2190 | } |
| 2191 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2192 | VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2193 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2194 | TRACE("(VkDevice device = %p, const VkCommandBufferAllocateInfo* pAllocateInfo = %p, VkCommandBuffer* pCommandBuffers = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2195 | device, pAllocateInfo, pCommandBuffers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2196 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2197 | auto *nextInfo = reinterpret_cast<const VkBaseInStructure *>(pAllocateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2198 | while(nextInfo) |
Alexis Hetu | bffee5e | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 2199 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2200 | LOG_TRAP("pAllocateInfo->pNext sType = %s", vk::Stringify(nextInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2201 | nextInfo = nextInfo->pNext; |
Alexis Hetu | bffee5e | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 2202 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2203 | |
Ben Clayton | a4e06ca | 2019-12-03 12:38:14 +0000 | [diff] [blame] | 2204 | return vk::Cast(pAllocateInfo->commandPool)->allocateCommandBuffers(vk::Cast(device), pAllocateInfo->level, pAllocateInfo->commandBufferCount, pCommandBuffers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2205 | } |
| 2206 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2207 | VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2208 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2209 | TRACE("(VkDevice device = %p, VkCommandPool commandPool = %p, uint32_t commandBufferCount = %d, const VkCommandBuffer* pCommandBuffers = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2210 | device, static_cast<void *>(commandPool), int(commandBufferCount), pCommandBuffers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2211 | |
Alexis Hetu | bffee5e | 2018-11-19 11:30:43 -0500 | [diff] [blame] | 2212 | vk::Cast(commandPool)->freeCommandBuffers(commandBufferCount, pCommandBuffers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2213 | } |
| 2214 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2215 | VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2216 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2217 | TRACE("(VkCommandBuffer commandBuffer = %p, const VkCommandBufferBeginInfo* pBeginInfo = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2218 | commandBuffer, pBeginInfo); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2219 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2220 | auto *nextInfo = reinterpret_cast<const VkBaseInStructure *>(pBeginInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2221 | while(nextInfo) |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2222 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2223 | LOG_TRAP("pBeginInfo->pNext sType = %s", vk::Stringify(nextInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2224 | nextInfo = nextInfo->pNext; |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2225 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2226 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2227 | return vk::Cast(commandBuffer)->begin(pBeginInfo->flags, pBeginInfo->pInheritanceInfo); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2228 | } |
| 2229 | |
| 2230 | VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer) |
| 2231 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2232 | TRACE("(VkCommandBuffer commandBuffer = %p)", commandBuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2233 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2234 | return vk::Cast(commandBuffer)->end(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2235 | } |
| 2236 | |
| 2237 | VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) |
| 2238 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2239 | TRACE("VkCommandBuffer commandBuffer = %p, VkCommandBufferResetFlags flags = %d", commandBuffer, int(flags)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2240 | |
| 2241 | return vk::Cast(commandBuffer)->reset(flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2242 | } |
| 2243 | |
| 2244 | VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) |
| 2245 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2246 | TRACE("(VkCommandBuffer commandBuffer = %p, VkPipelineBindPoint pipelineBindPoint = %d, VkPipeline pipeline = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2247 | commandBuffer, int(pipelineBindPoint), static_cast<void *>(pipeline)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2248 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2249 | vk::Cast(commandBuffer)->bindPipeline(pipelineBindPoint, vk::Cast(pipeline)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2250 | } |
| 2251 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2252 | VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *pViewports) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2253 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2254 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t firstViewport = %d, uint32_t viewportCount = %d, const VkViewport* pViewports = %p)", |
| 2255 | commandBuffer, int(firstViewport), int(viewportCount), pViewports); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2256 | |
| 2257 | vk::Cast(commandBuffer)->setViewport(firstViewport, viewportCount, pViewports); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2258 | } |
| 2259 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2260 | VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *pScissors) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2261 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2262 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t firstScissor = %d, uint32_t scissorCount = %d, const VkRect2D* pScissors = %p)", |
| 2263 | commandBuffer, int(firstScissor), int(scissorCount), pScissors); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2264 | |
| 2265 | vk::Cast(commandBuffer)->setScissor(firstScissor, scissorCount, pScissors); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2266 | } |
| 2267 | |
| 2268 | VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) |
| 2269 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2270 | TRACE("(VkCommandBuffer commandBuffer = %p, float lineWidth = %f)", commandBuffer, lineWidth); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2271 | |
| 2272 | vk::Cast(commandBuffer)->setLineWidth(lineWidth); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2273 | } |
| 2274 | |
| 2275 | VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) |
| 2276 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2277 | 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] | 2278 | commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
| 2279 | |
| 2280 | vk::Cast(commandBuffer)->setDepthBias(depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2281 | } |
| 2282 | |
| 2283 | VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) |
| 2284 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2285 | TRACE("(VkCommandBuffer commandBuffer = %p, const float blendConstants[4] = {%f, %f, %f, %f})", |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2286 | commandBuffer, blendConstants[0], blendConstants[1], blendConstants[2], blendConstants[3]); |
| 2287 | |
| 2288 | vk::Cast(commandBuffer)->setBlendConstants(blendConstants); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2289 | } |
| 2290 | |
| 2291 | VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) |
| 2292 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2293 | TRACE("(VkCommandBuffer commandBuffer = %p, float minDepthBounds = %f, float maxDepthBounds = %f)", |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2294 | commandBuffer, minDepthBounds, maxDepthBounds); |
| 2295 | |
| 2296 | vk::Cast(commandBuffer)->setDepthBounds(minDepthBounds, maxDepthBounds); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2297 | } |
| 2298 | |
| 2299 | VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) |
| 2300 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2301 | TRACE("(VkCommandBuffer commandBuffer = %p, VkStencilFaceFlags faceMask = %d, uint32_t compareMask = %d)", |
| 2302 | commandBuffer, int(faceMask), int(compareMask)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2303 | |
| 2304 | vk::Cast(commandBuffer)->setStencilCompareMask(faceMask, compareMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2305 | } |
| 2306 | |
| 2307 | VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) |
| 2308 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2309 | TRACE("(VkCommandBuffer commandBuffer = %p, VkStencilFaceFlags faceMask = %d, uint32_t writeMask = %d)", |
| 2310 | commandBuffer, int(faceMask), int(writeMask)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2311 | |
| 2312 | vk::Cast(commandBuffer)->setStencilWriteMask(faceMask, writeMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2313 | } |
| 2314 | |
| 2315 | VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) |
| 2316 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2317 | TRACE("(VkCommandBuffer commandBuffer = %p, VkStencilFaceFlags faceMask = %d, uint32_t reference = %d)", |
| 2318 | commandBuffer, int(faceMask), int(reference)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2319 | |
| 2320 | vk::Cast(commandBuffer)->setStencilReference(faceMask, reference); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2321 | } |
| 2322 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2323 | 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) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2324 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2325 | 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)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2326 | 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] | 2327 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2328 | 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] | 2329 | } |
| 2330 | |
| 2331 | VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) |
| 2332 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2333 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer buffer = %p, VkDeviceSize offset = %d, VkIndexType indexType = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2334 | commandBuffer, static_cast<void *>(buffer), int(offset), int(indexType)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2335 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2336 | vk::Cast(commandBuffer)->bindIndexBuffer(vk::Cast(buffer), offset, indexType); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2337 | } |
| 2338 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2339 | VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2340 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2341 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t firstBinding = %d, uint32_t bindingCount = %d, const VkBuffer* pBuffers = %p, const VkDeviceSize* pOffsets = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2342 | commandBuffer, int(firstBinding), int(bindingCount), pBuffers, pOffsets); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2343 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2344 | vk::Cast(commandBuffer)->bindVertexBuffers(firstBinding, bindingCount, pBuffers, pOffsets); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2345 | } |
| 2346 | |
| 2347 | VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) |
| 2348 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2349 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t vertexCount = %d, uint32_t instanceCount = %d, uint32_t firstVertex = %d, uint32_t firstInstance = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2350 | commandBuffer, int(vertexCount), int(instanceCount), int(firstVertex), int(firstInstance)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2351 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2352 | vk::Cast(commandBuffer)->draw(vertexCount, instanceCount, firstVertex, firstInstance); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2353 | } |
| 2354 | |
| 2355 | VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) |
| 2356 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2357 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t indexCount = %d, uint32_t instanceCount = %d, uint32_t firstIndex = %d, int32_t vertexOffset = %d, uint32_t firstInstance = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2358 | commandBuffer, int(indexCount), int(instanceCount), int(firstIndex), int(vertexOffset), int(firstInstance)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2359 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2360 | vk::Cast(commandBuffer)->drawIndexed(indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2361 | } |
| 2362 | |
| 2363 | VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) |
| 2364 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2365 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer buffer = %p, VkDeviceSize offset = %d, uint32_t drawCount = %d, uint32_t stride = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2366 | commandBuffer, static_cast<void *>(buffer), int(offset), int(drawCount), int(stride)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2367 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2368 | vk::Cast(commandBuffer)->drawIndirect(vk::Cast(buffer), offset, drawCount, stride); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2369 | } |
| 2370 | |
| 2371 | VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) |
| 2372 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2373 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer buffer = %p, VkDeviceSize offset = %d, uint32_t drawCount = %d, uint32_t stride = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2374 | commandBuffer, static_cast<void *>(buffer), int(offset), int(drawCount), int(stride)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2375 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2376 | vk::Cast(commandBuffer)->drawIndexedIndirect(vk::Cast(buffer), offset, drawCount, stride); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2377 | } |
| 2378 | |
| 2379 | VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) |
| 2380 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2381 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t groupCountX = %d, uint32_t groupCountY = %d, uint32_t groupCountZ = %d)", |
| 2382 | commandBuffer, int(groupCountX), int(groupCountY), int(groupCountZ)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2383 | |
| 2384 | vk::Cast(commandBuffer)->dispatch(groupCountX, groupCountY, groupCountZ); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2385 | } |
| 2386 | |
| 2387 | VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) |
| 2388 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2389 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer buffer = %p, VkDeviceSize offset = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2390 | commandBuffer, static_cast<void *>(buffer), int(offset)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2391 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2392 | vk::Cast(commandBuffer)->dispatchIndirect(vk::Cast(buffer), offset); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2393 | } |
| 2394 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2395 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy *pRegions) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2396 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2397 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer srcBuffer = %p, VkBuffer dstBuffer = %p, uint32_t regionCount = %d, const VkBufferCopy* pRegions = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2398 | commandBuffer, static_cast<void *>(srcBuffer), static_cast<void *>(dstBuffer), int(regionCount), pRegions); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2399 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2400 | vk::Cast(commandBuffer)->copyBuffer(vk::Cast(srcBuffer), vk::Cast(dstBuffer), regionCount, pRegions); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2401 | } |
| 2402 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2403 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy *pRegions) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2404 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2405 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage srcImage = %p, VkImageLayout srcImageLayout = %d, VkImage dstImage = %p, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkImageCopy* pRegions = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2406 | 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] | 2407 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2408 | 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] | 2409 | } |
| 2410 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2411 | VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2412 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2413 | 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)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2414 | 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] | 2415 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2416 | 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] | 2417 | } |
| 2418 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2419 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy *pRegions) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2420 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2421 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer srcBuffer = %p, VkImage dstImage = %p, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkBufferImageCopy* pRegions = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2422 | 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] | 2423 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2424 | 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] | 2425 | } |
| 2426 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2427 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2428 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2429 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage srcImage = %p, VkImageLayout srcImageLayout = %d, VkBuffer dstBuffer = %p, uint32_t regionCount = %d, const VkBufferImageCopy* pRegions = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2430 | 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] | 2431 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2432 | 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] | 2433 | } |
| 2434 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2435 | VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2436 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2437 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer dstBuffer = %p, VkDeviceSize dstOffset = %d, VkDeviceSize dataSize = %d, const void* pData = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2438 | commandBuffer, static_cast<void *>(dstBuffer), int(dstOffset), int(dataSize), pData); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2439 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2440 | vk::Cast(commandBuffer)->updateBuffer(vk::Cast(dstBuffer), dstOffset, dataSize, pData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2441 | } |
| 2442 | |
| 2443 | VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) |
| 2444 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2445 | TRACE("(VkCommandBuffer commandBuffer = %p, VkBuffer dstBuffer = %p, VkDeviceSize dstOffset = %d, VkDeviceSize size = %d, uint32_t data = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2446 | commandBuffer, static_cast<void *>(dstBuffer), int(dstOffset), int(size), data); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2447 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2448 | vk::Cast(commandBuffer)->fillBuffer(vk::Cast(dstBuffer), dstOffset, size, data); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2449 | } |
| 2450 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2451 | VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue *pColor, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2452 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2453 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage image = %p, VkImageLayout imageLayout = %d, const VkClearColorValue* pColor = %p, uint32_t rangeCount = %d, const VkImageSubresourceRange* pRanges = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2454 | commandBuffer, static_cast<void *>(image), int(imageLayout), pColor, int(rangeCount), pRanges); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2455 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2456 | vk::Cast(commandBuffer)->clearColorImage(vk::Cast(image), imageLayout, pColor, rangeCount, pRanges); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2457 | } |
| 2458 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2459 | VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2460 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2461 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage image = %p, VkImageLayout imageLayout = %d, const VkClearDepthStencilValue* pDepthStencil = %p, uint32_t rangeCount = %d, const VkImageSubresourceRange* pRanges = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2462 | commandBuffer, static_cast<void *>(image), int(imageLayout), pDepthStencil, int(rangeCount), pRanges); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2463 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2464 | vk::Cast(commandBuffer)->clearDepthStencilImage(vk::Cast(image), imageLayout, pDepthStencil, rangeCount, pRanges); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2465 | } |
| 2466 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2467 | VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment *pAttachments, uint32_t rectCount, const VkClearRect *pRects) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2468 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2469 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t attachmentCount = %d, const VkClearAttachment* pAttachments = %p, uint32_t rectCount = %d, const VkClearRect* pRects = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2470 | commandBuffer, int(attachmentCount), pAttachments, int(rectCount), pRects); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2471 | |
| 2472 | vk::Cast(commandBuffer)->clearAttachments(attachmentCount, pAttachments, rectCount, pRects); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2473 | } |
| 2474 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2475 | VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve *pRegions) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2476 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2477 | TRACE("(VkCommandBuffer commandBuffer = %p, VkImage srcImage = %p, VkImageLayout srcImageLayout = %d, VkImage dstImage = %p, VkImageLayout dstImageLayout = %d, uint32_t regionCount = %d, const VkImageResolve* pRegions = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2478 | 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] | 2479 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2480 | 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] | 2481 | } |
| 2482 | |
| 2483 | VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) |
| 2484 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2485 | TRACE("(VkCommandBuffer commandBuffer = %p, VkEvent event = %p, VkPipelineStageFlags stageMask = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2486 | commandBuffer, static_cast<void *>(event), int(stageMask)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2487 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2488 | vk::Cast(commandBuffer)->setEvent(vk::Cast(event), stageMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2489 | } |
| 2490 | |
| 2491 | VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) |
| 2492 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2493 | TRACE("(VkCommandBuffer commandBuffer = %p, VkEvent event = %p, VkPipelineStageFlags stageMask = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2494 | commandBuffer, static_cast<void *>(event), int(stageMask)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2495 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2496 | vk::Cast(commandBuffer)->resetEvent(vk::Cast(event), stageMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2497 | } |
| 2498 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2499 | 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) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2500 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2501 | 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)", |
| 2502 | 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] | 2503 | |
| 2504 | 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] | 2505 | } |
| 2506 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2507 | 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) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2508 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2509 | TRACE( |
| 2510 | "(VkCommandBuffer commandBuffer = %p, VkPipelineStageFlags srcStageMask = 0x%x, VkPipelineStageFlags dstStageMask = 0x%x, VkDependencyFlags dependencyFlags = %d, uint32_t memoryBarrierCount = %d, onst VkMemoryBarrier* pMemoryBarriers = %p," |
| 2511 | " uint32_t bufferMemoryBarrierCount = %d, const VkBufferMemoryBarrier* pBufferMemoryBarriers = %p, uint32_t imageMemoryBarrierCount = %d, const VkImageMemoryBarrier* pImageMemoryBarriers = %p)", |
| 2512 | 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] | 2513 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2514 | vk::Cast(commandBuffer)->pipelineBarrier(srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2515 | } |
| 2516 | |
| 2517 | VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) |
| 2518 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2519 | TRACE("(VkCommandBuffer commandBuffer = %p, VkQueryPool queryPool = %p, uint32_t query = %d, VkQueryControlFlags flags = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2520 | commandBuffer, static_cast<void *>(queryPool), query, int(flags)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2521 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2522 | vk::Cast(commandBuffer)->beginQuery(vk::Cast(queryPool), query, flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2523 | } |
| 2524 | |
| 2525 | VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query) |
| 2526 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2527 | TRACE("(VkCommandBuffer commandBuffer = %p, VkQueryPool queryPool = %p, uint32_t query = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2528 | commandBuffer, static_cast<void *>(queryPool), int(query)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2529 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2530 | vk::Cast(commandBuffer)->endQuery(vk::Cast(queryPool), query); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2531 | } |
| 2532 | |
| 2533 | VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) |
| 2534 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2535 | TRACE("(VkCommandBuffer commandBuffer = %p, VkQueryPool queryPool = %p, uint32_t firstQuery = %d, uint32_t queryCount = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2536 | commandBuffer, static_cast<void *>(queryPool), int(firstQuery), int(queryCount)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2537 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2538 | vk::Cast(commandBuffer)->resetQueryPool(vk::Cast(queryPool), firstQuery, queryCount); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2539 | } |
| 2540 | |
| 2541 | VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) |
| 2542 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2543 | TRACE("(VkCommandBuffer commandBuffer = %p, VkPipelineStageFlagBits pipelineStage = %d, VkQueryPool queryPool = %p, uint32_t query = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2544 | commandBuffer, int(pipelineStage), static_cast<void *>(queryPool), int(query)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2545 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2546 | vk::Cast(commandBuffer)->writeTimestamp(pipelineStage, vk::Cast(queryPool), query); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2547 | } |
| 2548 | |
| 2549 | VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) |
| 2550 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2551 | 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)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2552 | 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] | 2553 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2554 | 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] | 2555 | } |
| 2556 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2557 | VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void *pValues) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2558 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2559 | TRACE("(VkCommandBuffer commandBuffer = %p, VkPipelineLayout layout = %p, VkShaderStageFlags stageFlags = %d, uint32_t offset = %d, uint32_t size = %d, const void* pValues = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2560 | commandBuffer, static_cast<void *>(layout), stageFlags, offset, size, pValues); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2561 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2562 | vk::Cast(commandBuffer)->pushConstants(vk::Cast(layout), stageFlags, offset, size, pValues); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2563 | } |
| 2564 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2565 | VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkSubpassContents contents) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2566 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2567 | TRACE("(VkCommandBuffer commandBuffer = %p, const VkRenderPassBeginInfo* pRenderPassBegin = %p, VkSubpassContents contents = %d)", |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 2568 | commandBuffer, pRenderPassBegin, contents); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2569 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2570 | const VkBaseInStructure *renderPassBeginInfo = reinterpret_cast<const VkBaseInStructure *>(pRenderPassBegin->pNext); |
Alexis Hetu | 026ceef | 2019-05-07 17:35:11 -0400 | [diff] [blame] | 2571 | while(renderPassBeginInfo) |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2572 | { |
Alexis Hetu | 026ceef | 2019-05-07 17:35:11 -0400 | [diff] [blame] | 2573 | switch(renderPassBeginInfo->sType) |
| 2574 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2575 | case VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO: |
| 2576 | // This extension controls which render area is used on which physical device, |
| 2577 | // in order to distribute rendering between multiple physical devices. |
| 2578 | // SwiftShader only has a single physical device, so this extension does nothing in this case. |
| 2579 | break; |
| 2580 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2581 | LOG_TRAP("pRenderPassBegin->pNext sType = %s", vk::Stringify(renderPassBeginInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2582 | break; |
Alexis Hetu | 026ceef | 2019-05-07 17:35:11 -0400 | [diff] [blame] | 2583 | } |
| 2584 | |
| 2585 | renderPassBeginInfo = renderPassBeginInfo->pNext; |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2586 | } |
| 2587 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2588 | vk::Cast(commandBuffer)->beginRenderPass(vk::Cast(pRenderPassBegin->renderPass), vk::Cast(pRenderPassBegin->framebuffer), pRenderPassBegin->renderArea, pRenderPassBegin->clearValueCount, pRenderPassBegin->pClearValues, contents); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2589 | } |
| 2590 | |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 2591 | VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, const VkSubpassBeginInfoKHR *pSubpassBeginInfo) |
| 2592 | { |
| 2593 | TRACE("(VkCommandBuffer commandBuffer = %p, const VkRenderPassBeginInfo* pRenderPassBegin = %p, const VkSubpassBeginInfoKHR* pSubpassBeginInfo = %p)", |
| 2594 | commandBuffer, pRenderPassBegin, pSubpassBeginInfo); |
| 2595 | |
| 2596 | vk::Cast(commandBuffer)->beginRenderPass(vk::Cast(pRenderPassBegin->renderPass), vk::Cast(pRenderPassBegin->framebuffer), pRenderPassBegin->renderArea, pRenderPassBegin->clearValueCount, pRenderPassBegin->pClearValues, pSubpassBeginInfo->contents); |
| 2597 | } |
| 2598 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2599 | VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) |
| 2600 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2601 | TRACE("(VkCommandBuffer commandBuffer = %p, VkSubpassContents contents = %d)", |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2602 | commandBuffer, contents); |
| 2603 | |
| 2604 | vk::Cast(commandBuffer)->nextSubpass(contents); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2605 | } |
| 2606 | |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 2607 | VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass2KHR(VkCommandBuffer commandBuffer, const VkSubpassBeginInfoKHR *pSubpassBeginInfo, const VkSubpassEndInfoKHR *pSubpassEndInfo) |
| 2608 | { |
| 2609 | TRACE("(VkCommandBuffer commandBuffer = %p, const VkSubpassBeginInfoKHR* pSubpassBeginInfo = %p, const VkSubpassEndInfoKHR* pSubpassEndInfo = %p)", |
| 2610 | commandBuffer, pSubpassBeginInfo, pSubpassEndInfo); |
| 2611 | |
| 2612 | vk::Cast(commandBuffer)->nextSubpass(pSubpassBeginInfo->contents); |
| 2613 | } |
| 2614 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2615 | VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer) |
| 2616 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2617 | TRACE("(VkCommandBuffer commandBuffer = %p)", commandBuffer); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2618 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2619 | vk::Cast(commandBuffer)->endRenderPass(); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2620 | } |
| 2621 | |
Alexis Hetu | 9f8337e | 2020-02-07 11:07:43 -0500 | [diff] [blame] | 2622 | VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass2KHR(VkCommandBuffer commandBuffer, const VkSubpassEndInfoKHR *pSubpassEndInfo) |
| 2623 | { |
| 2624 | TRACE("(VkCommandBuffer commandBuffer = %p, const VkSubpassEndInfoKHR* pSubpassEndInfo = %p)", commandBuffer, pSubpassEndInfo); |
| 2625 | |
| 2626 | vk::Cast(commandBuffer)->endRenderPass(); |
| 2627 | } |
| 2628 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2629 | VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2630 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2631 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t commandBufferCount = %d, const VkCommandBuffer* pCommandBuffers = %p)", |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 2632 | commandBuffer, commandBufferCount, pCommandBuffers); |
| 2633 | |
| 2634 | vk::Cast(commandBuffer)->executeCommands(commandBufferCount, pCommandBuffers); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2635 | } |
| 2636 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2637 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t *pApiVersion) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2638 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2639 | TRACE("(uint32_t* pApiVersion = %p)", pApiVersion); |
Nicolas Capens | ee841c5 | 2018-11-13 14:18:26 -0500 | [diff] [blame] | 2640 | *pApiVersion = vk::API_VERSION; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2641 | return VK_SUCCESS; |
| 2642 | } |
| 2643 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2644 | VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo *pBindInfos) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2645 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2646 | TRACE("(VkDevice device = %p, uint32_t bindInfoCount = %d, const VkBindBufferMemoryInfo* pBindInfos = %p)", |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 2647 | device, bindInfoCount, pBindInfos); |
| 2648 | |
| 2649 | for(uint32_t i = 0; i < bindInfoCount; i++) |
| 2650 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2651 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pBindInfos[i].pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2652 | while(extInfo) |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 2653 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2654 | LOG_TRAP("pBindInfos[%d].pNext sType = %s", i, vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2655 | extInfo = extInfo->pNext; |
Alexis Hetu | 38ff830 | 2018-10-18 15:08:13 -0400 | [diff] [blame] | 2656 | } |
| 2657 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 2658 | if(!vk::Cast(pBindInfos[i].buffer)->canBindToMemory(vk::Cast(pBindInfos[i].memory))) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 2659 | { |
| 2660 | UNSUPPORTED("vkBindBufferMemory2 with invalid external memory"); |
| 2661 | return VK_ERROR_INVALID_EXTERNAL_HANDLE; |
| 2662 | } |
| 2663 | } |
| 2664 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 2665 | for(uint32_t i = 0; i < bindInfoCount; i++) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 2666 | { |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 2667 | 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] | 2668 | } |
| 2669 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2670 | return VK_SUCCESS; |
| 2671 | } |
| 2672 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2673 | VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo *pBindInfos) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2674 | { |
Alexis Hetu | f18f0c1 | 2019-05-07 14:34:15 -0400 | [diff] [blame] | 2675 | TRACE("(VkDevice device = %p, uint32_t bindInfoCount = %d, const VkBindImageMemoryInfo* pBindInfos = %p)", |
| 2676 | device, bindInfoCount, pBindInfos); |
Nicolas Capens | 71c012b | 2019-05-22 13:31:52 -0400 | [diff] [blame] | 2677 | |
Alexis Hetu | f18f0c1 | 2019-05-07 14:34:15 -0400 | [diff] [blame] | 2678 | for(uint32_t i = 0; i < bindInfoCount; i++) |
| 2679 | { |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 2680 | if(!vk::Cast(pBindInfos[i].image)->canBindToMemory(vk::Cast(pBindInfos[i].memory))) |
David 'Digit' Turner | 359bc80 | 2019-08-14 17:46:07 +0200 | [diff] [blame] | 2681 | { |
| 2682 | UNSUPPORTED("vkBindImageMemory2 with invalid external memory"); |
| 2683 | return VK_ERROR_OUT_OF_DEVICE_MEMORY; |
| 2684 | } |
| 2685 | } |
| 2686 | |
| 2687 | for(uint32_t i = 0; i < bindInfoCount; i++) |
| 2688 | { |
Chris Forbes | 92577e5 | 2019-09-02 17:43:38 +0100 | [diff] [blame] | 2689 | vk::DeviceMemory *memory = vk::Cast(pBindInfos[i].memory); |
| 2690 | VkDeviceSize offset = pBindInfos[i].memoryOffset; |
| 2691 | |
| 2692 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pBindInfos[i].pNext); |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 2693 | while(extInfo) |
Alexis Hetu | f18f0c1 | 2019-05-07 14:34:15 -0400 | [diff] [blame] | 2694 | { |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 2695 | switch(extInfo->sType) |
Chris Forbes | 92577e5 | 2019-09-02 17:43:38 +0100 | [diff] [blame] | 2696 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2697 | case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO: |
| 2698 | /* Do nothing */ |
| 2699 | break; |
Chris Forbes | 92577e5 | 2019-09-02 17:43:38 +0100 | [diff] [blame] | 2700 | |
| 2701 | #ifndef __ANDROID__ |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2702 | case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR: |
Chris Forbes | 92577e5 | 2019-09-02 17:43:38 +0100 | [diff] [blame] | 2703 | { |
| 2704 | auto swapchainInfo = reinterpret_cast<VkBindImageMemorySwapchainInfoKHR const *>(extInfo); |
| 2705 | memory = vk::Cast(swapchainInfo->swapchain)->getImage(swapchainInfo->imageIndex).getImageMemory(); |
| 2706 | offset = 0; |
| 2707 | } |
| 2708 | break; |
| 2709 | #endif |
| 2710 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2711 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2712 | LOG_TRAP("pBindInfos[%d].pNext sType = %s", i, vk::Stringify(extInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2713 | break; |
Chris Forbes | 92577e5 | 2019-09-02 17:43:38 +0100 | [diff] [blame] | 2714 | } |
| 2715 | extInfo = extInfo->pNext; |
Alexis Hetu | f18f0c1 | 2019-05-07 14:34:15 -0400 | [diff] [blame] | 2716 | } |
| 2717 | |
Chris Forbes | 92577e5 | 2019-09-02 17:43:38 +0100 | [diff] [blame] | 2718 | vk::Cast(pBindInfos[i].image)->bind(memory, offset); |
Alexis Hetu | f18f0c1 | 2019-05-07 14:34:15 -0400 | [diff] [blame] | 2719 | } |
| 2720 | |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2721 | return VK_SUCCESS; |
| 2722 | } |
| 2723 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2724 | VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags *pPeerMemoryFeatures) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2725 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2726 | 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] | 2727 | device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures); |
| 2728 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2729 | ASSERT(localDeviceIndex != remoteDeviceIndex); // "localDeviceIndex must not equal remoteDeviceIndex" |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 2730 | UNSUPPORTED("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] | 2731 | } |
| 2732 | |
| 2733 | VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask) |
| 2734 | { |
Alexis Hetu | 026ceef | 2019-05-07 17:35:11 -0400 | [diff] [blame] | 2735 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t deviceMask = %d", commandBuffer, deviceMask); |
| 2736 | |
| 2737 | vk::Cast(commandBuffer)->setDeviceMask(deviceMask); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2738 | } |
| 2739 | |
| 2740 | 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) |
| 2741 | { |
Chris Forbes | 4a4c259 | 2019-05-13 08:53:36 -0700 | [diff] [blame] | 2742 | TRACE("(VkCommandBuffer commandBuffer = %p, baseGroupX = %u, baseGroupY = %u, baseGroupZ = %u, groupCountX = %u, groupCountY = %u, groupCountZ = %u)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2743 | commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ); |
Chris Forbes | 4a4c259 | 2019-05-13 08:53:36 -0700 | [diff] [blame] | 2744 | |
| 2745 | vk::Cast(commandBuffer)->dispatchBase(baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2746 | } |
| 2747 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2748 | VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2749 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2750 | TRACE("VkInstance instance = %p, uint32_t* pPhysicalDeviceGroupCount = %p, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties = %p", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2751 | instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties); |
| 2752 | |
Chris Forbes | df84b94 | 2019-06-12 11:28:09 -0700 | [diff] [blame] | 2753 | return vk::Cast(instance)->getPhysicalDeviceGroups(pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2754 | } |
| 2755 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2756 | VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2757 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2758 | TRACE("(VkDevice device = %p, const VkImageMemoryRequirementsInfo2* pInfo = %p, VkMemoryRequirements2* pMemoryRequirements = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2759 | device, pInfo, pMemoryRequirements); |
| 2760 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2761 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2762 | while(extInfo) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2763 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2764 | LOG_TRAP("pInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2765 | extInfo = extInfo->pNext; |
Alexis Hetu | 42761d2 | 2019-04-08 11:25:59 -0400 | [diff] [blame] | 2766 | } |
| 2767 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2768 | VkBaseOutStructure *extensionRequirements = reinterpret_cast<VkBaseOutStructure *>(pMemoryRequirements->pNext); |
Alexis Hetu | 42761d2 | 2019-04-08 11:25:59 -0400 | [diff] [blame] | 2769 | while(extensionRequirements) |
| 2770 | { |
| 2771 | switch(extensionRequirements->sType) |
| 2772 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2773 | case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: |
| 2774 | { |
| 2775 | auto requirements = reinterpret_cast<VkMemoryDedicatedRequirements *>(extensionRequirements); |
| 2776 | vk::Cast(device)->getRequirements(requirements); |
| 2777 | } |
Alexis Hetu | 42761d2 | 2019-04-08 11:25:59 -0400 | [diff] [blame] | 2778 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2779 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2780 | LOG_TRAP("pMemoryRequirements->pNext sType = %s", vk::Stringify(extensionRequirements->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2781 | break; |
Alexis Hetu | 42761d2 | 2019-04-08 11:25:59 -0400 | [diff] [blame] | 2782 | } |
| 2783 | |
| 2784 | extensionRequirements = extensionRequirements->pNext; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2785 | } |
| 2786 | |
| 2787 | vkGetImageMemoryRequirements(device, pInfo->image, &(pMemoryRequirements->memoryRequirements)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2788 | } |
| 2789 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2790 | VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2791 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2792 | TRACE("(VkDevice device = %p, const VkBufferMemoryRequirementsInfo2* pInfo = %p, VkMemoryRequirements2* pMemoryRequirements = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2793 | device, pInfo, pMemoryRequirements); |
| 2794 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2795 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2796 | while(extInfo) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2797 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2798 | LOG_TRAP("pInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2799 | extInfo = extInfo->pNext; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2800 | } |
| 2801 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2802 | VkBaseOutStructure *extensionRequirements = reinterpret_cast<VkBaseOutStructure *>(pMemoryRequirements->pNext); |
Alexis Hetu | 1e6a989 | 2019-03-15 12:12:00 -0400 | [diff] [blame] | 2803 | while(extensionRequirements) |
| 2804 | { |
| 2805 | switch(extensionRequirements->sType) |
| 2806 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2807 | case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: |
Alexis Hetu | 1e6a989 | 2019-03-15 12:12:00 -0400 | [diff] [blame] | 2808 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2809 | auto requirements = reinterpret_cast<VkMemoryDedicatedRequirements *>(extensionRequirements); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2810 | vk::Cast(device)->getRequirements(requirements); |
Alexis Hetu | 1e6a989 | 2019-03-15 12:12:00 -0400 | [diff] [blame] | 2811 | } |
| 2812 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2813 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2814 | LOG_TRAP("pMemoryRequirements->pNext sType = %s", vk::Stringify(extensionRequirements->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2815 | break; |
Alexis Hetu | 1e6a989 | 2019-03-15 12:12:00 -0400 | [diff] [blame] | 2816 | } |
| 2817 | |
| 2818 | extensionRequirements = extensionRequirements->pNext; |
| 2819 | } |
| 2820 | |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2821 | vkGetBufferMemoryRequirements(device, pInfo->buffer, &(pMemoryRequirements->memoryRequirements)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2822 | } |
| 2823 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2824 | VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2825 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2826 | 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] | 2827 | device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); |
| 2828 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2829 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2830 | while(extInfo) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2831 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2832 | LOG_TRAP("pInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2833 | extInfo = extInfo->pNext; |
| 2834 | } |
| 2835 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2836 | auto extensionRequirements = reinterpret_cast<VkBaseInStructure const *>(pSparseMemoryRequirements->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2837 | while(extensionRequirements) |
| 2838 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2839 | LOG_TRAP("pSparseMemoryRequirements->pNext sType = %s", vk::Stringify(extensionRequirements->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 2840 | extensionRequirements = extensionRequirements->pNext; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2841 | } |
| 2842 | |
Alexis Hetu | 4100b73 | 2019-10-11 17:01:48 -0400 | [diff] [blame] | 2843 | // The 'sparseBinding' feature is not supported, so images can not be created with the VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT flag. |
| 2844 | // "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." |
| 2845 | *pSparseMemoryRequirementCount = 0; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2846 | } |
| 2847 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2848 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2849 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2850 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceFeatures2* pFeatures = %p)", physicalDevice, pFeatures); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2851 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2852 | VkBaseOutStructure *extensionFeatures = reinterpret_cast<VkBaseOutStructure *>(pFeatures->pNext); |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2853 | while(extensionFeatures) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2854 | { |
Alexis Hetu | b07147b | 2019-10-29 12:49:24 -0400 | [diff] [blame] | 2855 | switch((long)(extensionFeatures->sType)) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2856 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2857 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2858 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2859 | auto features = reinterpret_cast<VkPhysicalDeviceSamplerYcbcrConversionFeatures *>(extensionFeatures); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2860 | vk::Cast(physicalDevice)->getFeatures(features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2861 | } |
| 2862 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2863 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2864 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2865 | auto features = reinterpret_cast<VkPhysicalDevice16BitStorageFeatures *>(extensionFeatures); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2866 | vk::Cast(physicalDevice)->getFeatures(features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2867 | } |
| 2868 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2869 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2870 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2871 | auto features = reinterpret_cast<VkPhysicalDeviceVariablePointerFeatures *>(extensionFeatures); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2872 | vk::Cast(physicalDevice)->getFeatures(features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2873 | } |
| 2874 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2875 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2876 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2877 | auto features = reinterpret_cast<VkPhysicalDevice8BitStorageFeaturesKHR *>(extensionFeatures); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2878 | vk::Cast(physicalDevice)->getFeatures(features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2879 | } |
| 2880 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2881 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2882 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2883 | auto features = reinterpret_cast<VkPhysicalDeviceMultiviewFeatures *>(extensionFeatures); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2884 | vk::Cast(physicalDevice)->getFeatures(features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2885 | } |
| 2886 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2887 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2888 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2889 | auto features = reinterpret_cast<VkPhysicalDeviceProtectedMemoryFeatures *>(extensionFeatures); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2890 | vk::Cast(physicalDevice)->getFeatures(features); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2891 | } |
| 2892 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2893 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES: |
Chris Forbes | 6408c55 | 2019-04-15 12:59:34 -0700 | [diff] [blame] | 2894 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2895 | auto features = reinterpret_cast<VkPhysicalDeviceShaderDrawParameterFeatures *>(extensionFeatures); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2896 | vk::Cast(physicalDevice)->getFeatures(features); |
Chris Forbes | 6408c55 | 2019-04-15 12:59:34 -0700 | [diff] [blame] | 2897 | } |
| 2898 | break; |
Alexis Hetu | aabd085 | 2020-02-10 14:27:29 -0500 | [diff] [blame] | 2899 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES_KHR: |
| 2900 | { |
Ben Clayton | a0453d5 | 2020-02-11 18:05:41 +0000 | [diff] [blame] | 2901 | auto features = reinterpret_cast<VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR *>(extensionFeatures); |
Alexis Hetu | aabd085 | 2020-02-10 14:27:29 -0500 | [diff] [blame] | 2902 | vk::Cast(physicalDevice)->getFeatures(features); |
| 2903 | } |
| 2904 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2905 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT: |
Alexis Hetu | 23f9c25 | 2019-10-17 13:58:25 -0400 | [diff] [blame] | 2906 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2907 | auto features = reinterpret_cast<VkPhysicalDeviceLineRasterizationFeaturesEXT *>(extensionFeatures); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2908 | vk::Cast(physicalDevice)->getFeatures(features); |
Alexis Hetu | 23f9c25 | 2019-10-17 13:58:25 -0400 | [diff] [blame] | 2909 | } |
| 2910 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2911 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT: |
Alexis Hetu | b07147b | 2019-10-29 12:49:24 -0400 | [diff] [blame] | 2912 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2913 | auto features = reinterpret_cast<VkPhysicalDeviceProvokingVertexFeaturesEXT *>(extensionFeatures); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2914 | vk::Cast(physicalDevice)->getFeatures(features); |
Alexis Hetu | b07147b | 2019-10-29 12:49:24 -0400 | [diff] [blame] | 2915 | } |
Alexis Hetu | e1cda39 | 2019-10-29 14:29:02 -0400 | [diff] [blame] | 2916 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2917 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: |
| 2918 | ASSERT(!HasExtensionProperty(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME, deviceExtensionProperties, |
| 2919 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2920 | break; |
| 2921 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT: |
| 2922 | ASSERT(!HasExtensionProperty(VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME, deviceExtensionProperties, |
| 2923 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2924 | break; |
| 2925 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR: |
| 2926 | ASSERT(!HasExtensionProperty(VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME, deviceExtensionProperties, |
| 2927 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2928 | break; |
| 2929 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR: |
| 2930 | ASSERT(!HasExtensionProperty(VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME, deviceExtensionProperties, |
| 2931 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2932 | break; |
| 2933 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 2934 | LOG_TRAP("pFeatures->pNext sType = %s", vk::Stringify(extensionFeatures->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2935 | break; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2936 | } |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2937 | |
| 2938 | extensionFeatures = extensionFeatures->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2939 | } |
| 2940 | |
| 2941 | vkGetPhysicalDeviceFeatures(physicalDevice, &(pFeatures->features)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2942 | } |
| 2943 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2944 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2945 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 2946 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceProperties2* pProperties = %p)", physicalDevice, pProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 2947 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2948 | VkBaseOutStructure *extensionProperties = reinterpret_cast<VkBaseOutStructure *>(pProperties->pNext); |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 2949 | while(extensionProperties) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 2950 | { |
Alexis Hetu | f8f6103 | 2019-10-10 16:45:30 -0400 | [diff] [blame] | 2951 | // Casting to a long since some structures, such as |
| 2952 | // VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID and |
| 2953 | // VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT |
Hernan Liatis | 83a3eb4 | 2019-04-29 17:16:10 -0700 | [diff] [blame] | 2954 | // are not enumerated in the official Vulkan header |
| 2955 | switch((long)(extensionProperties->sType)) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2956 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2957 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2958 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2959 | auto properties = reinterpret_cast<VkPhysicalDeviceIDProperties *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2960 | vk::Cast(physicalDevice)->getProperties(properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2961 | } |
| 2962 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2963 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2964 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2965 | auto properties = reinterpret_cast<VkPhysicalDeviceMaintenance3Properties *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2966 | vk::Cast(physicalDevice)->getProperties(properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2967 | } |
| 2968 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2969 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2970 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2971 | auto properties = reinterpret_cast<VkPhysicalDeviceMultiviewProperties *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2972 | vk::Cast(physicalDevice)->getProperties(properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2973 | } |
| 2974 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2975 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2976 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2977 | auto properties = reinterpret_cast<VkPhysicalDevicePointClippingProperties *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2978 | vk::Cast(physicalDevice)->getProperties(properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2979 | } |
| 2980 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2981 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2982 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2983 | auto properties = reinterpret_cast<VkPhysicalDeviceProtectedMemoryProperties *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2984 | vk::Cast(physicalDevice)->getProperties(properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2985 | } |
| 2986 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2987 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES: |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2988 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2989 | auto properties = reinterpret_cast<VkPhysicalDeviceSubgroupProperties *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 2990 | vk::Cast(physicalDevice)->getProperties(properties); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 2991 | } |
| 2992 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 2993 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT: |
| 2994 | // Explicitly ignored, since VK_EXT_sample_locations is not supported |
| 2995 | ASSERT(!HasExtensionProperty(VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME, deviceExtensionProperties, |
| 2996 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 2997 | break; |
| 2998 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT: |
Jonah Ryan-Davis | f9f999f | 2020-01-08 14:41:28 -0500 | [diff] [blame] | 2999 | { |
| 3000 | auto properties = reinterpret_cast<VkPhysicalDeviceExternalMemoryHostPropertiesEXT *>(extensionProperties); |
| 3001 | vk::Cast(physicalDevice)->getProperties(properties); |
| 3002 | } |
| 3003 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3004 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR: |
Nicolas Capens | 657dd6c | 2018-11-16 17:41:37 -0500 | [diff] [blame] | 3005 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3006 | auto properties = reinterpret_cast<VkPhysicalDeviceDriverPropertiesKHR *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 3007 | vk::Cast(physicalDevice)->getProperties(properties); |
Nicolas Capens | 657dd6c | 2018-11-16 17:41:37 -0500 | [diff] [blame] | 3008 | } |
| 3009 | break; |
Hernan Liatis | 83a3eb4 | 2019-04-29 17:16:10 -0700 | [diff] [blame] | 3010 | #ifdef __ANDROID__ |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3011 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: |
Hernan Liatis | 83a3eb4 | 2019-04-29 17:16:10 -0700 | [diff] [blame] | 3012 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3013 | auto properties = reinterpret_cast<VkPhysicalDevicePresentationPropertiesANDROID *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 3014 | vk::Cast(physicalDevice)->getProperties(properties); |
Hernan Liatis | 83a3eb4 | 2019-04-29 17:16:10 -0700 | [diff] [blame] | 3015 | } |
| 3016 | break; |
| 3017 | #endif |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3018 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT: |
Alexis Hetu | 23f9c25 | 2019-10-17 13:58:25 -0400 | [diff] [blame] | 3019 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3020 | auto properties = reinterpret_cast<VkPhysicalDeviceLineRasterizationPropertiesEXT *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 3021 | vk::Cast(physicalDevice)->getProperties(properties); |
Alexis Hetu | 23f9c25 | 2019-10-17 13:58:25 -0400 | [diff] [blame] | 3022 | } |
| 3023 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3024 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT: |
Alexis Hetu | f8f6103 | 2019-10-10 16:45:30 -0400 | [diff] [blame] | 3025 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3026 | auto properties = reinterpret_cast<VkPhysicalDeviceProvokingVertexPropertiesEXT *>(extensionProperties); |
Alexis Hetu | 131a1ba | 2019-11-21 16:39:06 -0500 | [diff] [blame] | 3027 | vk::Cast(physicalDevice)->getProperties(properties); |
Alexis Hetu | f8f6103 | 2019-10-10 16:45:30 -0400 | [diff] [blame] | 3028 | } |
| 3029 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3030 | default: |
| 3031 | // "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]" |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3032 | LOG_TRAP("pProperties->pNext sType = %s", vk::Stringify(extensionProperties->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3033 | break; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3034 | } |
Nicolas Capens | ae8d464 | 2018-11-13 15:17:16 -0500 | [diff] [blame] | 3035 | |
| 3036 | extensionProperties = extensionProperties->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3037 | } |
| 3038 | |
| 3039 | vkGetPhysicalDeviceProperties(physicalDevice, &(pProperties->properties)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3040 | } |
| 3041 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3042 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 *pFormatProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3043 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3044 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkFormat format = %d, VkFormatProperties2* pFormatProperties = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3045 | physicalDevice, format, pFormatProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3046 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3047 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pFormatProperties->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3048 | while(extInfo) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3049 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3050 | LOG_TRAP("pFormatProperties->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3051 | extInfo = extInfo->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3052 | } |
| 3053 | |
| 3054 | vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &(pFormatProperties->formatProperties)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3055 | } |
| 3056 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3057 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3058 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3059 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo = %p, VkImageFormatProperties2* pImageFormatProperties = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3060 | physicalDevice, pImageFormatInfo, pImageFormatProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3061 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3062 | const VkBaseInStructure *extensionFormatInfo = reinterpret_cast<const VkBaseInStructure *>(pImageFormatInfo->pNext); |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3063 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3064 | const VkExternalMemoryHandleTypeFlagBits *handleType = nullptr; |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3065 | while(extensionFormatInfo) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3066 | { |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3067 | switch(extensionFormatInfo->sType) |
| 3068 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3069 | case VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR: |
| 3070 | { |
| 3071 | // Explicitly ignored, since VK_KHR_image_format_list is not supported |
| 3072 | ASSERT(!HasExtensionProperty(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME, deviceExtensionProperties, |
| 3073 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 3074 | } |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3075 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3076 | case VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO_EXT: |
| 3077 | { |
| 3078 | // Explicitly ignored, since VK_EXT_separate_stencil_usage is not supported |
| 3079 | ASSERT(!HasExtensionProperty(VK_EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME, deviceExtensionProperties, |
| 3080 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 3081 | } |
| 3082 | break; |
| 3083 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO: |
| 3084 | { |
| 3085 | const VkPhysicalDeviceExternalImageFormatInfo *imageFormatInfo = reinterpret_cast<const VkPhysicalDeviceExternalImageFormatInfo *>(extensionFormatInfo); |
| 3086 | handleType = &(imageFormatInfo->handleType); |
| 3087 | } |
| 3088 | break; |
| 3089 | case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT: |
| 3090 | { |
| 3091 | // Explicitly ignored, since VK_EXT_image_drm_format_modifier is not supported |
| 3092 | ASSERT(!HasExtensionProperty(VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME, deviceExtensionProperties, |
| 3093 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 3094 | } |
| 3095 | break; |
| 3096 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3097 | LOG_TRAP("pImageFormatInfo->pNext sType = %s", vk::Stringify(extensionFormatInfo->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3098 | break; |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3099 | } |
| 3100 | |
| 3101 | extensionFormatInfo = extensionFormatInfo->pNext; |
| 3102 | } |
| 3103 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3104 | VkBaseOutStructure *extensionProperties = reinterpret_cast<VkBaseOutStructure *>(pImageFormatProperties->pNext); |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3105 | |
| 3106 | while(extensionProperties) |
| 3107 | { |
| 3108 | switch(extensionProperties->sType) |
| 3109 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3110 | case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES: |
| 3111 | { |
| 3112 | auto properties = reinterpret_cast<VkExternalImageFormatProperties *>(extensionProperties); |
| 3113 | vk::Cast(physicalDevice)->getProperties(handleType, properties); |
| 3114 | } |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3115 | break; |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3116 | case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES: |
| 3117 | { |
| 3118 | auto properties = reinterpret_cast<VkSamplerYcbcrConversionImageFormatProperties *>(extensionProperties); |
| 3119 | vk::Cast(physicalDevice)->getProperties(properties); |
| 3120 | } |
| 3121 | break; |
| 3122 | case VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD: |
| 3123 | { |
| 3124 | // Explicitly ignored, since VK_AMD_texture_gather_bias_lod is not supported |
| 3125 | ASSERT(!HasExtensionProperty(VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME, deviceExtensionProperties, |
| 3126 | sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]))); |
| 3127 | } |
| 3128 | break; |
| 3129 | default: |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3130 | LOG_TRAP("pImageFormatProperties->pNext sType = %s", vk::Stringify(extensionProperties->sType).c_str()); |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3131 | break; |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3132 | } |
| 3133 | |
| 3134 | extensionProperties = extensionProperties->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3135 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3136 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3137 | return vkGetPhysicalDeviceImageFormatProperties(physicalDevice, |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3138 | pImageFormatInfo->format, |
| 3139 | pImageFormatInfo->type, |
| 3140 | pImageFormatInfo->tiling, |
| 3141 | pImageFormatInfo->usage, |
| 3142 | pImageFormatInfo->flags, |
| 3143 | &(pImageFormatProperties->imageFormatProperties)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3144 | } |
| 3145 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3146 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3147 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3148 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t* pQueueFamilyPropertyCount = %p, VkQueueFamilyProperties2* pQueueFamilyProperties = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3149 | physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3150 | |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3151 | if(pQueueFamilyProperties) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3152 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3153 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pQueueFamilyProperties->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3154 | while(extInfo) |
| 3155 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3156 | LOG_TRAP("pQueueFamilyProperties->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3157 | extInfo = extInfo->pNext; |
| 3158 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3159 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3160 | |
Alexis Hetu | 4100b73 | 2019-10-11 17:01:48 -0400 | [diff] [blame] | 3161 | if(!pQueueFamilyProperties) |
| 3162 | { |
| 3163 | *pQueueFamilyPropertyCount = vk::Cast(physicalDevice)->getQueueFamilyPropertyCount(); |
| 3164 | } |
| 3165 | else |
| 3166 | { |
| 3167 | vk::Cast(physicalDevice)->getQueueFamilyProperties(*pQueueFamilyPropertyCount, pQueueFamilyProperties); |
| 3168 | } |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3169 | } |
| 3170 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3171 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3172 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3173 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkPhysicalDeviceMemoryProperties2* pMemoryProperties = %p)", physicalDevice, pMemoryProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3174 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3175 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pMemoryProperties->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3176 | while(extInfo) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3177 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3178 | LOG_TRAP("pMemoryProperties->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3179 | extInfo = extInfo->pNext; |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3180 | } |
| 3181 | |
| 3182 | vkGetPhysicalDeviceMemoryProperties(physicalDevice, &(pMemoryProperties->memoryProperties)); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3183 | } |
| 3184 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3185 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3186 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3187 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo = %p, uint32_t* pPropertyCount = %p, VkSparseImageFormatProperties2* pProperties = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3188 | physicalDevice, pFormatInfo, pPropertyCount, pProperties); |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3189 | |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3190 | if(pProperties) |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3191 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3192 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pProperties->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3193 | while(extInfo) |
| 3194 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3195 | LOG_TRAP("pProperties->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3196 | extInfo = extInfo->pNext; |
| 3197 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3198 | } |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 3199 | |
Alexis Hetu | 4100b73 | 2019-10-11 17:01:48 -0400 | [diff] [blame] | 3200 | // We do not support sparse images. |
| 3201 | *pPropertyCount = 0; |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3202 | } |
| 3203 | |
| 3204 | VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) |
| 3205 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3206 | TRACE("(VkDevice device = %p, VkCommandPool commandPool = %p, VkCommandPoolTrimFlags flags = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3207 | device, static_cast<void *>(commandPool), flags); |
Nicolas Capens | de16f32 | 2019-02-12 00:32:31 -0500 | [diff] [blame] | 3208 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 3209 | if(flags != 0) |
| 3210 | { |
| 3211 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 3212 | UNSUPPORTED("flags %d", int(flags)); |
| 3213 | } |
| 3214 | |
Alexis Hetu | cd610c9 | 2019-02-01 16:47:51 -0500 | [diff] [blame] | 3215 | vk::Cast(commandPool)->trim(flags); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3216 | } |
| 3217 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3218 | VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3219 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3220 | TRACE("(VkDevice device = %p, const VkDeviceQueueInfo2* pQueueInfo = %p, VkQueue* pQueue = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3221 | device, pQueueInfo, pQueue); |
| 3222 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3223 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pQueueInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3224 | while(extInfo) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3225 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3226 | LOG_TRAP("pQueueInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3227 | extInfo = extInfo->pNext; |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3228 | } |
| 3229 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 3230 | if(pQueueInfo->flags != 0) |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3231 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 3232 | // The only flag that can be set here is VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT |
| 3233 | // According to the Vulkan 1.2.132 spec, 4.3.1. Queue Family Properties: |
| 3234 | // "VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT specifies that the device queue is a |
| 3235 | // protected-capable queue. If the protected memory feature is not enabled, |
| 3236 | // the VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT bit of flags must not be set." |
| 3237 | UNSUPPORTED("VkPhysicalDeviceVulkan11Features::protectedMemory"); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3238 | } |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 3239 | |
| 3240 | vkGetDeviceQueue(device, pQueueInfo->queueFamilyIndex, pQueueInfo->queueIndex, pQueue); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3241 | } |
| 3242 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3243 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3244 | { |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 3245 | TRACE("(VkDevice device = %p, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkSamplerYcbcrConversion* pYcbcrConversion = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3246 | device, pCreateInfo, pAllocator, pYcbcrConversion); |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 3247 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3248 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3249 | while(extInfo) |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 3250 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3251 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3252 | extInfo = extInfo->pNext; |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 3253 | } |
| 3254 | |
| 3255 | return vk::SamplerYcbcrConversion::Create(pAllocator, pCreateInfo, pYcbcrConversion); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3256 | } |
| 3257 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3258 | VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3259 | { |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 3260 | TRACE("(VkDevice device = %p, VkSamplerYcbcrConversion ycbcrConversion = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3261 | device, static_cast<void *>(ycbcrConversion), pAllocator); |
Nicolas Capens | 6b63c80 | 2019-05-16 11:10:34 -0400 | [diff] [blame] | 3262 | |
| 3263 | vk::destroy(ycbcrConversion, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3264 | } |
| 3265 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3266 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3267 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3268 | 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] | 3269 | device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); |
| 3270 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 3271 | if(pCreateInfo->flags != 0) |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 3272 | { |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 3273 | // Vulkan 1.2: "flags is reserved for future use." "flags must be 0" |
| 3274 | UNSUPPORTED("pCreateInfo->flags %d", int(pCreateInfo->flags)); |
| 3275 | } |
| 3276 | |
| 3277 | if(pCreateInfo->templateType != VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET) |
| 3278 | { |
| 3279 | UNSUPPORTED("pCreateInfo->templateType %d", int(pCreateInfo->templateType)); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3280 | } |
| 3281 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3282 | auto extInfo = reinterpret_cast<VkBaseInStructure const *>(pCreateInfo->pNext); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3283 | while(extInfo) |
| 3284 | { |
Sean Risser | c1e60dc | 2020-02-19 12:52:24 -0500 | [diff] [blame] | 3285 | LOG_TRAP("pCreateInfo->pNext sType = %s", vk::Stringify(extInfo->sType).c_str()); |
Alexis Hetu | 7b29abf | 2019-11-21 17:26:17 -0500 | [diff] [blame] | 3286 | extInfo = extInfo->pNext; |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 3287 | } |
| 3288 | |
| 3289 | return vk::DescriptorUpdateTemplate::Create(pAllocator, pCreateInfo, pDescriptorUpdateTemplate); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3290 | } |
| 3291 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3292 | VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks *pAllocator) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3293 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3294 | TRACE("(VkDevice device = %p, VkDescriptorUpdateTemplate descriptorUpdateTemplate = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3295 | device, static_cast<void *>(descriptorUpdateTemplate), pAllocator); |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 3296 | |
| 3297 | vk::destroy(descriptorUpdateTemplate, pAllocator); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3298 | } |
| 3299 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3300 | VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void *pData) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3301 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3302 | TRACE("(VkDevice device = %p, VkDescriptorSet descriptorSet = %p, VkDescriptorUpdateTemplate descriptorUpdateTemplate = %p, const void* pData = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3303 | device, static_cast<void *>(descriptorSet), static_cast<void *>(descriptorUpdateTemplate), pData); |
Alexis Hetu | f705cec | 2019-01-29 14:09:36 -0500 | [diff] [blame] | 3304 | |
Alexis Hetu | 6448bd6 | 2019-06-11 15:58:59 -0400 | [diff] [blame] | 3305 | vk::Cast(descriptorUpdateTemplate)->updateDescriptorSet(vk::Cast(device), descriptorSet, pData); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3306 | } |
| 3307 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3308 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3309 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3310 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo = %p, VkExternalBufferProperties* pExternalBufferProperties = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3311 | physicalDevice, pExternalBufferInfo, pExternalBufferProperties); |
| 3312 | |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3313 | vk::Cast(physicalDevice)->getProperties(pExternalBufferInfo, pExternalBufferProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3314 | } |
| 3315 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3316 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3317 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3318 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo = %p, VkExternalFenceProperties* pExternalFenceProperties = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3319 | physicalDevice, pExternalFenceInfo, pExternalFenceProperties); |
| 3320 | |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3321 | vk::Cast(physicalDevice)->getProperties(pExternalFenceInfo, pExternalFenceProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3322 | } |
| 3323 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3324 | VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3325 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3326 | TRACE("(VkPhysicalDevice physicalDevice = %p, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo = %p, VkExternalSemaphoreProperties* pExternalSemaphoreProperties = %p)", |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3327 | physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties); |
| 3328 | |
Alexis Hetu | 0083573 | 2019-04-10 16:36:31 -0400 | [diff] [blame] | 3329 | vk::Cast(physicalDevice)->getProperties(pExternalSemaphoreInfo, pExternalSemaphoreProperties); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3330 | } |
| 3331 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3332 | VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, VkDescriptorSetLayoutSupport *pSupport) |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3333 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3334 | TRACE("(VkDevice device = %p, const VkDescriptorSetLayoutCreateInfo* pCreateInfo = %p, VkDescriptorSetLayoutSupport* pSupport = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3335 | device, pCreateInfo, pSupport); |
Alexis Hetu | 9e4d040 | 2018-10-16 15:44:12 -0400 | [diff] [blame] | 3336 | |
| 3337 | vk::Cast(device)->getDescriptorSetLayoutSupport(pCreateInfo, pSupport); |
Alexis Hetu | d73b871 | 2018-09-21 15:14:43 -0400 | [diff] [blame] | 3338 | } |
| 3339 | |
Chris Forbes | deac536 | 2019-11-25 08:18:34 -0800 | [diff] [blame] | 3340 | VKAPI_ATTR void VKAPI_CALL vkCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern) |
| 3341 | { |
| 3342 | TRACE("(VkCommandBuffer commandBuffer = %p, uint32_t lineStippleFactor = %u, uint16_t lineStipplePattern = %u", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3343 | commandBuffer, lineStippleFactor, lineStipplePattern); |
Chris Forbes | deac536 | 2019-11-25 08:18:34 -0800 | [diff] [blame] | 3344 | |
Nicolas Capens | 44bd43a | 2020-01-22 03:07:14 -0500 | [diff] [blame] | 3345 | UNSUPPORTED("VkPhysicalDeviceLineRasterizationFeaturesEXT::stippled*Lines"); |
Chris Forbes | deac536 | 2019-11-25 08:18:34 -0800 | [diff] [blame] | 3346 | } |
| 3347 | |
Ben Clayton | a9af883 | 2019-08-14 13:09:43 +0100 | [diff] [blame] | 3348 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3349 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) |
Ben Clayton | a9af883 | 2019-08-14 13:09:43 +0100 | [diff] [blame] | 3350 | { |
| 3351 | TRACE("(VkInstance instance = %p, VkXcbSurfaceCreateInfoKHR* pCreateInfo = %p, VkAllocationCallbacks* pAllocator = %p, VkSurface* pSurface = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3352 | instance, pCreateInfo, pAllocator, pSurface); |
Ben Clayton | a9af883 | 2019-08-14 13:09:43 +0100 | [diff] [blame] | 3353 | |
| 3354 | return vk::XcbSurfaceKHR::Create(pAllocator, pCreateInfo, pSurface); |
| 3355 | } |
| 3356 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3357 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t *connection, xcb_visualid_t visual_id) |
Ben Clayton | a9af883 | 2019-08-14 13:09:43 +0100 | [diff] [blame] | 3358 | { |
| 3359 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t queueFamilyIndex = %d, xcb_connection_t* connection = %p, xcb_visualid_t visual_id = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3360 | physicalDevice, int(queueFamilyIndex), connection, int(visual_id)); |
Ben Clayton | a9af883 | 2019-08-14 13:09:43 +0100 | [diff] [blame] | 3361 | |
| 3362 | return VK_TRUE; |
| 3363 | } |
| 3364 | #endif |
| 3365 | |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3366 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3367 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3368 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3369 | TRACE("(VkInstance instance = %p, VkXlibSurfaceCreateInfoKHR* pCreateInfo = %p, VkAllocationCallbacks* pAllocator = %p, VkSurface* pSurface = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3370 | instance, pCreateInfo, pAllocator, pSurface); |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3371 | |
| 3372 | return vk::XlibSurfaceKHR::Create(pAllocator, pCreateInfo, pSurface); |
| 3373 | } |
Hernan Liatis | bd18d58 | 2019-05-29 15:38:58 -0700 | [diff] [blame] | 3374 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3375 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy, VisualID visualID) |
Hernan Liatis | bd18d58 | 2019-05-29 15:38:58 -0700 | [diff] [blame] | 3376 | { |
| 3377 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t queueFamilyIndex = %d, Display* dpy = %p, VisualID visualID = %lu)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3378 | physicalDevice, int(queueFamilyIndex), dpy, visualID); |
Hernan Liatis | bd18d58 | 2019-05-29 15:38:58 -0700 | [diff] [blame] | 3379 | |
| 3380 | return VK_TRUE; |
| 3381 | } |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3382 | #endif |
| 3383 | |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 3384 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3385 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 3386 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3387 | TRACE("(VkInstance instance = %p, VkMacOSSurfaceCreateInfoMVK* pCreateInfo = %p, VkAllocationCallbacks* pAllocator = %p, VkSurface* pSurface = %p)", |
| 3388 | instance, pCreateInfo, pAllocator, pSurface); |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 3389 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3390 | return vk::MacOSSurfaceMVK::Create(pAllocator, pCreateInfo, pSurface); |
Alexis Hetu | 0662a4a | 2019-07-08 15:06:40 -0400 | [diff] [blame] | 3391 | } |
| 3392 | #endif |
| 3393 | |
Jonah Ryan-Davis | 215bc79 | 2019-10-31 17:23:49 -0400 | [diff] [blame] | 3394 | #ifdef VK_USE_PLATFORM_METAL_EXT |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3395 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT(VkInstance instance, const VkMetalSurfaceCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) |
Jonah Ryan-Davis | 215bc79 | 2019-10-31 17:23:49 -0400 | [diff] [blame] | 3396 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3397 | TRACE("(VkInstance instance = %p, VkMetalSurfaceCreateInfoEXT* pCreateInfo = %p, VkAllocationCallbacks* pAllocator = %p, VkSurface* pSurface = %p)", |
| 3398 | instance, pCreateInfo, pAllocator, pSurface); |
Jonah Ryan-Davis | 215bc79 | 2019-10-31 17:23:49 -0400 | [diff] [blame] | 3399 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3400 | return vk::MetalSurfaceEXT::Create(pAllocator, pCreateInfo, pSurface); |
Jonah Ryan-Davis | 215bc79 | 2019-10-31 17:23:49 -0400 | [diff] [blame] | 3401 | } |
| 3402 | #endif |
| 3403 | |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 3404 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3405 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 3406 | { |
| 3407 | TRACE("(VkInstance instance = %p, VkWin32SurfaceCreateInfoKHR* pCreateInfo = %p, VkAllocationCallbacks* pAllocator = %p, VkSurface* pSurface = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3408 | instance, pCreateInfo, pAllocator, pSurface); |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 3409 | |
| 3410 | return vk::Win32SurfaceKHR::Create(pAllocator, pCreateInfo, pSurface); |
| 3411 | } |
Sascha Willems | 883e817 | 2019-10-22 20:08:12 +0200 | [diff] [blame] | 3412 | |
| 3413 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex) |
| 3414 | { |
| 3415 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t queueFamilyIndex = %d)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3416 | physicalDevice, queueFamilyIndex); |
Sascha Willems | 883e817 | 2019-10-22 20:08:12 +0200 | [diff] [blame] | 3417 | return VK_TRUE; |
| 3418 | } |
Nicolas Capens | d354537 | 2019-08-09 13:59:18 -0400 | [diff] [blame] | 3419 | #endif |
| 3420 | |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 3421 | #ifndef __ANDROID__ |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3422 | VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 3423 | { |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3424 | TRACE("(VkInstance instance = %p, VkSurfaceKHR surface = %p, const VkAllocationCallbacks* pAllocator = %p)", |
| 3425 | instance, static_cast<void *>(surface), pAllocator); |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 3426 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3427 | vk::destroy(surface, pAllocator); |
Chris Forbes | 1d667d6 | 2019-04-05 08:25:18 -0700 | [diff] [blame] | 3428 | } |
| 3429 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3430 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported) |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3431 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3432 | TRACE("(VkPhysicalDevice physicalDevice = %p, uint32_t queueFamilyIndex = %d, VkSurface surface = %p, VKBool32* pSupported = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3433 | physicalDevice, int(queueFamilyIndex), static_cast<void *>(surface), pSupported); |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3434 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3435 | *pSupported = VK_TRUE; |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3436 | return VK_SUCCESS; |
| 3437 | } |
| 3438 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3439 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3440 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3441 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkSurfaceKHR surface = %p, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3442 | physicalDevice, static_cast<void *>(surface), pSurfaceCapabilities); |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3443 | |
| 3444 | vk::Cast(surface)->getSurfaceCapabilities(pSurfaceCapabilities); |
| 3445 | return VK_SUCCESS; |
| 3446 | } |
| 3447 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3448 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats) |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3449 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3450 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkSurfaceKHR surface = %p. uint32_t* pSurfaceFormatCount = %p, VkSurfaceFormatKHR* pSurfaceFormats = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3451 | physicalDevice, static_cast<void *>(surface), pSurfaceFormatCount, pSurfaceFormats); |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3452 | |
| 3453 | if(!pSurfaceFormats) |
| 3454 | { |
| 3455 | *pSurfaceFormatCount = vk::Cast(surface)->getSurfaceFormatsCount(); |
| 3456 | return VK_SUCCESS; |
| 3457 | } |
| 3458 | |
| 3459 | return vk::Cast(surface)->getSurfaceFormats(pSurfaceFormatCount, pSurfaceFormats); |
| 3460 | } |
| 3461 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3462 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes) |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3463 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3464 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkSurfaceKHR surface = %p uint32_t* pPresentModeCount = %p, VkPresentModeKHR* pPresentModes = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3465 | physicalDevice, static_cast<void *>(surface), pPresentModeCount, pPresentModes); |
Hernan Liatis | c6eb41b | 2019-02-22 11:12:59 -0800 | [diff] [blame] | 3466 | |
| 3467 | if(!pPresentModes) |
| 3468 | { |
| 3469 | *pPresentModeCount = vk::Cast(surface)->getPresentModeCount(); |
| 3470 | return VK_SUCCESS; |
| 3471 | } |
| 3472 | |
| 3473 | return vk::Cast(surface)->getPresentModes(pPresentModeCount, pPresentModes); |
| 3474 | } |
| 3475 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3476 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 3477 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3478 | TRACE("(VkDevice device = %p, const VkSwapchainCreateInfoKHR* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkSwapchainKHR* pSwapchain = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3479 | device, pCreateInfo, pAllocator, pSwapchain); |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 3480 | |
Hernan Liatis | 43be716 | 2019-03-08 17:57:41 -0800 | [diff] [blame] | 3481 | if(pCreateInfo->oldSwapchain) |
| 3482 | { |
| 3483 | vk::Cast(pCreateInfo->oldSwapchain)->retire(); |
| 3484 | } |
| 3485 | |
Alexis Hetu | 63ae924 | 2019-06-06 13:52:15 -0400 | [diff] [blame] | 3486 | if(vk::Cast(pCreateInfo->surface)->hasAssociatedSwapchain()) |
Hernan Liatis | 43be716 | 2019-03-08 17:57:41 -0800 | [diff] [blame] | 3487 | { |
| 3488 | return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR; |
| 3489 | } |
| 3490 | |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 3491 | VkResult status = vk::SwapchainKHR::Create(pAllocator, pCreateInfo, pSwapchain); |
| 3492 | |
| 3493 | if(status != VK_SUCCESS) |
| 3494 | { |
| 3495 | return status; |
| 3496 | } |
| 3497 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 3498 | auto swapchain = vk::Cast(*pSwapchain); |
| 3499 | status = swapchain->createImages(device, pCreateInfo); |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 3500 | |
| 3501 | if(status != VK_SUCCESS) |
| 3502 | { |
| 3503 | vk::destroy(*pSwapchain, pAllocator); |
| 3504 | return status; |
| 3505 | } |
| 3506 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 3507 | vk::Cast(pCreateInfo->surface)->associateSwapchain(swapchain); |
Hernan Liatis | 43be716 | 2019-03-08 17:57:41 -0800 | [diff] [blame] | 3508 | |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 3509 | return VK_SUCCESS; |
| 3510 | } |
| 3511 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3512 | VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 3513 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3514 | TRACE("(VkDevice device = %p, VkSwapchainKHR swapchain = %p, const VkAllocationCallbacks* pAllocator = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3515 | device, static_cast<void *>(swapchain), pAllocator); |
Hernan Liatis | c7943e9 | 2019-02-25 19:29:54 -0800 | [diff] [blame] | 3516 | |
| 3517 | vk::destroy(swapchain, pAllocator); |
| 3518 | } |
| 3519 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3520 | VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) |
Hernan Liatis | d00375a | 2019-02-26 11:19:27 -0800 | [diff] [blame] | 3521 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3522 | TRACE("(VkDevice device = %p, VkSwapchainKHR swapchain = %p, uint32_t* pSwapchainImageCount = %p, VkImage* pSwapchainImages = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3523 | device, static_cast<void *>(swapchain), pSwapchainImageCount, pSwapchainImages); |
Hernan Liatis | d00375a | 2019-02-26 11:19:27 -0800 | [diff] [blame] | 3524 | |
| 3525 | if(!pSwapchainImages) |
| 3526 | { |
| 3527 | *pSwapchainImageCount = vk::Cast(swapchain)->getImageCount(); |
| 3528 | return VK_SUCCESS; |
| 3529 | } |
| 3530 | |
| 3531 | return vk::Cast(swapchain)->getImages(pSwapchainImageCount, pSwapchainImages); |
| 3532 | } |
| 3533 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3534 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 3535 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3536 | TRACE("(VkDevice device = %p, VkSwapchainKHR swapchain = %p, uint64_t timeout = %d, VkSemaphore semaphore = %p, VkFence fence = %p, uint32_t* pImageIndex = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3537 | 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] | 3538 | |
Alexis Hetu | 7d96f51 | 2019-06-13 18:23:56 -0400 | [diff] [blame] | 3539 | 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] | 3540 | } |
| 3541 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3542 | VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 3543 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3544 | TRACE("(VkQueue queue = %p, const VkPresentInfoKHR* pPresentInfo = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3545 | queue, pPresentInfo); |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 3546 | |
Antonio Maiorano | 26c6c4a | 2019-10-17 15:33:47 -0400 | [diff] [blame] | 3547 | return vk::Cast(queue)->present(pPresentInfo); |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 3548 | } |
Chris Forbes | f993de3 | 2019-04-15 09:45:34 -0700 | [diff] [blame] | 3549 | |
Chris Forbes | 25c8e08 | 2019-09-02 16:20:09 +0100 | [diff] [blame] | 3550 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo, uint32_t *pImageIndex) |
| 3551 | { |
| 3552 | TRACE("(VkDevice device = %p, const VkAcquireNextImageInfoKHR *pAcquireInfo = %p, uint32_t *pImageIndex = %p", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3553 | device, pAcquireInfo, pImageIndex); |
Chris Forbes | 25c8e08 | 2019-09-02 16:20:09 +0100 | [diff] [blame] | 3554 | |
| 3555 | return vk::Cast(pAcquireInfo->swapchain)->getNextImage(pAcquireInfo->timeout, vk::Cast(pAcquireInfo->semaphore), vk::Cast(pAcquireInfo->fence), pImageIndex); |
| 3556 | } |
| 3557 | |
Chris Forbes | f993de3 | 2019-04-15 09:45:34 -0700 | [diff] [blame] | 3558 | VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pDeviceGroupPresentCapabilities) |
| 3559 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3560 | TRACE("(VkDevice device = %p, VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3561 | device, pDeviceGroupPresentCapabilities); |
Chris Forbes | f993de3 | 2019-04-15 09:45:34 -0700 | [diff] [blame] | 3562 | |
Nicolas Capens | 81bc9d9 | 2019-12-16 15:05:57 -0500 | [diff] [blame] | 3563 | for(int i = 0; i < VK_MAX_DEVICE_GROUP_SIZE; i++) |
Chris Forbes | f993de3 | 2019-04-15 09:45:34 -0700 | [diff] [blame] | 3564 | { |
| 3565 | // The only real physical device in the presentation group is device 0, |
| 3566 | // and it can present to itself. |
| 3567 | pDeviceGroupPresentCapabilities->presentMask[i] = (i == 0) ? 1 : 0; |
| 3568 | } |
| 3569 | |
| 3570 | pDeviceGroupPresentCapabilities->modes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR; |
| 3571 | |
| 3572 | return VK_SUCCESS; |
| 3573 | } |
| 3574 | |
| 3575 | VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR *pModes) |
| 3576 | { |
Ben Clayton | fb28067 | 2019-04-25 11:16:15 +0100 | [diff] [blame] | 3577 | TRACE("(VkDevice device = %p, VkSurfaceKHR surface = %p, VkDeviceGroupPresentModeFlagsKHR *pModes = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3578 | device, static_cast<void *>(surface), pModes); |
Chris Forbes | f993de3 | 2019-04-15 09:45:34 -0700 | [diff] [blame] | 3579 | |
| 3580 | *pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR; |
| 3581 | return VK_SUCCESS; |
| 3582 | } |
| 3583 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3584 | VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pRectCount, VkRect2D *pRects) |
Chris Forbes | b52384b | 2019-08-28 12:01:29 -0700 | [diff] [blame] | 3585 | { |
| 3586 | TRACE("(VkPhysicalDevice physicalDevice = %p, VkSurfaceKHR surface = %p, uint32_t* pRectCount = %p, VkRect2D* pRects = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3587 | physicalDevice, static_cast<void *>(surface), pRectCount, pRects); |
Chris Forbes | b52384b | 2019-08-28 12:01:29 -0700 | [diff] [blame] | 3588 | |
| 3589 | return vk::Cast(surface)->getPresentRectangles(pRectCount, pRects); |
| 3590 | } |
| 3591 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3592 | #endif // ! __ANDROID__ |
Hernan Liatis | 6b12a50 | 2019-03-01 15:06:13 -0800 | [diff] [blame] | 3593 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3594 | #ifdef __ANDROID__ |
| 3595 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3596 | VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage2ANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, VkSwapchainImageUsageFlagsANDROID swapchainUsage, uint64_t *grallocConsumerUsage, uint64_t *grallocProducerUsage) |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3597 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 3598 | TRACE("(VkDevice device = %p, VkFormat format = %d, VkImageUsageFlags imageUsage = %d, VkSwapchainImageUsageFlagsANDROID swapchainUsage = %d, uint64_t* grallocConsumerUsage = %p, uin64_t* grallocProducerUsage = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3599 | device, format, imageUsage, swapchainUsage, grallocConsumerUsage, grallocProducerUsage); |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3600 | |
Hernan Liatis | 788ea9f | 2019-05-01 11:10:36 -0700 | [diff] [blame] | 3601 | *grallocConsumerUsage = 0; |
| 3602 | *grallocProducerUsage = GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN; |
| 3603 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3604 | return VK_SUCCESS; |
| 3605 | } |
| 3606 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3607 | VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, int *grallocUsage) |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3608 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 3609 | TRACE("(VkDevice device = %p, VkFormat format = %d, VkImageUsageFlags imageUsage = %d, int* grallocUsage = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3610 | device, format, imageUsage, grallocUsage); |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3611 | |
Hernan Liatis | 3429bb5 | 2019-05-29 18:42:11 -0700 | [diff] [blame] | 3612 | *grallocUsage = GRALLOC_USAGE_SW_WRITE_OFTEN; |
| 3613 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3614 | return VK_SUCCESS; |
| 3615 | } |
| 3616 | |
| 3617 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageANDROID(VkDevice device, VkImage image, int nativeFenceFd, VkSemaphore semaphore, VkFence fence) |
| 3618 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 3619 | TRACE("(VkDevice device = %p, VkImage image = %p, int nativeFenceFd = %d, VkSemaphore semaphore = %p, VkFence fence = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3620 | 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] | 3621 | |
Hernan Liatis | d5f462c | 2019-05-24 15:45:05 -0700 | [diff] [blame] | 3622 | if(nativeFenceFd >= 0) |
| 3623 | { |
| 3624 | sync_wait(nativeFenceFd, -1); |
| 3625 | close(nativeFenceFd); |
| 3626 | } |
| 3627 | |
| 3628 | if(fence != VK_NULL_HANDLE) |
| 3629 | { |
| 3630 | vk::Cast(fence)->complete(); |
| 3631 | } |
| 3632 | |
| 3633 | if(semaphore != VK_NULL_HANDLE) |
| 3634 | { |
| 3635 | vk::Cast(semaphore)->signal(); |
| 3636 | } |
| 3637 | |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3638 | return VK_SUCCESS; |
| 3639 | } |
| 3640 | |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3641 | VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore *pWaitSemaphores, VkImage image, int *pNativeFenceFd) |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3642 | { |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 3643 | TRACE("(VkQueue queue = %p, uint32_t waitSemaphoreCount = %d, const VkSemaphore* pWaitSemaphores = %p, VkImage image = %p, int* pNativeFenceFd = %p)", |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3644 | queue, waitSemaphoreCount, pWaitSemaphores, static_cast<void *>(image), pNativeFenceFd); |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3645 | |
Hernan Liatis | d61595f | 2019-05-10 16:30:07 -0700 | [diff] [blame] | 3646 | // This is a hack to deal with screen tearing for now. |
| 3647 | // Need to correctly implement threading using VkSemaphore |
| 3648 | // to get rid of it. b/132458423 |
| 3649 | vkQueueWaitIdle(queue); |
| 3650 | |
Alexis Hetu | 5244595 | 2019-10-31 17:51:07 -0400 | [diff] [blame] | 3651 | *pNativeFenceFd = -1; |
Hernan Liatis | 628604e | 2019-05-07 15:30:18 -0700 | [diff] [blame] | 3652 | |
Alexis Hetu | 5244595 | 2019-10-31 17:51:07 -0400 | [diff] [blame] | 3653 | return vk::Cast(image)->prepareForExternalUseANDROID(); |
Hernan Liatis | 8a91a35 | 2019-04-29 17:14:06 -0700 | [diff] [blame] | 3654 | } |
Ben Clayton | 2ed93ab | 2019-12-17 20:38:03 +0000 | [diff] [blame] | 3655 | #endif // __ANDROID__ |
Chris Forbes | 3d27f2e | 2018-09-26 09:24:39 -0700 | [diff] [blame] | 3656 | } |