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

Steve Lhomme git at videolan.org
Fri Jul 21 13:56:22 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Jul 19 11:09:28 2017 +0200| [f39ca0188a8eab62b840dbfadd345a89ffe1b29c] | committer: Jean-Baptiste Kempf

d3d11va: only create the device with the debug flag in debug builds

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

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f39ca0188a8eab62b840dbfadd345a89ffe1b29c
---

 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
 
     /* */



More information about the vlc-commits mailing list