vlc | branch: master | Steve Lhomme <[email protected]> | Tue Aug 16 09:33:47 
2016 +0200| [880b283428824c0eb9fc09028c0f2724750b7bb5] | committer: 
Jean-Baptiste Kempf

direct3d11: don't use a texture that has an incorrect texture mapping

This can happen on some AMD hardware

Signed-off-by: Jean-Baptiste Kempf <[email protected]>

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

 modules/video_output/win32/direct3d11.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/video_output/win32/direct3d11.c 
b/modules/video_output/win32/direct3d11.c
index 92dd0fc..f17ebdb 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1711,6 +1711,18 @@ static int AllocQuad(vout_display_t *vd, const 
video_format_t *fmt, d3d_quad_t *
         goto error;
     }
 
+    hr = ID3D11DeviceContext_Map(sys->d3dcontext, (ID3D11Resource 
*)quad->pTexture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+    if( FAILED(hr) ) {
+        msg_Err(vd, "The texture cannot be mapped. (hr=0x%lX)", hr);
+        goto error;
+    }
+    ID3D11DeviceContext_Unmap(sys->d3dcontext, (ID3D11Resource 
*)quad->pTexture, 0);
+    if (mappedResource.RowPitch < p_chroma_desc->pixel_size * texDesc.Width) {
+        msg_Err( vd, "The texture row pitch is too small (%d instead of %d)", 
mappedResource.RowPitch,
+                 p_chroma_desc->pixel_size * texDesc.Width );
+        goto error;
+    }
+
     D3D11_SHADER_RESOURCE_VIEW_DESC resviewDesc;
     memset(&resviewDesc, 0, sizeof(resviewDesc));
     resviewDesc.Format = cfg->resourceFormatYRGB;

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to