Rework OpenGL check to avoid potential problems
A few versions of the Windows Intel drivers seem to crash while performing the OpenGL check; re-order the code to try and prevent this. Sentry-Id: FLIGHTGEAR-K7R
This commit is contained in:
parent
335d0003cc
commit
2178de9d0d
1 changed files with 20 additions and 13 deletions
|
@ -276,26 +276,33 @@ OpenGLStatus checkForWorkingOpenGL()
|
||||||
return OpenGLStatus::Unknown;
|
return OpenGLStatus::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// from here on, we need to ensure orderly cleanup or some drivers
|
||||||
|
// crash. So we can't early return.
|
||||||
|
|
||||||
|
OpenGLStatus result = OpenGLStatus::Unknown;
|
||||||
QOffscreenSurface offSurface;
|
QOffscreenSurface offSurface;
|
||||||
offSurface.setFormat(ctx.format()); // ensure it's compatible
|
offSurface.setFormat(ctx.format()); // ensure it's compatible
|
||||||
offSurface.create();
|
offSurface.create();
|
||||||
if (!ctx.makeCurrent(&offSurface)) {
|
|
||||||
return OpenGLStatus::Unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string renderer = (char*)glGetString(GL_RENDERER);
|
if (ctx.makeCurrent(&offSurface)) {
|
||||||
if (renderer == "GDI Generic") {
|
result = OpenGLStatus::OpenGL21;
|
||||||
flightgear::addSentryBreadcrumb("Detected GDI generic renderer", "info");
|
std::string renderer = (char*)glGetString(GL_RENDERER);
|
||||||
return OpenGLStatus::GDIGeneric;
|
if (renderer == "GDI Generic") {
|
||||||
} else if (simgear::strutils::starts_with(renderer, "Intel")) {
|
flightgear::addSentryBreadcrumb("Detected GDI generic renderer", "info");
|
||||||
if (ctx.format().majorVersion() < 2) {
|
result = OpenGLStatus::GDIGeneric;
|
||||||
flightgear::addSentryBreadcrumb("Detected Intel < 2.1 renderer", "info");
|
} else if (simgear::strutils::starts_with(renderer, "Intel")) {
|
||||||
return OpenGLStatus::Intel14;
|
if (ctx.format().majorVersion() < 2) {
|
||||||
|
flightgear::addSentryBreadcrumb("Detected Intel < 2.1 renderer", "info");
|
||||||
|
result = OpenGLStatus::Intel14;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// not worried about 2.0
|
|
||||||
|
// ensure the context is no longer current on the offscreen
|
||||||
|
ctx.doneCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return OpenGLStatus::OpenGL21;
|
offSurface.destroy();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // of anonymous namespace
|
} // of anonymous namespace
|
||||||
|
|
Loading…
Reference in a new issue