qt: force OpenGL on Windows 7 if Qt >= 6.0

QRhiD3D11 uses functionality that is expected
to be not available on Windows 7. Since RHI
fallback does not work, we force OpenGL so
that it does not crash.
This commit is contained in:
Fatih Uzunoglu 2023-09-19 16:07:19 +03:00 committed by Jean-Baptiste Kempf
parent 1488db7f68
commit cbd2cf1d26
1 changed files with 20 additions and 0 deletions

View File

@ -730,6 +730,26 @@ static void *Thread( void *obj )
Q_INIT_RESOURCE( vlc );
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#ifdef _WIN32
// QSysInfo::productVersion() returns "unknown" on Windows 7
// RHI Fallback does not seem to work.
DWORD dwVersion = 0;
DWORD dwMajorVersion = 0;
DWORD dwMinorVersion = 0;
dwVersion = GetVersion();
dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
if (dwMajorVersion <= 6 && dwMinorVersion <= 1)
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
#endif
#endif
auto compositor = var_InheritString(p_intf, "qt-compositor");
vlc::CompositorFactory compositorFactory(p_intf, compositor);
free(compositor);