libvlc: provide the adapter to use for D3D9 rendering

This commit is contained in:
Steve Lhomme 2019-07-02 09:44:15 +02:00
parent 41d7a66a4d
commit 8bcea68edf
3 changed files with 4 additions and 1 deletions

View File

@ -204,6 +204,7 @@ static bool Setup_cb( void **opaque, const libvlc_video_direct3d_device_cfg_t *c
{
struct render_context *ctx = *opaque;
out->device_context = ctx->d3d;
out->adapter = D3DADAPTER_DEFAULT;
return true;
}

View File

@ -616,6 +616,7 @@ typedef struct
typedef struct
{
void *device_context; /** ID3D11DeviceContext* for D3D11, IDirect3D9 * for D3D9 */
int adapter; /** Adapter to use with the IDirect3D9 for D3D9 */
} libvlc_video_direct3d_device_setup_t;
/** Setup the rendering environment.

View File

@ -1610,6 +1610,7 @@ static bool LocalSwapchainSetupDevice( void **opaque, const libvlc_video_direct3
}
out->device_context = sys->hd3d.obj;
out->adapter = -1;
return true;
}
@ -1698,7 +1699,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
}
IDirect3D9 *d3d9_device = device_setup.device_context;
D3D9_CloneExternal( &sys->hd3d, d3d9_device );
HRESULT hr = D3D9_CreateDevice(vd, &sys->hd3d, -1, sys->sys.hvideownd, &sys->d3d_dev);
HRESULT hr = D3D9_CreateDevice(vd, &sys->hd3d, device_setup.adapter, sys->sys.hvideownd, &sys->d3d_dev);
if (FAILED(hr)) {
msg_Err( vd, "D3D9 Creation failed! (hr=0x%lX)", hr);
D3D9_Destroy(&sys->hd3d);