Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows rendering #4023

Merged
merged 4 commits into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file removed build/windows/installer/resources/opengl32sw.dll
Binary file not shown.
68 changes: 54 additions & 14 deletions src/app/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <QQmlContext>
#include <QSettings>
#include <QMessageBox>
#include <QQuickWindow>
#include <easylogging++.h>
#include <qredisclient/redisclient.h>

Expand Down Expand Up @@ -38,6 +39,7 @@ Application::Application(int &argc, char **argv)
// Init components required for models and qml
initLog();
initAppInfo();
processCmdArgs();
initAppFonts();
initRedisClient();
initUpdater();
Expand Down Expand Up @@ -121,10 +123,34 @@ void Application::registerQmlRootObjects()
}

void Application::initQml()
{
{
if (m_renderingBackend == "auto") {
#ifdef Q_OS_WIN
// Experimental
// Use DirectX 12 on Windows 10
if (QSysInfo::productVersion() == "10") {
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Direct3D12);
} else {
// Use software renderer on older versions
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
}
#endif
} else {
QQuickWindow::setSceneGraphBackend(m_renderingBackend);
}

registerQmlTypes();
registerQmlRootObjects();
m_engine.load(QUrl(QStringLiteral("qrc:///app.qml")));

try {
m_engine.load(QUrl(QStringLiteral("qrc:///app.qml")));
} catch (...) {
qDebug() << "Failed to load app window. Retrying with software renderer...";
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
m_engine.load(QUrl(QStringLiteral("qrc:///app.qml")));
}

qDebug() << "Rendering backend:" << QQuickWindow::sceneGraphBackend();
}

void Application::initLog()
Expand All @@ -148,19 +174,8 @@ void Application::initLog()

void Application::initConnectionsManager()
{
// Parse optional arguments first
QCommandLineParser parser;
QCommandLineOption settingsDir(
"settings-dir",
"(Optional) Directory where RDM looks/saves .rdm directory with connections.json file",
"settingsDir",
QDir::homePath()
);
parser.addOption(settingsDir);
parser.process(*this);

//connection manager
ConfigManager confManager(parser.value(settingsDir));
ConfigManager confManager(m_settingsDir);
if (confManager.migrateOldConfig("connections.xml", "connections.json")) {
LOG(INFO) << "Migrate connections.xml to connections.json";
}
Expand Down Expand Up @@ -236,6 +251,31 @@ void Application::installTranslator()
}
}

void Application::processCmdArgs()
{
QCommandLineParser parser;
QCommandLineOption settingsDir(
"settings-dir",
"(Optional) Directory where RDM looks/saves .rdm directory with connections.json file",
"settingsDir",
QDir::homePath()
);
QCommandLineOption renderingBackend(
"rendering-backend",
"(Optional) QML rendering backend [software|opengl|d3d12|'']",
"renderingBackend",
"auto"
);
parser.addHelpOption();
parser.addVersionOption();
parser.addOption(settingsDir);
parser.addOption(renderingBackend);
parser.process(*this);

m_settingsDir = parser.value(settingsDir);
m_renderingBackend = parser.value(renderingBackend);
}

void Application::OnNewUpdateAvailable(QString &url)
{
QMessageBox::information(nullptr, "New update available",
Expand Down
3 changes: 3 additions & 0 deletions src/app/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Application : public QApplication
void initConnectionsManager();
void initUpdater();
void installTranslator();
void processCmdArgs();

private slots:
void OnNewUpdateAvailable(QString &url);
Expand All @@ -52,4 +53,6 @@ private slots:
QSharedPointer<TabViewModel> m_consoleModel;
QSharedPointer<TabViewModel> m_serverStatsModel;
LogHandler* m_logger;
QString m_settingsDir;
QString m_renderingBackend;
};