Skip to content

Commit

Permalink
Simplify force-switching to ANGLE mode (Fix #2471).
Browse files Browse the repository at this point in the history
  • Loading branch information
gzotti committed Jun 1, 2022
1 parent ae32fd2 commit 8673f0e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/CLIProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,28 @@ void CLIProcessor::parseCLIArgsPreConfig(const QStringList& argList)

#ifdef Q_OS_WIN
if (argsGetOption(argList, "-s", "--safe-mode"))
qApp->setProperty("onetime_mesa_mode", true);
qputenv("QT_OPENGL", "software");

if (argsGetOption(argList, "-a", "--angle-mode"))
qApp->setProperty("onetime_angle_mode", true);
qputenv("QT_OPENGL", "angle");

if (argsGetOption(argList, "-9", "--angle-d3d9"))
{
qputenv("QT_OPENGL", "angle");
qputenv("QT_ANGLE_PLATFORM", "d3d9");
qApp->setProperty("onetime_angle_mode", true);
}
if (argsGetOption(argList, "", "--angle-d3d11"))
{
qputenv("QT_OPENGL", "angle");
qputenv("QT_ANGLE_PLATFORM", "d3d11");
qApp->setProperty("onetime_angle_mode", true);
}
if (argsGetOption(argList, "", "--angle-warp"))
{
qputenv("QT_OPENGL", "angle");
qputenv("QT_ANGLE_PLATFORM", "warp");
qApp->setProperty("onetime_angle_mode", true);
}
if (argsGetOption(argList, "-m", "--mesa-mode"))
qApp->setProperty("onetime_mesa_mode", true);
qputenv("QT_OPENGL", "software");

#endif
if (argsGetOption(argList, "", "--list-landscapes"))
Expand Down
2 changes: 1 addition & 1 deletion src/StelMainView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ QSurfaceFormat StelMainView::getDesiredGLFormat() const
}

// Note: this only works if --mesa-mode was given on the command line. Auto-switch to Mesa or the driver name apparently cannot be detected at this early stage.
bool isMesa= qApp->property("onetime_mesa_mode").isValid() && (qApp->property("onetime_mesa_mode")==true);
const bool isMesa= (QString(getenv("QT_OPENGL"))=="software");

//request some sane buffer formats
fmt.setRedBufferSize(8);
Expand Down
11 changes: 0 additions & 11 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,6 @@ int main(int argc, char **argv)
// output, such as --help and --version
CLIProcessor::parseCLIArgsPreConfig(argList);

#ifdef Q_OS_WIN
if (qApp->property("onetime_angle_mode").isValid())
{
app.setAttribute(Qt::AA_UseOpenGLES, true);
}
if (qApp->property("onetime_mesa_mode").isValid())
{
app.setAttribute(Qt::AA_UseSoftwareOpenGL, true);
}
#endif

// Start logging.
StelLogger::init(StelFileMgr::getUserDir()+"/log.txt");
StelLogger::writeLog(argStr);
Expand Down

0 comments on commit 8673f0e

Please sign in to comment.