[vlc-commits] direct3d11: fix subpictures textures not always mapped the same between calls

Steve Lhomme git at videolan.org
Thu Sep 10 14:05:54 CEST 2015


vlc | branch: master | Steve Lhomme <robux4 at gmail.com> | Fri Jul 31 16:54:49 2015 +0200| [61b7a4f4a53c6906101701f2bc4c2b52b1191450] | committer: Jean-Baptiste Kempf

direct3d11: fix subpictures textures not always mapped the same between calls

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

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

 modules/video_output/msw/direct3d11.c |   31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/modules/video_output/msw/direct3d11.c b/modules/video_output/msw/direct3d11.c
index f69aec5..8850aff 100644
--- a/modules/video_output/msw/direct3d11.c
+++ b/modules/video_output/msw/direct3d11.c
@@ -1721,27 +1721,26 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
                 continue;
             }
             quad_picture = (*region)[i];
-            hr = ID3D11DeviceContext_Map(sys->d3dcontext, (ID3D11Resource *)((d3d_quad_t *) quad_picture->p_sys)->pTexture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
-            if( SUCCEEDED(hr) ) {
-                err = CommonUpdatePicture(quad_picture, NULL, mappedResource.pData, mappedResource.RowPitch);
-                ID3D11DeviceContext_Unmap(sys->d3dcontext, (ID3D11Resource *)((d3d_quad_t *) quad_picture->p_sys)->pTexture, 0);
-                if (err != VLC_SUCCESS) {
-                    msg_Err(vd, "Failed to set the buffer on the OSD picture" );
-                    picture_Release(quad_picture);
-                    continue;
-                }
-            } else {
-                msg_Err(vd, "Failed to map the OSD texture (hr=0x%lX)", hr );
+        }
+
+        hr = ID3D11DeviceContext_Map(sys->d3dcontext, (ID3D11Resource *)((d3d_quad_t *) quad_picture->p_sys)->pTexture, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+        if( SUCCEEDED(hr) ) {
+            err = CommonUpdatePicture(quad_picture, NULL, mappedResource.pData, mappedResource.RowPitch);
+            if (err != VLC_SUCCESS) {
+                msg_Err(vd, "Failed to set the buffer on the SPU picture" );
                 picture_Release(quad_picture);
                 continue;
             }
-#ifndef NDEBUG
-            msg_Dbg(vd, "Created %dx%d texture for OSD",
-                    r->fmt.i_visible_width, r->fmt.i_visible_height);
-#endif
+
+            picture_CopyPixels(quad_picture, r->p_picture);
+
+            ID3D11DeviceContext_Unmap(sys->d3dcontext, (ID3D11Resource *)((d3d_quad_t *) quad_picture->p_sys)->pTexture, 0);
+        } else {
+            msg_Err(vd, "Failed to map the SPU texture (hr=0x%lX)", hr );
+            picture_Release(quad_picture);
+            continue;
         }
 
-        picture_CopyPixels(quad_picture, r->p_picture);
 
         /* Map the subpicture to sys->rect_dest */
         const int i_original_width  = subpicture->i_original_picture_width;



More information about the vlc-commits mailing list