From 91082f07fbea06135a2a135894b4be04644dd74d Mon Sep 17 00:00:00 2001 From: Bill Hollings Date: Thu, 1 Mar 2018 19:42:15 -0500 Subject: [PATCH 1/3] Add build and runtime OS and device requirements to documentation. --- Docs/MoltenVK_Runtime_UserGuide.md | 19 ++++++++++++++++--- README.md | 20 ++++++++++++++------ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Docs/MoltenVK_Runtime_UserGuide.md b/Docs/MoltenVK_Runtime_UserGuide.md index 9f39e8709..71f814b38 100755 --- a/Docs/MoltenVK_Runtime_UserGuide.md +++ b/Docs/MoltenVK_Runtime_UserGuide.md @@ -21,6 +21,7 @@ Table of Contents - [About **MoltenVK**](#about_moltenvk) - [Running the **MoltenVK** Demo Applications](#demos) - [Installing **MoltenVK** in Your *Vulkan* Application](#install) + - [Build and Runtime Requirements](#requirements) - [Install as Static Library Framework](#install_static_lib) - [Install as Dynamic Library](#install_dynamic_lib) - [Interacting with the **MoltenVK** Runtime](#interaction) @@ -95,9 +96,21 @@ features by modifying *Xcode* build settings. All of this is explained in the Installing **MoltenVK** in Your *Vulkan* Application ---------------------------------------------------- ->***Note:*** **MoltenVK** can be run on *iOS 9* and *macOS 11.0* devices, - but it does reference advanced OS frameworks during building. *Xcode 9* - or above is required to build and link **MoltenVK** projects. + +### Build and Runtime Requirements + +At development time, **MoltenVK** references advanced OS frameworks during building. + +- *Xcode 9* or above is required to build and link **MoltenVK** projects. + +Once built, **MoltenVK** can be run on *iOS* or *macOS* devices that support *Metal*. + +- **MoltenVK** requires at least *macOS 10.11* or *iOS 9*. +- Information on *macOS* devices that are compatible with *Metal* can be found in + [this article](http://www.idownloadblog.com/2015/06/22/how-to-find-mac-el-capitan-metal-compatible). +- Information on compatible *iOS* devices that are compatible with *Metal* can be found in + [this article](https://developer.apple.com/library/content/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/HardwareGPUInformation/HardwareGPUInformation.html). + ### Install as Static Library Framework diff --git a/README.md b/README.md index b9297ac0b..df3cf4d86 100755 --- a/README.md +++ b/README.md @@ -120,9 +120,7 @@ The updated versions will then be "locked in" the next time the `MoltenVK` repos This procdure updates all of the Third-Party library submodules. To update only a single submodule, or for more information about the various Third-Party libraries and submodules used by **MoltenVK**, -please refer to the following documents: - -- [`Docs/ThirdPartyConfig.md`](Docs/ThirdPartyConfig.md) +please refer to the [`Docs/ThirdPartyConfig.md`](Docs/ThirdPartyConfig.md) document. @@ -134,9 +132,19 @@ Building **MoltenVK** instructions in the [*Third-Party Components*](#third-party) section above to retrieve and install the required third-party components. ->***Note:*** At runtime, **MoltenVK** can run on *iOS 9* and *macOS 10.11* devices, ->but it does reference advanced OS frameworks during building. *Xcode 9* ->or above is required to build **MoltenVK**, and build and link **MoltenVK** projects. +At development time, **MoltenVK** references advanced OS frameworks during building. + +- *Xcode 9* or above is required to build and link **MoltenVK** projects. + +Once built, **MoltenVK** can be run on *iOS* or *macOS* devices that support *Metal*. + +- **MoltenVK** requires at least *macOS 10.11* or *iOS 9*. +- Information on *macOS* devices that are compatible with *Metal* can be found in + [this article](http://www.idownloadblog.com/2015/06/22/how-to-find-mac-el-capitan-metal-compatible). +- Information on compatible *iOS* devices that are compatible with *Metal* can be found in + [this article](https://developer.apple.com/library/content/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/HardwareGPUInformation/HardwareGPUInformation.html). + + The `MoltenVKPackaging.xcodeproj` *Xcode* project contains targets and schemes to build and package the entire **MoltenVK** runtime distribution package, or to build individual From 26967d4fa19063a9d82ecaaf35814c07c320b4d2 Mon Sep 17 00:00:00 2001 From: Bill Hollings Date: Thu, 1 Mar 2018 20:07:37 -0500 Subject: [PATCH 2/3] Update compile warnings originating from use of __printflike. --- MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm | 2 +- MoltenVK/MoltenVK/Commands/MVKMTLBufferAllocation.mm | 2 +- MoltenVK/MoltenVK/GPUObjects/MVKImage.mm | 10 +++++----- MoltenVK/MoltenVK/GPUObjects/MVKSync.mm | 4 ++-- MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm index e324f541d..d56b5f6cc 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm @@ -387,7 +387,7 @@ case VK_SHADER_STAGE_FRAGMENT_BIT: return &_fragmentPushConstants; case VK_SHADER_STAGE_COMPUTE_BIT: return &_computePushConstants; default: - MVKAssert(false, "Invalid shader stage: %lu", shaderStage); + MVKAssert(false, "Invalid shader stage: %u", shaderStage); return VK_NULL_HANDLE; } } diff --git a/MoltenVK/MoltenVK/Commands/MVKMTLBufferAllocation.mm b/MoltenVK/MoltenVK/Commands/MVKMTLBufferAllocation.mm index af77a5a6b..368fd66af 100644 --- a/MoltenVK/MoltenVK/Commands/MVKMTLBufferAllocation.mm +++ b/MoltenVK/MoltenVK/Commands/MVKMTLBufferAllocation.mm @@ -76,7 +76,7 @@ #pragma mark MVKMTLBufferAllocator const MVKMTLBufferAllocation* MVKMTLBufferAllocator::acquireMTLBufferRegion(NSUInteger length) { - MVKAssert(length <= _maxAllocationLength, "This MVKMTLBufferAllocator has been configured to dispense MVKMTLBufferRegions no larger than %llu bytes.", _maxAllocationLength); + MVKAssert(length <= _maxAllocationLength, "This MVKMTLBufferAllocator has been configured to dispense MVKMTLBufferRegions no larger than %lu bytes.", (unsigned long)_maxAllocationLength); // Convert max length to the next power-of-two exponent to use as a lookup uint32_t p2Exp = mvkPowerOfTwoExponent(length); diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm index bb8ac468d..ce10d1c63 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm +++ b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm @@ -287,11 +287,11 @@ resetIOSurface(); if (ioSurface) { - if (IOSurfaceGetWidth(ioSurface) != _extent.width) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface width %d does not match VkImage width %d.", IOSurfaceGetWidth(ioSurface), _extent.width); } - if (IOSurfaceGetHeight(ioSurface) != _extent.height) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface height %d does not match VkImage height %d.", IOSurfaceGetHeight(ioSurface), _extent.height); } - if (IOSurfaceGetBytesPerElement(ioSurface) != mvkMTLPixelFormatBytesPerBlock(_mtlPixelFormat)) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface bytes per element %d does not match VkImage bytes per element %d.", IOSurfaceGetBytesPerElement(ioSurface), mvkMTLPixelFormatBytesPerBlock(_mtlPixelFormat)); } - if (IOSurfaceGetElementWidth(ioSurface) != mvkMTLPixelFormatBlockTexelSize(_mtlPixelFormat).width) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface element width %d does not match VkImage element width %d.", IOSurfaceGetElementWidth(ioSurface), mvkMTLPixelFormatBlockTexelSize(_mtlPixelFormat).width); } - if (IOSurfaceGetElementHeight(ioSurface) != mvkMTLPixelFormatBlockTexelSize(_mtlPixelFormat).height) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface element height %d does not match VkImage element height %d.", IOSurfaceGetElementHeight(ioSurface), mvkMTLPixelFormatBlockTexelSize(_mtlPixelFormat).height); } + if (IOSurfaceGetWidth(ioSurface) != _extent.width) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface width %zu does not match VkImage width %d.", IOSurfaceGetWidth(ioSurface), _extent.width); } + if (IOSurfaceGetHeight(ioSurface) != _extent.height) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface height %zu does not match VkImage height %d.", IOSurfaceGetHeight(ioSurface), _extent.height); } + if (IOSurfaceGetBytesPerElement(ioSurface) != mvkMTLPixelFormatBytesPerBlock(_mtlPixelFormat)) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface bytes per element %zu does not match VkImage bytes per element %d.", IOSurfaceGetBytesPerElement(ioSurface), mvkMTLPixelFormatBytesPerBlock(_mtlPixelFormat)); } + if (IOSurfaceGetElementWidth(ioSurface) != mvkMTLPixelFormatBlockTexelSize(_mtlPixelFormat).width) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface element width %zu does not match VkImage element width %d.", IOSurfaceGetElementWidth(ioSurface), mvkMTLPixelFormatBlockTexelSize(_mtlPixelFormat).width); } + if (IOSurfaceGetElementHeight(ioSurface) != mvkMTLPixelFormatBlockTexelSize(_mtlPixelFormat).height) { return mvkNotifyErrorWithText(VK_ERROR_INITIALIZATION_FAILED, "vkUseIOSurfaceMVK() : IOSurface element height %zu does not match VkImage element height %d.", IOSurfaceGetElementHeight(ioSurface), mvkMTLPixelFormatBlockTexelSize(_mtlPixelFormat).height); } _ioSurface = ioSurface; CFRetain(_ioSurface); diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKSync.mm b/MoltenVK/MoltenVK/GPUObjects/MVKSync.mm index b1772c7c5..d5668a369 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKSync.mm +++ b/MoltenVK/MoltenVK/GPUObjects/MVKSync.mm @@ -81,7 +81,7 @@ // MVKLogDebug("Waiting on semaphore %p for max timeout %llu. Elapsed time: %.6f ms.", this, timeout, mvkGetElapsedMilliseconds()); bool isDone = _blocker.wait(timeout, true); // MVKLogDebug("Done waiting on semaphore %p. Elapsed time: %.6f ms.", this, mvkGetElapsedMilliseconds()); - if ( !isDone && timeout > 0 ) { mvkNotifyErrorWithText(VK_TIMEOUT, "Vulkan semaphore timeout after %d nanoseconds.", timeout); } + if ( !isDone && timeout > 0 ) { mvkNotifyErrorWithText(VK_TIMEOUT, "Vulkan semaphore timeout after %llu nanoseconds.", timeout); } return isDone; } @@ -176,7 +176,7 @@ bool MVKFenceSitter::wait(uint64_t timeout) { bool isDone = _blocker.wait(timeout); - if ( !isDone && timeout > 0 ) { mvkNotifyErrorWithText(VK_TIMEOUT, "Vulkan fence timeout after %d nanoseconds.", timeout); } + if ( !isDone && timeout > 0 ) { mvkNotifyErrorWithText(VK_TIMEOUT, "Vulkan fence timeout after %llu nanoseconds.", timeout); } return isDone; } diff --git a/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm b/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm index bb66511c6..0801e0eca 100644 --- a/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm +++ b/MoltenVK/MoltenVK/Vulkan/mvk_datatypes.mm @@ -509,7 +509,7 @@ MVK_PUBLIC_SYMBOL MTLPixelFormat mvkMTLPixelFormatFromVkFormat(VkFormat vkFormat errMsg += (fmtDescSubs.vkName) ? fmtDescSubs.vkName : to_string(fmtDescSubs.vk); errMsg += " instead."; } - mvkNotifyErrorWithText(VK_ERROR_FORMAT_NOT_SUPPORTED, errMsg.c_str()); + mvkNotifyErrorWithText(VK_ERROR_FORMAT_NOT_SUPPORTED, "%s", errMsg.c_str()); } return mtlPixFmt; From 754cc1073038cefbf13e2e0803fdb99c210c0303 Mon Sep 17 00:00:00 2001 From: Bill Hollings Date: Thu, 1 Mar 2018 21:39:39 -0500 Subject: [PATCH 3/3] Allow MoltenVK to be installed and built without asciidoctor. --- External/makeSPIRVTools | 5 +++++ External/makeVulkanSpec | 10 ++++++++++ External/makeglslang | 5 +++++ MoltenVKPackaging.xcodeproj/project.pbxproj | 2 +- README.md | 13 +++++++++---- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/External/makeSPIRVTools b/External/makeSPIRVTools index 1a29ee788..1d30845db 100755 --- a/External/makeSPIRVTools +++ b/External/makeSPIRVTools @@ -7,6 +7,11 @@ # macOS usage: ./makeSPIRVTools # Build SPIRV-Tools + +echo +echo MoltenVK building SPIRV-Tools +echo + ln -sfn ../../SPIRV-Headers SPIRV-Tools/external/SPIRV-Headers rm -rf SPIRV-Tools/build mkdir SPIRV-Tools/build diff --git a/External/makeVulkanSpec b/External/makeVulkanSpec index ada32c15c..36eb3130c 100755 --- a/External/makeVulkanSpec +++ b/External/makeVulkanSpec @@ -12,6 +12,11 @@ MVK_EXTS="VK_KHR_swapchain VK_KHR_surface VK_MVK_ios_surface VK_MVK_macos_surface VK_IMG_format_pvrtc VK_AMD_negative_viewport_height" # Generate vulkan.hpp and consolidate all header files + +echo +echo MoltenVK building vulkan.h +echo + cd Vulkan-Hpp cmake . make @@ -20,6 +25,11 @@ cp Vulkan-Docs/src/vulkan/*.h vulkan cd - # Generate the Vulkan Spec document + +echo +echo MoltenVK building Vulkan spec document +echo + cd Vulkan-Hpp/Vulkan-Docs/doc/specs/vulkan make clean_generated make EXTENSIONS="$MVK_EXTS" APITITLE="(with extensions supported by MoltenVK)" html diff --git a/External/makeglslang b/External/makeglslang index 4dc20bd48..941df36b2 100755 --- a/External/makeglslang +++ b/External/makeglslang @@ -7,6 +7,11 @@ # macOS usage: ./makeglslang # Build glslang + +echo +echo MoltenVK building glslang +echo + rm -rf glslang/build mkdir glslang/build cd glslang/build diff --git a/MoltenVKPackaging.xcodeproj/project.pbxproj b/MoltenVKPackaging.xcodeproj/project.pbxproj index cb6ad87af..7974a11ae 100644 --- a/MoltenVKPackaging.xcodeproj/project.pbxproj +++ b/MoltenVKPackaging.xcodeproj/project.pbxproj @@ -316,7 +316,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -e\n\n# Package folder\nexport MVK_WKSPC_PATH=\"${PROJECT_DIR}\"\nexport MVK_PKG_LOCN=\"${MVK_WKSPC_PATH}/Package\"\nexport MVK_PKG_CONFIG_PATH=\"${MVK_PKG_LOCN}/${CONFIGURATION}\"\n\n# Copy the docs\ncp -a \"${MVK_WKSPC_PATH}/LICENSE\" \"${MVK_PKG_CONFIG_PATH}\"\ncp -pRLf \"${MVK_WKSPC_PATH}/Docs\" \"${MVK_PKG_CONFIG_PATH}\"\n\n"; + shellScript = "set -e\n\n# Package folder\nexport MVK_WKSPC_PATH=\"${PROJECT_DIR}\"\nexport MVK_PKG_LOCN=\"${MVK_WKSPC_PATH}/Package\"\nexport MVK_PKG_CONFIG_PATH=\"${MVK_PKG_LOCN}/${CONFIGURATION}\"\n\n# Copy the docs. Allow silent fail if a symlinked doc is not built.\ncp -a \"${MVK_WKSPC_PATH}/LICENSE\" \"${MVK_PKG_CONFIG_PATH}\"\ncp -pRLf \"${MVK_WKSPC_PATH}/Docs\" \"${MVK_PKG_CONFIG_PATH}\" 2> /dev/null || true\n\n"; }; A9FEADD61F3517480010240E /* Package MoltenVK */ = { isa = PBXShellScriptBuildPhase; diff --git a/README.md b/README.md index df3cf4d86..c198a7097 100755 --- a/README.md +++ b/README.md @@ -68,16 +68,21 @@ Installing **MoltenVK** this `MoltenVK` repository, and then run the `External/makeAll` script to create necessary components within the third-party libraries. -1. Ensure you have `python3` and `asciidoctor` installed: +1. Ensure you have `python3` installed: brew install python3 - sudo gem install asciidoctor -2. Recursively clone the `MoltenVK` repository: +2. **_Optional:_** If you want to generate a Vulkan specification document for inclusion + in the final **MoltenVK** distribution package, ensure you have `asciidoctor` installed + (you can skip this otherwise): + + brew install asciidoctor + +3. Recursively clone the `MoltenVK` repository: git clone --recursive https://github.com/KhronosGroup/MoltenVK.git -3. Run the third-party build script: +4. Run the third-party build script: cd MoltenVK/External ./makeAll