From 178c1a6243b556fe580047f716e7a0399a1597fa Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 4 Feb 2022 22:05:35 +0100 Subject: rhi: Add the long-pending probe() helper, with backing for Metal There is a TODO for this in Qt Quick from the 6.0 times. To decide upfront if Metal can be expected to function, or if a fallback to OpenGL needs to be triggered (especially important with macOS virtual machines, where, unlike any real macOS system, Metal may not be present at all), the scenegraph calls create() and then drops the result. The idea to make this less wasteful was back then to add a dedicated probing function which can, possibly, perform the checks in a more lightweight manner than full initialization. Implement this now, focusing on Metal. Brought to attention by QTBUG-100441: printing warnings about not having an MTLDevice is confusing in a Metal-less macOS VM, because it is not an actual error, only part of the probing at scenegraph initialization. We can now avoid printing confusing warnings there. Change-Id: Ie52c36af9224bedc3f5e4c23edb486d961c9f216 Reviewed-by: Qt CI Bot Reviewed-by: Andy Nichols --- src/gui/rhi/qrhi_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gui/rhi/qrhi_p.h') diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index 972aed6fd8..c96b773e0b 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -1711,6 +1711,7 @@ public: QRhiInitParams *params, Flags flags = {}, QRhiNativeHandles *importDevice = nullptr); + static bool probe(Implementation impl, QRhiInitParams *params); Implementation backend() const; const char *backendName() const; -- cgit v1.2.3