implemented recommended MVKVector changes and merge with HEAD

This commit is contained in:
aerofly 2019-01-16 22:45:09 +01:00
commit 85a8356809
31 changed files with 348 additions and 2753 deletions

View File

@ -6,7 +6,7 @@ osx_image: xcode10
# Build dependencies
install:
- brew install python3
- ./fetchDependencies
- ./fetchDependencies -v
# Cache built deps
cache:
@ -14,6 +14,6 @@ cache:
- External
script:
- xcodebuild -scheme "MoltenVK Package"
- xcodebuild -project MoltenVKPackaging.xcodeproj -scheme "MoltenVK Package"
- xcodebuild -workspace Demos/Demos.xcworkspace -scheme "Cube-macOS"

View File

@ -1,7 +1,7 @@
/*
* AppDelegate.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* main.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* AppDelegate.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* main.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* AppDelegate.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* DemoViewController.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* main.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* AppDelegate.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* DemoViewController.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -25,7 +25,7 @@
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) 2015-2018 The Brenwill Workshop Ltd. All rights reserved.</string>
<string>Copyright (c) 2015-2019 The Brenwill Workshop Ltd. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>

View File

@ -1,7 +1,7 @@
/*
* main.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* AppDelegate.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* main.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,7 +1,7 @@
/*
* AppDelegate.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -25,7 +25,7 @@
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) 2015-2018 The Brenwill Workshop Ltd. All rights reserved.</string>
<string>Copyright (c) 2015-2019 The Brenwill Workshop Ltd. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>

View File

@ -1,7 +1,7 @@
/*
* main.m
*
* Copyright (c) 2014-2018 The Brenwill Workshop Ltd. (http://www.brenwill.com)
* Copyright (c) 2014-2019 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@
#MoltenVK Demo Projects
Copyright (c) 2014-2018 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
Copyright (c) 2014-2019 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
*This document is written in [Markdown](http://en.wikipedia.org/wiki/Markdown) format.
For best results, use a Markdown reader.*

View File

@ -7,7 +7,7 @@
MoltenVK Runtime User Guide
===========================
Copyright (c) 2014-2018 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
Copyright (c) 2014-2019 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
*This document is written in [Markdown](http://en.wikipedia.org/wiki/Markdown) format.
For best results, use a Markdown reader.*
@ -23,7 +23,8 @@ Table of Contents
- [Build and Runtime Requirements](#requirements)
- [Install as Static Framework, Static Library, or Dynamic Library](#install_lib)
- [Interacting with the **MoltenVK** Runtime](#interaction)
- [MoltenVK Extension](#moltenvk_extension)
- [MoltenVK `VK_MVK_moltenvk` Extension](#moltenvk_extension)
- [Configuring MoltenVK](#moltenvk_config)
- [*Metal Shading Language* Shaders](#shaders)
- [MoltenVKShaderConverter Shader Converter Tool](#shader_converter_tool)
- [Troubleshooting Shader Conversion](#spv_vs_msl)
@ -241,11 +242,13 @@ In addition to the core *Vulkan* API, **MoltenVK** also supports the following
- `VK_KHR_surface`
- `VK_KHR_swapchain`
- `VK_KHR_swapchain_mutable_format`
- `VK_KHR_variable_pointers`
- `VK_EXT_shader_viewport_index_layer`
- `VK_EXT_vertex_attribute_divisor`
- `VK_MVK_moltenvk`
- `VK_MVK_macos_surface` (macOS)
- `VK_MVK_ios_surface` (iOS)
- `VK_MVK_moltenvk`
- `VK_AMD_gpu_shader_half_float`
- `VK_AMD_negative_viewport_height`
- `VK_IMG_format_pvrtc` (iOS)
@ -259,9 +262,9 @@ of the `mvk_vulkan.h` file below for a convenient way to enable these extensions
When using the `VK_MVK_macos_surface ` extension, the `pView` member of the `VkMacOSSurfaceCreateInfoMVK`
structure passed in the `vkCreateMacOSSurfaceMVK` function can be either an `NSView` whose layer is a
`CAMetalLayer`, or the `CAMetalLayer` itself. Passing the `CAMetalLayer` itself is recommended when calling
the `vkCreateMacOSSurfaceMVK` function from outside the main application thread, as `NSView` should only be
accessed from the main application thread.
`CAMetalLayer`, or the `CAMetalLayer` itself. Passing the `CAMetalLayer` itself is recommended when
calling the `vkCreateMacOSSurfaceMVK` function from outside the main application thread, as `NSView`
should only be accessed from the main application thread.
When using the `VK_MVK_ios_surface ` extension, the `pView` member of the `VkIOSSurfaceCreateInfoMVK`
structure passed in the `vkCreateIOSSurfaceMVK` function can be either a `UIView` whose layer is a
@ -269,14 +272,14 @@ structure passed in the `vkCreateIOSSurfaceMVK` function can be either a `UIView
calling the `vkCreateIOSSurfaceMVK ` function from outside the main application thread, as `UIView`
should only be accessed from the main application thread.
<a name="moltenvk_extension"></a>
### MoltenVK Extension
The `VK_MVK_moltenvk` *Vulkan* extension provides functionality beyond the standard *Vulkan*
API, to support configuration options, license registration, and behaviour that is specific
to the **MoltenVK** implementation of *Vulkan*. You can access this functionality by including
the `vk_mvk_moltenvk.h` header file in your code. The `vk_mvk_moltenvk.h` file also includes
the API documentation for this `VK_MVK_moltenvk` extension.
<a name="moltenvk_extension"></a>
### MoltenVK `VK_MVK_moltenvk` Extension
The `VK_MVK_moltenvk` *Vulkan* extension provides functionality beyond the standard *Vulkan* API, to
support configuration options and behaviour that is specific to the **MoltenVK** implementation of *Vulkan*.
You can access this functionality by including the `vk_mvk_moltenvk.h` header file in your code.
The `vk_mvk_moltenvk.h` file also includes the API documentation for this `VK_MVK_moltenvk` extension.
The following API header files are included in the **MoltenVK** package, each of which
can be included in your application source code as follows:
@ -305,6 +308,30 @@ where `HEADER_FILE` is one of the following:
directly, or simply logging data values.
<a name="moltenvk_config"></a>
### Configuring MoltenVK
The `VK_MVK_moltenvk` *Vulkan* extension provides the ability to configure and optimize
**MoltenVK** for your particular application runtime requirements.
There are three mechanisms for setting the values of the **MoltenVK** configuration parameters:
- Runtime API via the `vkGetMoltenVKConfigurationMVK()/vkSetMoltenVKConfigurationMVK()` functions.
- Application runtime environment variables.
- Build settings at **MoltenVK** build time.
To change the **MoltenVK** configuration settings at runtime using a programmatic API, use the
`vkGetMoltenVKConfigurationMVK()` and `vkSetMoltenVKConfigurationMVK()` functions to retrieve,
modify, and set a copy of the `MVKConfiguration` structure.
The initial value of each of the configuration settings can established at runtime
by a corresponding environment variable, or if the environment variable is not set,
by a corresponding build setting at the time **MoltenVK** is compiled. The environment
variable and build setting for each configuration parameter share the same name.
See the description of the `MVKConfiguration` structure parameters in the `vk_mvk_moltenvk.h`
file for more info about configuring and optimizing **MoltenVK** at build time or runtime.
<a name="shaders"></a>
*Metal Shading Language* Shaders
@ -376,21 +403,16 @@ you can address the issue as follows:
- Errors encountered during **Runtime Shader Conversion** are logged to the console.
- To help understand conversion issues during **Runtime Shader Conversion**, you can enable
the logging of the *SPIR-V* and *MSL* shader source code during conversion as follows:
#include <MoltenVK/vk_mvk_moltenvk.h>
...
MVKConfiguration mvkConfig;
size_t appConfigSize = sizeof(mvkConfig);
vkGetMoltenVKConfigurationMVK(vkInstance, &mvkConfig, &appConfigSize);
mvkConfig.debugMode = true;
vkSetMoltenVKConfigurationMVK(vkInstance, &mvkConfig, &appConfigSize);
- To help understand conversion issues during **Runtime Shader Conversion**, you can enable the
logging of the *SPIR-V* and *MSL* shader source code during shader conversion, by turning on
the `MVKConfiguration::debugMode` configuration parameter, or setting the value of the `MVK_DEBUG`
runtime environment variable to `1`. See the [*MoltenVK Configuration*](#moltenvk_config)
description above.
Performing these steps will enable debug mode in **MoltenVK**, which includes shader conversion
logging, and causes both the incoming *SPIR-V* code and the converted *MSL* source code to be
logged to the console (in human-readable form). This allows you to manually verify the conversions,
and can help you diagnose issues that might occur during shader conversion.
Enabling debug mode in **MoltenVK** includes shader conversion logging, which causes both
the incoming *SPIR-V* code and the converted *MSL* source code to be logged to the console
in human-readable form. This allows you to manually verify the conversions, and can help
you diagnose issues that might occur during shader conversion.
- For minor issues, you may be able to adjust your *SPIR-V* code so that it behaves the same
under *Vulkan*, but is easier to automatically convert to *MSL*.

View File

@ -6,12 +6,67 @@
#What's New in MoltenVK
Copyright (c) 2014-2018 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
Copyright (c) 2014-2019 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
*This document is written in [Markdown](http://en.wikipedia.org/wiki/Markdown) format.
For best results, use a Markdown reader.*
MoltenVK 1.0.31
---------------
Released 2019/01/16
- Support runtime config via runtime environment variables
- Add full ImageView swizzling to config, and disable it by default.
- Add GPU switching to config, and enable it by default.
- Add queue family specialization to config, and disable it by default.
- Enable synchronous queue submits as config default.
- Support 4 queue families.
- Pad fragment shader output to 4 components when needed.
- Add support for copying to and from PVRTC images.
- Log Vulkan versions in human readable form when reporting version error.
- Update `VK_MVK_MOLTENVK_SPEC_VERSION` to 16.
- Update copyright to 2019.
- Advertise the `VK_AMD_gpu_shader_half_float` extension.
- Support the `VK_KHR_variable_pointers` extension.
- MoltenVKShaderConverter tool exit with fail code on any file conversion fail.
- Update to latest SPIRV-Cross version:
- MSL: Support SPV_KHR_variable_pointers.
- MSL: Workaround missing gradient2d() on macOS for typical cascaded shadow mapping.
- MSL: Fix mapping of identity-swizzled components.
- MSL: Support composites inside I/O blocks.
- MSL: Fix case where we pass arrays to functions by value.
- MSL: Add option to pad fragment outputs.
- MSL: Fix passing a sampled image to a function.
- Performance improvements on iterating internal constructs.
- Update copyright to 2019.
MoltenVK 1.0.30
---------------
Released 2018/12/31
- Allow 2 or 3 swapchain images to support both double and triple buffering.
- Force display to switch to GPU selected by vkCreateDevice() to avoid system view compositor having to copy from that GPU to display GPU.
- Use inline buffer for pipeline auxiliary buffer.
- vkCmdCopyImage: Cast source image to the destination format.
- Result of vkGetPhysicalDeviceFormatProperties2KHR match vkGetPhysicalDeviceFormatProperties.
- MVKImage: Return error for BLOCK_TEXEL_VIEW.
- MVKDescriptorSet: Fix handling of immutable samplers.
- MVKPipeline: Forbid vertex attribute offsets >= stride.
- Fix handling of case where vertex bindings and binding indices don't match up.
- Return VK_TIMEOUT even on zero wait if fences not signalled.
- Support iOS builds for arm64e architecture.
- Improvements to building external libraries.
- Print Vulkan semantics when logging converted GLSL.
- Support uploading S3TC-compressed 3D images.
MoltenVK 1.0.29
---------------

View File

@ -5,7 +5,7 @@
#MoltenVK External Dependencies
Copyright (c) 2014-2018 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
Copyright (c) 2014-2019 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
*This document is written in [Markdown](http://en.wikipedia.org/wiki/Markdown) format.
For best results, use a Markdown reader.*
@ -15,18 +15,18 @@ For best results, use a Markdown reader.*
Table of Contents
-----------------
- [Fetching External Libraries](#fetching)
- [Fetching and Building External Libraries](#fetching)
- [Updating External Library Versions](#updating)
- [Adding the *cereal* Library to the *MoltenVK Xcode* Project](#add_cereal)
- [Adding the *SPIRV-Cross* Library to the *MoltenVKShaderConverter Xcode* Project](#add_spirv-cross)
- [Adding the *glslang* Library to the *MoltenVKShaderConverter Xcode* Project](#add_glslang)
- [Adding the *SPIRV-Tools* Library to the *MoltenVKShaderConverter Xcode* Project](#add_spirv-tools)
- [Adding the *SPIRV-Cross* Library to the *ExternalDependencies Xcode* Project](#add_spirv-cross)
- [Adding the *SPIRV-Tools* Library to the *ExternalDependencies Xcode* Project](#add_spirv-tools)
- [Adding the *glslang* Library to the *ExternalDependencies Xcode* Project](#add_glslang)
<a name="fetching"></a>
Fetching External Libraries
---------------------------
Fetching and Building External Libraries
----------------------------------------
**MoltenVK** uses technology from the following external open-source libraries:
@ -40,8 +40,8 @@ Fetching External Libraries
- [*VulkanSamples*](https://github.com/LunarG/VulkanSamples)
These external open-source libraries are maintained in the `External` directory.
To retrieve these libraries from their sources, run the `fetchDependencies` script
in the main repository directory:
To retrieve and build these libraries from their sources, run the `fetchDependencies`
script in the main repository directory:
./fetchDependencies
@ -84,8 +84,8 @@ the value held in the corresponding `*_repo_revision` file listed above.
The version of the *SPIRV-Tools* and *SPIRV-Headers* libraries is automatically
determined by the version of the *glslang* library you have retrieved.
Once you have made changes to the `*_repo_revision` files, you can retrieve the
updated library versions by running the `fetchDependencies` script again.
Once you have made changes to the `*_repo_revision` files, you can retrieve the updated
library versions by running the `fetchDependencies` script, as described above, again.
>***Note:*** If, after updating to new versions of the external libraries, you encounter
>build errors when building **MoltenVK**, review the instructions in the sections below
@ -109,18 +109,18 @@ errors, you may need to re-add the *cereal* library to the `MoltenVK` *Xcode* pr
<a name="add_spirv-cross"></a>
Adding the *SPIRV-Cross* Library to the *MoltenVKShaderConverter Xcode* Project
-------------------------------------------------------------------------------
Adding the *SPIRV-Cross* Library to the *ExternalDependencies Xcode* Project
----------------------------------------------------------------------------
The `MoltenVKShaderConverter` *Xcode* project is already configured to use the *SPIRV-Cross*
The `ExternalDependencies` *Xcode* project is already configured to use the *SPIRV-Cross*
library. However, after updating the version of *SPIRV-Cross*, as described [above](#updating),
if you encounter any building errors, you may need to re-add the *SPIRV-Cross* library to the
`MoltenVKShaderConverter` *Xcode* project as follows:
`ExternalDependencies` *Xcode* project as follows:
1. In the *Project Navigator*, remove all of the files under the *Group* named
`MoltenVKSPIRVToMSLConverter/SPIRV-Cross`.
`External/SPIRV-Cross`.
2. Drag the following files from the `External/SPIRV-Cross` directory to the `SPIRV-Cross`
2. Drag the following files from the `External/SPIRV-Cross` directory to the `External/SPIRV-Cross`
group in the *Project Navigator* panel:
spirv_cfg.cpp
@ -137,24 +137,20 @@ if you encounter any building errors, you may need to re-add the *SPIRV-Cross* l
spirv_parser.cpp
spirv_parser.hpp
In the ***Choose options for adding these files*** dialog that opens, select the
***Create groups*** option, add the files to *both* the `MoltenVKSPIRVToMSLConverter-iOS`
and `MoltenVKSPIRVToMSLConverter-macOS` targets, and click the ***Finish*** button.
3. ***(Optional)*** To simplify the paths used within *Xcode* to reference the added files,
perform the following steps:
1. **Create a backup of your project!** This is an intrusive and dangerous operation!
2. In the *Finder*, right-click your `MoltenVKShaderConverter.xcodeproj` file and select
**_Show Package Contents_**.
3. Open the `project.pbxproj` file in a text editor.
4. Remove all occurrences of `path-to-SPIRV-Cross-repo-folder` from the paths to the files added above.
In the ***Choose options for adding these files*** dialog that opens, select the ***Create groups*** option,
add the files to *both* the `SPIRV-Cross-macOS` and `SPIRV-Cross-iOS` targets, and click the ***Finish*** button.
### Regression Testing Your Changes to *SPIRV-Cross*
If you make changes to the `SPIRV-Cross` repository, you can regression test your changes
using the following steps:
The *SPIRV-Cross* library plays an important part in providing features for **_MoltenVK_**, and if
you are developing features for **_MoltenVK_**, you may end up making changes to *SPIRV-Cross*.
If you make changes to the `SPIRV-Cross` repository, you can build a new version of the `libSPIRVCross.a`
static library by opening the `ExternalDependencies.xcodeproj` *Xcode* project, and running the **_ExternalDependencies_** *Xcode* scheme. You can then rebuild **MoltenVK** to include the new library.
While makng changes to the `SPIRV-Cross` repository, you can regression test your changes using the
following steps:
1. Load and build the versions of `SPRIV-Tools` and `glslang` that are used by the `SPIRV-Cross` tests:
@ -170,88 +166,62 @@ If you make changes to the `SPIRV-Cross` repository, you can regression test you
./test_shaders.sh
4. If your changes result in different expected output for a reference shader, and the new results
are correct, you can update the reference shader for a particular regression test by deleting
that reference shader, in either `External/SPIRV-Cross/reference/shaders-msl` or
`External/SPIRV-Cross/reference/opt/shaders-msl`, and running the test again. The test will
replace the deleted reference shader.
<a name="add_spirv-tools"></a>
Adding the *SPIRV-Tools* Library to the *ExternalDependencies Xcode* Project
----------------------------------------------------------------------------
The `ExternalDependencies` *Xcode* project is already configured to use the *SPIRV-Tools*
library. However, after updating the version of *glslang* (which adds *SPIRV-Tools*),
as described [above](#updating), if you encounter any building errors, you may need to re-add
the *SPIRV-Tools* library to the `ExternalDependencies` *Xcode* project as follows:
1. In the *Project Navigator*, remove the *Group* named `source` from under the *Group* named
`External/SPIRV-Tools`.
2. Drag the `External/glslang/Extermal/spirv-tools/source` file folder to the `External/SPIRV-Tools`
group in the *Project Navigator* panel. In the _**Choose options for adding these files**_ dialog
that opens, select the _**Create groups**_ option, add the files to *both* the `SPIRV-Tools-macOS`
and `SPIRV-Tools-iOS` targets, and click the ***Finish*** button.
3. In the *Project Navigator* panel, select the `ExternalDependencies` *Xcode* project, then
select the `SPIRV-Tools-macOS` target, and open the *Build Settings* tab. Locate the build
setting entry **Header Search Paths** (`HEADER_SEARCH_PATHS`) and add the following paths:
$(inherited)
"$(SRCROOT)/External/glslang/External/spirv-tools/"
"$(SRCROOT)/External/glslang/External/spirv-tools/include"
"$(SRCROOT)/External/glslang/External/spirv-tools/external/spirv-headers/include"
"$(SRCROOT)/External/glslang/External/spirv-tools/build"
4. Repeat *Step 3* for the `SPIRV-Tools-iOS` target within the `ExternalDependencies` *Xcode* project
<a name="add_glslang"></a>
Adding the *glslang* Library to the *MoltenVKShaderConverter Xcode* Project
---------------------------------------------------------------------------
Adding the *glslang* Library to the *ExternalDependencies Xcode* Project
------------------------------------------------------------------------
The `MoltenVKShaderConverter` *Xcode* project is already configured to use the *glslang*
The `ExternalDependencies` *Xcode* project is already configured to use the *glslang*
library. However, after updating the version of *glslang*, as described [above](#updating),
if you encounter any building errors, you may need to re-add the *glslang* library to the
`MoltenVKShaderConverter` *Xcode* project as follows:
`ExternalDependencies` *Xcode* project as follows:
1. In the *Project Navigator*, remove all *Groups* from under the *Group* named
`MoltenVKGLSLToSPIRVConverter/glslang`.
`External/glslang`.
2. Drag the following folders from the `External/glslang` file folder to the `glslang` *Group* in
the *Project Navigator* panel:
2. Drag the following folders from the `External/glslang` file folder to the `External/glslang`
*Group* in the *Project Navigator* panel:
glslang
OGLCompilersDLL
SPIRV
In the ***Choose options for adding these files*** dialog that opens, select the
***Create groups*** option, add the files to *both* the `MoltenVKGLSLToSPIRVConverter-iOS`
and `MoltenVKGLSLToSPIRVConverter-macOS` targets, and click the ***Finish*** button.
In the ***Choose options for adding these files*** dialog that opens, select the ***Create groups*** option,
add the files to *both* the `glslang-macOS` and `glslang-iOS` targets, and click the ***Finish*** button.
3. In the *Project Navigator* panel, remove the references to the following files and folders:
glslang/glslang/MachineIndependant/glslang.y
glslang/glslang/OSDependent/Windows
4. ***(Optional)*** To simplify the paths used within *Xcode* to reference the added files,
perform the following steps:
1. **Create a backup of your project!** This is an intrusive and dangerous operation!
2. In the *Finder*, right-click your `MoltenVKShaderConverter.xcodeproj` file and select
**_Show Package Contents_**.
3. Open the `project.pbxproj` file in a text editor.
4. Remove all occurrences of `path-to-glslang-repo-folder` from the paths to the
`glslang`, `OGLCompilersDLL`, and `SPIRV` directories added above.
<a name="add_spirv-tools"></a>
Adding the *SPIRV-Tools* Library to the *MoltenVKShaderConverter Xcode* Project
-------------------------------------------------------------------------------
The `MoltenVKShaderConverter` *Xcode* project is already configured to use the *SPIRV-Tools*
library. However, after updating the version of *SPIRV-Tools*, as described [above](#updating),
if you encounter any building errors, you may need to re-add the *SPIRV-Tools* library to the
`MoltenVKShaderConverter` *Xcode* project as follows:
1. In the *Project Navigator*, remove the *Group* named `source` from under the *Group* named
`MoltenVKSPIRVToMSLConverter/SPIRV-Tools`.
2. Drag the `External/glslang/Extermal/spirv-tools/source` file folder to the `SPIRV-Tools` group in the *Project Navigator* panel.
In the _**Choose options for adding these files**_ dialog that opens, select the
_**Create groups**_ option, add the files to *both* the `MoltenVKSPIRVToMSLConverter-iOS`
and `MoltenVKSPIRVToMSLConverter-macOS` targets, and click the ***Finish*** button.
3. In the *Project Navigator* panel, select the `MoltenVKShaderConverter` *Xcode* project, then select the
`MoltenVKSPIRVToMSLConverter-macOS` target, and open the *Build Settings* tab. Locate the build setting
entry **Header Search Paths** (`HEADER_SEARCH_PATHS`) and add the following paths:
"$(SRCROOT)/glslang/External/spirv-tools"
"$(SRCROOT)/glslang/External/spirv-tools/include"
"$(SRCROOT)/glslang/External/spirv-tools/external/spirv-headers/include"
"$(SRCROOT)/glslang/build/External/spirv-tools"
4. Repeat *Step 3* for the `MoltenVKSPIRVToMSLConverter-iOS` target within the `MoltenVKShaderConverter` *Xcode* project
5. ***(Optional)*** To simplify the paths used within *Xcode* to reference the added files,
perform the following steps:
1. **Create a backup of your project!** This is an intrusive and dangerous operation!
2. In the *Finder*, right-click your `MoltenVKShaderConverter.xcodeproj` file and select
**_Show Package Contents_**.
3. Open the `project.pbxproj` file in a text editor.
4. Remove all occurrences of `path-to-SPIRV-Tools-repo-folder` from the paths to the
`source` directory added above.
External/glslang/glslang/MachineIndependant/glslang.y
External/glslang/glslang/OSDependent/Windows

View File

@ -1 +1 @@
ed16b3e69985feaf565efbecea70a1cc2fca2a58
9e3a41ad00ca48b9119d805cd96f337984458fe7

View File

@ -9,6 +9,10 @@
/* Begin PBXBuildFile section */
45003E73214AD4E500E989CB /* MVKExtensions.def in Headers */ = {isa = PBXBuildFile; fileRef = 45003E6F214AD4C900E989CB /* MVKExtensions.def */; };
45003E74214AD4E600E989CB /* MVKExtensions.def in Headers */ = {isa = PBXBuildFile; fileRef = 45003E6F214AD4C900E989CB /* MVKExtensions.def */; };
45557A5221C9EFF3008868BD /* MVKCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45557A4D21C9EFF3008868BD /* MVKCodec.cpp */; };
45557A5321C9EFF3008868BD /* MVKCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45557A4D21C9EFF3008868BD /* MVKCodec.cpp */; };
45557A5421C9EFF3008868BD /* MVKCodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 45557A5121C9EFF3008868BD /* MVKCodec.h */; };
45557A5521C9EFF3008868BD /* MVKCodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 45557A5121C9EFF3008868BD /* MVKCodec.h */; };
83A4AD2A21BD75570006C935 /* MVKVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A4AD2521BD75570006C935 /* MVKVector.h */; };
83A4AD2B21BD75570006C935 /* MVKVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A4AD2521BD75570006C935 /* MVKVector.h */; };
83A4AD2C21BD75570006C935 /* MVKVectorAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A4AD2921BD75570006C935 /* MVKVectorAllocator.h */; };
@ -265,6 +269,9 @@
/* Begin PBXFileReference section */
45003E6F214AD4C900E989CB /* MVKExtensions.def */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = MVKExtensions.def; sourceTree = "<group>"; };
45557A4D21C9EFF3008868BD /* MVKCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MVKCodec.cpp; sourceTree = "<group>"; };
45557A5121C9EFF3008868BD /* MVKCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKCodec.h; sourceTree = "<group>"; };
45557A5721CD83C3008868BD /* MVKDXTnCodec.def */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = MVKDXTnCodec.def; sourceTree = "<group>"; };
83A4AD2521BD75570006C935 /* MVKVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKVector.h; sourceTree = "<group>"; };
83A4AD2921BD75570006C935 /* MVKVectorAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKVectorAllocator.h; sourceTree = "<group>"; };
A9096E5C1F81E16300DFBEA6 /* MVKCmdDispatch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVKCmdDispatch.h; sourceTree = "<group>"; };
@ -497,6 +504,9 @@
A98149401FB6A3F7005F00B4 /* Utility */ = {
isa = PBXGroup;
children = (
45557A5721CD83C3008868BD /* MVKDXTnCodec.def */,
45557A4D21C9EFF3008868BD /* MVKCodec.cpp */,
45557A5121C9EFF3008868BD /* MVKCodec.h */,
83A4AD2521BD75570006C935 /* MVKVector.h */,
83A4AD2921BD75570006C935 /* MVKVectorAllocator.h */,
A98149411FB6A3F7005F00B4 /* MVKBaseObject.cpp */,
@ -611,6 +621,7 @@
A94FB7E01C7DFB4800632CA3 /* MVKDescriptorSet.h in Headers */,
A9E53DE12100B197002781DD /* NSString+MoltenVK.h in Headers */,
A9E53DDF2100B197002781DD /* CAMetalLayer+MoltenVK.h in Headers */,
45557A5421C9EFF3008868BD /* MVKCodec.h in Headers */,
A94FB8041C7DFB4800632CA3 /* MVKRenderPass.h in Headers */,
A9F042A61FB4CF83009FCCB8 /* MVKLogging.h in Headers */,
A94FB8001C7DFB4800632CA3 /* MVKQueue.h in Headers */,
@ -674,6 +685,7 @@
A94FB7E11C7DFB4800632CA3 /* MVKDescriptorSet.h in Headers */,
A9E53DE22100B197002781DD /* NSString+MoltenVK.h in Headers */,
A9E53DE02100B197002781DD /* CAMetalLayer+MoltenVK.h in Headers */,
45557A5521C9EFF3008868BD /* MVKCodec.h in Headers */,
A94FB8051C7DFB4800632CA3 /* MVKRenderPass.h in Headers */,
A9F042A71FB4CF83009FCCB8 /* MVKLogging.h in Headers */,
A94FB8011C7DFB4800632CA3 /* MVKQueue.h in Headers */,
@ -949,6 +961,7 @@
A94FB7CE1C7DFB4800632CA3 /* MVKCommand.mm in Sources */,
A94FB80E1C7DFB4800632CA3 /* MVKShaderModule.mm in Sources */,
A94FB81A1C7DFB4800632CA3 /* MVKSync.mm in Sources */,
45557A5221C9EFF3008868BD /* MVKCodec.cpp in Sources */,
A94FB7BE1C7DFB4800632CA3 /* MVKCmdPipeline.mm in Sources */,
A94FB81E1C7DFB4800632CA3 /* MVKLayers.mm in Sources */,
A94FB7EE1C7DFB4800632CA3 /* MVKFramebuffer.mm in Sources */,
@ -1001,6 +1014,7 @@
A94FB7CF1C7DFB4800632CA3 /* MVKCommand.mm in Sources */,
A94FB80F1C7DFB4800632CA3 /* MVKShaderModule.mm in Sources */,
A94FB81B1C7DFB4800632CA3 /* MVKSync.mm in Sources */,
45557A5321C9EFF3008868BD /* MVKCodec.cpp in Sources */,
A94FB7BF1C7DFB4800632CA3 /* MVKCmdPipeline.mm in Sources */,
A94FB81F1C7DFB4800632CA3 /* MVKLayers.mm in Sources */,
A94FB7EF1C7DFB4800632CA3 /* MVKFramebuffer.mm in Sources */,
@ -1029,6 +1043,7 @@
A9B8EE1E1A98D796009C5A02 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SDKROOT = iphoneos;
@ -1040,6 +1055,7 @@
A9B8EE1F1A98D796009C5A02 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
BITCODE_GENERATION_MODE = bitcode;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SDKROOT = iphoneos;

View File

@ -179,19 +179,11 @@
A92EF7CA21856EA200C8B91B /* package_update_latest.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = package_update_latest.sh; sourceTree = "<group>"; };
A92EF7CB21856EA300C8B91B /* package_shader_converter.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = package_shader_converter.sh; sourceTree = "<group>"; };
A92EF7DE2186451700C8B91B /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = ../Makefile; sourceTree = "<group>"; };
A943100220546CDD00F5CF87 /* fetchDependencies */ = {isa = PBXFileReference; lastKnownFileType = text; name = fetchDependencies; path = ../fetchDependencies; sourceTree = "<group>"; };
A975D55C213F25D700D4834F /* create_dylib.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = create_dylib.sh; path = ../MoltenVK/scripts/create_dylib.sh; sourceTree = "<group>"; };
A98149E51FB78829005F00B4 /* MoltenVK_Runtime_UserGuide.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = MoltenVK_Runtime_UserGuide.md; path = Docs/MoltenVK_Runtime_UserGuide.md; sourceTree = "<group>"; };
A99A760321852584000A8E2A /* create_framework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = create_framework.sh; path = ../MoltenVK/scripts/create_framework.sh; sourceTree = "<group>"; };
A9AD67D12054E2D700ED3C08 /* VulkanSamples_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = VulkanSamples_repo_revision; sourceTree = "<group>"; };
A9AD67D32054E2D700ED3C08 /* SPIRV-Cross_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = "SPIRV-Cross_repo_revision"; sourceTree = "<group>"; };
A9AD67E92055D8A600ED3C08 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
A9D3560A20BB3A2900BE295C /* glslang_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = glslang_repo_revision; sourceTree = "<group>"; };
A9D3560B20BB3A5600BE295C /* Vulkan-Headers_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Vulkan-Headers_repo_revision"; sourceTree = "<group>"; };
A9D3560C20BB3A7200BE295C /* Vulkan-Tools_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Vulkan-Tools_repo_revision"; sourceTree = "<group>"; };
A9DA8340218A198C002AA662 /* .travis.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .travis.yml; sourceTree = "<group>"; };
A9DA8341218A198C002AA662 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
A9EE46412065766C00193200 /* cereal_repo_revision */ = {isa = PBXFileReference; lastKnownFileType = text; path = cereal_repo_revision; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
@ -200,7 +192,6 @@
children = (
A92DB3EE1CE0F72500FBC835 /* MoltenVK.xcodeproj */,
A92DB40E1CE0F89600FBC835 /* MoltenVKShaderConverter.xcodeproj */,
A939A6FB1F5479D0006ACA0C /* External */,
A975D55B213F25AD00D4834F /* Scripts */,
A92DB3E11CE0F34500FBC835 /* Docs */,
A9DA833F218A193F002AA662 /* Git */,
@ -227,22 +218,6 @@
name = Products;
sourceTree = "<group>";
};
A939A6FB1F5479D0006ACA0C /* External */ = {
isa = PBXGroup;
children = (
A9AD67E92055D8A600ED3C08 /* README.md */,
A943100220546CDD00F5CF87 /* fetchDependencies */,
A9EE46412065766C00193200 /* cereal_repo_revision */,
A9D3560A20BB3A2900BE295C /* glslang_repo_revision */,
A9AD67D32054E2D700ED3C08 /* SPIRV-Cross_repo_revision */,
A9D3560B20BB3A5600BE295C /* Vulkan-Headers_repo_revision */,
A9D3560C20BB3A7200BE295C /* Vulkan-Tools_repo_revision */,
A9AD67D12054E2D700ED3C08 /* VulkanSamples_repo_revision */,
);
name = External;
path = ExternalRevisions;
sourceTree = "<group>";
};
A975D55B213F25AD00D4834F /* Scripts */ = {
isa = PBXGroup;
children = (

View File

@ -1 +0,0 @@
../../External/SPIRV-Cross/spirv.hpp

View File

@ -7,7 +7,7 @@
MoltenVK
========
Copyright (c) 2014-2018 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
Copyright (c) 2014-2019 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
*This document is written in [Markdown](http://en.wikipedia.org/wiki/Markdown) format.
For best results, use a Markdown reader.*

11
Scripts/package_ext_libs.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
export MVK_EXT_LIB_DST_DIR="External"
export MVK_EXT_LIB_DST_OS_PATH="${PROJECT_DIR}/${MVK_EXT_LIB_DST_DIR}/build/${MVK_OS}"
rm -rf "${MVK_EXT_LIB_DST_OS_PATH}"
mkdir -p "${MVK_EXT_LIB_DST_OS_PATH}"
cp -a "${MVK_BUILT_PROD_PATH}/"*.a "${MVK_EXT_LIB_DST_OS_PATH}"

View File

@ -0,0 +1,7 @@
#!/bin/bash
export MVK_OS="iOS"
export MVK_BUILT_PROD_PATH="${BUILT_PRODUCTS_DIR}-iphoneos"
"${SRCROOT}/Scripts/package_ext_libs.sh"

View File

@ -0,0 +1,7 @@
#!/bin/bash
export MVK_OS="macOS"
export MVK_BUILT_PROD_PATH="${BUILT_PRODUCTS_DIR}"
"${SRCROOT}/Scripts/package_ext_libs.sh"

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Copyright (c) 2016-2018 The Brenwill Workshop Ltd.
# Copyright (c) 2016-2019 The Brenwill Workshop Ltd.
#
# fetchDependencies - Retrieves the correct versions of all dependencies
#
@ -22,17 +22,23 @@
# build directory must be in the specified directory.
# It should be built the same way this script builds it.
#
# -v verbose output
#
# ----------------- Functions -------------------
XC_BUILD_VERBOSITY="-quiet"
V_HEADERS_ROOT=""
SPIRV_CROSS_ROOT=""
GLSLANG_ROOT=""
while (( "$#" )); do
case "$1" in
-v)
XC_BUILD_VERBOSITY=""
shift 1
;;
--v-headers-root)
V_HEADERS_ROOT=$2
shift 2
@ -89,8 +95,6 @@ build_repo() {
make -j $(sysctl -n hw.activecpu)
fi
make install
cd -
}
@ -98,7 +102,7 @@ build_repo() {
# ----------------- Main -------------------
EXT_DIR=External
EXT_REV_DIR=ExternalRevisions
EXT_REV_DIR=../ExternalRevisions
echo
echo ========== Retrieving MoltenVK dependencies into ${EXT_DIR} ==========
@ -115,7 +119,7 @@ echo
REPO_NAME=cereal
REPO_URL="https://github.com/USCiLab/${REPO_NAME}.git"
REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
REPO_REV=$(cat "${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV}
@ -135,7 +139,7 @@ if [ ! "$V_HEADERS_ROOT" = "" ]; then
else
REPO_NAME=Vulkan-Headers
REPO_URL="https://github.com/KhronosGroup/${REPO_NAME}.git"
REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
REPO_REV=$(cat "${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV}
fi
@ -156,7 +160,7 @@ if [ ! "$SPIRV_CROSS_ROOT" = "" ]; then
else
REPO_NAME=SPIRV-Cross
REPO_URL="https://github.com/KhronosGroup/${REPO_NAME}.git"
REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
REPO_REV=$(cat "${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV}
fi
@ -177,7 +181,7 @@ if [ ! "$GLSLANG_ROOT" = "" ]; then
else
REPO_NAME=glslang
REPO_URL="https://github.com/KhronosGroup/${REPO_NAME}.git"
REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
REPO_REV=$(cat "${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV}
@ -185,7 +189,7 @@ else
./update_glslang_sources.py
cd -
build_repo ${REPO_NAME}
build_repo "${REPO_NAME}/External/spirv-tools"
fi
@ -197,7 +201,7 @@ echo
REPO_NAME=Vulkan-Tools
REPO_URL="https://github.com/KhronosGroup/${REPO_NAME}.git"
REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
REPO_REV=$(cat "${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV}
@ -210,7 +214,7 @@ echo
REPO_NAME=VulkanSamples
REPO_URL="https://github.com/LunarG/${REPO_NAME}.git"
REPO_REV=$(cat "../${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
REPO_REV=$(cat "${EXT_REV_DIR}/${REPO_NAME}_repo_revision")
update_repo ${REPO_NAME} ${REPO_URL} ${REPO_REV}
@ -225,3 +229,20 @@ cd -
cd ..
# -------------- Build MoltenVK dependencies -----------------
echo
echo ========== Building dependency libraries quietly. Please be patient on first build. ==========
echo
EXT_DEPS=ExternalDependencies
xcodebuild \
-project "${EXT_DEPS}.xcodeproj" \
-scheme "${EXT_DEPS}" \
-derivedDataPath "${EXT_DIR}/build" \
${XC_BUILD_VERBOSITY} \
build
echo ========== Done! ==========