[vlc-devel] [PATCH 2/2] d3d11va: only create the device with the debug flag in debug builds

Steve Lhomme robux4 at videolabs.io
Wed Jul 19 11:09:28 CEST 2017


With a debugger attached.
In UWP we can assume it's present with MS build and no debug with mingw

--
replaces https://patches.videolan.org/patch/17554/
- fix UWP build
---
 modules/codec/avcodec/d3d11va.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 699277d31c..12ee88fcb8 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -427,8 +427,17 @@ static int D3dCreateDevice(vlc_va_t *va)
 #endif
 
     UINT creationFlags = D3D11_CREATE_DEVICE_VIDEO_SUPPORT;
-#if !defined(NDEBUG) //&& defined(_MSC_VER)
-    creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
+#if !defined(NDEBUG)
+#if !VLC_WINSTORE_APP
+    if (IsDebuggerPresent())
+#endif
+    {
+        HINSTANCE sdklayer_dll = LoadLibrary(TEXT("d3d11_1sdklayers.dll"));
+        if (sdklayer_dll) {
+            creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
+            FreeLibrary(sdklayer_dll);
+        }
+    }
 #endif
 
     /* */
-- 
2.12.1



More information about the vlc-devel mailing list