diff --git a/Docs/MoltenVK_Runtime_UserGuide.md b/Docs/MoltenVK_Runtime_UserGuide.md index bcc42c77e..6582dbcff 100644 --- a/Docs/MoltenVK_Runtime_UserGuide.md +++ b/Docs/MoltenVK_Runtime_UserGuide.md @@ -53,7 +53,7 @@ distribution package, see the main [`README.md`](../README.md) document in the ` About **MoltenVK** ------------------ -**MoltenVK** is a layered implementation of [*Vulkan 1.1*](https://www.khronos.org/vulkan) +**MoltenVK** is a layered implementation of [*Vulkan 1.2*](https://www.khronos.org/vulkan) graphics and compute functionality, that is built on Apple's [*Metal*](https://developer.apple.com/metal) graphics and compute framework on *macOS*, *iOS*, and *tvOS*. **MoltenVK** allows you to use *Vulkan* graphics and compute functionality to develop modern, cross-platform, high-performance graphical games diff --git a/Docs/Whats_New.md b/Docs/Whats_New.md index 578c77559..98106d967 100644 --- a/Docs/Whats_New.md +++ b/Docs/Whats_New.md @@ -13,11 +13,12 @@ Copyright (c) 2015-2022 [The Brenwill Workshop Ltd.](http://www.brenwill.com) -MoltenVK 1.1.12 +MoltenVK 1.2.0 -------------- Released TBD +- Add support for _Vulkan 1.2_. - Add support for extensions: - `VK_KHR_shader_float_controls` - `VK_KHR_spirv_1_4` @@ -31,8 +32,10 @@ Released TBD - Fix occassional crash from retention of `MVKSwapchain` for future drawable presentations. - Fix undefined reference to `vkGetBufferDeviceAddressEXT` when building with `MVK_HIDE_VULKAN_SYMBOLS=1`. - Update `Makefile` to forward any build setting declared on the command line to Xcode. +- Add _**non-functional** Vulkan 1.3_ core function **_stubs_**, to avoid link errors with some external + libraries that assume _Vulkan 1.3_ linkages from the standard _Vulkan_ header files included with **MoltenVK**. - Add `MVK_USE_CEREAL` build setting to avoid use of Cereal external library (for pipeline caching). -- `MoltenVKShaderConverter` tool automatically map bindings when converting _GLSL_. +- `MoltenVKShaderConverter` tool automatically maps bindings when converting _GLSL_. - Update `VK_MVK_MOLTENVK_SPEC_VERSION` to version `36`. diff --git a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h index 683a43563..fb3eb2f89 100644 --- a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h +++ b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h @@ -50,8 +50,8 @@ typedef unsigned long MTLArgumentBuffersTier; * - 401215 (version 4.12.15) */ #define MVK_VERSION_MAJOR 1 -#define MVK_VERSION_MINOR 1 -#define MVK_VERSION_PATCH 12 +#define MVK_VERSION_MINOR 2 +#define MVK_VERSION_PATCH 0 #define MVK_MAKE_VERSION(major, minor, patch) (((major) * 10000) + ((minor) * 100) + (patch)) #define MVK_VERSION MVK_MAKE_VERSION(MVK_VERSION_MAJOR, MVK_VERSION_MINOR, MVK_VERSION_PATCH) @@ -747,6 +747,7 @@ typedef struct { * When reading this value, it will be one of the VK_API_VERSION_1_* values, including the latest * VK_HEADER_VERSION component. When setting this value, it should be set to one of: * + * VK_API_VERSION_1_2 (equivalent decimal number 4202496) * VK_API_VERSION_1_1 (equivalent decimal number 4198400) * VK_API_VERSION_1_0 (equivalent decimal number 4194304) * diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDescriptor.h b/MoltenVK/MoltenVK/GPUObjects/MVKDescriptor.h index 28d93296b..449be0369 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKDescriptor.h +++ b/MoltenVK/MoltenVK/GPUObjects/MVKDescriptor.h @@ -94,7 +94,7 @@ class MVKDescriptorSetLayoutBinding : public MVKBaseDeviceObject { /** Returns whether this binding has a variable descriptor count. */ inline bool hasVariableDescriptorCount() const { - return mvkIsAnyFlagEnabled(_flags, VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT); + return mvkIsAnyFlagEnabled(_flags, VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT); } /** diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDescriptorSet.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDescriptorSet.mm index 156572be8..77ae6ff73 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKDescriptorSet.mm +++ b/MoltenVK/MoltenVK/GPUObjects/MVKDescriptorSet.mm @@ -249,8 +249,8 @@ const VkDescriptorBindingFlags* MVKDescriptorSetLayout::getBindingFlags(const VkDescriptorSetLayoutCreateInfo* pCreateInfo) { for (const auto* next = (VkBaseInStructure*)pCreateInfo->pNext; next; next = next->pNext) { switch (next->sType) { - case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT: { - auto* pDescSetLayoutBindingFlags = (VkDescriptorSetLayoutBindingFlagsCreateInfoEXT*)next; + case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO: { + auto* pDescSetLayoutBindingFlags = (VkDescriptorSetLayoutBindingFlagsCreateInfo*)next; return pDescSetLayoutBindingFlags->bindingCount ? pDescSetLayoutBindingFlags->pBindingFlags : nullptr; } default: @@ -468,8 +468,8 @@ const uint32_t* MVKDescriptorPool::getVariableDecriptorCounts(const VkDescriptorSetAllocateInfo* pAllocateInfo) { for (const auto* next = (VkBaseInStructure*)pAllocateInfo->pNext; next; next = next->pNext) { switch (next->sType) { - case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT: { - auto* pVarDescSetVarCounts = (VkDescriptorSetVariableDescriptorCountAllocateInfoEXT*)next; + case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO: { + auto* pVarDescSetVarCounts = (VkDescriptorSetVariableDescriptorCountAllocateInfo*)next; return pVarDescSetVarCounts->descriptorSetCount ? pVarDescSetVarCounts->pDescriptorCounts : nullptr; } default: @@ -809,7 +809,7 @@ if (metalArgBuffSize) { NSUInteger maxMTLBuffSize = _device->_pMetalFeatures->maxMTLBufferSize; if (metalArgBuffSize > maxMTLBuffSize) { - setConfigurationResult(reportError(VK_ERROR_FRAGMENTATION_EXT, "vkCreateDescriptorPool(): The requested descriptor storage of %d MB is larger than the maximum descriptor storage of %d MB per VkDescriptorPool.", (uint32_t)(metalArgBuffSize / MEBI), (uint32_t)(maxMTLBuffSize / MEBI))); + setConfigurationResult(reportError(VK_ERROR_FRAGMENTATION, "vkCreateDescriptorPool(): The requested descriptor storage of %d MB is larger than the maximum descriptor storage of %d MB per VkDescriptorPool.", (uint32_t)(metalArgBuffSize / MEBI), (uint32_t)(maxMTLBuffSize / MEBI))); metalArgBuffSize = maxMTLBuffSize; } _metalArgumentBuffer = [getMTLDevice() newBufferWithLength: metalArgBuffSize options: MTLResourceStorageModeShared]; // retained diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.h b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.h index d378fd997..54ca3a6e8 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.h +++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.h @@ -869,7 +869,7 @@ class MVKDevice : public MVKDispatchableVulkanAPIObject { void updateActivityPerformance(MVKPerformanceTracker& activity, uint64_t startTime, uint64_t endTime); void getDescriptorVariableDescriptorCountLayoutSupport(const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport, - VkDescriptorSetVariableDescriptorCountLayoutSupportEXT* pVarDescSetCountSupport); + VkDescriptorSetVariableDescriptorCountLayoutSupport* pVarDescSetCountSupport); MVKPhysicalDevice* _physicalDevice = nullptr; MVKCommandResourceFactory* _commandResourceFactory = nullptr; diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm index f43f9426e..f67ac5c8d 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm +++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm @@ -3364,8 +3364,8 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope // Check whether the layout has a variable-count descriptor, and if so, whether we can support it. for (auto* next = (VkBaseOutStructure*)pSupport->pNext; next; next = next->pNext) { switch (next->sType) { - case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT: { - auto* pVarDescSetCountSupport = (VkDescriptorSetVariableDescriptorCountLayoutSupportEXT*)next; + case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT: { + auto* pVarDescSetCountSupport = (VkDescriptorSetVariableDescriptorCountLayoutSupport*)next; getDescriptorVariableDescriptorCountLayoutSupport(pCreateInfo, pSupport, pVarDescSetCountSupport); break; } @@ -3378,7 +3378,7 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope // Check whether the layout has a variable-count descriptor, and if so, whether we can support it. void MVKDevice::getDescriptorVariableDescriptorCountLayoutSupport(const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport, - VkDescriptorSetVariableDescriptorCountLayoutSupportEXT* pVarDescSetCountSupport) { + VkDescriptorSetVariableDescriptorCountLayoutSupport* pVarDescSetCountSupport) { // Assume we don't need this, then set appropriately if we do. pVarDescSetCountSupport->maxVariableDescriptorCount = 0; @@ -3386,8 +3386,8 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope int32_t varBindingIdx = -1; for (const auto* next = (VkBaseInStructure*)pCreateInfo->pNext; next; next = next->pNext) { switch (next->sType) { - case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT: { - auto* pDescSetLayoutBindingFlags = (VkDescriptorSetLayoutBindingFlagsCreateInfoEXT*)next; + case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO: { + auto* pDescSetLayoutBindingFlags = (VkDescriptorSetLayoutBindingFlagsCreateInfo*)next; for (uint32_t bindIdx = 0; bindIdx < pDescSetLayoutBindingFlags->bindingCount; bindIdx++) { if (mvkIsAnyFlagEnabled(pDescSetLayoutBindingFlags->pBindingFlags[bindIdx], VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT)) { varBindingIdx = bindIdx; diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm b/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm index ecb682564..1fb78e62a 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm +++ b/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm @@ -402,18 +402,18 @@ #define ADD_INST_ENTRY_POINT(func) ADD_ENTRY_POINT(func, VK_API_VERSION_1_0, nullptr, nullptr, false) #define ADD_DVC_ENTRY_POINT(func) ADD_ENTRY_POINT(func, VK_API_VERSION_1_0, nullptr, nullptr, true) +// Add a core function. #define ADD_INST_1_1_ENTRY_POINT(func) ADD_ENTRY_POINT(func, VK_API_VERSION_1_1, nullptr, nullptr, false) #define ADD_INST_1_3_ENTRY_POINT(func) ADD_ENTRY_POINT(func, VK_API_VERSION_1_3, nullptr, nullptr, false) #define ADD_DVC_1_1_ENTRY_POINT(func) ADD_ENTRY_POINT(func, VK_API_VERSION_1_1, nullptr, nullptr, true) #define ADD_DVC_1_2_ENTRY_POINT(func) ADD_ENTRY_POINT(func, VK_API_VERSION_1_2, nullptr, nullptr, true) #define ADD_DVC_1_3_ENTRY_POINT(func) ADD_ENTRY_POINT(func, VK_API_VERSION_1_3, nullptr, nullptr, true) -// Adds both the 1.1 function and the promoted extension function. +// Add both the promoted core function and the extension function. #define ADD_INST_1_1_PROMOTED_ENTRY_POINT(func, EXT) \ ADD_INST_1_1_ENTRY_POINT(func); \ ADD_ENTRY_POINT_MAP(func##KHR, func, 0, VK_##EXT##_EXTENSION_NAME, nullptr, false) -// Adds both the 1.1 function and the promoted extension function. #define ADD_DVC_1_1_PROMOTED_ENTRY_POINT(func, EXT) \ ADD_DVC_1_1_ENTRY_POINT(func); \ ADD_ENTRY_POINT_MAP(func##KHR, func, 0, VK_##EXT##_EXTENSION_NAME, nullptr, true) @@ -430,6 +430,7 @@ ADD_DVC_1_3_ENTRY_POINT(func); \ ADD_ENTRY_POINT_MAP(func##suffix, func, 0, VK_##EXT##_EXTENSION_NAME, nullptr, true) +// Add an extension function. #define ADD_INST_EXT_ENTRY_POINT(func, EXT) ADD_ENTRY_POINT(func, 0, VK_##EXT##_EXTENSION_NAME, nullptr, false) #define ADD_DVC_EXT_ENTRY_POINT(func, EXT) ADD_ENTRY_POINT(func, 0, VK_##EXT##_EXTENSION_NAME, nullptr, true) diff --git a/MoltenVK/MoltenVK/Utility/MVKEnvironment.h b/MoltenVK/MoltenVK/Utility/MVKEnvironment.h index 307038d7d..dc9e4558e 100644 --- a/MoltenVK/MoltenVK/Utility/MVKEnvironment.h +++ b/MoltenVK/MoltenVK/Utility/MVKEnvironment.h @@ -36,8 +36,8 @@ #endif /** Macro to determine the Vulkan version supported by MoltenVK. */ -#define MVK_VULKAN_API_VERSION VK_MAKE_VERSION(VK_VERSION_MAJOR(VK_API_VERSION_1_1), \ - VK_VERSION_MINOR(VK_API_VERSION_1_1), \ +#define MVK_VULKAN_API_VERSION VK_MAKE_VERSION(VK_VERSION_MAJOR(VK_API_VERSION_1_2), \ + VK_VERSION_MINOR(VK_API_VERSION_1_2), \ VK_HEADER_VERSION) /** diff --git a/MoltenVK/MoltenVK/Vulkan/vulkan.mm b/MoltenVK/MoltenVK/Vulkan/vulkan.mm index 127bc81a4..736f73609 100644 --- a/MoltenVK/MoltenVK/Vulkan/vulkan.mm +++ b/MoltenVK/MoltenVK/Vulkan/vulkan.mm @@ -2454,7 +2454,7 @@ MVK_PUBLIC_VULKAN_SYMBOL void vkResetQueryPool( MVK_PUBLIC_VULKAN_SYMBOL VkResult vkSignalSemaphore( VkDevice device, - const VkSemaphoreSignalInfoKHR* pSignalInfo) { + const VkSemaphoreSignalInfo* pSignalInfo) { MVKTraceVulkanCallStart(); auto* mvkSem4 = (MVKTimelineSemaphore*)pSignalInfo->semaphore; @@ -2465,7 +2465,7 @@ MVK_PUBLIC_VULKAN_SYMBOL VkResult vkSignalSemaphore( MVK_PUBLIC_VULKAN_SYMBOL VkResult vkWaitSemaphores( VkDevice device, - const VkSemaphoreWaitInfoKHR* pWaitInfo, + const VkSemaphoreWaitInfo* pWaitInfo, uint64_t timeout) { MVKTraceVulkanCallStart(); diff --git a/README.md b/README.md index 49f74682d..14c9ab5ad 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ document in the `Docs` directory. Introduction to MoltenVK ------------------------ -**MoltenVK** is a layered implementation of [*Vulkan 1.1*](https://www.khronos.org/vulkan) +**MoltenVK** is a layered implementation of [*Vulkan 1.2*](https://www.khronos.org/vulkan) graphics and compute functionality, that is built on Apple's [*Metal*](https://developer.apple.com/metal) graphics and compute framework on *macOS*, *iOS*, and *tvOS*. **MoltenVK** allows you to use *Vulkan* graphics and compute functionality to develop modern, cross-platform, high-performance graphical @@ -88,7 +88,7 @@ channels, including *Apple's App Store*. The **MoltenVK** runtime package contains two products: - **MoltenVK** is a implementation of an almost-complete subset of the - [*Vulkan 1.1*](https://www.khronos.org/vulkan) graphics and compute API. + [*Vulkan 1.2*](https://www.khronos.org/vulkan) graphics and compute API. - **MoltenVKShaderConverter** converts *SPIR-V* shader code to *Metal Shading Language (MSL)* shader code, and converts *GLSL* shader source code to *SPIR-V* shader code and/or @@ -305,11 +305,11 @@ the contents of that directory out of this **MoltenVK** repository into your own **MoltenVK** and *Vulkan* Compliance ------------------------------------ -**MoltenVK** is designed to be an implementation of a *Vulkan 1.1* subset that runs on *macOS*, *iOS*, +**MoltenVK** is designed to be an implementation of a *Vulkan 1.2* subset that runs on *macOS*, *iOS*, and *tvOS* platforms by mapping *Vulkan* capability to native *Metal* capability. The fundamental design and development goal of **MoltenVK** is to provide this capability in a way that -is both maximally compliant with the *Vulkan 1.1* specification, and maximally performant. +is both maximally compliant with the *Vulkan 1.2* specification, and maximally performant. Such compliance and performance is inherently affected by the capability available through *Metal*, as the native graphics driver on *macOS*, *iOS*, and *tvOS* platforms. *Vulkan* compliance may fall into one of @@ -389,7 +389,7 @@ Property claims. ### *Vulkan* Validation Despite running on top of *Metal*, **MoltenVK** operates as a *Vulkan* core layer. As such, as per the -error handling guidelines of the [*Vulkan* specification](https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#fundamentals-errors), **MoltenVK** should not perform *Vulkan* validation. When adding functionality +error handling guidelines of the [*Vulkan* specification](https://www.khronos.org/registry/vulkan/specs/1.2/html/vkspec.html#fundamentals-errors), **MoltenVK** should not perform *Vulkan* validation. When adding functionality to **MoltenVK**, avoid adding unnecessary validation code. Validation and error generation **_is_** appropriate within **MoltenVK** in cases where **MoltenVK** deviates