[vlc-commits] direct3d11: check the pointers before mapping the texture

Steve Lhomme git at videolan.org
Wed Mar 21 11:17:08 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 21 09:56:35 2018 +0100| [72375dd63c2fcde4409aa00ff9fedf6fc60c9852] | committer: Steve Lhomme

direct3d11: check the pointers before mapping the texture

And use the proper slice, even though it's currently always 0

Ref #20103

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

 modules/video_output/win32/direct3d11.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 55d918a4b7..919bd2e6b2 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -399,7 +399,19 @@ static int Direct3D11MapPoolTexture(picture_t *picture)
     picture_sys_t *p_sys = picture->p_sys;
     D3D11_MAPPED_SUBRESOURCE mappedResource;
     HRESULT hr;
-    hr = ID3D11DeviceContext_Map(p_sys->context, p_sys->resource[KNOWN_DXGI_INDEX], 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+
+    ID3D11Device *dev;
+    ID3D11DeviceContext_GetDevice(p_sys->context, &dev);
+    ID3D11Device_Release(dev);
+
+#ifndef NDEBUG
+    D3D11_TEXTURE2D_DESC dsc;
+    ID3D11Texture2D_GetDesc(p_sys->texture[KNOWN_DXGI_INDEX], &dsc);
+    assert(dsc.CPUAccessFlags & D3D11_CPU_ACCESS_WRITE);
+    assert(dsc.Usage & D3D11_USAGE_DYNAMIC);
+#endif
+
+    hr = ID3D11DeviceContext_Map(p_sys->context, p_sys->resource[KNOWN_DXGI_INDEX], p_sys->slice_index, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
     if( FAILED(hr) )
     {
         return VLC_EGENERIC;



More information about the vlc-commits mailing list