83 Commits

Author SHA1 Message Date
Bill Hollings
0d62ff8fb7 Improve support for iOS App Store rules by using dynamic XCFramework.
Apple's iOS App Store does not permit an app to link to naked dylibs.
Instead, these must be placed in frameworks, which are embedded in a
dynamic version of MoltenVK.xcframework.

- Use Xcode to directly generate a MoltenVK.framework for each platform,
  and remove create_dylib*.sh scripts.
- Move static XCFramework, containing libMoltenVK.a static libraries,
  to Package/Latest/MoltenVK/static/MoltenVK.xcframework.
- Generate dynamic XCFramework, containing MoltenVK.framework dynamic
  libraries, in Package/Latest/MoltenVK/dynamic/MoltenVK.xcframework.
- Add macro MVK_VERSION_STRING to create version string at compile time,
  use it to validate the CURRENT_PROJECT_VERSION build setting at compile time,
  and use it at runtime instead of mvkGetMoltenVKVersionString() function.
- Add -w to OTHER_LDFLAGS to dynamic framework builds to suppress
  spurious linker warnings of the type
  "ld: warning: no platform load command found in '...', assuming: iOS"
  issued from the new linker introduced in Xcode 15.
- Add MoltenVK-MacCat Xcode target and MoltenVK Package (MacCat only)
  Xcode scheme to avoid building dynamic MoltenVK.framework for the
  Mac Catalyst platform, because Xcode does not support doing so.
- Always run MoltenVK build scripts, to ensure all components are
  added to the XCFrameworks, and MoltenVK/Package is always refreshed,
  even if code compilation is not required.
- Cube demo link to dynamic MoltenVK.framework through
  dynamic/MoltenVK.xcframework, instead of to naked libMoltenVK.dylib.
- Update the version of Volk used by the Cube demo, to support
  loading MoltenVK from dynamic frameworks inside Volk.
- Update README.md and MoltenVK_Runtime_UserGuide.md documents.
- Update MVK_PRIVATE_API_VERSION to 40.
- Fix make install to install /usr/local/lib/libMoltenVK.dylib on macOS (unrelated).
- Remove unused MTLAttributeStrideStatic declaration prior to Xcode 15 (unrelated).
2024-03-05 20:38:35 -05:00
Chip Davis
60a429f353 Support the depth bounds test.
This isn't even a regular SPI. It's not even present in the Metal
framework. It's exposed by the driver. Only AMD drivers support the
method we need for now.
2024-01-29 15:42:13 -07:00
Chip Davis
f8b974371b MVKPipeline: Support sample masks in the Metal SPI.
This is yet another "secret" property on the
`MTLRenderPipelineDescriptor`.
2024-01-29 15:39:01 -07:00
Chip Davis
f5d7190554 MVKSampler: Support LoD bias.
Metal actually supports this, but this is a hidden property of the
`MTLSamplerDescriptor`. It's not part of the public API. Guard our use
of it appropriately.
2024-01-29 15:38:52 -07:00
Chip Davis
8d1303a57a MVKPipeline: Support framebuffer logic operations.
This support was always there in Metal. It was just hidden from public
view--but not from prying eyes on the Objective-C metadata.

I had initially thought they were using OpenGL/Vulkan values for the
logic operation. When that didn't work, I then tried D3D11 values. I
guess D3D11 makes sense, because the Intel GPU drivers were the first to
support this in Metal.

Move the definition of `MVK_USE_METAL_PRIVATE_API` into
`"MVKCommonEnvironment.h"` so we can use it from non-C++ code.
2024-01-29 15:37:29 -07:00
Chip Davis
06d493dcc1 Add a configuration parameter to control the use of Metal SPIs.
With the new `MVK_CONFIG_USE_METAL_PRIVATE_API`, the user can prevent their
use at run time without recompiling MoltenVK. This may be useful for
troubleshooting purposes.

The extra member is because the compiler adds tail padding to make the
struct aligned on an 8-byte boundary, so the `static_assert()` fails
without it.
2024-01-29 15:26:23 -07:00
Bill Hollings
5992dda9ba Add optional support for VkPhysicalDeviceFeatures::wideLines.
- Add MVK_USE_METAL_PRIVATE_API build setting to allow MoltenVK
  to be built with access to Metal private API calls.
- Add support for VkPhysicalDeviceFeatures::wideLines feature
  when MVK_USE_METAL_PRIVATE_API is enabled in a MoltenVK build.
