[vlc-devel] [PATCH 05/14] d3d11_fmt: add D3D11_ReleaseDevice()
Steve Lhomme
robux4 at videolabs.io
Sat Nov 18 14:29:19 CET 2017
---
modules/video_chroma/d3d11_fmt.c | 15 +++++++++++++++
modules/video_chroma/d3d11_fmt.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index cb55f32338..377bccb658 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -130,6 +130,21 @@ int AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
return VLC_SUCCESS;
}
+void D3D11_ReleaseDevice(d3d11_device_t *d3d_dev)
+{
+ if (d3d_dev->d3dcontext)
+ {
+ ID3D11DeviceContext_Flush(d3d_dev->d3dcontext);
+ ID3D11DeviceContext_Release(d3d_dev->d3dcontext);
+ d3d_dev->d3dcontext = NULL;
+ }
+ if (d3d_dev->d3ddevice)
+ {
+ ID3D11Device_Release(d3d_dev->d3ddevice);
+ d3d_dev->d3ddevice = NULL;
+ }
+}
+
#undef D3D11_CreateDevice
HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *hd3d,
bool hw_decoding, d3d11_device_t *out)
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 345c25206d..fc15439b80 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -86,6 +86,8 @@ HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *,
bool hw_decoding, d3d11_device_t *out);
#define D3D11_CreateDevice(a,b,c,d) D3D11_CreateDevice( VLC_OBJECT(a), b, c, d )
+void D3D11_ReleaseDevice(d3d11_device_t *);
+
bool isXboxHardware(ID3D11Device *d3ddev);
bool isNvidiaHardware(ID3D11Device *d3ddev);
IDXGIAdapter *D3D11DeviceAdapter(ID3D11Device *d3ddev);
--
2.14.2
More information about the vlc-devel
mailing list