47 Commits

Author SHA1 Message Date
Bill Hollings
cfc2556c31 Fix use of VkFlags in MVKConfiguration enumerated values.
MVKConfigLogLevel, MVKConfigTraceVulkanCalls, and MVKConfigAutoGPUCaptureScope
do not need to be VkFlags, since they aren't bitwise flags.

MVK_SET_FROM_ENV_OR_BUILD_INT32 supports setting enumerated values.
2021-03-10 09:26:59 -05:00
Bill Hollings
8e610a43a8 Support configuring supported Vulkan API version.
Add MVKConfiguration::apiVersionToAdvertise and MVK_CONFIG_API_VERSION_TO_ADVERTISE
env var to configure MoltenVK to advertise a particular Vulkan version.

Advertise MVKConfiguration::apiVersionToAdvertise in:
  vkEnumerateInstanceVersion()
  vkGetPhysicalDeviceProperties()
  vkEnumerateInstanceLayerProperties()
  vkEnumerateDeviceLayerProperties()

Add MVKConfiguration::advertiseExtensions and MVK_CONFIG_ADVERTISE_EXTENSIONS
env var to configure MoltenVK to not advertise support for any Vulkan  extensions.
Refactor population of MVKConfiguration from environment variables to better
support validating and baking config values set by app.
Update MoltenVK version to 1.1.3.
Update VK_MVK_MOLTENVK_SPEC_VERSION to 31.
2021-02-24 16:32:14 -05:00
Bill Hollings
4675481a06 Redefine derivations of MVK_APPLE_SILICON, MVK_MACOS_APPLE_SILICON, and MVK_XCODE_12.
Derive MVK_APPLE_SILICON from target CPU.
Derive MVK_MACOS_APPLE_SILICON from target CPU and macOS platform.
Derive MVK_XCODE_12 from macOS and iOS SDK versions.
Test for simulator on non-Apple GPU using MVK_OS_SIMULATOR && !MVK_APPLE_SILICON.
2021-02-20 09:33:32 -05:00
Bill Hollings
e1b3585413 Add MVK_APPLE_SILICON macro definition.
Use MVK_APPLE_SILICON instead of
MVK_IOS_OR_TVOS || MVK_MACOS_APPLE_SILICON or
MVK_MACOS_APPLE_SILICON || MVK_IOS_OR_TVOS.
2021-01-21 16:53:17 -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
Bill Hollings
7f62362db3 Fixes from review for Mac Catalyst on macOS 11.0+.
MVKPixelFormats revert testing for stencil feedback and add Mac Catalyst test.
Revert mvkOSVersionIsAtLeast(mac, ios) to remove test for Mac Catalyst version.
MVKRenderPass revert testing for MTLStorageModeMemoryless for iOS.
2020-12-02 16:22:38 -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
d73017f4db MVKDevice: Set properties for Apple Silicon GPUs on macOS. 2020-10-28 19:35:24 -05:00
Chip Davis
2c40e39699 Fix aliases on ARM64.
The semicolon is the comment character in ARM64 assembly. Just put the
alias symbol definition on another line.
2020-09-10 20:21:02 -05:00
Chip Davis
78963db6cc Export core names of Vulkan 1.1 calls promoted from extensions.
The functions are now defined under their core names. To avoid code
bloat, I've defined the suffixed names as aliases of the core names.
Both symbols will be globally defined with the same value, and in the
dylib both will be exported.

Fix the default API version when none is given. Zero is the same as
`VK_API_VERSION_1_0`. Prior to this, we were overwriting it with zero if
no app info were given, or if it were zero in the app info. It wasn't
important before, but now that we gate API availability on maximum
Vulkan version, we need to make sure it's a valid version.
2020-09-08 13:22:17 -05:00
Bill Hollings
72c4ba1118 Remove unneeded MVK_IOS_SIMULATOR and MVK_TVOS_SIMULATOR macros. 2020-07-17 22:18:08 -04:00
Bill Hollings
40d3485cec Remove unneeded switch default for MTLLanguageVersion.
Minor doc fixes from PR review.
2020-06-24 17:04:30 -04:00
Bill Hollings
7910f43867 MVKPixelFormats reduce some MTLPixelFormat capabilities for simulators.
Add MVK_IOS_SIMULATOR and MVK_TVOS_SIMULATOR macros.
MVKPixelFormats add disableMTLPixelFormatCapabilities().
MVKPixelFormats add disableAllMTLPixelFormatCapabilities().
2020-06-22 23:52:51 -04:00
Bill Hollings
72517a2474 Cleanup tvOS build warnings.
Use platform macros to conditionally build outstanding tvOS code.
Log validation error message when tvOS code doesn't support expected functionality.
2020-06-22 21:55:51 -04:00
Bill Hollings
37e8e3182c Redefine MoltenVK platform macros in terms of newer Apple target conditionals. 2020-06-22 21:37:30 -04:00
Aman Gupta
b8fb92a9e3 oops forgot this return 2020-06-18 16:36:45 -07:00
Aman Gupta
bdff52283d remove !MVK_TVOS usage 2020-06-17 17:14:31 -07:00
Aman Gupta
e847fb38e9 fix some missing return warnings 2020-06-17 14:46:06 -07:00
Aman Gupta
7392e23db2 unncessary change in the diff 2020-06-17 10:30:41 -07:00
Aman Gupta
a0e357fab5 Merge remote-tracking branch 'upstream/master' into tvos 2020-06-17 10:05:40 -07:00
Aman Gupta
9694169da6 split out MVK_IOS_OR_TVOS 2020-06-15 16:36:05 -07:00
Aman Gupta
b250212c6f add MVK_TVOS and start conditionalizing build failures 2020-06-15 16:21:13 -07:00
Bill Hollings
dd98fbd26f Remove use of @available() directive as it can cause issues in some build environments.
Generally replace use of @available() with respondsToSelector:.
Add mvkMakeOSVersion() and mvkOSVersionIsAtLeast(macos,ios) to help testing OS versions.
Set maxDrawIndexedIndexValue to kMVKUndefinedLargeUInt32 instead of uint32_t max.
2020-06-11 12:43:38 -04:00
Chip Davis
9260f5bfd5 MVKDevice: Support capturing GPU traces to a file.
Use MVK_CONFIG_AUTO_GPU_CAPTURE_OUTPUT_FILE to set the destination file.
This is useful for capturing traces where the program in question cannot
be run under Xcode's control; the captured trace can then be inspected
later with Xcode.

This new feature requires Metal 3.0 (macOS 10.15, iOS 13).
2020-04-22 18:38:08 -05:00
Bill Hollings
eb99488f04 Reinstate VulkanSamples API-Samples demo apps.
MVKShaderConverterTool add support to output SPIR-V as header (.h) files.
Add MVKShaderConverterTool Xcode target.
Add MVKShaderConverterTool Package Xcode scheme.
fetchDependencies builds MVKShaderConverterTool and runs
it on shader files in VulkanSamples API-Samples directory.
2020-04-11 16:19:03 -04:00
Bill Hollings
98fadbf68b Fix memory estimates for iOS 13+.
Fix os_proc_available_memory() not being called.
2020-04-02 18:54:22 -04:00
Bill Hollings
5728f50f0f Add mvkOSVersionIsAtLeast() to simplify and standardizing testing OS version. 2020-03-28 20:11:21 -04:00
Bill Hollings
8ec682938b Update copyright to 2020. 2020-01-07 16:47:29 -05:00
Bill Hollings
9b13006018 Support linear filtering when using vkCmdBlitImage().
Fixes linear filtering when using vkCmdBlitImage(), useful for mipmap generation.
Move MVKCmdBlitImage sampler definition to shader as a constexpr sampler,
and ensure mip_filter and filter are set correctly.
Add MVKRPSKeyBlitImg::srcFilter.
Include MVKCommonEnvironment.h in MVKLogging.h.
Update MoltenVK version to 1.0.39.
2019-11-12 16:47:33 -05:00
Bill Hollings
c6ea99e4db Support Metal 3.0.
Merge Metal-3.0 branch into master branch.
Update What's New document with merged features.
2019-10-16 18:26:58 -04:00
Bill Hollings
5c87700732 Reduce memory usage by adjusting default memory allocs for many MVKVectorInline uses.
MVKRenderPass use emplace_back() instead of push_back()
when populating _subpasses  & _attachments vectors.
Add mvkLogSizeOf(T) development debugging function.
2019-10-10 16:46:17 -04: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
Chip Davis
92f0bec6e2 MVKDevice: Report a second heap for non-UMA devices.
This is the heap representing system memory. The memory type
corresponding to `MTLStorageModeShared` is reported as belonging to this
heap.

