139 Commits

Author SHA1 Message Date
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
51777ca49c Merge branch 'master' of https://github.com/billhollings/MoltenVK into xcode12 2020-09-11 14:03:03 -04:00
Bill Hollings
b7b1435d8b Support Xcode 11.7. 2020-09-11 11:35:44 -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
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
fe89118435 Support Xcode 12 settings. 2020-08-13 13:13:30 -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
927bfddbc7 VkPhysicalDeviceProperties::pipelineCacheUUID include MoltenVK Git revision hash. 2020-07-20 17:53:11 -04:00
Bill Hollings
7aca997250 Support Xcode 11.6. 2020-07-18 00:11:56 -04:00
Bill Hollings
039cb199bb Remove use of TARGETED_DEVICE_FAMILY Xcode build setting. 2020-06-19 15:55:22 -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
Aman Gupta
766bed17e6 xcode updates 2020-06-17 10:15:34 -07:00
Aman Gupta
a0e357fab5 Merge remote-tracking branch 'upstream/master' into tvos 2020-06-17 10:05:40 -07:00
Aman Gupta
7d1b1e7e8e fix build 2020-06-15 16:49:51 -07:00
Aman Gupta
8c7b6771bc oops 2020-06-15 16:47:53 -07:00
Aman Gupta
b13dd86350 forgot an ios reference 2020-06-15 16:45:27 -07:00
Aman Gupta
4ab6b3d4fe fix more xcode deps for tvos 2020-06-15 16:11:14 -07:00
Aman Gupta
118ef06371 add tvos targets to the xcode projects 2020-06-09 15:16:14 -07:00
Bill Hollings
752c1a908d Refactor Xcode build architectures
Set ARCHS build setting to $(ARCHS_STANDARD_64_BIT) in Xcode projects.
Remove ARCHS and VALID_ARCHS build settings in Xcode targets.
2020-06-09 16:39:23 -04:00
Bill Hollings
9685f5d00a Support Xcode 11.5. 2020-05-22 18:48:29 -04:00
Bill Hollings
94e392cb37 Add MVKSmallVector as a more memory efficient substitute of MVKVector.
Replicate MVKVector.h and MVKVectorAllocator.h into MVKSmallVector.h and
MVKSmallVectorAllocator.h, and collapse class hierarchies.
Add MVKArrayRef struct to allow the contents of MVKSmallVector and MVKVector
to be passed between functions consistently.
Add contents() function to MVKVector to return MVKArrayRef.
2020-05-19 17:24:01 -04:00
Bill Hollings
6ce5b00a1e MVKCommandPool uses def file to define and manage command type pool member variables. 2020-04-24 12:20:53 -04:00
Bill Hollings
e4be6b836c Simplify MVKCommand and MVKCommandTypePool instantiation.
MVKCommand constructor not longer take MVKCommandTypePool.
Remove MVKCommand::returnToPool().
MVKCommandTypePool no longer track MVKCommandPool.
Remove MVKCommand.mm.
2020-04-18 22:52:40 -04:00
Bill Hollings
0904c49014 Alphabetize file sorting in Xcode Project Navigator. 2020-04-09 14:19:46 -04:00
Bill Hollings
d46b2f3036 Disable use of MTLHeap by default.
Add MVK_CONFIG_USE_MTLHEAP environment variable to enable use of MTLHeap if needed.
Minor fixes to consistent use of MVK_SET_FROM_ENV_OR_BUILD_BOOL().
2020-04-03 16:55:10 -04:00
Bill Hollings
50eba6fee1 Support Xcode 11.4. 2020-03-25 20:24:07 -04:00
Bill Hollings
e9bbea96d1 Rename MVKFormats to MVKPixelFormats. 2020-03-10 08:38:43 -04:00
Bill Hollings
a9e5cb2914 Add initial MVKFormats class to manage Vulkan and Metal formats. 2020-03-08 14:50:37 -04:00
Bill Hollings
3a1b19be51 Rename MVKDescriptorBinding to MVKDescriptor, including subclasses. 2020-01-15 11:48:27 -05:00
Bill Hollings
8bca6709a1 Refactor descriptor binding files.
Move MVKDescriptorBinding & MVKDescriptorSetLayoutBinding
to new MVKDescriptorBinding.h/mm files.
2020-01-07 22:25:49 -05:00
Bill Hollings
b213996c5e Support Xcode 11.3.
Update What's New document.
2019-12-12 12:38:17 -05:00
Bill Hollings
025abe501a Support Xcode 11.2. 2019-11-04 20:39:41 -05:00
Bill Hollings
c6e9d6b189 Support Xcode 11.1. 2019-10-11 15:16:13 -04:00
Bill Hollings
a2951a19e6 Support Xcode 11.
Declare _formatDescriptions[] in mvk_datatypes.mm as officially writable
because Clang now locates static const in non-writable memory.
Update build settings to Xcode 11.
Update MoltenVK_Runtime_UserGuide.md about embedding `libMoltenVK.dylib` in an application.
2019-10-01 00:25:09 -04:00
Bill Hollings
095dd3339b Update to latest version of SPIRV-Cross.
Update demos to latest dependency library versions.
Update to Xcode 10.3.
Update What's New document.
2019-07-24 14:39:38 -04:00
Bill Hollings
8d9fa6bbd5 Add support for VK_EXT_debug_marker extension.
Move MVKVulkanAPIObject to its own .h/mm files.
Add MVKCmdDebug.h/mm files.
Change extension on MVKExtensions.cpp and MVKBaseObject.cpp to .mm.
Remove unused command use in MVKQueue submit() and waitIdle() functions.
MVKCommandPool constructor use default isPooling value in MVKCommandTypePool constructors.
MVKSwapchainImage pass image index in constructor.
2019-05-25 16:23:05 -04:00
Bill Hollings
c3aaf976ae Add support for the VK_NV_glsl_shader extension.
Support runtime shader compilation from GLSL.
Return VK_ERROR_INVALID_SHADER_NV on shader and pipeline compilation errors.
Add MVKShaderCompilationPerformance::glslToSPRIV to track GLSL conversion performance.
Rename MoltenVKGLSLToSPIRVConverter MVKShaderStage enum to MVKGLSLConversionShaderStage
to avoid naming conflicts with MoltenVK MVKShaderStage enum.
Hologram demo load SPIR-V directly instead of using GLSL through either
MoltenVKGLSLToSPIRVConverter or VK_NV_glsl_shader extension.
Update to latest version of VulkanSamples that supports MVKGLSLConversionShaderStage.
2019-05-10 12:21:03 -04:00
Bill Hollings
acd8a6cb4d Resolve and merge conflicts. 2019-05-01 23:29:11 -04:00
Bill Hollings
173d8cc5f3 Add support for the VK_EXT_debug_report extension.
Add MVKDebugReportCallback class.
Add MVKVulkanAPIObject class as base class of classes exposed in Vulkan API.
Remove MVKRefCountedDeviceObject class and move ref-counting to MVKVulkanAPIObject.
Rename MVKDispatchableObject class to MVKDispatchableVulkanAPIObject.
Introduce multiple inheritance mixin classes into class hierarchy.
Add MVKBaseObject::getVulkanAPIObject() function to find Vulkan API object
controlling any subobject that needs to report something.
MVKCommandResourceFactory functions pass in calling object for reporting.
Add MVKBaseObject::reportMessage() & reportError() functions.
Replace mvkNotifyErrorWithText() static function with reportError()
instance function to allow access to debug reporting.
Redefine MVKLog*() functions to call reportError() instance method.
Delete MVKLogging.cpp.
Remove MVKLogging.h from MoltenVKShaderConverter project.
Add mvk_datatypes.hpp to redirect errors in mvk_datatypes.h functions to debug
reporting. Use mvk_datatypes.hpp internally for all references to these functions.
Convert several static methods to instance methods.
Refactor platform defines in MVKSurface.h.
Explicitly count MVKExtensionList extension count to avoid relying on struct size.
Remove MVKCommandBuffer::recordResult() and use setConfigurationResult().
Change log indication of error in logs from [***MoltenVK ERROR***] to [mvk-error],
for consistency with other log level indications.
Update MoltenVK version to 1.0.35.
2019-05-01 22:27:03 -04:00
Chip Davis
48d319432a MVKCountingEvent -> MVKSemaphoreImpl.
Remove the redundant class I added. Simplify a bit.
2019-04-17 10:42:25 -05:00
Chip Davis
9a0c4f6cef Fix a race condition between sync objects and queries.
In the past, MoltenVK signaled fences and semaphores immediately when
Metal reported that the batch was finished executing. But, some commands
do work in completion handlers that run concurrently with this. In
particular, in #278 I shunted copying query pool results onto a
different dispatch queue. This caused a race between this block and the
block which signals fences and semaphores.

