2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Allow to choose ANGLE backend.

This commit is contained in:
John Preston
2021-07-01 10:47:29 +03:00
parent e71fc60d22
commit 18b48df9ce
7 changed files with 99 additions and 23 deletions

View File

@@ -58,6 +58,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_lock_widgets.h"
#include "history/history_location_manager.h"
#include "ui/widgets/tooltip.h"
#include "ui/gl/gl_detection.h"
#include "ui/image/image.h"
#include "ui/text/text_options.h"
#include "ui/emoji_config.h"
@@ -281,8 +282,7 @@ void Application::run() {
LOG(("Shortcuts Error: %1").arg(error));
}
if (!Platform::IsMac()
&& Ui::Integration::Instance().openglLastCheckFailed()) {
if (!Platform::IsMac() && Ui::GL::LastCrashCheckFailed()) {
showOpenGLCrashNotification();
}
@@ -297,14 +297,14 @@ void Application::run() {
void Application::showOpenGLCrashNotification() {
const auto enable = [=] {
Ui::GL::ForceDisable(false);
Ui::Integration::Instance().openglCheckFinish();
Ui::GL::CrashCheckFinish();
Core::App().settings().setDisableOpenGL(false);
Local::writeSettings();
App::restart();
};
const auto keepDisabled = [=] {
Ui::GL::ForceDisable(true);
Ui::Integration::Instance().openglCheckFinish();
Ui::GL::CrashCheckFinish();
Core::App().settings().setDisableOpenGL(true);
Local::writeSettings();
};

View File

@@ -549,7 +549,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
_disableOpenGL = (disableOpenGL == 1);
if (!Platform::IsMac()) {
Ui::GL::ForceDisable(_disableOpenGL
|| Ui::Integration::Instance().openglLastCheckFailed());
|| Ui::GL::LastCrashCheckFailed());
}
_groupCallNoiseSuppression = (groupCallNoiseSuppression == 1);
const auto uncheckedWorkMode = static_cast<WorkMode>(workMode);

View File

@@ -88,6 +88,10 @@ const auto kBadPrefix = u"http://"_q;
return cWorkingDir() + "tdata/opengl_crash_check";
}
[[nodiscard]] QString ANGLEBackendFilePath() {
return cWorkingDir() + "tdata/angle_backend";
}
} // namespace
void UiIntegration::postponeCall(FnMut<void()> &&callable) {
@@ -106,20 +110,12 @@ QString UiIntegration::emojiCacheFolder() {
return cWorkingDir() + "tdata/emoji";
}
void UiIntegration::openglCheckStart() {
auto f = QFile(OpenGLCheckFilePath());
if (f.open(QIODevice::WriteOnly)) {
f.write("1", 1);
f.close();
}
QString UiIntegration::openglCheckFilePath() {
return OpenGLCheckFilePath();
}
void UiIntegration::openglCheckFinish() {
QFile::remove(OpenGLCheckFilePath());
}
bool UiIntegration::openglLastCheckFailed() {
return OpenGLLastCheckFailed();
QString UiIntegration::angleBackendFilePath() {
return ANGLEBackendFilePath();
}
void UiIntegration::textActionsUpdated() {

View File

@@ -37,10 +37,8 @@ public:
void unregisterLeaveSubscription(not_null<QWidget*> widget) override;
QString emojiCacheFolder() override;
void openglCheckStart() override;
void openglCheckFinish() override;
bool openglLastCheckFailed() override;
QString openglCheckFilePath() override;
QString angleBackendFilePath() override;
void textActionsUpdated() override;
void activationFromTopPanel() override;