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

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


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu May 18 14:01:06 2017 +0200| [490a433102e113b2c444773e2274eb2ebb38ca26] | 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.

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

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

diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index e4d82583d1..5003e2003c 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1562,7 +1562,14 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
 
     /* Copy picture surface into texture surface
      * color space conversion happen here */
-    hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, NULL, destination, NULL, D3DTEXF_NONE);
+    RECT copy_rect = sys->sys.rect_src_clipped;
+    // On nVidia & AMD, StretchRect will 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, "Failed IDirect3DDevice9_StretchRect: source 0x%p 0x%0lx",



More information about the vlc-commits mailing list