[vlc-commits] direct3d11: check the pointers before mapping the texture
Steve Lhomme
git at videolan.org
Wed Mar 21 15:08:09 CET 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 21 09:56:35 2018 +0100| [a1fca1187092e13631a502533d822d401b09d557] | committer: Hugo Beauzée-Luyssen
direct3d11: check the pointers before mapping the texture
And use the proper slice, even though it's currently always 0
Ref #20103
(cherry picked from commit 72375dd63c2fcde4409aa00ff9fedf6fc60c9852)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=a1fca1187092e13631a502533d822d401b09d557
---
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 2e62f22b64..843b771475 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