Allow force-disabling OpenGL.
This commit is contained in:
parent
ca5b2e6746
commit
5e38964fbf
2 changed files with 15 additions and 0 deletions
|
|
@ -16,8 +16,17 @@
|
||||||
#define LOG_ONCE(x) static auto logged = [&] { LOG(x); return true; };
|
#define LOG_ONCE(x) static auto logged = [&] { LOG(x); return true; };
|
||||||
|
|
||||||
namespace Ui::GL {
|
namespace Ui::GL {
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
bool ForceDisabled/* = false*/;
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
Capabilities CheckCapabilities(QWidget *widget) {
|
Capabilities CheckCapabilities(QWidget *widget) {
|
||||||
|
if (ForceDisabled) {
|
||||||
|
LOG_ONCE(("OpenGL: Force-disabled."));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
auto format = QSurfaceFormat();
|
auto format = QSurfaceFormat();
|
||||||
format.setAlphaBufferSize(8);
|
format.setAlphaBufferSize(8);
|
||||||
if (widget) {
|
if (widget) {
|
||||||
|
|
@ -73,4 +82,8 @@ Capabilities CheckCapabilities(QWidget *widget) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ForceDisable(bool disable) {
|
||||||
|
ForceDisabled = disable;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Ui::GL
|
} // namespace Ui::GL
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,6 @@ struct Capabilities {
|
||||||
|
|
||||||
[[nodiscard]] Capabilities CheckCapabilities(QWidget *widget = nullptr);
|
[[nodiscard]] Capabilities CheckCapabilities(QWidget *widget = nullptr);
|
||||||
|
|
||||||
|
void ForceDisable(bool disable);
|
||||||
|
|
||||||
} // namespace Ui::GL
|
} // namespace Ui::GL
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue