[vlc-commits] direct3d11: use the same size for the staging texture as the source picture

Steve Lhomme git at videolan.org
Thu Jul 27 18:30:21 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Jul 27 17:46:08 2017 +0200| [a212c6a3de2aba62794fb853b5f021a837702c67] | committer: Jean-Baptiste Kempf

direct3d11: use the same size for the staging texture as the source picture

So we don't need to deal with 2 ways to position the texture.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_output/win32/direct3d11.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 893870b1f1..a68f67a407 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -741,8 +741,8 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
         /* we need a staging texture */
         video_format_t staging_fmt;
         video_format_Copy(&staging_fmt, &surface_fmt);
-        staging_fmt.i_width = staging_fmt.i_visible_width;
-        staging_fmt.i_height = staging_fmt.i_visible_height;
+        staging_fmt.i_width = staging_fmt.i_width;
+        staging_fmt.i_height = staging_fmt.i_height;
         if ( sys->picQuadConfig->formatTexture != DXGI_FORMAT_R8G8B8A8_UNORM &&
              sys->picQuadConfig->formatTexture != DXGI_FORMAT_B5G6R5_UNORM )
         {
@@ -1128,11 +1128,13 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
         if (!is_d3d11_opaque(picture->format.i_chroma))
             Direct3D11UnmapPoolTexture(picture);
         ID3D11Texture2D_GetDesc(sys->stagingSys.texture[0], &texDesc);
+        assert(picture->format.i_x_offset + picture->format.i_visible_width <= texDesc.Width);
+        assert(picture->format.i_y_offset + picture->format.i_visible_height <= texDesc.Height);
         D3D11_BOX box = {
-            .top = picture->format.i_y_offset,
-            .bottom = picture->format.i_y_offset + texDesc.Height,
-            .left = picture->format.i_x_offset,
-            .right = picture->format.i_x_offset + texDesc.Width,
+            .top = 0,
+            .bottom = picture->format.i_y_offset + picture->format.i_visible_height,
+            .left = 0,
+            .right = picture->format.i_x_offset + picture->format.i_visible_width,
             .back = 1,
         };
         ID3D11DeviceContext_CopySubresourceRegion(sys->d3dcontext,



More information about the vlc-commits mailing list