Skip to content
Snippets Groups Projects
Commit 97bd7ac8 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

d3d11_fmt: make the d3d11_handle_t private

It's not used outside and doesn't need to be shared.
parent 1e2212b1
No related branches found
No related tags found
No related merge requests found
......@@ -223,6 +223,17 @@ static void D3D11_GetDriverVersion(vlc_object_t *obj, d3d11_device_t *d3d_dev)
}
#endif /* VLC_WINSTORE_APP */
typedef struct
{
#if !VLC_WINSTORE_APP
HINSTANCE hdll; /* handle of the opened d3d11 dll */
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
HINSTANCE dxgidebug_dll;
HRESULT (WINAPI * pf_DXGIGetDebugInterface)(const GUID *riid, void **ppDebug);
#endif
#endif
} d3d11_handle_t;
typedef struct {
struct {
void *opaque;
......@@ -233,6 +244,51 @@ typedef struct {
d3d11_decoder_device_t dec_device;
} d3d11_decoder_device;
static int D3D11_Create(vlc_object_t *obj, d3d11_handle_t *hd3d)
{
#if !VLC_WINSTORE_APP
hd3d->hdll = LoadLibrary(TEXT("D3D11.DLL"));
if (!hd3d->hdll)
{
msg_Warn(obj, "cannot load d3d11.dll, aborting");
return VLC_EGENERIC;
}
# if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
hd3d->dxgidebug_dll = NULL;
hd3d->pf_DXGIGetDebugInterface = NULL;
if (IsDebuggerPresent())
{
hd3d->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL"));
if (hd3d->dxgidebug_dll)
{
hd3d->pf_DXGIGetDebugInterface =
(void *)GetProcAddress(hd3d->dxgidebug_dll, "DXGIGetDebugInterface");
if (unlikely(!hd3d->pf_DXGIGetDebugInterface))
{
FreeLibrary(hd3d->dxgidebug_dll);
hd3d->dxgidebug_dll = NULL;
}
}
}
# endif // !NDEBUG && HAVE_DXGIDEBUG_H
#endif // !VLC_WINSTORE_APP
return VLC_SUCCESS;
}
static 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
}
void D3D11_ReleaseDevice(d3d11_decoder_device_t *dev_sys)
{
d3d11_decoder_device *sys = container_of(dev_sys, d3d11_decoder_device, dec_device);
......@@ -782,39 +838,6 @@ error:
return VLC_EGENERIC;
}
#undef D3D11_Create
int D3D11_Create(vlc_object_t *obj, d3d11_handle_t *hd3d)
{
#if !VLC_WINSTORE_APP
hd3d->hdll = LoadLibrary(TEXT("D3D11.DLL"));
if (!hd3d->hdll)
{
msg_Warn(obj, "cannot load d3d11.dll, aborting");
return VLC_EGENERIC;
}
# if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
hd3d->dxgidebug_dll = NULL;
hd3d->pf_DXGIGetDebugInterface = NULL;
if (IsDebuggerPresent())
{
hd3d->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL"));
if (hd3d->dxgidebug_dll)
{
hd3d->pf_DXGIGetDebugInterface =
(void *)GetProcAddress(hd3d->dxgidebug_dll, "DXGIGetDebugInterface");
if (unlikely(!hd3d->pf_DXGIGetDebugInterface))
{
FreeLibrary(hd3d->dxgidebug_dll);
hd3d->dxgidebug_dll = NULL;
}
}
}
# endif // !NDEBUG && HAVE_DXGIDEBUG_H
#endif
return VLC_SUCCESS;
}
void D3D11_LogResources(d3d11_decoder_device_t *dev_sys)
{
#if !VLC_WINSTORE_APP
......@@ -831,19 +854,6 @@ void D3D11_LogResources(d3d11_decoder_device_t *dev_sys)
#endif
}
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
}
const struct vlc_video_context_operations d3d11_vctx_ops = {
NULL,
};
......
......@@ -51,17 +51,6 @@ typedef struct
DXGI_ADAPTER_DESC adapterDesc;
} d3d11_device_t;
typedef struct
{
#if !VLC_WINSTORE_APP
HINSTANCE hdll; /* handle of the opened d3d11 dll */
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
HINSTANCE dxgidebug_dll;
HRESULT (WINAPI * pf_DXGIGetDebugInterface)(const GUID *riid, void **ppDebug);
#endif
#endif
} d3d11_handle_t;
/* owned by the vout for VLC_CODEC_D3D11_OPAQUE */
typedef struct
{
......@@ -157,10 +146,6 @@ HRESULT D3D11_CreateDeviceExternal(vlc_object_t *obj, ID3D11DeviceContext *,
void D3D11_ReleaseDevice(d3d11_decoder_device_t *);
int D3D11_Create(vlc_object_t *, d3d11_handle_t *);
#define D3D11_Create(a,b) D3D11_Create( VLC_OBJECT(a), b )
void D3D11_Destroy(d3d11_handle_t *);
void D3D11_LogResources(d3d11_decoder_device_t *);
bool isXboxHardware(const d3d11_device_t *);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment