[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: use QOperatingSystemVersion to probe os version in qt.cpp
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Jun 14 11:32:55 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
4fb3b6fc by Fatih Uzunoglu at 2024-06-14T11:19:04+00:00
qt: use QOperatingSystemVersion to probe os version in qt.cpp
- - - - -
c6eb30f9 by Fatih Uzunoglu at 2024-06-14T11:19:04+00:00
qt: probe and use d3d11 if available on windows 7
Drivers implementing desktop OpenGL on Windows have been known
for their notoriously bad functionality.
Windows 7 supports D3D12, D3D11 and Vulkan. If possible, we should
use these over OpenGL.
Previously we were forcing OpenGL on Windows 7 as a safe option.
The investigation showed that the features used from D3D11 by Qt
may not be supplemented in Windows 7 graphics drivers. However,
this does not mean that this is the case at all times.
- - - - -
1 changed file:
- modules/gui/qt/qt.cpp
Changes:
=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -55,6 +55,12 @@ extern "C" char **environ;
#include <QQmlError>
#include <QList>
#include <QTranslator>
+#ifdef _WIN32
+#include <QOperatingSystemVersion>
+#if __has_include(<rhi/qrhi.h>)
+#include <rhi/qrhi.h>
+#endif
+#endif
#include "qt.hpp"
@@ -63,8 +69,6 @@ extern "C" char **environ;
#include "dialogs/dialogs_provider.hpp" /* THEDP creation */
#include "dialogs/dialogs/dialogmodel.hpp"
#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
# include "maininterface/mainctx_win32.hpp"
#include "maininterface/win32windoweffects_module.hpp"
#else
@@ -837,24 +841,6 @@ static void *Thread( void *obj )
// Q_INIT_RESOURCE( qtquickshapes_shaders );
#endif
-#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
-
auto compositor = var_InheritString(p_intf, "qt-compositor");
vlc::CompositorFactory compositorFactory(p_intf, compositor);
free(compositor);
@@ -876,6 +862,30 @@ static void *Thread( void *obj )
QApplication app( argc, argv );
app.setProperty("initialStyle", app.style()->objectName());
+#if defined(_WIN32) && (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+ // TODO: Qt Quick RHI Fallback does not work (Qt 6.7.1).
+ // We have to manually pick a graphics api here for
+ // Windows 7, since it may not support the default
+ // graphics api (D3D11).
+
+ if (qEnvironmentVariableIsEmpty("QSG_RHI_BACKEND"))
+ {
+ if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8)
+ {
+ // TODO: Probe D3D12 when it becomes the default.
+ {
+#if __has_include(<rhi/qrhi.h>)
+ QRhiD3D11InitParams params;
+ if (QRhi::probe(QRhi::D3D11, ¶ms))
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11);
+ else
+#endif
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
+ }
+ }
+ }
+#endif
+
{
// Install custom translator:
const auto translator = new Translator(&app);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/182bcb9cb2111b556f223f72d9ab912eb33a4613...c6eb30f9dee18b44538e5938784d517d9ccee45d
--
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/182bcb9cb2111b556f223f72d9ab912eb33a4613...c6eb30f9dee18b44538e5938784d517d9ccee45d
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list