[vlc-commits] direct3d9: Fix green lines on nVidia

Hugo Beauzée-Luyssen git at videolan.org
Thu May 18 15:51:54 CEST 2017


vlc/vlc-2.2 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu May 18 15:48:31 2017 +0200| [7588a1fb319c4d629c33692a3acc6c08231b93db] | committer: Hugo Beauzée-Luyssen

direct3d9: Fix green lines on nVidia

Green line fixing, episode 4.
This has been tested on all 3 major chips manufacturers.
(cherry picked from commit bb1a4d46378327dfe2fb5608b4aff94801cf7b0d)

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/video_output/msw/direct3d.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c
index f395fad236..4b8653e913 100644
--- a/modules/video_output/msw/direct3d.c
+++ b/modules/video_output/msw/direct3d.c
@@ -1459,7 +1459,14 @@ static int Direct3DImportPicture(vout_display_t *vd,
 
     /* Copy picture surface into texture surface
      * color space conversion happen here */
-    hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, &vd->sys->rect_src, destination, NULL, D3DTEXF_NONE );
+    RECT copy_rect = vd->sys->rect_src_clipped;
+    // On nVidia & AMD, StretchRect will fail if the visible size isn't even.
+    // When copying the entire buffer, the margin end up being blended in the actual picture
+    // on nVidia (regardless of even/odd dimensions)
+    if ( copy_rect.right & 1 ) copy_rect.right++;
+    if ( copy_rect.bottom & 1 ) copy_rect.bottom++;
+    hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, &copy_rect, destination,
+                                      &copy_rect, D3DTEXF_NONE);
     IDirect3DSurface9_Release(destination);
     if (FAILED(hr)) {
         msg_Dbg(vd, "%s:%d (hr=0x%0lX)", __FUNCTION__, __LINE__, hr);



More information about the vlc-commits mailing list