Allow force-disabling OpenGL.

This commit is contained in:
John Preston 2021-05-20 16:07:19 +04:00
parent ca5b2e6746
commit 5e38964fbf
2 changed files with 15 additions and 0 deletions

View file

@ -16,8 +16,17 @@
#define LOG_ONCE(x) static auto logged = [&] { LOG(x); return true; };
namespace Ui::GL {
namespace {
bool ForceDisabled/* = false*/;
} // namespace
Capabilities CheckCapabilities(QWidget *widget) {
if (ForceDisabled) {
LOG_ONCE(("OpenGL: Force-disabled."));
return {};
}
auto format = QSurfaceFormat();
format.setAlphaBufferSize(8);
if (widget) {
@ -73,4 +82,8 @@ Capabilities CheckCapabilities(QWidget *widget) {
return result;
}
void ForceDisable(bool disable) {
ForceDisabled = disable;
}
} // namespace Ui::GL

View file

@ -17,4 +17,6 @@ struct Capabilities {
[[nodiscard]] Capabilities CheckCapabilities(QWidget *widget = nullptr);
void ForceDisable(bool disable);
} // namespace Ui::GL