summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhimetal.mm
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-10-03 17:33:23 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-10-09 17:15:05 +0200
commite22399af826b582e330a2772460d3bc0d98eb558 (patch)
tree334b52649ef2219c5352488bc97dc74a3c75cc84 /src/gui/rhi/qrhimetal.mm
parent89ec1b3618f0f26a8f92049aabfc2df4d84c34c5 (diff)
Make QRhi::create() return false when there is no MTLDevice
The interesting part here is that sending messages to a null object is valid in Objective-C, so without an explicit check it is not necessarily straightforward to discover that we do not have working rendering. (because the application won't just simply crash) Do the right thing now and return false like other backends do. Task-number: QTBUG-78994 Change-Id: I0d3c4a49a3fc78f9149f8af4fe67d581e74daae7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhimetal.mm')
-rw-r--r--src/gui/rhi/qrhimetal.mm5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index e55513277b..9c579ebfe1 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -367,6 +367,11 @@ bool QRhiMetal::create(QRhi::Flags flags)
else
d->dev = MTLCreateSystemDefaultDevice();
+ if (!d->dev) {
+ qWarning("No MTLDevice");
+ return false;
+ }
+
qCDebug(QRHI_LOG_INFO, "Metal device: %s", qPrintable(QString::fromNSString([d->dev name])));
if (importedCmdQueue)