[vlc-devel] [PATCH v2 04/16] qt: fallback when d3dcompiler is missing when using DComp

Pierre Lamot pierre at videolabs.io
Fri Aug 14 18:43:38 CEST 2020


---
 .../maininterface/compositor_dcomp_uisurface.cpp   | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp b/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
index fcf567efa5..599d4b2fc3 100644
--- a/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
+++ b/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
@@ -114,12 +114,12 @@ public:
         compile = nullptr;
     }
 
-    int init(vlc_object_t *obj)
+    bool init(vlc_object_t *obj)
     {
         m_compiler_dll = Direct3D11LoadShaderLibrary();
         if (!m_compiler_dll) {
             msg_Err(obj, "cannot load d3dcompiler.dll, aborting");
-            return VLC_EGENERIC;
+            return false;
         }
 
         compile = (pD3DCompile)GetProcAddress(m_compiler_dll, "D3DCompile");
@@ -127,9 +127,9 @@ public:
             msg_Err(obj, "Cannot locate reference to D3DCompile in d3dcompiler DLL");
             FreeLibrary(m_compiler_dll);
             m_compiler_dll = nullptr;
-            return VLC_EGENERIC;
+            return false;
         }
-        return VLC_SUCCESS;
+        return true;
     }
 
     pD3DCompile               compile = nullptr;
@@ -200,7 +200,11 @@ bool CompositorDCompositionUISurface::init()
     m_uiWindow->setClearBeforeRendering(false);
 
     m_d3dCompiler = std::make_shared<OurD3DCompiler>();
-    m_d3dCompiler->init(VLC_OBJECT(m_intf));
+    ret = m_d3dCompiler->init(VLC_OBJECT(m_intf));
+    if (!ret) {
+        msg_Err(m_intf, "failed to initialize D3D compiler");
+        return false;
+    }
 
     qreal dpr = m_rootWindow->devicePixelRatio();
     ret = initialiseD3DSwapchain(dpr * m_rootWindow->width(), dpr * m_rootWindow->height());
-- 
2.25.1



More information about the vlc-devel mailing list