Updates to better support Rosetta2 runtimes, and MSL 2.4 and 2.3 versions.
Do not use MTLEvent for VkSemaphore under Rosetta2. Remove compile test for MVK_MACOS_APPLE_SILICON and MVK_APPLE_SILICON when testing for Apple GPU families, to allow x86 builds to test for Apple GPU under Rosetta2. Simplify identifying M1 GPU. All M1 SoCs currently support the A14 (Apple7) GPU. Support compiling MSL 2.4 in runtime pipelines and MoltenVKShaderConverterTool. Fix issue where MSL 2.3 only available on Apple Silicon, even on macOS. Update to latest SPIRV-Cross (unrelated to Rosetta2).
This commit is contained in:
parent
80256771f7
commit
18642002ce
@ -18,7 +18,13 @@ MoltenVK 1.1.7
|
||||
|
||||
Released TBD
|
||||
|
||||
- Support building MoltenVK with static Vulkan linkage symbols hidden.
|
||||
- Support building MoltenVK with static Vulkan linkage symbols hidden.
|
||||
- Do not use `MTLEvent` for `VkSemaphore` under *Rosetta2*.
|
||||
- Support compiling *MSL 2.4* in runtime pipelines and `MoltenVKShaderConverterTool`.
|
||||
- Fix issue where *MSL 2.3* only available on *Apple Silicon*, even on *macOS*.
|
||||
- Update to latest SPIRV-Cross:
|
||||
- MSL: Add 64 bit support for `OpSwitch`.
|
||||
- MSL: Don't output depth and stencil values with explicit early fragment tests.
|
||||
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
7c3cb0b12c9965497b08403c82ac1b82846fa7be
|
||||
e9cc6403341baf0edd430a4027b074d0a06b782f
|
||||
|
@ -1273,6 +1273,11 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
||||
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_3;
|
||||
}
|
||||
#endif
|
||||
#if MVK_XCODE_13
|
||||
if ( mvkOSVersionIsAtLeast(15.0) ) {
|
||||
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_4;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -1377,6 +1382,11 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if MVK_XCODE_13
|
||||
if ( mvkOSVersionIsAtLeast(15.0) ) {
|
||||
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_4;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -1447,7 +1457,7 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
||||
}
|
||||
}
|
||||
|
||||
#if MVK_MACOS_APPLE_SILICON
|
||||
#if MVK_XCODE_12
|
||||
if ( mvkOSVersionIsAtLeast(10.16) ) {
|
||||
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_3;
|
||||
if (supportsMTLGPUFamily(Apple5)) {
|
||||
@ -1475,6 +1485,11 @@ void MVKPhysicalDevice::initMetalFeatures() {
|
||||
_metalFeatures.textureBarriers = true;
|
||||
}
|
||||
|
||||
#if MVK_XCODE_13
|
||||
if ( mvkOSVersionIsAtLeast(12.0) ) {
|
||||
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_4;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Note the selector name, which is different from the property name.
|
||||
@ -2200,21 +2215,10 @@ void MVKPhysicalDevice::initGPUInfoProperties() {
|
||||
_properties.deviceType = isIntegrated ? VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU : VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU;
|
||||
strlcpy(_properties.deviceName, _mtlDevice.name.UTF8String, VK_MAX_PHYSICAL_DEVICE_NAME_SIZE);
|
||||
|
||||
if (supportsMTLGPUFamily(Apple5)) {
|
||||
// This is an Apple GPU. It won't have a 'device-id' property, so fill it in
|
||||
// like on iOS/tvOS.
|
||||
if (supportsMTLGPUFamily(Apple7)) {
|
||||
// This is an Apple GPU. It won't have a 'device-id' property, so fill it in like on iOS/tvOS.
|
||||
_properties.vendorID = kAppleVendorId;
|
||||
#if MVK_MACOS_APPLE_SILICON
|
||||
if (supportsMTLGPUFamily(Apple7)) {
|
||||
_properties.deviceID = 0xa140;
|
||||
} else if (supportsMTLGPUFamily(Apple6)) {
|
||||
_properties.deviceID = 0xa130;
|
||||
} else {
|
||||
_properties.deviceID = 0xa120;
|
||||
}
|
||||
#else
|
||||
_properties.deviceID = 0xa120;
|
||||
#endif
|
||||
_properties.deviceID = 0xa140;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2480,10 +2484,8 @@ uint32_t MVKPhysicalDevice::getHighestMTLFeatureSet() {
|
||||
if (supportsMTLGPUFamily(Apple3)) { mtlFam = MTLGPUFamilyApple3; }
|
||||
if (supportsMTLGPUFamily(Apple4)) { mtlFam = MTLGPUFamilyApple4; }
|
||||
if (supportsMTLGPUFamily(Apple5)) { mtlFam = MTLGPUFamilyApple5; }
|
||||
#if MVK_IOS || MVK_MACOS_APPLE_SILICON
|
||||
if (supportsMTLGPUFamily(Apple6)) { mtlFam = MTLGPUFamilyApple6; }
|
||||
if (supportsMTLGPUFamily(Apple7)) { mtlFam = MTLGPUFamilyApple7; }
|
||||
#endif
|
||||
|
||||
// Not explicitly guaranteed to be unique...but close enough without spilling over
|
||||
uint32_t mtlFS = (mtlVer << 8) + (uint32_t)mtlFam;
|
||||
@ -2622,7 +2624,7 @@ void MVKPhysicalDevice::initMemoryProperties() {
|
||||
|
||||
// Memoryless storage
|
||||
uint32_t memlessBit = 0;
|
||||
#if MVK_MACOS_APPLE_SILICON
|
||||
#if MVK_MACOS
|
||||
if (supportsMTLGPUFamily(Apple5)) {
|
||||
memlessBit = 1 << typeIdx;
|
||||
setMemoryType(typeIdx, mainHeapIdx, MVK_VK_MEMORY_TYPE_METAL_MEMORYLESS);
|
||||
@ -2808,10 +2810,8 @@ void MVKPhysicalDevice::logGPUInfo() {
|
||||
logMsg += "\n\tsupports the following Metal Versions, GPU's and Feature Sets:";
|
||||
logMsg += "\n\t\tMetal Shading Language %s";
|
||||
|
||||
#if MVK_IOS || MVK_MACOS_APPLE_SILICON
|
||||
if (supportsMTLGPUFamily(Apple7)) { logMsg += "\n\t\tGPU Family Apple 7"; }
|
||||
if (supportsMTLGPUFamily(Apple6)) { logMsg += "\n\t\tGPU Family Apple 6"; }
|
||||
#endif
|
||||
if (supportsMTLGPUFamily(Apple5)) { logMsg += "\n\t\tGPU Family Apple 5"; }
|
||||
if (supportsMTLGPUFamily(Apple4)) { logMsg += "\n\t\tGPU Family Apple 4"; }
|
||||
if (supportsMTLGPUFamily(Apple3)) { logMsg += "\n\t\tGPU Family Apple 3"; }
|
||||
@ -3966,9 +3966,12 @@ void MVKDevice::initPhysicalDevice(MVKPhysicalDevice* physicalDevice, const VkDe
|
||||
|
||||
// Decide whether Vulkan semaphores should use a MTLEvent or MTLFence if they are available.
|
||||
// Prefer MTLEvent, because MTLEvent handles sync across MTLCommandBuffers and MTLCommandQueues.
|
||||
// However, do not allow use of MTLEvents on NVIDIA GPUs, which have demonstrated trouble with MTLEvents.
|
||||
// Since MTLFence config is disabled by default, emulation will be used on NVIDIA unless MTLFence is enabled.
|
||||
bool canUseMTLEventForSem4 = _pMetalFeatures->events && mvkConfig().semaphoreUseMTLEvent && (_pProperties->vendorID != kNVVendorId);
|
||||
// However, do not allow use of MTLEvents on Rosetta2 (x86 build on M1 runtime) or NVIDIA GPUs,
|
||||
// which have demonstrated trouble with MTLEvents. In that case, since MTLFence use is disabled
|
||||
// by default, unless MTLFence is deliberately enabled, CPU emulation will be used.
|
||||
bool isNVIDIA = _pProperties->vendorID == kNVVendorId;
|
||||
bool isRosetta2 = _pProperties->vendorID == kAppleVendorId && !MVK_APPLE_SILICON;
|
||||
bool canUseMTLEventForSem4 = _pMetalFeatures->events && mvkConfig().semaphoreUseMTLEvent && !(isRosetta2 || isNVIDIA);
|
||||
bool canUseMTLFenceForSem4 = _pMetalFeatures->fences && mvkConfig().semaphoreUseMTLFence;
|
||||
_vkSemaphoreStyle = canUseMTLEventForSem4 ? VkSemaphoreStyleUseMTLEvent : (canUseMTLFenceForSem4 ? VkSemaphoreStyleUseMTLFence : VkSemaphoreStyleUseEmulation);
|
||||
switch (_vkSemaphoreStyle) {
|
||||
|
@ -71,6 +71,11 @@ bool mvk::compile(const string& mslSourceCode,
|
||||
#define mslVer(MJ, MN, PT) mslVersionMajor == MJ && mslVersionMinor == MN && mslVersionPoint == PT
|
||||
|
||||
MTLLanguageVersion mslVerEnum = (MTLLanguageVersion)0;
|
||||
#if MVK_XCODE_13
|
||||
if (mslVer(2, 4, 0)) {
|
||||
mslVerEnum = MTLLanguageVersion2_4;
|
||||
} else
|
||||
#endif
|
||||
#if MVK_XCODE_12
|
||||
if (mslVer(2, 3, 0)) {
|
||||
mslVerEnum = MTLLanguageVersion2_3;
|
||||
|
Loading…
x
Reference in New Issue
Block a user