Commit 0cd9200e authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

d3d11_fmt: move the DXGI debug handling in D3D11_CreateDevice

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 0bcdc1c4
......@@ -93,10 +93,6 @@ vlc_module_end()
#endif /* __MINGW32__ */
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
# include <dxgidebug.h>
#endif
DEFINE_GUID(DXVA_Intel_H264_NoFGT_ClearVideo, 0x604F8E68, 0x4951, 0x4c54, 0x88, 0xFE, 0xAB, 0xD2, 0x5C, 0x15, 0xB3, 0xD6);
DEFINE_GUID(DXVA2_NoEncrypt, 0x1b81bed0, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5);
......@@ -111,10 +107,6 @@ struct vlc_va_sys_t
d3d11_handle_t hd3d;
d3d11_device_t d3d_dev;
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
HINSTANCE dxgidebug_dll;
#endif
/* Video service */
ID3D11VideoContext *d3dvidctx;
DXGI_FORMAT render;
......@@ -313,11 +305,6 @@ static void Close(vlc_va_t *va, void **ctx)
D3D11_Destroy( &sys->hd3d );
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
if (sys->dxgidebug_dll)
FreeLibrary(sys->dxgidebug_dll);
#endif
free((char *)va->description);
free(sys);
}
......@@ -337,10 +324,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
if (unlikely(sys == NULL))
return VLC_ENOMEM;
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
sys->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL"));
#endif
dx_sys = &sys->dx_sys;
dx_sys->va_pool.pf_create_device = D3dCreateDevice;
......@@ -445,20 +428,6 @@ static int D3dCreateDevice(vlc_va_t *va)
}
sys->d3dvidctx = d3dvidctx;
#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;
hr = pf_DXGIGetDebugInterface(&IID_IDXGIDebug, (void**)&pDXGIDebug);
if (SUCCEEDED(hr) && pDXGIDebug) {
hr = IDXGIDebug_ReportLiveObjects(pDXGIDebug, DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL);
}
}
}
#endif
return VLC_SUCCESS;
}
......
......@@ -30,6 +30,10 @@
#define COBJMACROS
#include <d3d11.h>
#include <assert.h>
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
# include <initguid.h>
# include <dxgidebug.h>
#endif
#include "d3d11_fmt.h"
......@@ -430,6 +434,22 @@ int D3D11_Create(vlc_object_t *obj, d3d11_handle_t *hd3d)
msg_Warn(obj, "cannot load d3d11.dll, aborting");
return VLC_EGENERIC;
}
# if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
if (IsDebuggerPresent())
{
hd3d->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL"));
HRESULT (WINAPI * pf_DXGIGetDebugInterface)(const GUID *riid, void **ppDebug) = NULL;
if (hd3d->dxgidebug_dll)
pf_DXGIGetDebugInterface =
(void *)GetProcAddress(hd3d->dxgidebug_dll, "DXGIGetDebugInterface");
if (pf_DXGIGetDebugInterface) {
IDXGIDebug *pDXGIDebug;
if (SUCCEEDED(pf_DXGIGetDebugInterface(&IID_IDXGIDebug, (void**)&pDXGIDebug)))
IDXGIDebug_ReportLiveObjects(pDXGIDebug, DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL);
}
}
# endif
#endif
return VLC_SUCCESS;
}
......@@ -439,5 +459,10 @@ void D3D11_Destroy(d3d11_handle_t *hd3d)
#if !VLC_WINSTORE_APP
if (hd3d->hdll)
FreeLibrary(hd3d->hdll);
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
if (hd3d->dxgidebug_dll)
FreeLibrary(hd3d->dxgidebug_dll);
#endif
#endif
}
......@@ -40,6 +40,9 @@ typedef struct
{
#if !VLC_WINSTORE_APP
HINSTANCE hdll; /* handle of the opened d3d11 dll */
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
HINSTANCE dxgidebug_dll;
#endif
#endif
} d3d11_handle_t;
......
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