rhi: metal: Query supported sample counts from the device

Check if 2, 4, 8 are actually supported.

Pick-to: 6.2
Fixes: QTBUG-97146
Change-Id: I23c22c2bfeb072b9658f3b5dfba51dd6dc850de3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
bb10
Laszlo Agocs 2021-10-06 14:35:20 +02:00
parent 3fbf1f13ae
commit cef788f398
2 changed files with 8 additions and 1 deletions

View File

@ -440,6 +440,12 @@ bool QRhiMetal::create(QRhi::Flags flags)
}
#endif
caps.supportedSampleCounts = { 1 };
for (int sampleCount : { 2, 4, 8 }) {
if ([d->dev supportsTextureSampleCount: sampleCount])
caps.supportedSampleCounts.append(sampleCount);
}
nativeHandlesStruct.dev = (MTLDevice *) d->dev;
nativeHandlesStruct.cmdQueue = (MTLCommandQueue *) d->cmdQueue;
@ -469,7 +475,7 @@ void QRhiMetal::destroy()
QVector<int> QRhiMetal::supportedSampleCounts() const
{
return { 1, 2, 4, 8 };
return caps.supportedSampleCounts;
}
int QRhiMetal::effectiveSampleCount(int sampleCount) const

View File

@ -482,6 +482,7 @@ public:
struct {
int maxTextureSize = 4096;
bool baseVertexAndInstance = true;
QVector<int> supportedSampleCounts;
} caps;
QRhiMetalData *d = nullptr;