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.
This commit is contained in:
parent
1329f3adee
commit
1ec58c9a92
@ -44,12 +44,17 @@ extern "C" {
|
||||
|
||||
/** Building for macOS. */
|
||||
#ifndef MVK_MACOS
|
||||
# define MVK_MACOS TARGET_OS_OSX
|
||||
# define MVK_MACOS (TARGET_OS_OSX || TARGET_OS_MACCATALYST)
|
||||
#endif
|
||||
|
||||
/** Building for iOS. */
|
||||
#ifndef MVK_IOS
|
||||
# define MVK_IOS TARGET_OS_IOS
|
||||
# define MVK_IOS (TARGET_OS_IOS && !TARGET_OS_MACCATALYST)
|
||||
#endif
|
||||
|
||||
/** Building for iOS on Mac Catalyst. */
|
||||
#ifndef MVK_MACCAT
|
||||
# define MVK_MACCAT TARGET_OS_MACCATALYST
|
||||
#endif
|
||||
|
||||
/** Building for tvOS. */
|
||||
|
@ -48,16 +48,19 @@ inline bool mvkOSVersionIsAtLeast(MVKOSVersion minVer) { return mvkOSVersion() >
|
||||
|
||||
/**
|
||||
* Returns whether the operating system version is at least the appropriate min version.
|
||||
* The constant kMVKOSVersionUnsupported can be used for either value to cause the test
|
||||
* The constant kMVKOSVersionUnsupported can be used for any value to cause the test
|
||||
* to always fail on that OS, which is useful for indidicating functionalty guarded by
|
||||
* this test is not supported on that OS.
|
||||
*/
|
||||
inline bool mvkOSVersionIsAtLeast(MVKOSVersion macOSMinVer, MVKOSVersion iOSMinVer) {
|
||||
inline bool mvkOSVersionIsAtLeast(MVKOSVersion iOSMinVer, MVKOSVersion macOSMinVer, MVKOSVersion macCatMinVer) {
|
||||
#if MVK_IOS_OR_TVOS
|
||||
return mvkOSVersionIsAtLeast(iOSMinVer);
|
||||
#endif
|
||||
#if MVK_MACOS
|
||||
return mvkOSVersionIsAtLeast(macOSMinVer);
|
||||
#endif
|
||||
#if MVK_IOS_OR_TVOS
|
||||
return mvkOSVersionIsAtLeast(iOSMinVer);
|
||||
#if MVK_MACCAT
|
||||
return mvkOSVersionIsAtLeast(macCatMinVer);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
@ -110,6 +110,7 @@
|
||||
A9B67B881C3AAEA200373FFD /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
|
||||
A9B67B8A1C3AAEA200373FFD /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
|
||||
A9B67B8B1C3AAEA200373FFD /* macOS.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = macOS.xcassets; sourceTree = "<group>"; };
|
||||
A9B735072576E0D900455E2A /* API-Samples.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "API-Samples.entitlements"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -144,6 +145,7 @@
|
||||
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9B735072576E0D900455E2A /* API-Samples.entitlements */,
|
||||
A92F37071C7E1B2B008F8BC9 /* Samples.h */,
|
||||
A99B2F0D24436190001117F7 /* generateSPIRVShaders */,
|
||||
A95C03971C98FBED00CC653D /* API-Samples */,
|
||||
@ -630,6 +632,7 @@
|
||||
1D6058940D05DD3E006BFB54 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = "API-Samples.entitlements";
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
@ -642,17 +645,20 @@
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
|
||||
MARKETING_VERSION = 1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.moltenvk.API-Samples";
|
||||
PRODUCT_NAME = "API-Samples";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1D6058950D05DD3E006BFB54 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = "API-Samples.entitlements";
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
@ -661,11 +667,13 @@
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
|
||||
MARKETING_VERSION = 1;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.moltenvk.API-Samples";
|
||||
PRODUCT_NAME = "API-Samples";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
10
Demos/LunarG-VulkanSamples/Cube/Cube.entitlements
Normal file
10
Demos/LunarG-VulkanSamples/Cube/Cube.entitlements
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
@ -61,6 +61,7 @@
|
||||
A9B67B881C3AAEA200373FFD /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
|
||||
A9B67B8A1C3AAEA200373FFD /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
|
||||
A9B67B8B1C3AAEA200373FFD /* macOS.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = macOS.xcassets; sourceTree = "<group>"; };
|
||||
A9B734FE2576E04000455E2A /* Cube.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Cube.entitlements; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -104,6 +105,7 @@
|
||||
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9B734FE2576E04000455E2A /* Cube.entitlements */,
|
||||
A904B52C1C9A08C80008C013 /* cube */,
|
||||
A9B67B6A1C3AAE9800373FFD /* iOS */,
|
||||
A9B67B811C3AAEA200373FFD /* macOS */,
|
||||
@ -411,6 +413,7 @@
|
||||
A9B53B411C3AC15200ABC6F6 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = Cube.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
@ -421,16 +424,19 @@
|
||||
);
|
||||
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
|
||||
MARKETING_VERSION = 1;
|
||||
PRODUCT_NAME = Cube;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A9B53B421C3AC15200ABC6F6 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = Cube.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
@ -441,10 +447,12 @@
|
||||
);
|
||||
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
|
||||
MARKETING_VERSION = 1;
|
||||
PRODUCT_NAME = Cube;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -56,8 +56,9 @@ In addition to devices, this demo will also run on the `iOS Simulator` or `tvOS
|
||||
The *macOS* version of this demo includes a sizable window, and represents an example of how to detect,
|
||||
within your *Vulkan* code, when a window has been resized, and to modify the *Vulkan* swapchain accordingly.
|
||||
|
||||
The `Cube` demo is a simple example of installing **MoltenVK** as an `XCFramework`
|
||||
that is statically linked to the application.
|
||||
The `Cube` demo is a simple example of installing **MoltenVK** as an `XCFramework` that is
|
||||
statically linked to the application. It supports all platforms, including _Mac Catalyst_, _iOS
|
||||
Simulator_ and _tvOS Simulator_, and all architectures including _Apple Silicon_.
|
||||
|
||||
|
||||
<a name="lunarg-vulkan-samples-hologram"></a>
|
||||
@ -121,7 +122,8 @@ To see descriptions and screenshots of each of the demos, open
|
||||
[this summary document](LunarG-VulkanSamples/VulkanSamples/samples_index.html#AdditionalVulkan).
|
||||
|
||||
The `API-Samples` demo is a simple example of installing **MoltenVK** as an `XCFramework` that
|
||||
is statically linked to the application.
|
||||
is statically linked to the application. It supports all platforms, including _Mac Catalyst_, _iOS
|
||||
Simulator_ and _tvOS Simulator_, and all architectures including _Apple Silicon_.
|
||||
|
||||
|
||||
|
||||
|
@ -58,7 +58,8 @@ About **MoltenVK**
|
||||
graphics and compute functionality, that is built on Apple's [*Metal*](https://developer.apple.com/metal)
|
||||
graphics and compute framework on *macOS*, *iOS*, and *tvOS*. **MoltenVK** allows you to use *Vulkan*
|
||||
graphics and compute functionality to develop modern, cross-platform, high-performance graphical games
|
||||
and applications, and to run them across many platforms, including *macOS*, *iOS*, and *tvOS*.
|
||||
and applications, and to run them across many platforms, including *macOS*, *iOS*, *tvOS*, *Simulators*,
|
||||
and *Mac Catalyst* on *macOS 11.0+*.
|
||||
|
||||
*Metal* uses a different shading language, the *Metal Shading Language (MSL)*, than
|
||||
*Vulkan*, which uses *SPIR-V*. **MoltenVK** automatically converts your *SPIR-V* shaders
|
||||
@ -84,7 +85,7 @@ as a universal `XCFramework` or as a *dynamic library* (`.dylib`). Distributing
|
||||
a dynamic library via the *iOS App Store* or *tvOS App Store* can require specialized bundling.
|
||||
If you are unsure about which linking and deployment option you need, or on *iOS* or *tvOS*,
|
||||
unless you have specific needs for dynamic libraries, follow the steps for linking **MoltenVK**
|
||||
as an `XCFramework`, as it is the simpler option.
|
||||
as an `XCFramework`, as it is the simpler option, and encompasses the largest set of supported platforms.
|
||||
|
||||
The demo apps, found in the `Demos.xcworkspace`, located in the `Demos` folder, demonstrate both
|
||||
of the installation techniques discussed above:
|
||||
|
@ -16,7 +16,7 @@ For best results, use a Markdown reader.*
|
||||
MoltenVK 1.1.1
|
||||
--------------
|
||||
|
||||
Released TBD
|
||||
Released 2010/12/07
|
||||
|
||||
- Add support for extensions:
|
||||
- `VK_KHR_timeline_semaphore`
|
||||
@ -26,6 +26,7 @@ Released TBD
|
||||
- `VK_EXT_texture_compression_astc_hdr`
|
||||
- `VK_AMD_shader_image_load_store` (macOS)
|
||||
- `VK_IMG_format_pvrtc` (macOS)
|
||||
- Support the *Mac Catalyst* platform for *iOS* apps on *macOS 11.0+*, under both `x86_64` and `arm64` architectures.
|
||||
- Use `VK_KHR_image_format_list` to disable `MTLTextureUsagePixelFormatView`
|
||||
if only swizzles or `sRGB` conversion will be used for image views, improving
|
||||
performance on *iOS* by allowing Metal to use lossless texture compression.
|
||||
|
@ -107,7 +107,9 @@ void MVKCmdPipelineBarrier<N>::encode(MVKCommandEncoder* cmdEncoder) {
|
||||
beforeStages: dstStages];
|
||||
}
|
||||
} else {
|
||||
#if !MVK_MACCAT
|
||||
if (coversTextures()) { [cmdEncoder->_mtlRenderEncoder textureBarrier]; }
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -909,3 +909,13 @@ protected:
|
||||
|
||||
/** Returns the registry ID of the specified device, or zero if the device does not have a registry ID. */
|
||||
uint64_t mvkGetRegistryID(id<MTLDevice> mtlDevice);
|
||||
|
||||
/** Redefinitions because Mac Catalyst doesn't support feature sets. */
|
||||
#if MVK_MACCAT
|
||||
#define MTLFeatureSet_macOS_GPUFamily1_v1 MTLGPUFamilyMacCatalyst1
|
||||
#define MTLFeatureSet_macOS_GPUFamily1_v2 MTLGPUFamilyMacCatalyst1
|
||||
#define MTLFeatureSet_macOS_GPUFamily1_v3 MTLGPUFamilyMacCatalyst1
|
||||
#define MTLFeatureSet_macOS_GPUFamily1_v4 MTLGPUFamilyMacCatalyst1
|
||||
|
||||
#define MTLFeatureSet_macOS_GPUFamily2_v1 MTLGPUFamilyMacCatalyst2
|
||||
#endif
|
||||
|
@ -50,7 +50,13 @@ using namespace std;
|
||||
# define MVKViewClass NSView
|
||||
#endif
|
||||
|
||||
// Mac Catalyst does not support feature sets, so we redefine them to GPU families in MVKDevice.h.
|
||||
#if MVK_MACCAT
|
||||
#define supportsMTLFeatureSet(MFS) [_mtlDevice supportsFamily: MTLFeatureSet_ ##MFS]
|
||||
#else
|
||||
#define supportsMTLFeatureSet(MFS) [_mtlDevice supportsFeatureSet: MTLFeatureSet_ ##MFS]
|
||||
#endif
|
||||
|
||||
#define supportsMTLGPUFamily(GPUF) ([_mtlDevice respondsToSelector: @selector(supportsFamily:)] && [_mtlDevice supportsFamily: MTLGPUFamily ##GPUF])
|
||||
|
||||
|
||||
@ -324,7 +330,7 @@ void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2* properties) {
|
||||
if (_features.tessellationShader) {
|
||||
subgroupProps->supportedStages |= VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
|
||||
}
|
||||
if (mvkOSVersionIsAtLeast(10.15, 13.0)) {
|
||||
if (mvkOSVersionIsAtLeast(13.0, 10.15, 14.0)) {
|
||||
subgroupProps->supportedStages |= VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
}
|
||||
subgroupProps->supportedOperations = VK_SUBGROUP_FEATURE_BASIC_BIT;
|
||||
@ -2684,8 +2690,16 @@ void MVKPhysicalDevice::logGPUInfo() {
|
||||
if (supportsMTLFeatureSet(macOS_GPUFamily1_v2)) { logMsg += "\n\t\tmacOS GPU Family 1 v2"; }
|
||||
if (supportsMTLFeatureSet(macOS_GPUFamily1_v1)) { logMsg += "\n\t\tmacOS GPU Family 1 v1"; }
|
||||
|
||||
#if !MVK_MACCAT
|
||||
if (supportsMTLFeatureSet(macOS_ReadWriteTextureTier2)) { logMsg += "\n\t\tmacOS Read-Write Texture Tier 2"; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MVK_MACCAT
|
||||
if ([_mtlDevice respondsToSelector: @selector(readWriteTextureSupport)] &&
|
||||
_mtlDevice.readWriteTextureSupport == MTLReadWriteTextureTier2) {
|
||||
logMsg += "\n\t\tmacOS Read-Write Texture Tier 2";
|
||||
}
|
||||
#endif
|
||||
|
||||
NSUUID* nsUUID = [[NSUUID alloc] initWithUUIDBytes: _properties.pipelineCacheUUID]; // temp retain
|
||||
|
@ -114,7 +114,8 @@ MTLTextureDescriptor* MVKImagePlane::newMTLTextureDescriptor() {
|
||||
|
||||
// Metal before 3.0 doesn't support 3D compressed textures, so we'll decompress
|
||||
// the texture ourselves. This, then, is the *uncompressed* format.
|
||||
MTLPixelFormat mtlPixFmt = (MVK_MACOS && _image->_is3DCompressed) ? MTLPixelFormatBGRA8Unorm : _mtlPixFmt;
|
||||
bool shouldSubFmt = MVK_MACOS && _image->_is3DCompressed;
|
||||
MTLPixelFormat mtlPixFmt = shouldSubFmt ? MTLPixelFormatBGRA8Unorm : _mtlPixFmt;
|
||||
|
||||
VkExtent3D extent = _image->getExtent3D(_planeIndex, 0);
|
||||
MTLTextureDescriptor* mtlTexDesc = [MTLTextureDescriptor new]; // retained
|
||||
@ -847,7 +848,8 @@ MTLTextureUsage MVKImage::getMTLTextureUsage(MTLPixelFormat mtlPixFmt) {
|
||||
|
||||
// Metal before 3.0 doesn't support 3D compressed textures, so we'll
|
||||
// decompress the texture ourselves, and we need to be able to write to it.
|
||||
if (MVK_MACOS && _is3DCompressed) {
|
||||
bool makeWritable = MVK_MACOS && _is3DCompressed;
|
||||
if (makeWritable) {
|
||||
mvkEnableFlags(mtlUsage, MTLTextureUsageShaderWrite);
|
||||
}
|
||||
|
||||
@ -1014,7 +1016,6 @@ void MVKImage::validateConfig(const VkImageCreateInfo* pCreateInfo, bool isAttac
|
||||
MVKPixelFormats* pixFmts = getPixelFormats();
|
||||
|
||||
bool is2D = (getImageType() == VK_IMAGE_TYPE_2D);
|
||||
bool isCompressed = pixFmts->getFormatType(pCreateInfo->format) == kMVKFormatCompressed;
|
||||
bool isChromaSubsampled = pixFmts->getChromaSubsamplingPlaneCount(pCreateInfo->format) > 0;
|
||||
|
||||
if (isChromaSubsampled && !is2D) {
|
||||
|
@ -364,6 +364,12 @@ MVKInstance::MVKInstance(const VkInstanceCreateInfo* pCreateInfo) : _enabledExte
|
||||
setConfigurationResult(reportError(VK_ERROR_INCOMPATIBLE_DRIVER, "Vulkan is not supported on this device. MoltenVK requires Metal, which is not available on this device."));
|
||||
}
|
||||
|
||||
if (MVK_MACCAT && !mvkOSVersionIsAtLeast(11.0)) {
|
||||
setConfigurationResult(reportError(VK_ERROR_INCOMPATIBLE_DRIVER, "To support Mac Catalyst, MoltenVK requires macOS 11.0 or above."));
|
||||
}
|
||||
MVKLogInfo("Running Mac Catalyst %.4f.", mvkOSVersion());
|
||||
|
||||
|
||||
MVKLogInfo("Created VkInstance with the following %d Vulkan extensions enabled:%s",
|
||||
_enabledExtensions.getEnabledCount(),
|
||||
_enabledExtensions.enabledNamesString("\n\t\t", true).c_str());
|
||||
|
@ -1434,9 +1434,23 @@ void MVKPixelFormats::modifyMTLFormatCapabilities() {
|
||||
}
|
||||
|
||||
|
||||
// Mac Catalyst does not support feature sets, so we redefine them to GPU families in MVKDevice.h.
|
||||
#if MVK_MACCAT
|
||||
#define addFeatSetMTLPixFmtCaps(FEAT_SET, MTL_FMT, CAPS) \
|
||||
addMTLPixelFormatCapabilities(mtlDevice, MTLFeatureSet_ ##FEAT_SET, 10.16, MTLPixelFormat ##MTL_FMT, kMVKMTLFmtCaps ##CAPS)
|
||||
|
||||
#define addFeatSetMTLVtxFmtCaps(FEAT_SET, MTL_FMT, CAPS) \
|
||||
addMTLVertexFormatCapabilities(mtlDevice, MTLFeatureSet_ ##FEAT_SET, 10.16, MTLVertexFormat ##MTL_FMT, kMVKMTLFmtCaps ##CAPS)
|
||||
|
||||
#else
|
||||
#define addFeatSetMTLPixFmtCaps(FEAT_SET, MTL_FMT, CAPS) \
|
||||
addMTLPixelFormatCapabilities(mtlDevice, MTLFeatureSet_ ##FEAT_SET, MTLPixelFormat ##MTL_FMT, kMVKMTLFmtCaps ##CAPS)
|
||||
|
||||
#define addFeatSetMTLVtxFmtCaps(FEAT_SET, MTL_FMT, CAPS) \
|
||||
addMTLVertexFormatCapabilities(mtlDevice, MTLFeatureSet_ ##FEAT_SET, MTLVertexFormat ##MTL_FMT, kMVKMTLFmtCaps ##CAPS)
|
||||
|
||||
#endif
|
||||
|
||||
#define addGPUOSMTLPixFmtCaps(GPU_FAM, OS_VER, MTL_FMT, CAPS) \
|
||||
addMTLPixelFormatCapabilities(mtlDevice, MTLGPUFamily ##GPU_FAM, OS_VER, MTLPixelFormat ##MTL_FMT, kMVKMTLFmtCaps ##CAPS)
|
||||
|
||||
@ -1446,9 +1460,6 @@ void MVKPixelFormats::modifyMTLFormatCapabilities() {
|
||||
#define disableMTLPixFmtCaps(MTL_FMT, CAPS) \
|
||||
disableMTLPixelFormatCapabilities(MTLPixelFormat ##MTL_FMT, kMVKMTLFmtCaps ##CAPS)
|
||||
|
||||
#define addFeatSetMTLVtxFmtCaps(FEAT_SET, MTL_FMT, CAPS) \
|
||||
addMTLVertexFormatCapabilities(mtlDevice, MTLFeatureSet_ ##FEAT_SET, MTLVertexFormat ##MTL_FMT, kMVKMTLFmtCaps ##CAPS)
|
||||
|
||||
#define addGPUOSMTLVtxFmtCaps(GPU_FAM, OS_VER, MTL_FMT, CAPS) \
|
||||
addMTLVertexFormatCapabilities(mtlDevice, MTLGPUFamily ##GPU_FAM, OS_VER, MTLVertexFormat ##MTL_FMT, kMVKMTLFmtCaps ##CAPS)
|
||||
|
||||
@ -2039,7 +2050,8 @@ void MVKPixelFormats::setFormatProperties(MVKVkFormatDesc& vkDesc) {
|
||||
// XXX We really want to use the device's Metal features instead of duplicating the
|
||||
// logic from MVKPhysicalDevice, but those may not have been initialized yet.
|
||||
#if MVK_MACOS
|
||||
(isStencilFormat(vkDesc.mtlPixelFormat) && (!_physicalDevice || ![mtlDev supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily2_v1]))
|
||||
(isStencilFormat(vkDesc.mtlPixelFormat) && (!_physicalDevice || !([mtlDev supportsFamily: MTLGPUFamilyMac2] ||
|
||||
[mtlDev supportsFamily: MTLGPUFamilyMacCatalyst2])))
|
||||
#endif
|
||||
#if MVK_IOS
|
||||
(isStencilFormat(vkDesc.mtlPixelFormat) && (!_physicalDevice || ![mtlDev supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily5_v1]))
|
||||
|
@ -327,15 +327,11 @@ void MVKRenderSubpass::populateMTLRenderPassDescriptor(MTLRenderPassDescriptor*
|
||||
mtlTexDesc.textureType = MTLTextureType2DMultisample;
|
||||
mtlTexDesc.sampleCount = sampleCount;
|
||||
}
|
||||
#if MVK_IOS
|
||||
if ([_renderPass->getMTLDevice() supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v3]) {
|
||||
if (mvkOSVersionIsAtLeast(10.0, 11.0, 14.0)) {
|
||||
mtlTexDesc.storageMode = MTLStorageModeMemoryless;
|
||||
} else {
|
||||
mtlTexDesc.storageMode = MTLStorageModePrivate;
|
||||
}
|
||||
#else
|
||||
mtlTexDesc.storageMode = MTLStorageModePrivate;
|
||||
#endif
|
||||
mtlTexDesc.usage = MTLTextureUsageRenderTarget;
|
||||
_mtlDummyTex = [_renderPass->getMTLDevice() newTextureWithDescriptor: mtlTexDesc]; // not retained
|
||||
[_mtlDummyTex setPurgeableState: MTLPurgeableStateVolatile];
|
||||
|
@ -49,7 +49,7 @@ static bool mvkIsSupportedOnPlatform(VkExtensionProperties* pProperties) {
|
||||
#define MVK_DISABLED_EXTENSION(EXT) \
|
||||
if (pProperties == &kVkExtProps_##EXT) { return false; }
|
||||
#define MVK_EXTENSION_MIN_OS(EXT, MAC, IOS) \
|
||||
if (pProperties == &kVkExtProps_##EXT) { return mvkOSVersionIsAtLeast(MAC, IOS); }
|
||||
if (pProperties == &kVkExtProps_##EXT) { return mvkOSVersionIsAtLeast(IOS, MAC, 14.0); }
|
||||
#if MVK_MACOS
|
||||
MVK_DISABLED_EXTENSION(MVK_IOS_SURFACE)
|
||||
|
||||
|
@ -36,7 +36,9 @@ void MVKGPUCaptureScope::beginScope() {
|
||||
if (_mtlCaptureScope) {
|
||||
[_mtlCaptureScope beginScope];
|
||||
} else if (_isDefault && _isFirstBoundary) {
|
||||
#if !MVK_MACCAT
|
||||
[_mtlQueue insertDebugCaptureBoundary];
|
||||
#endif
|
||||
}
|
||||
_isFirstBoundary = false;
|
||||
}
|
||||
@ -45,7 +47,9 @@ void MVKGPUCaptureScope::endScope() {
|
||||
if (_mtlCaptureScope) {
|
||||
[_mtlCaptureScope endScope];
|
||||
} else if (_isDefault) {
|
||||
#if !MVK_MACCAT
|
||||
[_mtlQueue insertDebugCaptureBoundary];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,8 @@ Introduction to MoltenVK
|
||||
graphics and compute functionality, that is built on Apple's [*Metal*](https://developer.apple.com/metal)
|
||||
graphics and compute framework on *macOS*, *iOS*, and *tvOS*. **MoltenVK** allows you to use *Vulkan*
|
||||
graphics and compute functionality to develop modern, cross-platform, high-performance graphical
|
||||
games and applications, and to run them across many platforms, including *macOS*, *iOS*, and *tvOS*.
|
||||
games and applications, and to run them across many platforms, including *macOS*, *iOS*, *tvOS*,
|
||||
*Simulators*, and *Mac Catalyst* on *macOS 11.0+*, and all *Apple* architectures, including *Apple Silicon*.
|
||||
|
||||
*Metal* uses a different shading language, the *Metal Shading Language (MSL)*, than
|
||||
*Vulkan*, which uses *SPIR-V*. **MoltenVK** automatically converts your *SPIR-V* shaders
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
set -e
|
||||
|
||||
# We don't support dylib for Mac Catalyst yet
|
||||
if [ "${IS_MACCATALYST}" == "YES" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export MVK_OS_CLANG="ios"
|
||||
export MVK_UX_FWK="UIKit"
|
||||
export MVK_MIN_OS_VERSION=${IPHONEOS_DEPLOYMENT_TARGET}
|
||||
|
@ -30,6 +30,9 @@ export MVK_PROD_NAME="MoltenVK"
|
||||
export MVK_PROD_PROJ_PATH="${PROJECT_DIR}/${MVK_PROD_NAME}"
|
||||
export MVK_PKG_PROD_PATH="${PROJECT_DIR}/Package/${CONFIGURATION}/${MVK_PROD_NAME}"
|
||||
|
||||
# Make sure directory is there in case no dylibs are created for this platform
|
||||
mkdir -p "${MVK_PKG_PROD_PATH}"
|
||||
|
||||
copy_dylib "" "macOS"
|
||||
copy_dylib "-iphoneos" "iOS"
|
||||
copy_dylib "-iphonesimulator" "iOS-simulator"
|
||||
|
Loading…
x
Reference in New Issue
Block a user