Qt: Do some basic filtering on too-minimal OpenGL 1.x implementations

This commit is contained in:
Vicki Pfau 2021-11-18 23:21:04 -08:00
parent dfd44b280f
commit 0086599290
1 changed files with 17 additions and 1 deletions

View File

@ -11,6 +11,7 @@
#include <QMutexLocker>
#include <QOffscreenSurface>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include <QOpenGLPaintDevice>
#include <QResizeEvent>
#include <QScreen>
@ -125,7 +126,22 @@ bool DisplayGL::supportsFormat(const QSurfaceFormat& format) {
context.format().profile() == QSurfaceFormat::CompatibilityProfile ||
context.format().testOption(QSurfaceFormat::DeprecatedFunctions))) {
// Supports the old stuff
s_supports[format] = true;
QOffscreenSurface surface;
surface.create();
if (!context.makeCurrent(&surface)) {
s_supports[format] = false;
return false;
}
#ifdef Q_OS_WIN
QLatin1String renderer(reinterpret_cast<const char*>(context.functions()->glGetString(GL_RENDERER)));
if (renderer == "GDI Generic") {
// Windows' software OpenGL 1.1 implementation is not sufficient
s_supports[format] = false;
return false;
}
#endif
s_supports[format] = context,hasExtension("GL_EXT_blend_color"); // Core as of 1.2
context.doneCurrent();
} else if (!context.isOpenGLES() && format.version() >= qMakePair(2, 1) && foundVersion < qMakePair(3, 0) && foundVersion >= qMakePair(2, 1)) {
// Weird edge case we support if ARB_framebuffer_object is present
QOffscreenSurface surface;