Separate ForceDisable from LastCheckCrashed.
This commit is contained in:
parent
f1d0a67d41
commit
b21a93f3ba
2 changed files with 23 additions and 5 deletions
|
|
@ -33,6 +33,7 @@ namespace Ui::GL {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool ForceDisabled/* = false*/;
|
bool ForceDisabled/* = false*/;
|
||||||
|
bool LastCheckCrashed/* = false*/;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
ANGLE ResolvedANGLE/* = ANGLE::Auto*/;
|
ANGLE ResolvedANGLE/* = ANGLE::Auto*/;
|
||||||
|
|
@ -59,9 +60,14 @@ void CrashCheckStart() {
|
||||||
const char kOptionAllowLinuxNvidiaOpenGL[] = "allow-linux-nvidia-opengl";
|
const char kOptionAllowLinuxNvidiaOpenGL[] = "allow-linux-nvidia-opengl";
|
||||||
|
|
||||||
Capabilities CheckCapabilities(QWidget *widget, bool avoidWidgetCreation) {
|
Capabilities CheckCapabilities(QWidget *widget, bool avoidWidgetCreation) {
|
||||||
if (ForceDisabled) {
|
if (!Platform::IsMac()) {
|
||||||
LOG_ONCE(("OpenGL: Force-disabled."));
|
if (ForceDisabled) {
|
||||||
return {};
|
LOG_ONCE(("OpenGL: Force-disabled."));
|
||||||
|
return {};
|
||||||
|
} else if (LastCheckCrashed) {
|
||||||
|
LOG_ONCE(("OpenGL: Last-crashed."));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[[maybe_unused]] static const auto BugListInited = [] {
|
[[maybe_unused]] static const auto BugListInited = [] {
|
||||||
|
|
@ -243,8 +249,17 @@ Backend ChooseBackendDefault(Capabilities capabilities) {
|
||||||
return use ? Backend::OpenGL : Backend::Raster;
|
return use ? Backend::OpenGL : Backend::Raster;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DetectLastCheckCrash() {
|
||||||
|
[[maybe_unused]] static const auto Once = [] {
|
||||||
|
LastCheckCrashed = !Platform::IsMac()
|
||||||
|
&& QFile::exists(Integration::Instance().openglCheckFilePath());
|
||||||
|
return false;
|
||||||
|
}();
|
||||||
|
}
|
||||||
|
|
||||||
bool LastCrashCheckFailed() {
|
bool LastCrashCheckFailed() {
|
||||||
return QFile::exists(Integration::Instance().openglCheckFilePath());
|
DetectLastCheckCrash();
|
||||||
|
return LastCheckCrashed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrashCheckFinish() {
|
void CrashCheckFinish() {
|
||||||
|
|
@ -252,7 +267,9 @@ void CrashCheckFinish() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForceDisable(bool disable) {
|
void ForceDisable(bool disable) {
|
||||||
ForceDisabled = disable;
|
if (!Platform::IsMac()) {
|
||||||
|
ForceDisabled = disable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ struct Capabilities {
|
||||||
|
|
||||||
void ForceDisable(bool disable);
|
void ForceDisable(bool disable);
|
||||||
|
|
||||||
|
void DetectLastCheckCrash();
|
||||||
[[nodiscard]] bool LastCrashCheckFailed();
|
[[nodiscard]] bool LastCrashCheckFailed();
|
||||||
void CrashCheckFinish();
|
void CrashCheckFinish();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue