[vlc-commits] direct3d11: don't use a texture that has an incorrect texture mapping

Steve Lhomme git at videolan.org
Sun Aug 21 18:27:27 CEST 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | 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 <jb at videolan.org>

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



More information about the vlc-commits mailing list