[vlc-commits] direct3d11: don't allocate NV12/P010 textures with odd sizes
Steve Lhomme
git at videolan.org
Sun Oct 9 10:46:24 CEST 2016
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Tue Sep 27 14:36:35 2016 +0200| [e492431b6a197f700f982e58998db2c291f61373] | committer: Jean-Baptiste Kempf
direct3d11: don't allocate NV12/P010 textures with odd sizes
fixes #17419
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e492431b6a197f700f982e58998db2c291f61373
---
modules/video_output/win32/direct3d11.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index c6da0b5..bffdf20 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -851,14 +851,26 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
}
D3D11_BOX box;
- box.left = picture->format.i_x_offset;
- box.right = picture->format.i_x_offset + picture->format.i_visible_width;
- box.top = picture->format.i_y_offset;
- box.bottom = picture->format.i_y_offset + picture->format.i_visible_height;
+ picture_sys_t *p_sys = picture->p_sys;
+ D3D11_TEXTURE2D_DESC texDesc;
+ ID3D11Texture2D_GetDesc( p_sys->texture, &texDesc );
+ if (texDesc.Format == DXGI_FORMAT_NV12 || texDesc.Format == DXGI_FORMAT_P010)
+ {
+ box.left = (picture->format.i_x_offset + 1) & ~1;
+ box.right = (picture->format.i_x_offset + picture->format.i_visible_width) & ~1;
+ box.top = (picture->format.i_y_offset + 1) & ~1;
+ box.bottom = (picture->format.i_y_offset + picture->format.i_visible_height) & ~1;
+ }
+ else
+ {
+ box.left = picture->format.i_x_offset;
+ box.right = picture->format.i_x_offset + picture->format.i_visible_width;
+ box.top = picture->format.i_y_offset;
+ box.bottom = picture->format.i_y_offset + picture->format.i_visible_height;
+ }
box.back = 1;
box.front = 0;
- picture_sys_t *p_sys = picture->p_sys;
ID3D11DeviceContext_CopySubresourceRegion(sys->d3dcontext,
(ID3D11Resource*) sys->picQuad.pTexture,
0, 0, 0, 0,
@@ -1704,6 +1716,11 @@ static int AllocQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t *
if ( i_extra )
texDesc.Height -= p_chroma_desc->p[plane].h.den / p_chroma_desc->p[plane].h.num - i_extra;
}
+ if (texDesc.Format == DXGI_FORMAT_NV12 || texDesc.Format == DXGI_FORMAT_P010)
+ {
+ texDesc.Width &= ~1;
+ texDesc.Height &= ~1;
+ }
hr = ID3D11Device_CreateTexture2D(sys->d3ddevice, &texDesc, NULL, &quad->pTexture);
if (FAILED(hr)) {
More information about the vlc-commits
mailing list