Merge pull request #1168 from billhollings/mac-catalyst
Support Mac Catalyst on macOS 11.0+
This commit is contained in:
commit
6110c349ce
@ -2,7 +2,7 @@ language: objective-c
|
||||
|
||||
# macOS and Xcode Version
|
||||
os: osx
|
||||
osx_image: xcode12
|
||||
osx_image: xcode12.2
|
||||
|
||||
# Build with verbose logging to avoid Travis timing out.
|
||||
script:
|
||||
|
@ -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. */
|
||||
|
@ -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_sampler_mirror_clamp_to_edge` (iOS)
|
||||
@ -28,6 +28,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.
|
||||
|
10
Makefile
10
Makefile
@ -7,6 +7,7 @@ all:
|
||||
@$(MAKE) macos
|
||||
@$(MAKE) ios
|
||||
@$(MAKE) iossim
|
||||
@$(MAKE) maccat
|
||||
@$(MAKE) tvos
|
||||
@$(MAKE) tvossim
|
||||
|
||||
@ -15,6 +16,7 @@ all-debug:
|
||||
@$(MAKE) macos-debug
|
||||
@$(MAKE) ios-debug
|
||||
@$(MAKE) iossim-debug
|
||||
@$(MAKE) maccat-debug
|
||||
@$(MAKE) tvos-debug
|
||||
@$(MAKE) tvossim-debug
|
||||
|
||||
@ -42,6 +44,14 @@ iossim:
|
||||
iossim-debug:
|
||||
xcodebuild build -quiet -project "$(XC_PROJ)" -scheme "$(XC_SCHEME) (iOS only)" -destination "generic/platform=iOS Simulator" -configuration "Debug"
|
||||
|
||||
.PHONY: maccat
|
||||
maccat:
|
||||
xcodebuild build -quiet -project "$(XC_PROJ)" -scheme "$(XC_SCHEME) (iOS only)" -destination "generic/platform=macOS,variant=Mac Catalyst"
|
||||
|
||||
.PHONY: maccat-debug
|
||||
maccat-debug:
|
||||
xcodebuild build -quiet -project "$(XC_PROJ)" -scheme "$(XC_SCHEME) (iOS only)" -destination "generic/platform=macOS,variant=Mac Catalyst" -configuration "Debug"
|
||||
|
||||
.PHONY: tvos
|
||||
tvos:
|
||||
xcodebuild build -quiet -project "$(XC_PROJ)" -scheme "$(XC_SCHEME) (tvOS only)"
|
||||
|
@ -107,7 +107,9 @@ void MVKCmdPipelineBarrier<N>::encode(MVKCommandEncoder* cmdEncoder) {
|
||||
beforeStages: dstStages];
|
||||
}
|
||||
} else {
|
||||
#if !MVK_MACCAT
|
||||
if (coversTextures()) { [cmdEncoder->_mtlRenderEncoder textureBarrier]; }
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -927,3 +927,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
|
||||
|
@ -51,7 +51,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])
|
||||
|
||||
static const uint32_t kAMDVendorId = 0x1002;
|
||||
@ -2729,8 +2735,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,10 @@ 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("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)
|
||||
|
||||
@ -2032,24 +2043,25 @@ void MVKPixelFormats::setFormatProperties(MVKVkFormatDesc& vkDesc) {
|
||||
enableFormatFeatures(DSAtt, Tex, mtlPixFmtCaps, vkProps.optimalTilingFeatures);
|
||||
enableFormatFeatures(Blend, Tex, mtlPixFmtCaps, vkProps.optimalTilingFeatures);
|
||||
|
||||
#if MVK_MACOS_OR_IOS
|
||||
// We would really want to use the device's Metal features instead of duplicating
|
||||
// the logic from MVKPhysicalDevice, but those may not have been initialized yet.
|
||||
id<MTLDevice> mtlDev = _physicalDevice ? _physicalDevice->getMTLDevice() : nil;
|
||||
#if MVK_MACOS && !MVK_MACCAT
|
||||
bool supportsStencilFeedback = [mtlDev supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily2_v1];
|
||||
#endif
|
||||
if ( chromaSubsamplingComponentBits > 0 ||
|
||||
// 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]))
|
||||
#if MVK_MACCAT
|
||||
bool supportsStencilFeedback = [mtlDev supportsFamily: MTLGPUFamilyMacCatalyst2];
|
||||
#endif
|
||||
#if MVK_IOS
|
||||
(isStencilFormat(vkDesc.mtlPixelFormat) && (!_physicalDevice || ![mtlDev supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily5_v1]))
|
||||
bool supportsStencilFeedback = [mtlDev supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily5_v1];
|
||||
#endif
|
||||
#if MVK_TVOS
|
||||
isStencilFormat(vkDesc.mtlPixelFormat)
|
||||
bool supportsStencilFeedback = (mtlDev && !mtlDev); // Really just false...but silence warning on unused mtlDev otherwise
|
||||
#endif
|
||||
) {
|
||||
// Vulkan forbids blits between chroma-subsampled formats.
|
||||
// If we can't write the stencil reference from the shader, we can't blit stencil.
|
||||
|
||||
// Vulkan forbids blits between chroma-subsampled formats.
|
||||
// If we can't write the stencil reference from the shader, we can't blit stencil.
|
||||
if (chromaSubsamplingComponentBits > 0 || (isStencilFormat(vkDesc.mtlPixelFormat) && !supportsStencilFeedback)) {
|
||||
mvkDisableFlags(vkProps.optimalTilingFeatures, (VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_BLIT_DST_BIT));
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
@ -120,6 +121,7 @@ for which to build the external libraries. The platform choices include:
|
||||
--macos
|
||||
--ios
|
||||
--iossim
|
||||
--maccat
|
||||
--tvos
|
||||
--tvossim
|
||||
|
||||
@ -205,6 +207,7 @@ from the command line. The following `make` targets are provided:
|
||||
make macos
|
||||
make ios
|
||||
make iossim
|
||||
make maccat
|
||||
make tvos
|
||||
make tvossim
|
||||
|
||||
@ -212,6 +215,7 @@ from the command line. The following `make` targets are provided:
|
||||
make macos-debug
|
||||
make ios-debug
|
||||
make iossim-debug
|
||||
make maccat-debug
|
||||
make tvos-debug
|
||||
make tvossim-debug
|
||||
|
||||
|
@ -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"
|
||||
|
@ -17,6 +17,9 @@
|
||||
# --iossim
|
||||
# Build the external libraries for the iOS Simulator platform.
|
||||
#
|
||||
# --maccat
|
||||
# Build the external libraries for the Mac Catalyst platform.
|
||||
#
|
||||
# --tvos
|
||||
# Build the external libraries for the tvOS platform.
|
||||
#
|
||||
@ -24,7 +27,7 @@
|
||||
# Build the external libraries for the tvOS Simulator platform.
|
||||
#
|
||||
# --all
|
||||
# Equivalent to specifying [--macos --ios --iossim --tvos --tvossim].
|
||||
# Equivalent to specifying [--macos --ios --iossim --maccat --tvos --tvossim].
|
||||
# Results in one XCFramework for each external library, each containing
|
||||
# binaries for all supported platforms.
|
||||
#
|
||||
@ -88,6 +91,7 @@ set -e
|
||||
BLD_NONE=""
|
||||
BLD_IOS=""
|
||||
BLD_IOS_SIM=""
|
||||
BLD_MAC_CAT=""
|
||||
BLD_TVOS=""
|
||||
BLD_TVOS_SIM=""
|
||||
BLD_MACOS=""
|
||||
@ -113,6 +117,10 @@ while (( "$#" )); do
|
||||
BLD_IOS_SIM="Y"
|
||||
shift 1
|
||||
;;
|
||||
--maccat)
|
||||
BLD_MAC_CAT="Y"
|
||||
shift 1
|
||||
;;
|
||||
--tvos)
|
||||
BLD_TVOS="Y"
|
||||
shift 1
|
||||
@ -128,6 +136,7 @@ while (( "$#" )); do
|
||||
--all)
|
||||
BLD_IOS="Y"
|
||||
BLD_IOS_SIM="Y"
|
||||
BLD_MAC_CAT="Y"
|
||||
BLD_TVOS="Y"
|
||||
BLD_TVOS_SIM="Y"
|
||||
BLD_MACOS="Y"
|
||||
@ -388,22 +397,27 @@ echo Please be patient on first build
|
||||
|
||||
# Build an Xcode scheme for an OS and platform
|
||||
# 1 - OS
|
||||
# 2 - platform
|
||||
# 2 - Platform
|
||||
# 3 - Destination (Optional. Defaults to same as platform)
|
||||
function build_impl() {
|
||||
BLD_SPECIFIED="Y"
|
||||
XC_OS=${1}
|
||||
XC_PLTFM=${2}
|
||||
if [ "${3}" != "" ]; then
|
||||
XC_DEST=${3};
|
||||
else
|
||||
XC_DEST=${XC_PLTFM};
|
||||
fi
|
||||
|
||||
XC_SCHEME="${EXT_DEPS}-${XC_OS}"
|
||||
XC_LCL_DD_PATH="${XC_DD_PATH}/Intermediates/${XC_PLTFM}"
|
||||
XC_DEST="generic/platform=${XC_PLTFM}"
|
||||
|
||||
echo Building external libraries for ${XC_PLTFM}
|
||||
echo Building external libraries for platform ${XC_PLTFM} and destination ${XC_DEST}
|
||||
|
||||
xcodebuild \
|
||||
-project "${XC_PROJ}" \
|
||||
-scheme "${XC_SCHEME}" \
|
||||
-destination "${XC_DEST}" \
|
||||
-destination "generic/platform=${XC_DEST}" \
|
||||
-configuration "${XC_CONFIG}" \
|
||||
-enableAddressSanitizer "${XC_USE_ASAN}" \
|
||||
-enableThreadSanitizer "${XC_USE_TSAN}" \
|
||||
@ -420,9 +434,9 @@ function build_impl() {
|
||||
# 2 - platform
|
||||
function build() {
|
||||
if [ "$XC_USE_BCKGND" != "" ]; then
|
||||
build_impl "${1}" "${2}" &
|
||||
build_impl "${1}" "${2}" "${3}" &
|
||||
else
|
||||
build_impl "${1}" "${2}"
|
||||
build_impl "${1}" "${2}" "${3}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -449,6 +463,10 @@ if [ "$BLD_IOS_SIM" != "" ]; then
|
||||
build "iOS" "iOS Simulator"
|
||||
fi
|
||||
|
||||
if [ "$BLD_MAC_CAT" != "" ]; then
|
||||
build "iOS" "Mac Catalyst" "macOS,variant=Mac Catalyst"
|
||||
fi
|
||||
|
||||
if [ "$BLD_TVOS" != "" ]; then
|
||||
build "tvOS" "tvOS"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user