From 3a7a87074b8c1efd93b587e25a0790708f43dc17 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Sat, 26 Nov 2022 19:50:04 +0100 Subject: [PATCH] don't use @available --- src/gui/rhi/qrhimetal.mm | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/qtbase/src/gui/rhi/qrhimetal.mm b/qtbase/src/gui/rhi/qrhimetal.mm index bd761b4e15..deb584125c 100644 --- a/qtbase/src/gui/rhi/qrhimetal.mm +++ b/qtbase/src/gui/rhi/qrhimetal.mm @@ -2545,119 +2545,102 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR #else case QRhiTexture::ETC2_RGB8: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatETC2_RGB8_sRGB : MTLPixelFormatETC2_RGB8; } qWarning("QRhiMetal: ETC2 compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ETC2_RGB8A1: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatETC2_RGB8A1_sRGB : MTLPixelFormatETC2_RGB8A1; } qWarning("QRhiMetal: ETC2 compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ETC2_RGBA8: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatEAC_RGBA8_sRGB : MTLPixelFormatEAC_RGBA8; } qWarning("QRhiMetal: ETC2 compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_4x4: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_4x4_sRGB : MTLPixelFormatASTC_4x4_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_5x4: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_5x4_sRGB : MTLPixelFormatASTC_5x4_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_5x5: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_5x5_sRGB : MTLPixelFormatASTC_5x5_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_6x5: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_6x5_sRGB : MTLPixelFormatASTC_6x5_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_6x6: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_6x6_sRGB : MTLPixelFormatASTC_6x6_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_8x5: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_8x5_sRGB : MTLPixelFormatASTC_8x5_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_8x6: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_8x6_sRGB : MTLPixelFormatASTC_8x6_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_8x8: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_8x8_sRGB : MTLPixelFormatASTC_8x8_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_10x5: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_10x5_sRGB : MTLPixelFormatASTC_10x5_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_10x6: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_10x6_sRGB : MTLPixelFormatASTC_10x6_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_10x8: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_10x8_sRGB : MTLPixelFormatASTC_10x8_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_10x10: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_10x10_sRGB : MTLPixelFormatASTC_10x10_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_12x10: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_12x10_sRGB : MTLPixelFormatASTC_12x10_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); return MTLPixelFormatInvalid; case QRhiTexture::ASTC_12x12: if (d->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR; } qWarning("QRhiMetal: ASTC compression not supported on this platform"); @@ -2727,12 +2710,8 @@ bool QMetalRenderBuffer::create() case DepthStencil: #ifdef Q_OS_MACOS if (rhiD->caps.isAppleGPU) { - if (@available(macOS 11.0, *)) { - desc.storageMode = MTLStorageModeMemoryless; - d->format = MTLPixelFormatDepth32Float_Stencil8; - } else { - Q_UNREACHABLE(); - } + desc.storageMode = MTLStorageModeMemoryless; + d->format = MTLPixelFormatDepth32Float_Stencil8; } else { desc.storageMode = MTLStorageModePrivate; d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported -- 2.38.1