56 Commits

Author SHA1 Message Date
Filip Lundgren
d8b5a7df55 Merge branch 'main' of https://github.com/KhronosGroup/MoltenVK into visionOS 2023-06-23 10:29:57 -04:00
Filip Lundgren
16990efeb1 Support building for visionOS
Note: Internal naming is xrOS, but publicly it should be referred to as visionOS
2023-06-23 10:25:05 -04:00
Bill Hollings
937b0bf943 Deprecate the obsolete and non-standard VK_MVK_moltenvk extension.
The VK_MVK_moltenvk extension has never been brought inside Vulkan, and
the functions have never been supported by the Vulkan Loader and Layers.
Most of the functionality has long been replaced by the official
VK_metal_objects extension.

- Remove VK_MVK_moltenvk as an advertised extension.
- Refactor vk_mvk_moltenvk.h header file into separate headers files:
    - mvk_config.h - Valid public config functions
    - mvk_private_api.h - Valid development debugging functions used with care
    - mvk_deprecated_api.h - Formally deprecated functions.
- Retain skeleton vk_mvk_moltenvk.h header file for legacy compatibility only.
- Update documentation and header comments to explain changes.
2023-05-01 17:30:21 -04:00
Bill Hollings
c205c53ad9 Reduce memory footprint of retained MSL source code.
- Add MVKCompressor template class, and mvkCompress() & mvkDecompress()
  functions to support general data compression.
- Add MVKConfiguration::shaderSourceCompressionAlgorithm and
  env var MVK_CONFIG_SHADER_COMPRESSION_ALGORITHM to support
  compressing MSL shader source code held in a pipeline cache.
- Add MVKShaderCompilationPerformance::mslCompress and mslDecompress
  to allow performance of MSL compression to be tracked and queried.
- Add support for logging performance stats accumulated in a VkDevice,
  when it is destroyed. Good for CTS testing.
- Change MVKConfiguration::logActivityPerformanceInline boolean to
  activityPerformanceLoggingStyle enumeration value.
- Add MVK_CONFIG_ACTIVITY_PERFORMANCE_LOGGING_STYLE environment variable and
  build setting to set MVKConfiguration::activityPerformanceLoggingStyle value.
2023-03-03 10:39:26 -05:00
Bill Hollings
12592abbc9 Update copyright notices to year 2023. 2023-01-13 12:19:37 -05:00
Bill Hollings
14de07b6f4 Vulkan semaphore functional improvements.
- Support option to use MTLEvents for Vulkan semaphores on NVIDIA and Rosetta2.
- Add public MVKVkSemaphoreSupportStyle enumeration.
- MVKConfiguration replace deprecated legacy booleans semaphoreUseMTLEvent,
  and semaphoreUseMTLFence with enumerated semaphoreSupportStyle.
- Alias legacy semaphoreUseMTLEvent to semaphoreSupportStyle and support legacy
  use of semaphoreUseMTLFence and semaphoreUseMTLEvent for backwards compatibility.
- MVKConfiguration rename recently renamed semaphoreUseSingleQueue back to
  semaphoreUseMTLFence for backwards compatibility.
2022-09-01 12:10:23 -04:00
Bill Hollings
4effb9a5fd Support automatically enable Metal argument buffers when
VK_EXT_descriptor_indexing extension is enabled.

- Change MVKConfiguration::useMetalArgumentBuffers to enum instead of boolean
  and default to enabling Metal argument buffers for VK_EXT_descriptor_indexing.
- Leave Metal argument buffers disabled by default until they are improved.
- Enable VkPhysicalDeviceVulkan12Features::descriptorIndexing.
- Add MVKPhysicalDeviceVulkan12FeaturesNoExt to track and enable Vulkan 1.2
  features not part of any prior extensions absorbed by Vulkan 1.2.
- Update VK_MVK_MOLTENVK_SPEC_VERSION to version `36`.
- MVKDeviceTrackingMixin remove unnecessary inline declarations.
- MoltenShaderConveter tool support Metal Argument Buffers and MSL 3.0.
2022-08-26 14:48:13 -04:00
Bill Hollings
e0a50c8f2d Add support for the VK_KHR_shader_float_controls extension.
- Enable shaderSignedZeroInfNanPreserveFloat16 and
  shaderSignedZeroInfNanPreserveFloat32.
  Other float control properties are not settable in Metal.
