From d4cab2523cae58bd864770552da0332afe45585c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 27 Nov 2019 14:10:38 +0100 Subject: 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 --- src/quick/scenegraph/qsgrhisupport.cpp | 44 ++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'src/quick/scenegraph/qsgrhisupport.cpp') 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) -- cgit v1.2.3