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

Steve Lhomme robux4 at gmail.com
Wed Oct 18 13:43:18 CEST 2017


On Wed, Oct 18, 2017 at 1:03 PM, Jean-Baptiste Kempf <jb at videolan.org> wrote:
> For my curiosity, what's the difference?

Apparently D3DCREATE_SOFTWARE_VERTEXPROCESSING gives bad performance
but has more compatibility (since it's mostly software).

D3DCREATE_HARDWARE_VERTEXPROCESSING gives the best performance but is
not supported by all GPUs. It's also the mode recommended to be used
with Win10, the other ones have terrible performance.

> On Wed, 18 Oct 2017, at 12:33, Steve Lhomme wrote:
>> ---
>>  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 0798ba3ff9..0c5fec2799 100644
>> --- a/modules/video_output/win32/direct3d9.c
>> +++ b/modules/video_output/win32/direct3d9.c
>> @@ -900,22 +900,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;
>>      }
>> --
>> 2.14.2
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>
>
> --
> Jean-Baptiste Kempf -  President
> +33 672 704 734
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list