- Set lineWidthRange and lineWidthGranularity to reasonable arbitrary values.
2024-01-25 13:08:10 -05:00
Bill Hollings
8a675aa3a8 Revert to disabling MVK_HIDE_VULKAN_SYMBOLS by default.
- Statically expose vkGetInstanceProcAddr(), even
  when MVK_HIDE_VULKAN_SYMBOLS is enabled.
- To support Volk, link Cube demo dynamically to libMoltenVK.dylib
  instead of statically to MoltenVK.xcframework.
2024-01-10 17:16:33 -05:00
Bill Hollings
cb460524d7 Update dependency libraries to match Vulkan SDK 1.3.275.
- Hide static Vulkan API symbols by default
  (build setting MVK_HIDE_VULKAN_SYMBOLS=1 by default).
- Update documentation.
2024-01-09 08:17:16 -05:00
Bill Hollings
d9f75ed812 Update copyright notices to year 2024. 2024-01-04 14:51:53 -05:00
Bill Hollings
1ce40f63a4 Fixes from dev review feedback for adding VK_EXT_layer_settings extension.
- Document the name of the MoltenVK driver layer.
- Support future multiple string members in MVKConfiguration.
- Add static assert on number of string members in MVKConfigruation.
- Rename global mvkConfig() to getGlobalMVKConfig().
- Rename global mvkSetConfig() to mvkSetGlobalConfig().
- Remove unused mvkPrintSizeOf() macro. (unrelated).
- Trim trailing spaces from Markdown documents because
  it causes double-spaces in some Markdown readers (unrelated).
2023-12-19 11:17:39 -05:00
Bill Hollings
0fc9657bbd Update documentation for the VK_EXT_layer_settings extension.
- Add MoltenVK_Configuration_Parameters.md to
  document the MoltenVK configuration parameters.
- Deprecate vkSetMoltenVKConfigurationMVK().
- Deprecate mvk_config.h and move content to mvk_private_api.h and mvk_deprecated_api.h.
- Streamline lock on retrieval of MVKLayerManager singleton (unrelated).
2023-12-14 16:44:40 -05:00
Bill Hollings
90eb1af19f Add support for extension VK_EXT_headless_surface.
- Consolidate info about CAMetalLayer and headless in MVKSurface.
- MVKSwapchainImage remove getCAMetalDrawable()
  and focus on abstracting getMTLTexture().
- MVKPresentableSwapchainImage::getCAMetalDrawable() return nil if headless.
- Add MVKPresentableSwapchainImage::_mtlTextureHeadless to support
  a fixed MTLTexture that is not retrieved from a CAMetalDrawable.
- MVKPresentableSwapchainImage refactor signalling semaphores and fences.
- MVKPresentableSwapchainImage don't lock when signalling semaphores and fences.
- If no present occurs, actualPresentTime will be zero. Set it to current
  time, instead of to desiredPresentTime, since it's more accurate.
- Rework timestamps:
  - Remove _mvkTimestampBase so mvkGetTimestamp() is equal to
    mach_absolute_time(), which is used in presentation timing.
  - Add mvkGetRuntimeNanoseconds().
  - Rename mvkGetAbsoluteTime() to mvkGetContinuousNanoseconds().
  - Remove mvkGetTimestampPeriod() as unused.
- MVKSemaphoreMTLEvent::encodeDeferredSignal remove redundant nil test (unrelated).
- Fix swapchain and surface bugs when windowing system
  is accessed from off the main thread (unrelated).
- Log warning when deprecated functions vkCreateMacOSSurfaceMVK()
  or vkCreateIOSSurfaceMVK() are used (unrelated).
- Remove documentation for visionos, as support is not ready (unrelated).
2023-12-04 11:56:22 -05:00
Bill Hollings
e693a0a2be Reduce disk space consumed after running fetchDependencies.
- Add --keep-cache option to control whether or not to retain the
  External/build/Intermediates directory (default not retained).
- Export KEEP_CACHE & SKIP_PACKAGING to be available within scripts
  used by ExternalDependencies Xcode builds.
- Move BLD_SPECIFIED to build() instead of build_impl() to avoid
  updating it from background thread (which will fail).
- Update MoltenVK version to 1.2.7 (unrelated).
- Add CompilerMSL::Options::replace_recursive_inputs to pipeline cache (unrelated).
- Update GitHub CI to Xcode 15.0.
- Update Whats_new.md document.
2023-10-24 16:28:20 -04:00
Bill Hollings
6374d9d29b Fix visionOS build errors and warnings where possible.
- Remove visionOS from multi-platform builds because it
  requires Xcode 15+ and will abort a multi-platform build.
