diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-10-06 14:35:20 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-10-08 11:31:48 +0000 |
commit | d8ea4448dfc8650f31e1c87e93a99c2ac85176bb (patch) | |
tree | e90e983acf29ff778f5eda9b323ad4c09a6cb9d1 /src | |
parent | bf91f1cc762dde5547b45706a256d4b3253c3030 (diff) |
rhi: metal: Query supported sample counts from the device
Check if 2, 4, 8 are actually supported.
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>
(cherry picked from commit cef788f398568b07c28e2e4f364c84d7006d9ab9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-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; |