[vlc-commits] [Git][videolan/vlc][master] qt: do not request debug layers if not applicable in rhi d3d11 probing

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jul 25 05:36:09 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
270e8b01 by Fatih Uzunoglu at 2026-07-25T05:10:07+00:00
qt: do not request debug layers if not applicable in rhi d3d11 probing

Although Qt (`qrhid3d11.cpp`) has the following check, Windows 7 with
the platform update returns generic error code rather than the error
code Qt checks (`DXGI_ERROR_SDK_COMPONENT_MISSING`) if debug layers
is not available.

```
// We cannot assume that D3D11_CREATE_DEVICE_DEBUG is always available. Retry without it, if needed.
if (hr == DXGI_ERROR_SDK_COMPONENT_MISSING && debugLayer) {
...
}
```

- - - - -


1 changed file:

- modules/gui/qt/qt.cpp


Changes:

=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -63,10 +63,10 @@ extern "C" char **environ;
 #include <QOperatingSystemVersion>
 #include <QThreadPool>
 #include "util/asynctask.hpp"
-#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0)
 #include <rhi/qrhi.h>
 #include <QOffscreenSurface>
-#endif
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
 #endif
 
 #include "qt.hpp"
@@ -981,11 +981,23 @@ static void *Thread( void *obj )
 
         // TODO: Investigate if we should use D3D12. Currently it is not the default by
         //       Qt (as of Qt 6.8), and is not as battle tested as the default D3D11.
+#ifndef NDEBUG
+        const bool d3d11SdkLayersAvailable = []() {
+            std::unique_ptr<std::remove_pointer_t<HMODULE>, BOOL WINAPI (*)(HMODULE)>
+                d3d11sdklayerslib(::LoadLibraryEx(TEXT("d3d11_1sdklayers.dll"), nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32), ::FreeLibrary);
+
+            if (d3d11sdklayerslib)
+                return true;
+            else
+                return false;
+        }();
+#endif
 
         {
             QRhiD3D11InitParams params;
 #ifndef NDEBUG
-            params.enableDebugLayer = true;
+            if (d3d11SdkLayersAvailable)
+                params.enableDebugLayer = true;
 #endif
             if (QRhi::probe(QRhi::D3D11, &params))
             {
@@ -1019,7 +1031,8 @@ static void *Thread( void *obj )
             // as what `::probe()` does, at least for DirectX:
             QRhiD3D11InitParams params;
 #ifndef NDEBUG
-            params.enableDebugLayer = true;
+            if (d3d11SdkLayersAvailable)
+                params.enableDebugLayer = true;
 #endif
             QRhi *rhi = QRhi::create(QRhi::D3D11, &params, QRhi::PreferSoftwareRenderer);
             if (rhi)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/270e8b014e711573d272eae4355d1a3623a4893a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/270e8b014e711573d272eae4355d1a3623a4893a
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list