Commit 45ff2f78 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

win32: report DXGI/Direct3D leaks on exit in debug mode

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent e492431b
......@@ -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)
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment