Windows QPA: Don't test for Desktop GL if Qt::AA_UseDesktopOpenGL is set
Pass the requested render to detectSupportedRenderers(), replacing the bool glesOnly parameters. This allows for simplifying the code. Fixes: QTBUG-70733 Change-Id: Iab65f62d24bf750019180e3b00e2d23c105e5997 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
47bbc6d6f6
commit
05e2690009
@ -393,7 +393,7 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate()
|
||||
switch (requestedRenderer) {
|
||||
case QWindowsOpenGLTester::DesktopGl:
|
||||
if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) {
|
||||
if ((QWindowsOpenGLTester::supportedRenderers() & QWindowsOpenGLTester::DisableRotationFlag)
|
||||
if ((QWindowsOpenGLTester::supportedRenderers(requestedRenderer) & QWindowsOpenGLTester::DisableRotationFlag)
|
||||
&& !QWindowsScreen::setOrientationPreference(Qt::LandscapeOrientation)) {
|
||||
qCWarning(lcQpaGl, "Unable to disable rotation.");
|
||||
}
|
||||
@ -407,19 +407,19 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate()
|
||||
case QWindowsOpenGLTester::AngleRendererD3d11Warp:
|
||||
return QWindowsEGLStaticContext::create(requestedRenderer);
|
||||
case QWindowsOpenGLTester::Gles:
|
||||
return QWindowsEGLStaticContext::create(QWindowsOpenGLTester::supportedGlesRenderers());
|
||||
return QWindowsEGLStaticContext::create(requestedRenderer);
|
||||
case QWindowsOpenGLTester::SoftwareRasterizer:
|
||||
if (QWindowsStaticOpenGLContext *swCtx = QOpenGLStaticContext::create(true))
|
||||
return swCtx;
|
||||
qCWarning(lcQpaGl, "Software OpenGL failed. Falling back to system OpenGL.");
|
||||
if (QWindowsOpenGLTester::supportedRenderers() & QWindowsOpenGLTester::DesktopGl)
|
||||
if (QWindowsOpenGLTester::supportedRenderers(requestedRenderer) & QWindowsOpenGLTester::DesktopGl)
|
||||
return QOpenGLStaticContext::create();
|
||||
return nullptr;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers();
|
||||
const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers(requestedRenderer);
|
||||
if (supportedRenderers.testFlag(QWindowsOpenGLTester::DisableProgramCacheFlag)
|
||||
&& !QCoreApplication::testAttribute(Qt::AA_DisableShaderDiskCache)) {
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache);
|
||||
@ -441,7 +441,7 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate()
|
||||
#elif defined(QT_OPENGL_ES_2)
|
||||
QWindowsOpenGLTester::Renderers glesRenderers = QWindowsOpenGLTester::requestedGlesRenderer();
|
||||
if (glesRenderers == QWindowsOpenGLTester::InvalidRenderer)
|
||||
glesRenderers = QWindowsOpenGLTester::supportedGlesRenderers();
|
||||
glesRenderers = QWindowsOpenGLTester::supportedRenderers(QWindowsOpenGLTester::AngleRendererD3d11);
|
||||
return QWindowsEGLStaticContext::create(glesRenderers);
|
||||
#elif !defined(QT_NO_OPENGL)
|
||||
return QOpenGLStaticContext::create();
|
||||
|
@ -247,11 +247,12 @@ typedef QHash<QOpenGLConfig::Gpu, QWindowsOpenGLTester::Renderers> SupportedRend
|
||||
Q_GLOBAL_STATIC(SupportedRenderersCache, supportedRenderersCache)
|
||||
#endif
|
||||
|
||||
QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly)
|
||||
QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(const GpuDescription &gpu,
|
||||
Renderer requested)
|
||||
{
|
||||
Q_UNUSED(gpu)
|
||||
Q_UNUSED(glesOnly)
|
||||
#if defined(QT_NO_OPENGL)
|
||||
Q_UNUSED(gpu)
|
||||
Q_UNUSED(requested)
|
||||
return 0;
|
||||
#else
|
||||
QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion, gpu.description);
|
||||
@ -265,8 +266,11 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
|
||||
| QWindowsOpenGLTester::AngleRendererD3d11Warp
|
||||
| QWindowsOpenGLTester::SoftwareRasterizer);
|
||||
|
||||
if (!glesOnly && testDesktopGL())
|
||||
result |= QWindowsOpenGLTester::DesktopGl;
|
||||
// Don't test for GL if explicitly requested or GLES only is requested
|
||||
if (requested == DesktopGl
|
||||
|| ((requested & GlesMask) == 0 && testDesktopGL())) {
|
||||
result |= QWindowsOpenGLTester::DesktopGl;
|
||||
}
|
||||
|
||||
const char bugListFileVar[] = "QT_OPENGL_BUGLIST";
|
||||
QString buglistFileName = QStringLiteral(":/qt-project.org/windows/openglblacklists/default.json");
|
||||
@ -310,19 +314,11 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
|
||||
#endif // !QT_NO_OPENGL
|
||||
}
|
||||
|
||||
QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedGlesRenderers()
|
||||
QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers(Renderer requested)
|
||||
{
|
||||
const GpuDescription gpu = GpuDescription::detect();
|
||||
const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, true);
|
||||
qCDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result;
|
||||
return result;
|
||||
}
|
||||
|
||||
QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers()
|
||||
{
|
||||
const GpuDescription gpu = GpuDescription::detect();
|
||||
const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, false);
|
||||
qCDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result;
|
||||
const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, requested);
|
||||
qCDebug(lcQpaGl) << __FUNCTION__ << gpu << requested << "renderer: " << result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -91,11 +91,10 @@ public:
|
||||
static Renderer requestedGlesRenderer();
|
||||
static Renderer requestedRenderer();
|
||||
|
||||
static Renderers supportedGlesRenderers();
|
||||
static Renderers supportedRenderers();
|
||||
static QWindowsOpenGLTester::Renderers supportedRenderers(Renderer requested);
|
||||
|
||||
private:
|
||||
static QWindowsOpenGLTester::Renderers detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly);
|
||||
static Renderers detectSupportedRenderers(const GpuDescription &gpu, Renderer requested);
|
||||
static bool testDesktopGL();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user