- Define TARGET_OS_XR for older SDK's.
- A number of SDK deprecation warnings remain when building for visionOS.
  These cannot be removed without significant refactoring.
- Build visionOS dependencies for Release build by default.
- Fix local variable initialization warning (unrelated).
2023-07-11 15:43:41 -04:00
Bill Hollings
ab5429b18c GitHub CI improvements.
- Build one universal build, instead of per-platform.
- Upload this single build artifact to GitHub.
- Upgrade to v3 of action dependencies to remove Node.js deprecation warnings.
- Avoid use of deprecated set-output GitHub action command.
- Use macOS 13 and Xcode 14.3.
- README.md document access to binary artifacts.
2023-05-09 00:12:16 -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
12592abbc9 Update copyright notices to year 2023. 2023-01-13 12:19:37 -05:00
Bill Hollings
4d003bf256 Document new linkage model used by Xcode 14 and later, and how to link
MoltenVK to an app or game using Xcode 13 or earlier.
2022-11-15 18:48:36 -05:00
Bill Hollings
608342b528 Update documentation for prefilling Metal command buffers options. 2022-10-18 12:41:13 -04:00
Bill Hollings
0cc6e1d3a4 Fix support for MVK_HIDE_VULKAN_SYMBOLS build setting.
- Remove separate extension entry points for 1.3 promoted
  vkCmdBeginRenderingKHR() and vkCmdEndRenderingKHR() functions,
  which caused build breaks when MVK_HIDE_VULKAN_SYMBOLS=1.
- For consistency, hide vkGetMoltenVKConfigurationMVK(),
  vkSetMoltenVKConfigurationMVK(), and vkGetVersionStringsMVK()
  when MVK_HIDE_VULKAN_SYMBOLS=1, which was an oversight in original
  implementation of hiding Vulkan functions.
- Update build `README.md` for generic command line build settings
  and MVK_HIDE_VULKAN_SYMBOLS in particular.
2022-10-09 16:32:26 -04:00
Bill Hollings
ac39eb24e1 Add support for Vulkan 1.2.
- Set MVK_VULKAN_API_VERSION from VK_API_VERSION_1_2.
- Update MoltenVK version to 1.2.0.
- Remove several previously overlooked extension suffixes
  in use of promoted Vulkan struct and enum values.
- Update documentation.
2022-09-26 11:25:49 -04:00
Bill Hollings
26d4a13e34 Support Xcode 14, macOS 13, and iOS/tvOS 16.
- Update minimum Xcode deployment targets to macOS 10.13, iOS 11, and tvOS 11,
  to avoid Xcode build warnings.
- Add support for MTLLanguageVersion3_0 enumeration.
- Build efficiencies:
  - Build scripts create_dylib.sh and gen_moltenvk_rev_hdr.sh
    only run if build dependencies require it.
  - Packaging and copy_to_staging.sh scripts are too complex to define dependencies,
    and are fast, so configured to run every time, to avoid build warning.
- Replace use of deprecated sprintf() with  snprintf().
- Replace use of deprecated kIOMasterPortDefault with  kIOMainPortDefault.
- Support old-style GPU debug capture only if building for earlier minimum
  deployment targets, to avoid deprecation warning.
- Update minimum Xcode deployment targets of Cube demo to macOS 10.14, iOS 12,
  and tvOS 12, to avoid Xcode build warning regarding MTLSharedEvent in .
- Update README.md document regarding minimum Xcode deployment targets.
2022-07-06 18:15:10 -04:00
Bill Hollings
9fa373ebbb MoltenVK_icd.json support VK_KHR_portability_enumeration extension.
Update README.md and MoltenVK_Runtime_UserGuide.md to document the impact
of the VK_KHR_portability_enumeration extension during runtime loading on macOS.
Update MoltenVK version to 1.1.10.
2022-04-15 13:57:10 -04:00
Nikita Fediuchin
4efb90b3c1 Update license year 2022-02-04 13:33:27 +02:00
Bill Hollings
5de7f5551c Support building MoltenVK with static Vulkan linkage symbols hidden.
Add build environment variable MVK_HIDE_VULKAN_SYMBOLS. to allow MoltenVK
to be built with static Vulkan API symbols hidden, to avoid library linking
conflicts when bound to a Vulkan Loader that also exports identical symbols.

The default value of MVK_HIDE_VULKAN_SYMBOLS is 0,
meaning Vulkan static symbols are exposed by default.

Add MVK_PUBLIC_VULKAN_SYMBOL directive to mark each Vulkan call symbols
for exporting or hiding.

