From cef788f398568b07c28e2e4f364c84d7006d9ab9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 6 Oct 2021 14:35:20 +0200 Subject: 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 Reviewed-by: Andy Nichols --- src/gui/rhi/qrhimetal.mm | 8 +++++++- src/gui/rhi/qrhimetal_p_p.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/gui/rhi') 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 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 supportedSampleCounts; } caps; QRhiMetalData *d = nullptr; -- cgit v1.2.3