Allow building with macOS 10.14 SDK (will still warn about "instance method '-charactersByApplyingModifiers:' not found" and "instance method '-location' not found") Upstream-Status: Inappropriate [violates DRY] --- src/gui/platform/darwin/qapplekeymapper.mm.orig +++ src/gui/platform/darwin/qapplekeymapper.mm @@ -528,7 +528,7 @@ // we first run the event through the Carbon APIs and then // compare the results to Cocoa. auto cocoaModifiers = toCocoaModifiers(qtModifiers); - auto *charactersWithModifiers = [NSApp.currentEvent charactersByApplyingModifiers:cocoaModifiers]; + NSString *charactersWithModifiers = [NSApp.currentEvent charactersByApplyingModifiers:cocoaModifiers]; QChar cocoaUnicodeKey; if (charactersWithModifiers.length > 0) --- src/gui/rhi/qrhimetal.mm.orig +++ src/gui/rhi/qrhimetal.mm @@ -369,15 +369,15 @@ driverInfoStruct.deviceType = QRhiDriverInfo::IntegratedDevice; #else if (@available(macOS 10.15, *)) { - const MTLDeviceLocation deviceLocation = [d->dev location]; + const NSUInteger deviceLocation = (NSUInteger)[d->dev location]; switch (deviceLocation) { - case MTLDeviceLocationBuiltIn: + case 0: driverInfoStruct.deviceType = QRhiDriverInfo::IntegratedDevice; break; - case MTLDeviceLocationSlot: + case 1: driverInfoStruct.deviceType = QRhiDriverInfo::DiscreteDevice; break; - case MTLDeviceLocationExternal: + case 2: driverInfoStruct.deviceType = QRhiDriverInfo::ExternalDevice; break; default: @@ -403,8 +403,10 @@ #if defined(Q_OS_MACOS) caps.maxTextureSize = 16384; caps.baseVertexAndInstance = true; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 if (@available(macOS 10.15, *)) - caps.isAppleGPU = [d->dev supportsFamily:MTLGPUFamilyApple7]; + caps.isAppleGPU = [d->dev supportsFamily:MTLGPUFamily(1007)]; // MTLGPUFamilyApple7 +#endif caps.maxThreadGroupSize = 1024; #elif defined(Q_OS_TVOS) if ([d->dev supportsFeatureSet: MTLFeatureSet(30003)]) // MTLFeatureSet_tvOS_GPUFamily2_v1 @@ -2543,6 +2545,26 @@ return srgb ? MTLPixelFormatASTC_12x10_sRGB : MTLPixelFormatASTC_12x10_LDR; case QRhiTexture::ASTC_12x12: return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR; +#elif MAC_OS_X_VERSION_MAX_ALLOWED < 110000 + case QRhiTexture::ETC2_RGB8: + case QRhiTexture::ETC2_RGB8A1: + case QRhiTexture::ETC2_RGBA8: + case QRhiTexture::ASTC_4x4: + case QRhiTexture::ASTC_5x4: + case QRhiTexture::ASTC_5x5: + case QRhiTexture::ASTC_6x5: + case QRhiTexture::ASTC_6x6: + case QRhiTexture::ASTC_8x5: + case QRhiTexture::ASTC_8x6: + case QRhiTexture::ASTC_8x8: + case QRhiTexture::ASTC_10x5: + case QRhiTexture::ASTC_10x6: + case QRhiTexture::ASTC_10x8: + case QRhiTexture::ASTC_10x10: + case QRhiTexture::ASTC_12x10: + case QRhiTexture::ASTC_12x12: + qWarning("QRhiMetal: ETC2 compression not supported on this platform"); + return MTLPixelFormatInvalid; #else case QRhiTexture::ETC2_RGB8: if (d->caps.isAppleGPU) { @@ -2727,6 +2747,7 @@ switch (m_type) { case DepthStencil: #ifdef Q_OS_MACOS +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 if (rhiD->caps.isAppleGPU) { if (@available(macOS 11.0, *)) { desc.storageMode = MTLStorageModeMemoryless; @@ -2735,10 +2756,13 @@ Q_UNREACHABLE(); } } else { +#endif desc.storageMode = MTLStorageModePrivate; d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported ? MTLPixelFormatDepth24Unorm_Stencil8 : MTLPixelFormatDepth32Float_Stencil8; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 } +#endif #else desc.storageMode = MTLStorageModeMemoryless; d->format = MTLPixelFormatDepth32Float_Stencil8; --- src/plugins/platforms/cocoa/qcocoascreen.mm.orig 2023-02-14 09:26:04.000000000 +0100 +++ src/plugins/platforms/cocoa/qcocoascreen.mm 2023-12-28 11:31:59.000000000 +0100 @@ -271,9 +271,11 @@ float refresh = CGDisplayModeGetRefreshRate(displayMode); m_refreshRate = refresh > 0 ? refresh : 60.0; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 if (@available(macOS 10.15, *)) m_name = QString::fromNSString(nsScreen.localizedName); else +#endif m_name = displayName(m_displayId); const bool didChangeGeometry = m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry;