[vlc-commits] libvlc: provide the adapter to use for D3D9 rendering

Steve Lhomme git at videolan.org
Tue Jul 2 09:46:09 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jul  2 09:44:15 2019 +0200| [8bcea68edff1d388580899e5f5d426f50fd1b03b] | committer: Steve Lhomme

libvlc: provide the adapter to use for D3D9 rendering

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

 doc/libvlc/d3d9_player.c               | 1 +
 include/vlc/libvlc_media_player.h      | 1 +
 modules/video_output/win32/direct3d9.c | 3 ++-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/libvlc/d3d9_player.c b/doc/libvlc/d3d9_player.c
index 41745614a6..ec3dbf806f 100644
--- a/doc/libvlc/d3d9_player.c
+++ b/doc/libvlc/d3d9_player.c
@@ -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;
 }
 
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index c274ae2ee0..c4979dfe79 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -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.
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 4891847357..6c3f998ec4 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -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);



More information about the vlc-commits mailing list