[vlc-commits] direct3d9: prefer hardware vertex processing when possible

Steve Lhomme git at videolan.org
Wed Oct 18 13:58:10 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Oct 18 12:33:41 2017 +0200| [60e78354b953206ed59aa02ac017be97ea2079df] | committer: Jean-Baptiste Kempf

direct3d9: prefer hardware vertex processing when possible

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

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

 modules/video_output/win32/direct3d9.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 77b71d28ed..c645b91b4f 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -897,22 +897,30 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
                 d3dai.VendorId, d3dai.DeviceId, d3dai.Revision );
     }
 
+    DWORD creationFlags = D3DCREATE_MULTITHREADED;
+    if ( (sys->d3dcaps.DevCaps & D3DDEVCAPS_DRAWPRIMTLVERTEX) &&
+         (sys->d3dcaps.DevCaps & D3DDEVCAPS_HWRASTERIZATION) ) {
+        creationFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
+    } else if (sys->d3dcaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) {
+        creationFlags |= D3DCREATE_MIXED_VERTEXPROCESSING;
+    } else {
+        creationFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
+    }
+
     // Create the D3DDevice
     HRESULT hr;
     if (sys->use_d3d9ex) {
         LPDIRECT3DDEVICE9EX d3ddevex;
         hr = IDirect3D9Ex_CreateDeviceEx((LPDIRECT3D9EX)d3dobj, AdapterToUse,
                                          DeviceType, sys->sys.hvideownd,
-                                         D3DCREATE_SOFTWARE_VERTEXPROCESSING|
-                                         D3DCREATE_MULTITHREADED,
+                                         creationFlags,
                                          &sys->d3dpp, NULL, &d3ddevex);
         sys->d3ddev = (LPDIRECT3DDEVICE9)d3ddevex;
     } else {
         LPDIRECT3DDEVICE9 d3ddev;
         hr = IDirect3D9_CreateDevice(d3dobj, AdapterToUse,
                                      DeviceType, sys->sys.hvideownd,
-                                     D3DCREATE_SOFTWARE_VERTEXPROCESSING|
-                                     D3DCREATE_MULTITHREADED,
+                                     creationFlags,
                                      &sys->d3dpp, &d3ddev);
         sys->d3ddev = d3ddev;
     }



More information about the vlc-commits mailing list