rhi: metal: remove checking for legacy OS versions
Remove redundant OS version checking (via @available) and stop supporting legacy macOS (< 11) an iOS (< 14) versions that were already unsupported in previous 6.5 LTS. Change-Id: I505217e0f4f4c19bbdb27b535e658d158a5bafea Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 9c199a39d228658a20c1d6650ab6a7aedfaeccf6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
45d87f7bab
commit
0af3e3a45e
@ -525,7 +525,6 @@ bool QRhiMetalData::setupBinaryArchive(NSURL *sourceFileUrl)
|
|||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (@available(macOS 11.0, iOS 14.0, *)) {
|
|
||||||
[binArch release];
|
[binArch release];
|
||||||
MTLBinaryArchiveDescriptor *binArchDesc = [MTLBinaryArchiveDescriptor new];
|
MTLBinaryArchiveDescriptor *binArchDesc = [MTLBinaryArchiveDescriptor new];
|
||||||
binArchDesc.url = sourceFileUrl;
|
binArchDesc.url = sourceFileUrl;
|
||||||
@ -538,8 +537,6 @@ bool QRhiMetalData::setupBinaryArchive(NSURL *sourceFileUrl)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QRhiMetal::create(QRhi::Flags flags)
|
bool QRhiMetal::create(QRhi::Flags flags)
|
||||||
@ -565,7 +562,6 @@ bool QRhiMetal::create(QRhi::Flags flags)
|
|||||||
// apparently change when the system is rebooted.
|
// apparently change when the system is rebooted.
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
if (@available(macOS 10.15, *)) {
|
|
||||||
const MTLDeviceLocation deviceLocation = [d->dev location];
|
const MTLDeviceLocation deviceLocation = [d->dev location];
|
||||||
switch (deviceLocation) {
|
switch (deviceLocation) {
|
||||||
case MTLDeviceLocationBuiltIn:
|
case MTLDeviceLocationBuiltIn:
|
||||||
@ -580,7 +576,6 @@ bool QRhiMetal::create(QRhi::Flags flags)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
driverInfoStruct.deviceType = QRhiDriverInfo::IntegratedDevice;
|
driverInfoStruct.deviceType = QRhiDriverInfo::IntegratedDevice;
|
||||||
#endif
|
#endif
|
||||||
@ -605,7 +600,6 @@ bool QRhiMetal::create(QRhi::Flags flags)
|
|||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
caps.maxTextureSize = 16384;
|
caps.maxTextureSize = 16384;
|
||||||
caps.baseVertexAndInstance = true;
|
caps.baseVertexAndInstance = true;
|
||||||
if (@available(macOS 10.15, *))
|
|
||||||
caps.isAppleGPU = [d->dev supportsFamily:MTLGPUFamilyApple7];
|
caps.isAppleGPU = [d->dev supportsFamily:MTLGPUFamilyApple7];
|
||||||
caps.maxThreadGroupSize = 1024;
|
caps.maxThreadGroupSize = 1024;
|
||||||
caps.multiView = true;
|
caps.multiView = true;
|
||||||
@ -628,12 +622,10 @@ bool QRhiMetal::create(QRhi::Flags flags)
|
|||||||
caps.baseVertexAndInstance = false;
|
caps.baseVertexAndInstance = false;
|
||||||
}
|
}
|
||||||
caps.isAppleGPU = true;
|
caps.isAppleGPU = true;
|
||||||
if (@available(iOS 13, *)) {
|
|
||||||
if ([d->dev supportsFamily:MTLGPUFamilyApple4])
|
if ([d->dev supportsFamily:MTLGPUFamilyApple4])
|
||||||
caps.maxThreadGroupSize = 1024;
|
caps.maxThreadGroupSize = 1024;
|
||||||
if ([d->dev supportsFamily:MTLGPUFamilyApple5])
|
if ([d->dev supportsFamily:MTLGPUFamilyApple5])
|
||||||
caps.multiView = true;
|
caps.multiView = true;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
caps.supportedSampleCounts = { 1 };
|
caps.supportedSampleCounts = { 1 };
|
||||||
@ -663,10 +655,8 @@ void QRhiMetal::destroy()
|
|||||||
[d->captureScope release];
|
[d->captureScope release];
|
||||||
d->captureScope = nil;
|
d->captureScope = nil;
|
||||||
|
|
||||||
if (@available(macOS 11.0, iOS 14.0, *)) {
|
|
||||||
[d->binArch release];
|
[d->binArch release];
|
||||||
d->binArch = nil;
|
d->binArch = nil;
|
||||||
}
|
|
||||||
|
|
||||||
[d->cmdQueue release];
|
[d->cmdQueue release];
|
||||||
if (!importedCmdQueue)
|
if (!importedCmdQueue)
|
||||||
@ -813,12 +803,7 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
|
|||||||
case QRhi::ReadBackAnyTextureFormat:
|
case QRhi::ReadBackAnyTextureFormat:
|
||||||
return true;
|
return true;
|
||||||
case QRhi::PipelineCacheDataLoadSave:
|
case QRhi::PipelineCacheDataLoadSave:
|
||||||
{
|
|
||||||
if (@available(macOS 11.0, iOS 14.0, *))
|
|
||||||
return true;
|
return true;
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
case QRhi::ImageDataStride:
|
case QRhi::ImageDataStride:
|
||||||
return true;
|
return true;
|
||||||
case QRhi::RenderBufferImport:
|
case QRhi::RenderBufferImport:
|
||||||
@ -946,7 +931,6 @@ QByteArray QRhiMetal::pipelineCacheData()
|
|||||||
{
|
{
|
||||||
Q_STATIC_ASSERT(sizeof(QMetalPipelineCacheDataHeader) == 256);
|
Q_STATIC_ASSERT(sizeof(QMetalPipelineCacheDataHeader) == 256);
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
if (@available(macOS 11.0, iOS 14.0, *)) {
|
|
||||||
if (!d->binArch || !rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
|
if (!d->binArch || !rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave))
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
@ -993,7 +977,6 @@ QByteArray QRhiMetal::pipelineCacheData()
|
|||||||
|
|
||||||
memcpy(data.data(), &header, headerSize);
|
memcpy(data.data(), &header, headerSize);
|
||||||
memcpy(data.data() + headerSize, blob.constData(), dataSize);
|
memcpy(data.data() + headerSize, blob.constData(), dataSize);
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,7 +1026,6 @@ void QRhiMetal::setPipelineCacheData(const QByteArray &data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@available(macOS 11.0, iOS 14.0, *)) {
|
|
||||||
const char *p = data.constData() + dataOffset;
|
const char *p = data.constData() + dataOffset;
|
||||||
|
|
||||||
QTemporaryFile tmp;
|
QTemporaryFile tmp;
|
||||||
@ -1058,7 +1040,6 @@ void QRhiMetal::setPipelineCacheData(const QByteArray &data)
|
|||||||
NSURL *url = QUrl::fromLocalFile(fn).toNSURL();
|
NSURL *url = QUrl::fromLocalFile(fn).toNSURL();
|
||||||
if (d->setupBinaryArchive(url))
|
if (d->setupBinaryArchive(url))
|
||||||
qCDebug(QRHI_LOG_INFO, "Created MTLBinaryArchive with initial data of %u bytes", header.dataSize);
|
qCDebug(QRHI_LOG_INFO, "Created MTLBinaryArchive with initial data of %u bytes", header.dataSize);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QRhiRenderBuffer *QRhiMetal::createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize,
|
QRhiRenderBuffer *QRhiMetal::createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize,
|
||||||
@ -3521,122 +3502,88 @@ static inline MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QR
|
|||||||
return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR;
|
return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR;
|
||||||
#else
|
#else
|
||||||
case QRhiTexture::ETC2_RGB8:
|
case QRhiTexture::ETC2_RGB8:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatETC2_RGB8_sRGB : MTLPixelFormatETC2_RGB8;
|
return srgb ? MTLPixelFormatETC2_RGB8_sRGB : MTLPixelFormatETC2_RGB8;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ETC2_RGB8A1:
|
case QRhiTexture::ETC2_RGB8A1:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatETC2_RGB8A1_sRGB : MTLPixelFormatETC2_RGB8A1;
|
return srgb ? MTLPixelFormatETC2_RGB8A1_sRGB : MTLPixelFormatETC2_RGB8A1;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ETC2_RGBA8:
|
case QRhiTexture::ETC2_RGBA8:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatEAC_RGBA8_sRGB : MTLPixelFormatEAC_RGBA8;
|
return srgb ? MTLPixelFormatEAC_RGBA8_sRGB : MTLPixelFormatEAC_RGBA8;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
qWarning("QRhiMetal: ETC2 compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_4x4:
|
case QRhiTexture::ASTC_4x4:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_4x4_sRGB : MTLPixelFormatASTC_4x4_LDR;
|
return srgb ? MTLPixelFormatASTC_4x4_sRGB : MTLPixelFormatASTC_4x4_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_5x4:
|
case QRhiTexture::ASTC_5x4:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_5x4_sRGB : MTLPixelFormatASTC_5x4_LDR;
|
return srgb ? MTLPixelFormatASTC_5x4_sRGB : MTLPixelFormatASTC_5x4_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_5x5:
|
case QRhiTexture::ASTC_5x5:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_5x5_sRGB : MTLPixelFormatASTC_5x5_LDR;
|
return srgb ? MTLPixelFormatASTC_5x5_sRGB : MTLPixelFormatASTC_5x5_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_6x5:
|
case QRhiTexture::ASTC_6x5:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_6x5_sRGB : MTLPixelFormatASTC_6x5_LDR;
|
return srgb ? MTLPixelFormatASTC_6x5_sRGB : MTLPixelFormatASTC_6x5_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_6x6:
|
case QRhiTexture::ASTC_6x6:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_6x6_sRGB : MTLPixelFormatASTC_6x6_LDR;
|
return srgb ? MTLPixelFormatASTC_6x6_sRGB : MTLPixelFormatASTC_6x6_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_8x5:
|
case QRhiTexture::ASTC_8x5:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_8x5_sRGB : MTLPixelFormatASTC_8x5_LDR;
|
return srgb ? MTLPixelFormatASTC_8x5_sRGB : MTLPixelFormatASTC_8x5_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_8x6:
|
case QRhiTexture::ASTC_8x6:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_8x6_sRGB : MTLPixelFormatASTC_8x6_LDR;
|
return srgb ? MTLPixelFormatASTC_8x6_sRGB : MTLPixelFormatASTC_8x6_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_8x8:
|
case QRhiTexture::ASTC_8x8:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_8x8_sRGB : MTLPixelFormatASTC_8x8_LDR;
|
return srgb ? MTLPixelFormatASTC_8x8_sRGB : MTLPixelFormatASTC_8x8_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_10x5:
|
case QRhiTexture::ASTC_10x5:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_10x5_sRGB : MTLPixelFormatASTC_10x5_LDR;
|
return srgb ? MTLPixelFormatASTC_10x5_sRGB : MTLPixelFormatASTC_10x5_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_10x6:
|
case QRhiTexture::ASTC_10x6:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_10x6_sRGB : MTLPixelFormatASTC_10x6_LDR;
|
return srgb ? MTLPixelFormatASTC_10x6_sRGB : MTLPixelFormatASTC_10x6_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_10x8:
|
case QRhiTexture::ASTC_10x8:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_10x8_sRGB : MTLPixelFormatASTC_10x8_LDR;
|
return srgb ? MTLPixelFormatASTC_10x8_sRGB : MTLPixelFormatASTC_10x8_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_10x10:
|
case QRhiTexture::ASTC_10x10:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_10x10_sRGB : MTLPixelFormatASTC_10x10_LDR;
|
return srgb ? MTLPixelFormatASTC_10x10_sRGB : MTLPixelFormatASTC_10x10_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_12x10:
|
case QRhiTexture::ASTC_12x10:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_12x10_sRGB : MTLPixelFormatASTC_12x10_LDR;
|
return srgb ? MTLPixelFormatASTC_12x10_sRGB : MTLPixelFormatASTC_12x10_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
case QRhiTexture::ASTC_12x12:
|
case QRhiTexture::ASTC_12x12:
|
||||||
if (d->caps.isAppleGPU) {
|
if (d->caps.isAppleGPU)
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR;
|
return srgb ? MTLPixelFormatASTC_12x12_sRGB : MTLPixelFormatASTC_12x12_LDR;
|
||||||
}
|
|
||||||
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
qWarning("QRhiMetal: ASTC compression not supported on this platform");
|
||||||
return MTLPixelFormatInvalid;
|
return MTLPixelFormatInvalid;
|
||||||
#endif
|
#endif
|
||||||
@ -3704,12 +3651,8 @@ bool QMetalRenderBuffer::create()
|
|||||||
case DepthStencil:
|
case DepthStencil:
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
if (rhiD->caps.isAppleGPU) {
|
if (rhiD->caps.isAppleGPU) {
|
||||||
if (@available(macOS 11.0, *)) {
|
|
||||||
desc.storageMode = MTLStorageModeMemoryless;
|
desc.storageMode = MTLStorageModeMemoryless;
|
||||||
d->format = MTLPixelFormatDepth32Float_Stencil8;
|
d->format = MTLPixelFormatDepth32Float_Stencil8;
|
||||||
} else {
|
|
||||||
Q_UNREACHABLE();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
desc.storageMode = MTLStorageModePrivate;
|
desc.storageMode = MTLStorageModePrivate;
|
||||||
d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported
|
d->format = rhiD->d->dev.depth24Stencil8PixelFormatSupported
|
||||||
@ -3887,15 +3830,7 @@ bool QMetalTexture::create()
|
|||||||
} else if (is1D) {
|
} else if (is1D) {
|
||||||
desc.textureType = isArray ? MTLTextureType1DArray : MTLTextureType1D;
|
desc.textureType = isArray ? MTLTextureType1DArray : MTLTextureType1D;
|
||||||
} else if (isArray) {
|
} else if (isArray) {
|
||||||
#ifdef Q_OS_IOS
|
|
||||||
if (@available(iOS 14, *)) {
|
|
||||||
desc.textureType = samples > 1 ? MTLTextureType2DMultisampleArray : MTLTextureType2DArray;
|
desc.textureType = samples > 1 ? MTLTextureType2DMultisampleArray : MTLTextureType2DArray;
|
||||||
} else {
|
|
||||||
desc.textureType = MTLTextureType2DArray;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
desc.textureType = samples > 1 ? MTLTextureType2DMultisampleArray : MTLTextureType2DArray;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
desc.textureType = samples > 1 ? MTLTextureType2DMultisample : MTLTextureType2D;
|
desc.textureType = samples > 1 ? MTLTextureType2DMultisample : MTLTextureType2D;
|
||||||
}
|
}
|
||||||
@ -4776,13 +4711,7 @@ id<MTLLibrary> QRhiMetalData::createMetalLib(const QShader &shader, QShader::Var
|
|||||||
versions << 30;
|
versions << 30;
|
||||||
if (@available(macOS 12, iOS 15, *))
|
if (@available(macOS 12, iOS 15, *))
|
||||||
versions << 24;
|
versions << 24;
|
||||||
if (@available(macOS 11, iOS 14, *))
|
versions << 23 << 22 << 21 << 20 << 12;
|
||||||
versions << 23;
|
|
||||||
if (@available(macOS 10.15, iOS 13, *))
|
|
||||||
versions << 22;
|
|
||||||
if (@available(macOS 10.14, iOS 12, *))
|
|
||||||
versions << 21;
|
|
||||||
versions << 20 << 12;
|
|
||||||
|
|
||||||
const QList<QShaderKey> shaders = shader.availableShaders();
|
const QList<QShaderKey> shaders = shader.availableShaders();
|
||||||
|
|
||||||
@ -4997,17 +4926,14 @@ void QMetalGraphicsPipelineData::setupStageInputDescriptor(MTLStageInputOutputDe
|
|||||||
|
|
||||||
void QRhiMetalData::trySeedingRenderPipelineFromBinaryArchive(MTLRenderPipelineDescriptor *rpDesc)
|
void QRhiMetalData::trySeedingRenderPipelineFromBinaryArchive(MTLRenderPipelineDescriptor *rpDesc)
|
||||||
{
|
{
|
||||||
if (@available(macOS 11.0, iOS 14.0, *)) {
|
|
||||||
if (binArch) {
|
if (binArch) {
|
||||||
NSArray *binArchArray = [NSArray arrayWithObjects: binArch, nil];
|
NSArray *binArchArray = [NSArray arrayWithObjects: binArch, nil];
|
||||||
rpDesc.binaryArchives = binArchArray;
|
rpDesc.binaryArchives = binArchArray;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRhiMetalData::addRenderPipelineToBinaryArchive(MTLRenderPipelineDescriptor *rpDesc)
|
void QRhiMetalData::addRenderPipelineToBinaryArchive(MTLRenderPipelineDescriptor *rpDesc)
|
||||||
{
|
{
|
||||||
if (@available(macOS 11.0, iOS 14.0, *)) {
|
|
||||||
if (binArch) {
|
if (binArch) {
|
||||||
NSError *err = nil;
|
NSError *err = nil;
|
||||||
if (![binArch addRenderPipelineFunctionsWithDescriptor: rpDesc error: &err]) {
|
if (![binArch addRenderPipelineFunctionsWithDescriptor: rpDesc error: &err]) {
|
||||||
@ -5015,7 +4941,6 @@ void QRhiMetalData::addRenderPipelineToBinaryArchive(MTLRenderPipelineDescriptor
|
|||||||
qWarning("Failed to collect render pipeline functions to binary archive: %s", qPrintable(msg));
|
qWarning("Failed to collect render pipeline functions to binary archive: %s", qPrintable(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMetalGraphicsPipeline::createVertexFragmentPipeline()
|
bool QMetalGraphicsPipeline::createVertexFragmentPipeline()
|
||||||
@ -5983,17 +5908,14 @@ void QMetalComputePipeline::destroy()
|
|||||||
|
|
||||||
void QRhiMetalData::trySeedingComputePipelineFromBinaryArchive(MTLComputePipelineDescriptor *cpDesc)
|
void QRhiMetalData::trySeedingComputePipelineFromBinaryArchive(MTLComputePipelineDescriptor *cpDesc)
|
||||||
{
|
{
|
||||||
if (@available(macOS 11.0, iOS 14.0, *)) {
|
|
||||||
if (binArch) {
|
if (binArch) {
|
||||||
NSArray *binArchArray = [NSArray arrayWithObjects: binArch, nil];
|
NSArray *binArchArray = [NSArray arrayWithObjects: binArch, nil];
|
||||||
cpDesc.binaryArchives = binArchArray;
|
cpDesc.binaryArchives = binArchArray;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRhiMetalData::addComputePipelineToBinaryArchive(MTLComputePipelineDescriptor *cpDesc)
|
void QRhiMetalData::addComputePipelineToBinaryArchive(MTLComputePipelineDescriptor *cpDesc)
|
||||||
{
|
{
|
||||||
if (@available(macOS 11.0, iOS 14.0, *)) {
|
|
||||||
if (binArch) {
|
if (binArch) {
|
||||||
NSError *err = nil;
|
NSError *err = nil;
|
||||||
if (![binArch addComputePipelineFunctionsWithDescriptor: cpDesc error: &err]) {
|
if (![binArch addComputePipelineFunctionsWithDescriptor: cpDesc error: &err]) {
|
||||||
@ -6001,7 +5923,6 @@ void QRhiMetalData::addComputePipelineToBinaryArchive(MTLComputePipelineDescript
|
|||||||
qWarning("Failed to collect compute pipeline functions to binary archive: %s", qPrintable(msg));
|
qWarning("Failed to collect compute pipeline functions to binary archive: %s", qPrintable(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMetalComputePipeline::create()
|
bool QMetalComputePipeline::create()
|
||||||
@ -6270,15 +6191,12 @@ QSize QMetalSwapChain::surfacePixelSize()
|
|||||||
bool QMetalSwapChain::isFormatSupported(Format f)
|
bool QMetalSwapChain::isFormatSupported(Format f)
|
||||||
{
|
{
|
||||||
if (f == HDRExtendedSrgbLinear) {
|
if (f == HDRExtendedSrgbLinear) {
|
||||||
if (@available(macOS 10.11, iOS 16.0, *))
|
if (@available(iOS 16.0, *))
|
||||||
return hdrInfo().limits.colorComponentValue.maxPotentialColorComponentValue > 1.0f;
|
return hdrInfo().limits.colorComponentValue.maxPotentialColorComponentValue > 1.0f;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
} else if (f == HDRExtendedDisplayP3Linear) {
|
} else if (f == HDRExtendedDisplayP3Linear) {
|
||||||
if (@available(macOS 11.0, iOS 14.0, *))
|
|
||||||
return hdrInfo().limits.colorComponentValue.maxPotentialColorComponentValue > 1.0f;
|
return hdrInfo().limits.colorComponentValue.maxPotentialColorComponentValue > 1.0f;
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return f == SDR;
|
return f == SDR;
|
||||||
}
|
}
|
||||||
@ -6363,12 +6281,12 @@ bool QMetalSwapChain::createOrResize()
|
|||||||
d->layer.pixelFormat = d->colorFormat;
|
d->layer.pixelFormat = d->colorFormat;
|
||||||
|
|
||||||
if (m_format == HDRExtendedSrgbLinear) {
|
if (m_format == HDRExtendedSrgbLinear) {
|
||||||
if (@available(macOS 10.11, iOS 16.0, *)) {
|
if (@available(iOS 16.0, *)) {
|
||||||
d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
|
d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
|
||||||
d->layer.wantsExtendedDynamicRangeContent = YES;
|
d->layer.wantsExtendedDynamicRangeContent = YES;
|
||||||
}
|
}
|
||||||
} else if (m_format == HDRExtendedDisplayP3Linear) {
|
} else if (m_format == HDRExtendedDisplayP3Linear) {
|
||||||
if (@available(macOS 11.0, iOS 16.0, *)) {
|
if (@available(iOS 16.0, *)) {
|
||||||
d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearDisplayP3);
|
d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearDisplayP3);
|
||||||
d->layer.wantsExtendedDynamicRangeContent = YES;
|
d->layer.wantsExtendedDynamicRangeContent = YES;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user