[vlc-devel] [PATCH] direct3d11: do not force the decoder padding if we're using the staging texture

Steve Lhomme robux4 at videolabs.io
Wed Dec 27 11:58:27 CET 2017


The decoder will use its own pool with its own sizes anyway
---
 modules/video_output/win32/direct3d11.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 7c3cba8c89..d4ff4a53ed 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1114,15 +1114,23 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
             WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
 #endif
         if (!is_d3d11_opaque(picture->format.i_chroma) || sys->legacy_shader) {
-            D3D11_TEXTURE2D_DESC texDesc;
+            D3D11_TEXTURE2D_DESC srcDesc,texDesc;
             if (!is_d3d11_opaque(picture->format.i_chroma))
                 Direct3D11UnmapPoolTexture(picture);
+            ID3D11Texture2D_GetDesc(p_sys->texture[KNOWN_DXGI_INDEX], &srcDesc);
             ID3D11Texture2D_GetDesc(sys->stagingSys.texture[0], &texDesc);
+            D3D11_BOX box = {
+                .top = 0,
+                .bottom = __MIN(srcDesc.Height, texDesc.Height),
+                .left = 0,
+                .right = __MIN(srcDesc.Width, texDesc.Width),
+                .back = 1,
+            };
             ID3D11DeviceContext_CopySubresourceRegion(sys->d3d_dev.d3dcontext,
                                                       sys->stagingSys.resource[KNOWN_DXGI_INDEX],
                                                       0, 0, 0, 0,
                                                       p_sys->resource[KNOWN_DXGI_INDEX],
-                                                      p_sys->slice_index, NULL);
+                                                      p_sys->slice_index, &box);
         }
         else
         {
@@ -2008,7 +2016,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
 
     sys->picQuad.i_width  = fmt->i_width;
     sys->picQuad.i_height = fmt->i_height;
-    if (is_d3d11_opaque(fmt->i_chroma))
+    if (!sys->legacy_shader && is_d3d11_opaque(fmt->i_chroma))
     {
         sys->picQuad.i_width  = (sys->picQuad.i_width  + 0x7F) & ~0x7F;
         sys->picQuad.i_height = (sys->picQuad.i_height + 0x7F) & ~0x7F;
-- 
2.14.2



More information about the vlc-devel mailing list