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>
This commit is contained in:
parent
89ec1b3618
commit
e22399af82
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user