Since some commands do work in completion handlers, the handler which
signals semaphores and fences must wait until these handlers finish
running. Also because of this, it is not adequate to submit a fence-only
request to implement `vkQueueWaitIdle()`. So, that function must now
wait for all submissions to complete. To preserve the invariant that
fence-only submissions are equivalent to `vkQueueWaitIdle()`, this
change also makes fence signaling wait for all submissions.

If the queue is continually supplied with new work, this implementation
may delay signaling fences indefinitely. Ideally, fences would only wait
for all work up to that point to complete before signaling. But I'm not
sure how to accomplish that yet.

Fixes #454.
2019-04-12 00:17:46 -05:00
Bill Hollings
ebce19b0b7 Add MoltenVKShaderConverter tool option to log shader conversion performance.
Move MVKOSExtension.h/mm to from MoltenVK to Common
and move MTLDevice functions to MVKDevice.
2019-04-11 14:26:35 -04:00
Bill Hollings
dfd5638a0f Clean up use of SPIRV_CROSS_NAMESPACE_OVERRIDE in Xcode projects.
Setting of SPIRV_CROSS_NAMESPACE_OVERRIDE in Xcode projects was stomping on DEBUG setting.
Update What's New document.
2019-04-01 22:41:20 -04:00
Chip Davis
b8f22700d5 Handle surface loss.
Sometimes, the `CAMetalLayer` backing a view can be replaced--for
example, when the window is moved to another screen, or the style bits
on the window are changed. In that case, we must allow the client the
opportunity to recreate the surface and swapchain.

Layer-backed views always set themselves as the layer's delegate; we use
this fact to Key-Value Observe the view's `layer` property.

Other alternatives considered:

* Registering for `NSViewGlobalFrameDidChange` notifications. Aside from
  only working on macOS, this doesn't actually catch every case where we
  want to report a lost surface. I'm not even sure it works at all for
  Metal.
* Holding a reference to the view, and checking when its layer property
  has changed.
* Holding a weak reference to the layer; that way, the reference will
  become `nil` when the layer is replaced. But this requires ARC.
2019-04-01 13:11:01 -05:00
Hans-Kristian Arntzen
38edfdb3de Override namespace for SPIRV-Cross.
Some projects also link against SPIRV-Cross statically, and in order to
avoid ABI conflicts, we should use a private namespace for the
SPIRV-Cross dependency to avoid bugs. See SPIRV-Cross issue #902 for
more information. The new namespace is MVK_spirv_cross, and the code
now makes use of the SPIRV_CROSS_NAMESPACE macro rather than spirv_cross.
2019-03-29 11:34:55 +01:00
Bill Hollings
e4d96f6fa2 Support Xcode 10.2. 2019-03-26 11:50:39 -04:00
Bill Hollings
6f2dc4bdcb Add static and dynamic libraries to MoltenVKShaderConverter project.
Refactor build scripts.
Update paths to MoltenVKGLSLToSPIRVConverter framework in demos.
Fix rare build race condition on MoltenVKShaderConverter link to MoltenVK.
2019-02-18 22:19:37 +00:00
Bill Hollings
e0b75dbc2c Fix crash from use of MTLDevice registryID on early OS versions.
Add mvkGetRegistryID() function to check OS support for registry ID.
Rename build setting MVK_FORCE_LOW_POWER_GPU to MVK_CONFIG_FORCE_LOW_POWER_GPU
and make it an env var / build setting combo.
Rename env var MVK_LOG_LEVEL to MVK_CONFIG_LOG_LEVEL.
Rename MVKLogging.mm to MVKLogging.cpp.
2019-02-11 10:49:58 -05:00