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 {
|
||||
|
||||
bool ForceDisabled/* = false*/;
|
||||
bool LastCheckCrashed/* = false*/;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
ANGLE ResolvedANGLE/* = ANGLE::Auto*/;
|
||||
|
|
@ -59,9 +60,14 @@ void CrashCheckStart() {
|
|||
const char kOptionAllowLinuxNvidiaOpenGL[] = "allow-linux-nvidia-opengl";
|
||||
|
||||
Capabilities CheckCapabilities(QWidget *widget, bool avoidWidgetCreation) {
|
||||
if (!Platform::IsMac()) {
|
||||
if (ForceDisabled) {
|
||||
LOG_ONCE(("OpenGL: Force-disabled."));
|
||||
return {};
|
||||
} else if (LastCheckCrashed) {
|
||||
LOG_ONCE(("OpenGL: Last-crashed."));
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
[[maybe_unused]] static const auto BugListInited = [] {
|
||||
|
|
@ -243,8 +249,17 @@ Backend ChooseBackendDefault(Capabilities capabilities) {
|
|||
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() {
|
||||
return QFile::exists(Integration::Instance().openglCheckFilePath());
|
||||
DetectLastCheckCrash();
|
||||
return LastCheckCrashed;
|
||||
}
|
||||
|
||||
void CrashCheckFinish() {
|
||||
|
|
@ -252,8 +267,10 @@ void CrashCheckFinish() {
|
|||
}
|
||||
|
||||
void ForceDisable(bool disable) {
|
||||
if (!Platform::IsMac()) {
|
||||
ForceDisabled = disable;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ struct Capabilities {
|
|||
|
||||
void ForceDisable(bool disable);
|
||||
|
||||
void DetectLastCheckCrash();
|
||||
[[nodiscard]] bool LastCrashCheckFailed();
|
||||
void CrashCheckFinish();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue