vlc | branch: master | Steve Lhomme <[email protected]> | Tue Oct 4 15:08:05 2016 +0200| [45ff2f78e63941eac0d0141c67181287b9880edf] | committer: Jean-Baptiste Kempf
win32: report DXGI/Direct3D leaks on exit in debug mode Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45ff2f78e63941eac0d0141c67181287b9880edf --- modules/video_output/win32/common.c | 22 ++++++++++++++++++++++ modules/video_output/win32/common.h | 7 +++++++ 2 files changed, 29 insertions(+) diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c index cbd236d..e822e40 100644 --- a/modules/video_output/win32/common.c +++ b/modules/video_output/win32/common.c @@ -39,6 +39,10 @@ #include <assert.h> #define COBJMACROS +#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H) +# define INITGUID +# include <dxgidebug.h> +#endif #include <shobjidl.h> #include "common.h" @@ -108,6 +112,9 @@ int CommonInit(vout_display_t *vd) DisableScreensaver (vd); #endif +#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H) + sys->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL")); +#endif return VLC_SUCCESS; } @@ -355,6 +362,21 @@ void CommonClean(vout_display_t *vd) } RestoreScreensaver(vd); + +#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H) + HRESULT (WINAPI * pf_DXGIGetDebugInterface)(const GUID *riid, void **ppDebug); + if (sys->dxgidebug_dll) { + pf_DXGIGetDebugInterface = (void *)GetProcAddress(sys->dxgidebug_dll, "DXGIGetDebugInterface"); + if (pf_DXGIGetDebugInterface) { + IDXGIDebug *pDXGIDebug = NULL; + HRESULT hr = pf_DXGIGetDebugInterface(&IID_IDXGIDebug, (void**)&pDXGIDebug); + if (SUCCEEDED(hr) && pDXGIDebug) { + hr = IDXGIDebug_ReportLiveObjects(pDXGIDebug, DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL); + } + } + FreeLibrary(sys->dxgidebug_dll); + } +#endif } void CommonManage(vout_display_t *vd) diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h index e626035..8dc980c 100644 --- a/modules/video_output/win32/common.h +++ b/modules/video_output/win32/common.h @@ -41,6 +41,9 @@ #ifdef MODULE_NAME_IS_direct2d # include <d2d1.h> #endif +#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H) +# include <dxgidebug.h> +#endif /***************************************************************************** * event_thread_t: event thread @@ -95,6 +98,10 @@ struct vout_display_sys_t /* size of the overall window (including black bands) */ RECT rect_parent; +# if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H) + HINSTANCE dxgidebug_dll; +# endif + unsigned changes; /* changes made to the video display */ /* Misc */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