- MVKShaderModule log whether compiling with fast math enabled.
- Update MoltenVK_Runtime_UserGuide.md and Whats_New.md documents.
- runcts script enable MVK_CONFIG_FAST_MATH_ENABLED by default.
2022-08-18 13:35:35 -04:00
MennoVink
46b74c8a40
Update copy_lib_to_staging.sh
Allow for building on removable volumes with a space in their name, ie "/Volumes/T7 Touch/"
2022-07-28 20:33:27 +02:00
Bill Hollings
8dd1454651 Xcode 14 build fixes from code review and further testing.
- Replace use of deprecated kIOMasterPortDefault with MACH_PORT_NULL.
- Convert an inline VLA with constant length array.
- Add input files to all build phases to trigger dependencies when inputs change.
- Add packaging scripts to per-platform ExternalDependencies targets.
2022-07-08 18:07:18 -04:00
Nikita Fediuchin
be51560ba9 Update license year 2 2022-02-04 17:36:53 +02:00
Bill Hollings
ba9623cad5 Update to latest version of SPIRV-Cross.
Add additional SPIRV-Cross header files to ExternalDependencies.xcodeproj
to allow browsing these files in Xcode.
2021-09-30 13:45:54 -04:00
Bill Hollings
8b1435ca88 Pass MVKArrayRef by reference to functions.
Per cdavis5e observation:
Since an MVKArrayRef<T> is just a pointer and a size, passing it around by
reference doesn't buy much. It might actually hurt performance, since cache
lines might be evicted to make room for the MVKArrayRef in memory.
For this reason, LLVM passes its ArrayRefs by value.

Unrelatedly, update runcts to log errors by default.
2021-08-04 13:16:25 -04:00
Bill Hollings
51e3ae0d23 Additional documentation clarification in Scripts/runcts script. 2021-06-24 08:32:06 -04:00
Bill Hollings
b65d8f8677 Fixes to Scripts/runcts script from PR review.
Consolidate portability command line options selection.
Document magic numbers used to limit portability option
to Vulkan 1.0 and limited extensions.
2021-06-24 08:27:28 -04:00
Bill Hollings
25d1349579 Add Scripts/runcts script as a convenience for running Vulkan CTS tests.
Update .gitignore to ignore CTS artifacts in Scripts directory.
2021-06-22 19:45:24 -04:00
Bill Hollings
015031c955 Update copyright notices to year 2021 and Xcode build settings check to Xcode 12.3. 2021-01-21 13:37:07 -05:00
Bill Hollings
1ec58c9a92 Support building for Mac Catalyst on macOS 11.0+.
Define MVK_MACCAT build macro and use it to conditionally compile code to align
with build features and capabilities of Mac Catalyst platform on macOS 11.0+.
Treat Mac Catalyst as minor variation of macOS 11.0.
Update documentation.

Currently only support Mac Catalyst on macOS 11.0+, to avoid complexities of
deselecting iOS features and capabilities for Mac Catalyst on previous macOS versions.

Mac Catalyst (and Simulators) require use of XCFrameworks.
Currently unable to generate a dylib for Mac Catalyst.
2020-12-01 19:26:15 -05:00
Chip Davis
0f5af085e7 Scripts: Support ubsan when building the dylib. 2020-11-03 16:25:59 -06:00
Bill Hollings
9f2fc8f7d0 Update dependency libraries to match Vulkan SDK 1.2.154. 2020-09-28 19:03:00 -04:00
Bill Hollings
a23f99c3e5 Refactor MoltenVKShaderConverter frameworks.
Combine MoltenVKSPIRVToMSLConverter and MoltenVKGLSLToSPIRVConverter
frameworks into a single MoltenVKShaderConverter framework.

Update corresponding directory structures, symlinks, scripts, and build paths.
Update MoltenVK code to use new framework name for headers.
Add symlinks in API-Samples demo to support legacy
MoltenVKGLSLToSPIRVConverter header paths.

In addition to simplifying shader converter code and build management, the
use of only one shader converter framework fixes a race condition within Xcode,
prior to Xcode 12, when multiple targets use the same dependency XCFramework.
2020-09-23 11:09:46 -04:00
Bill Hollings
a47bcdf2c5 Support fat platform libraries in XCFrameworks and dylibs.
Remove EXCLUDED_ARCHS from all Xcode projects to allow fat platform libraries to be built.
Script copy_lib_to_staging.sh no longer breaks fat libraries into single-architecture
libraries, and simply copies fat file to XCFramework staging area.
This permits support for arm64 on macOS, and arm64e on iOS and tvOS.
Creating a Simulator dylib containing both x86_64 and arm64 (Apple Silicon)
architectures is not currently supported by Xcode, so Simulator dylibs are skipped.
2020-09-14 12:01:13 -04:00
Bill Hollings
9406fce556 Fix syntax crash in create_xcframework_func.sh. 2020-09-11 15:01:03 -04:00
Bill Hollings
7af7a3b29b create_xcframework_func.sh script check for header availability before copying.
XCFramework headers are still unusable due to an Xcode bug (documented in
create_xcframework_func.sh), but in testing for this, modifications to
create_xcframework_func.sh were made to test for the header file so that this
will work correctly when the Xcode bug is fixed and headers can be reintroduced.
2020-09-04 12:09:45 -04:00
Bill Hollings
56df7d61d7 Remove MoltenVK fat libraries and frameworks and use XCFramework instead.
- Delete fat library and framework scripts and templates.
- MoltenVK build package now only includes one XCFramework, and separate platform dylibs.
- Modify fetchDependencies and Makefile targets to not build fat libraries,
  and to build simulators separately than platforms instead.
- Script package_moltenvk.sh now copies dylibs for all built platforms.
- Consolidate package_all.sh and delete package_one_os.sh.
- Swap names of copy_lib_to_staging.sh and copy_to_staging.sh scripts.
- Cube demo now uses MoltenVK as XCFramework, and support Simulator builds.
- Hologram demo now uses MoltenVK as dylibs from new packaging location.
- API-Samples demo now uses MoltenVK as XCFramework.
- Update documentation.
2020-09-01 14:39:46 -04:00
Bill Hollings
536d6cf0d4 Add MoltenVK XCFramework.
Add package_moltenvk_xcframework.sh.
Rename package_shader_converter.sh to package_shader_converter_xcframework.sh.
2020-08-27 23:43:06 -04:00
Bill Hollings
e97d11a4f5 Shader converters as XCFramework.
Create shader converters as XCFrameworks.
Don't create shader converters as fat libs, dylibs, or regular frameworks.
Rename create_xcframework.sh to create_xcframework_func.sh.
Use separate MoltenVK packaging scripts for one or all OS's.
Add package_one_os.sh.
Remove package_shader_converter_lib.sh.
Remove redundant GLSL shader converter dependencies in MoltenVK packaging targets.
2020-08-27 19:29:14 -04:00
Bill Hollings
dd59aea71f Use external libraries as XCFrameworks.
Exclude arm64 architectures on macOS and Simulators.
Exclude arm64e architectures on iOS and tvOS.
Stop building fat libraries for external libraries.
Remove package_ext_libs.sh script.
Don't include Headers in ext lib XCFrameworks because of Xcode12 bug in using them.
2020-08-20 15:24:35 -04:00
Bill Hollings
7579cf6a3b Create external libraries as XCFrameworks.
Add script copy_to_staging.sh.
Add script copy_ext_lib_to_staging.sh.
Add script create_xcframework.sh.
Add script create_ext_lib_xcframeworks.sh.
2020-08-20 12:45:12 -04:00
Bill Hollings
d4b5df532e Re-add support for bitcode generation on iOS and tvOS.
Set BITCODE_GENERATION_MODE build setting in all Xcode projects.
create_dylib.sh support BITCODE_GENERATION_MODE.
2020-08-11 20:18:50 -04:00
Bill Hollings
834d391aec Update dependency libraries to match Vulkan SDK 1.2.148.
fetchDependencies support option to skip all library builds.
fetchDependencies avoid sync locks if not building in parallel.
fetchDependencies build glslang headers.
Update ExternalRevisions/README.md glslang build integration section.
Update What's New.
2020-07-27 22:25:44 -04:00
Bill Hollings
927bfddbc7 VkPhysicalDeviceProperties::pipelineCacheUUID include MoltenVK Git revision hash. 2020-07-20 17:53:11 -04:00
Bill Hollings
1acc1ac8ed Fix failure of MoltenVKShaderConverter Xcode build target packaging script.
Update outstanding uses of MVK_BUILT_PROD_PATH to MVK_BUILT_PROD_DIR.
2020-07-08 12:51:29 -04:00
Bill Hollings
b9f1d7519a Makefile add debug build targets.
Fix crash during creation of fat dSYMs.
Travis only build macOS version of everything.
2020-06-23 16:08:00 -04:00
Bill Hollings
abb8792843 fetchDependencies build external libraries in parallel by platform.
Log ext lib build steps to provide user feedback.
Add package_ext_libs_finish.sh script to separate packaging
libraries from building them, to avoid build database conflicts.
Travis only build macOS ext libs.
2020-06-22 00:00:00 -04:00
Bill Hollings
ac204382db Merge simulator support with tvOS support. 2020-06-19 15:05:43 -04:00
Bill Hollings
9fea13773d Support iOS simulator and fat library builds of MoltenVK libraries.
Create fat builds of static, dynamic & framework libraries if both iOS
and simulator versions have been created from separate manual Xcode builds.

