[vlc-commits] [Git][videolan/vlc][master] qt: extend Qt RHI fallback to software renderer

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Jul 29 06:12:30 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6ca4e0cf by Fatih Uzunoglu at 2024-07-29T05:56:48+00:00
qt: extend Qt RHI fallback to software renderer

Instead of stopping the fallback at OpenGL, probe
OpenGL as well and use software renderer if OpenGL
is not functional (probe test fails).

Old machines that use Windows 7 may not support
the features used by Qt for its OpenGL abstraction.

- - - - -


1 changed file:

- modules/gui/qt/qt.cpp


Changes:

=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -59,6 +59,7 @@ extern "C" char **environ;
 #include <QOperatingSystemVersion>
 #if __has_include(<rhi/qrhi.h>)
 #include <rhi/qrhi.h>
+#include <QOffscreenSurface>
 #endif
 #endif
 
@@ -907,13 +908,22 @@ static void *Thread( void *obj )
         {
             // TODO: Probe D3D12 when it becomes the default.
             {
+                // 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, &params))
-                    QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11);
+                    graphicsApi = QSGRendererInterface::Direct3D11;
                 else
+                {
+                    QRhiGles2InitParams params1;
+                    params1.fallbackSurface = QRhiGles2InitParams::newFallbackSurface();
+                    if (!QRhi::probe(QRhi::OpenGLES2, &params1))
+                        graphicsApi = QSGRendererInterface::Software;
+                    delete params1.fallbackSurface;
+                }
 #endif
-                    QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
+                QQuickWindow::setGraphicsApi(graphicsApi);
             }
         }
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6ca4e0cf6fcb2761df5217b76f22a58a2e3a6292

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6ca4e0cf6fcb2761df5217b76f22a58a2e3a6292
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