I've tried to correct the reported size of the heaps as well while I'm
at it. UMA GPUs and the system heap for NUMA GPUs use the system memory
size as the heap size, and the amount of available memory as the budget.
iOS 13 uses the new `os_proc_available_memory()` API for this purpose.
NUMA GPUs additionally use the memory used by the process as a crude
measure of system heap usage.
2019-08-09 11:53:39 -05:00
Bill Hollings
d1a6b5a40d Remove exposure to leakable instances of NSString, NSArray & NSDictionary.
Reduce creation of autoreleased instances of NSString, NSArray & NSDictionary.
Ensure remaining are covered by deliberate autorelease pools.
2019-07-15 18:59:52 -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
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
0984b11bc0 Set MSL version for shader compiling from Metal feature set.
Add MVKPhysicalDeviceMetalFeatures::mslVersionEnum and set from Metal feature sets.
Derive MVKPhysicalDeviceMetalFeatures:: mslVersion from mslVersionEnum.
MVKDevice::getMTLCompileOptions() sets MTLCompileOptions::languageVersion
from MVKPhysicalDeviceMetalFeatures::mslVersionEnum.
MVKAssert logs error even when assertions disabled.
Update VK_MVK_MOLTENVK_SPEC_VERSION to 18.
2019-02-25 18:11:47 -05: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
Bill Hollings
216e86de19 Allow logging level to be controlled via runtime environment variable. 2019-01-29 21:10:31 -05:00
Chip Davis
e59ffbb84b Log to stderr instead of stdout. 2019-01-28 13:29:41 -06:00
Bill Hollings
fe55930fd5 Update Brenwill copyright noticies to 2019. 2019-01-01 21:13:25 -05:00
Bill Hollings
86bb51554b Support IOSurface on iOS only if IPHONEOS_DEPLOYMENT_TARGET is at least iOS 11.0.
On iOS, only compile IOSurface support, and link IOSurface framework to
libMoltenVK.dylib, if IPHONEOS_DEPLOYMENT_TARGET is at least iOS 11.0.
Update to latest version of SPIRV-Cross.
Update MoltenVK version to 1.0.15.
2018-07-12 18:26:54 -04:00
Bill Hollings
20c98e5e46 Add support for caching converted MSL shader code offline from pipeline cache
via vkGetPipelineCacheData(), vkCreatePipelineCache() & vkMergePipelineCaches().

Add the cereal serialization framework as a dependency.
Update documentation. Update project settings to Xcode 9.3.
2018-03-30 12:13:50 -04:00
Bill Hollings
9e9aae4687 Remove executable permissions from non-executable files. 2018-03-12 16:59:34 -04:00
C.W. Betts
0c91b1e613 Add printf-like macros to MVKLogImpl and mvkNotifyErrorWithText.
This will make the compiler point out improper formatting of variadic functions.
2018-02-26 15:28:28 -07:00
Bill Hollings
98b050e6e2 Update copyright dates to 2018. 2018-01-31 16:57:59 -05:00
Bill Hollings
fd7b8234f9 Initial open-source commit. 2017-11-17 11:14:29 -05:00