Refactor scripts for creating fat libraries to reuse across projects.
Add MVK_BUILT_PROD_DIR to replace use of BUILT_PRODUCTS_DIR in most scripts
to allow flexibility across per-platform compilation.
2020-06-19 09:53:43 -04:00
Bill Hollings
491698e49d Support iOS simulator and fat library builds of external dependency libraries.
Create fat builds of external libraries if both iOS and simulator versions
have been created from separate manual Xcode builds.
Add Scripts/create_fat_libs.sh.
Remove Scripts/package_ext_libs_ios.sh and Scripts/package_ext_libs_macos.sh.
2020-06-17 13:22:10 -04:00
Aman Gupta
aabc94995b forgot a script 2020-06-15 15:54:31 -07:00
Aman Gupta
44a2ec5836 add tvOS boilerplate 2020-06-09 14:47:11 -07:00
Bill Hollings
4a5bf6953c Update fetchDependencies script to use pre-built spirv-tools files by default. 2020-06-02 13:30:52 -04:00
Bill Hollings
2b2bfc3fbd Move generation of API-Samples SPIR-V header files out of fetchDependencies.
Add Demos/LunarG-VulkanSamples/API-Samples/generateSPIRVShaders script.
Update user documentation.
2020-04-12 12:53:17 -04:00
Bill Hollings
a58f6bc441 Update to Vulkan SDK 1.2.135 library dependencies.
Add Scripts/packagePregenSpirvToolsHeaders script to automate packaging Spirv-Tools
headers in support of the fetchDependencies --skip-spirv-tools-build option.
Update Docs/Whats_New.md.
2020-04-02 16:35:48 -04:00
Bill Hollings
ddfa225f79 Fix crash in fetchDependencies on build paths containing spaces. 2019-11-14 17:11:10 -05:00
Bill Hollings
19c397e0b7 Move generation of SPIRV-Cross/mvkSpirvCrossRevisionDerived.h to separate script.
Add Scripts/gen_spirv_cross_rev_hdr.sh script and
call from ExternalDependencies SPIRV-Cross build.
2019-10-22 16:51:27 -04:00
Chip Davis
321af99cad Link to CoreGraphics.framework.
This is needed for color space support. I guess AppKit reexports this
framework on macOS, but UIKit on iOS doesn't.
2019-08-05 23:18:58 -05:00
Bill Hollings
62f374bf7e Allow building external dependency libraries in Debug mode.
Add ExternalDependencies (Debug) scheme to ExternalDependencies Xcode project.
Add --debug option to fetchDependencies script.
Support Release, Debug & Latest directories in External/build directory.
Enable DEPLOYMENT_POSTPROCESSING build setting when compiling
SPIRV-Tools to avoid warning spam when building dylibs.
Disable visibility warnings when building MoltenVKShaderConverter
in Release mode from external libraries built in Debug mode.
Always use -Xlinker -w option when creating dylibs to disable visibility warnings.
2019-04-18 15:08:39 -04:00
Bill Hollings
c388619792 Suppress visibility warning spam when building Debug macOS from SPIRV-Cross Release
Pass -Xlinker -w when building Debug macOS dylibs.
Include -w in OTHER_LDFLAGS when building Debug macOS MoltenVKShaderConverter tool.
2019-04-02 12:25:49 -04:00
Bill Hollings
0f22e2a70e MSL: Fix crash where variable storage buffer pointers are passed down.
Explicitly build dSYM files in BUILT_PRODUCTS_DIR
to avoid conflict between macOS and iOS build locations.
Update to latest SPIRV-Cross version.
2019-03-28 11:58:05 -04:00
Bill Hollings
0ac1edbac0 Project build enhancements, and MoltenVKShaderConverter
tool now validates converted MSL with a test compilation.

Project build scripts now build dylib and framework in separate build directories
to enable MoltenVKShaderConverter to link to static library instead of dynamic library.
Final Package structure remains the same.
In Debug build, copy dylib dSYM files to Package.
Package/Latest directory now links relative to local Debug or Release directory.
Add install option to Makefile.
MoltenVKShaderConverter tool now validates converted MSL with a test compilation.
Clean up various MSL conversion and compilation error logging.
MVKCommandResourceFactory wrap Metal library compile with autorelease pool.
Build ExternalDependencies with same symbol hiding as MoltenVK to suppress visibility warnings.
Update What's New document.
2019-03-22 19:36:21 -04:00