GODT-1438: Turn off SW OpenGL on windows and add debug info about graphic renderer.

This commit is contained in:
Jakub
2021-12-08 09:37:43 +01:00
committed by Jakub Cuth
parent f0b1ab55a2
commit 7276c23b2b

View File

@ -23,6 +23,7 @@ package qt
import (
"errors"
"os"
"runtime"
qmlLog "github.com/ProtonMail/proton-bridge/internal/frontend/qt/log"
"github.com/therecipe/qt/core"
@ -36,13 +37,22 @@ func (f *FrontendQt) initiateQtApplication() error {
f.app = widgets.NewQApplication(len(os.Args), os.Args)
if os.Getenv("QSG_INFO") != "" && os.Getenv("QSG_INFO") != "0" {
core.QLoggingCategory_SetFilterRules("qt.scenegraph.general=true")
}
core.QCoreApplication_SetApplicationName(f.programName)
core.QCoreApplication_SetApplicationVersion(f.programVersion)
// High DPI scaling for windows.
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, false)
// Software OpenGL: to avoid dedicated GPU.
core.QCoreApplication_SetAttribute(core.Qt__AA_UseSoftwareOpenGL, true)
// Use software OpenGL to avoid dedicated GPU on darwin. It cause no
// problems on linux, but it can cause initializaion issues on windows
// for some specific GPU / driver combination.
if runtime.GOOS != "windows" {
core.QCoreApplication_SetAttribute(core.Qt__AA_UseSoftwareOpenGL, true)
}
// Bridge runs background, no window is needed to be opened.
f.app.SetQuitOnLastWindowClosed(false)