[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: use `QT_VERSION_CHECK` rather than `__has_include` in qt.cpp
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Aug 17 05:42:11 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a1576a73 by Fatih Uzunoglu at 2024-08-17T05:24:26+00:00
qt: use `QT_VERSION_CHECK` rather than `__has_include` in qt.cpp
- - - - -
0dbfb4b9 by Fatih Uzunoglu at 2024-08-17T05:24:26+00:00
qt: extend RHI fallback to ensure D3D_FEATURE_LEVEL_11_1 is satisfied
Currently, the fallback procedure is only applied when
Windows version is older than 8.1. However, there is
no guarantee that `D3D_FEATURE_LEVEL_11_1` is supported
even with newer Windows versions.
- - - - -
1 changed file:
- modules/gui/qt/qt.cpp
Changes:
=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -57,7 +57,7 @@ extern "C" char **environ;
#include <QTranslator>
#ifdef _WIN32
#include <QOperatingSystemVersion>
-#if __has_include(<rhi/qrhi.h>)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
#include <rhi/qrhi.h>
#include <QOffscreenSurface>
#endif
@@ -896,35 +896,40 @@ static void *Thread( void *obj )
QApplication app( argc, argv );
app.setProperty("initialStyle", app.style()->objectName());
-#if defined(_WIN32) && (_WIN32_WINNT < _WIN32_WINNT_WINBLUE)
+#if defined(_WIN32)
// TODO: Qt Quick RHI Fallback does not work (Qt 6.7.1).
- // We have to manually pick a graphics api here for
- // Windows 7 and Windows 8, since it may not support
- // the default graphics api (Direct3D 11.2).
+ // D3D_FEATURE_LEVEL_11_1, which is required by Qt
+ // may not be supported. In order to avoid crash,
+ // fallback to OpenGL, or Software mode.
if (qEnvironmentVariableIsEmpty("QSG_RHI_BACKEND") && qEnvironmentVariableIsEmpty("QT_QUICK_BACKEND"))
{
- if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1)
+ // If OS version is lower than Windows 8.1, and Qt version is lower than
+ // 6.6.0, do not take risk and use OpenGL (since probing is not available).
+ // If OS version is greater than or equal to Windows 8.1, and Qt version is
+ // lower than 6.6.0, take risk and do not use the fallback procedure.
+ // Qt in the contribs is already version 6.7.0, so this should not be a
+ // concern.
+ if ((QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1) ||
+ (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)))
{
// TODO: Probe D3D12 when it becomes the default.
+ // If probing is not available, use OpenGL as a compromise:
+ QSGRendererInterface::GraphicsApi graphicsApi = QSGRendererInterface::OpenGL;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
+ QRhiD3D11InitParams params;
+ if (QRhi::probe(QRhi::D3D11, ¶ms))
+ graphicsApi = QSGRendererInterface::Direct3D11;
+ else
{
- // If probing is not available, use OpenGL as a compromise:
- QSGRendererInterface::GraphicsApi graphicsApi = QSGRendererInterface::OpenGL;
-#if __has_include(<rhi/qrhi.h>)
- QRhiD3D11InitParams params;
- if (QRhi::probe(QRhi::D3D11, ¶ms))
- graphicsApi = QSGRendererInterface::Direct3D11;
- else
- {
- QRhiGles2InitParams params1;
- params1.fallbackSurface = QRhiGles2InitParams::newFallbackSurface();
- if (!QRhi::probe(QRhi::OpenGLES2, ¶ms1))
- graphicsApi = QSGRendererInterface::Software;
- delete params1.fallbackSurface;
- }
-#endif
- QQuickWindow::setGraphicsApi(graphicsApi);
+ QRhiGles2InitParams params1;
+ params1.fallbackSurface = QRhiGles2InitParams::newFallbackSurface();
+ if (!QRhi::probe(QRhi::OpenGLES2, ¶ms1))
+ graphicsApi = QSGRendererInterface::Software;
+ delete params1.fallbackSurface;
}
+#endif
+ QQuickWindow::setGraphicsApi(graphicsApi);
}
}
#endif
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/380feb815e02a580ec6f9a7bdab900b023e867d7...0dbfb4b9d41ccd7bd7263bb0f343e3070aeb085d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/380feb815e02a580ec6f9a7bdab900b023e867d7...0dbfb4b9d41ccd7bd7263bb0f343e3070aeb085d
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