diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-10-06 14:35:20 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-10-08 11:07:15 +0200 |
commit | cef788f398568b07c28e2e4f364c84d7006d9ab9 (patch) | |
tree | baa0cd533b1c18500dddca29097562817c3318a5 /src/gui/rhi | |
parent | 3fbf1f13ae4c091c15cbba873cc36e2c3e39e0fe (diff) |
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>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 8 | ||||
-rw-r--r-- | src/gui/rhi/qrhimetal_p_p.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 6bdcfd70c8..d37a130d15 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -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 diff --git a/src/gui/rhi/qrhimetal_p_p.h b/src/gui/rhi/qrhimetal_p_p.h index 72a4d82888..579a2063ae 100644 --- a/src/gui/rhi/qrhimetal_p_p.h +++ b/src/gui/rhi/qrhimetal_p_p.h @@ -482,6 +482,7 @@ public: struct { int maxTextureSize = 4096; bool baseVertexAndInstance = true; + QVector<int> supportedSampleCounts; } caps; QRhiMetalData *d = nullptr; |