[vlc-commits] d3d11_fmt: add D3D11_ReleaseDevice()

Steve Lhomme git at videolan.org
Mon Nov 20 19:14:01 CET 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Sat Nov 18 14:29:19 2017 +0100| [070f516f4ef8dc093b3aa49e3905f64d7a937356] | committer: Jean-Baptiste Kempf

d3d11_fmt: add D3D11_ReleaseDevice()

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=070f516f4ef8dc093b3aa49e3905f64d7a937356
---

 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);



More information about the vlc-commits mailing list