[vlc-devel] [PATCH] Direct3D: do not use pixel shader when rendering subpictures

Felix Abecassis felix.abecassis at gmail.com
Thu Feb 13 16:29:24 CET 2014


---
 modules/video_output/msw/direct3d.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c
index 6b33bf4..22fe56d 100644
--- a/modules/video_output/msw/direct3d.c
+++ b/modules/video_output/msw/direct3d.c
@@ -1518,7 +1518,8 @@ static void Direct3DImportSubpicture(vout_display_t *vd,
 }
 
 static int Direct3DRenderRegion(vout_display_t *vd,
-                                d3d_region_t *region)
+                                d3d_region_t *region,
+                                bool use_pixel_shader)
 {
     vout_display_sys_t *sys = vd->sys;
 
@@ -1554,7 +1555,10 @@ static int Direct3DRenderRegion(vout_display_t *vd,
     }
 
     if (sys->d3dx_shader) {
-        hr = IDirect3DDevice9_SetPixelShader(d3ddev, sys->d3dx_shader);
+        if (use_pixel_shader)
+            hr = IDirect3DDevice9_SetPixelShader(d3ddev, sys->d3dx_shader);
+        else /* Disable any existing pixel shader. */
+            hr = IDirect3DDevice9_SetPixelShader(d3ddev, NULL);
         if (FAILED(hr)) {
             msg_Dbg(vd, "%s:%d (hr=0x%0lX)", __FUNCTION__, __LINE__, hr);
             return -1;
@@ -1617,14 +1621,14 @@ static void Direct3DRenderScene(vout_display_t *vd,
         return;
     }
 
-    Direct3DRenderRegion(vd, picture);
+    Direct3DRenderRegion(vd, picture, true);
 
     if (subpicture_count > 0)
         IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHABLENDENABLE, TRUE);
     for (int i = 0; i < subpicture_count; i++) {
         d3d_region_t *r = &subpicture[i];
         if (r->texture)
-            Direct3DRenderRegion(vd, r);
+            Direct3DRenderRegion(vd, r, false);
     }
     if (subpicture_count > 0)
         IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHABLENDENABLE, FALSE);
-- 
1.7.10.4




More information about the vlc-devel mailing list