Update the MoltenVK Xcode project to add the MVK_HIDE_VULKAN_SYMBOLS build
setting, and set the ENABLE_TESTABILITY build setting to NO, because it
conflicts with stripping symbols.

Update MoltenVK version to 1.1.7.
2021-11-17 18:22:33 -05:00
Bill Hollings
5648258da7 Remove LunarG/VulkanSamples as a dependency library.
LunarG is planning to retire the LunarG/VulkanSamples repository.
Remove dependency to it, and remove the affected Hologram and API-Samples demo apps.
Update documents, including directing developers to the
KhronosGroup/Vulkan-Samples repository for official demo apps.
2021-03-03 16:43:11 -05:00
Bill Hollings
bce76f1d29 GitHub repository enhancements.
Document availability of GitHub Discussions in `README.md`.
Expose .github/workflows/CI.yml in MoltenVKPackaging Xcode project.
2021-02-12 10:46:57 -05:00
Bill Hollings
ff8460ac0b Documentation updates.
Add link to Vulkan SDK Getting Started doc to README.md and
MoltenVK_Runtime_UserGuide.md documents.
Add Github CI badge to README.md, and remove Travis CI badge.
Make document notices of use of Markdown into comments
so they are invisible when using a Markdown reader.
2021-01-21 14:49:24 -05: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
Artyom Kohver
972f292cca
Update README.md 2021-01-09 00:13:44 +03:00
Artyom Kohver
3d46b93591
Hide note about a reader if you already use one. 2021-01-09 00:08:13 +03: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
Bill Hollings
1329f3adee Update build scripts to build for Mac Catalyst. 2020-11-30 18:52:34 -05:00
Bill Hollings
fe3c2e156b Update validation policy in README.md document to cover attrition of existing validation code. 2020-10-02 12:38:30 -04:00
Bill Hollings
78c58cc026 Add validation policy for MoltenVK development to README.md document.
Remove unnecessary image view format validation.
2020-10-02 12:22:32 -04:00
Bill Hollings
51777ca49c Merge branch 'master' of https://github.com/billhollings/MoltenVK into xcode12 2020-09-11 14:03:03 -04:00
Bill Hollings
e9c4b4813b Cleanup Vulkan 1.1 info.
Update remaining documents to reference Vulkan 1.1 instead of 1.0.
Per Vulkan 1.1 spec, remove now-obsolete MVKInstance code
that emits error if app requests higher Vulkan version.
Upgrade MoltenVK version to 1.1.0.
2020-09-11 11:16:34 -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
5e5d6439da Update documentation to cover tvOS, iOS Simulator, and tvOS Simulator. 2020-06-23 23:06:08 -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
d984d403bf Makefile supports building fat iOS and tvOS libraries from command line. 2020-06-22 15:56:22 -04:00
Bill Hollings
ac204382db Merge simulator support with tvOS support. 2020-06-19 15:05:43 -04:00
Bill Hollings
50828dde93 fetchDependencies supports iOS simulator fat external library builds.
fetchDependencies supports options for specifying which platform options to build for.
Fix SPIRV-Tools builds to avoid code stripping warnings.
2020-06-17 19:10:33 -04:00
Bill Hollings
23818e30ec Fixes for the make install build command.
Fix the make install build command to overwrite the existing framework
in the system framework library.
Update README.md to clarify the instructions for using make install.
2020-04-02 21:11:14 -04:00
Bill Hollings
c1f1dd09d5 Update documentation to clarify that MoltenVK is not a fully-compliant implementation of Vulkan. 2020-03-19 18:01:05 -04:00
Bill Hollings
8ec682938b Update copyright to 2020. 2020-01-07 16:47:29 -05:00
Bill Hollings
5c7904c3a7 Add request for feedback from people who reject MoltenVK to README.md document.
Update MoltenVK version to 1.0.38.
2019-09-25 15:41:40 -05:00
Bill Hollings
65eed2fe33 Reduce memory leaks when autorelease pools are not available.
Remove use of autorelease.
Rename getXXX() functions that returned autoreleased objects to newXXX() that don't.
Calling functions now responsible for releasing returned objects from these functions.
Move creation and tracking of texture->texture views for copying to MVKImage.
MVKCmdCopyImage retrieve texture view from MVKImage.
MVKMTLFunction responsible for releasing its MTLFunction.
Add dev notes to README.md.
2019-07-17 18:24:07 -04:00
Bill Hollings
ef8de08ff1 Skip SPIRV-Tools build in Travis.
Add fetchDependencies option to skip building SPIRV-Tools and use a template of pre-generated headers.
Modify .travis.yml to use this.
2019-06-16 12:00:22 -04:00