Merge pull request #77 from billhollings/master

Fixes for issues #73 & #76.
This commit is contained in:
Bill Hollings 2018-03-01 22:11:17 -05:00 committed by GitHub
commit 3f9e8bc2ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 70 additions and 24 deletions

View File

@ -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.
<a name="requirements"></a>
### 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).
<a name="install_static_lib"></a>
### Install as Static Library Framework

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -387,7 +387,7 @@ MVKPushConstantsCommandEncoderState* MVKCommandEncoder::getPushConstants(VkShade
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;
}
}

View File

@ -76,7 +76,7 @@ MVKMTLBufferAllocationPool::~MVKMTLBufferAllocationPool() {
#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);

View File

@ -287,11 +287,11 @@ VkResult MVKImage::useIOSurface(IOSurfaceRef ioSurface) {
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);

View File

@ -81,7 +81,7 @@ bool MVKSemaphore::wait(uint64_t timeout) {
// 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 @@ void MVKFenceSitter::wait() { _blocker.wait(); }
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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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
@ -120,9 +125,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 +137,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