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

Steve Lhomme robux4 at videolabs.io
Wed Jul 19 10:45:58 CEST 2017


With a debugger attached
---
 modules/codec/avcodec/d3d11va.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 699277d31c..7e363fa3aa 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -427,8 +427,14 @@ 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 (IsDebuggerPresent()) {
+        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