diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-11-27 14:10:38 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-11-28 13:44:16 +0100 |
commit | d4cab2523cae58bd864770552da0332afe45585c (patch) | |
tree | 077b78e2061a7598f4bb3cdafd524d1f6d82e9ed /src/quick/scenegraph/qsgrhisupport.cpp | |
parent | a6fe62fcb4ee219cdf0ddea7936545785d896015 (diff) |
Make the initialization failure dialog sensible with QRhi
So on Windows one now gets a message box with a reasonable message,
instead of the OpenGL nonsense. Then the application closes when pressing
Abort etc.
On other platforms there is a qFatal, printing the same message.
Involves simplifying the OpenGL version a bit since passing isES type of
flags through multiple layers is not justified here.
Task-number: QTBUG-80365
Change-Id: Ie3ea1e9395a283f7e95eda78c1d3894797ff0acf
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrhisupport.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index 38c2ef9612..afcfa53e83 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -185,29 +185,10 @@ void QSGRhiSupport::applySettings() if (m_killDeviceFrameCount > 0 && m_rhiBackend == QRhi::D3D11) qDebug("Graphics device will be reset every %d frames", m_killDeviceFrameCount); - const char *backendName = "unknown"; - switch (m_rhiBackend) { - case QRhi::Null: - backendName = "Null"; - break; - case QRhi::Vulkan: - backendName = "Vulkan"; - break; - case QRhi::OpenGLES2: - backendName = "OpenGL"; - break; - case QRhi::D3D11: - backendName = "D3D11"; - break; - case QRhi::Metal: - backendName = "Metal"; - break; - default: - break; - } + const QString backendName = rhiBackendName(); qCDebug(QSG_LOG_INFO, "Using QRhi with backend %s\n graphics API debug/validation layers: %d\n QRhi profiling and debug markers: %d", - backendName, m_debugLayer, m_profile); + qPrintable(backendName), m_debugLayer, m_profile); if (m_preferSoftwareRenderer) qCDebug(QSG_LOG_INFO, "Prioritizing software renderers"); } @@ -247,6 +228,27 @@ QSGRhiSupport *QSGRhiSupport::instance() return inst; } +QString QSGRhiSupport::rhiBackendName() const +{ + if (m_enableRhi) { + switch (m_rhiBackend) { + case QRhi::Null: + return QLatin1String("Null"); + case QRhi::Vulkan: + return QLatin1String("Vulkan"); + case QRhi::OpenGLES2: + return QLatin1String("OpenGL"); + case QRhi::D3D11: + return QLatin1String("D3D11"); + case QRhi::Metal: + return QLatin1String("Metal"); + default: + return QLatin1String("Unknown"); + } + } + return QLatin1String("Unknown (RHI not enabled)"); +} + QSGRendererInterface::GraphicsApi QSGRhiSupport::graphicsApi() const { if (!m_enableRhi) |