[vlc-commits] d3d11: allow creating a device for a specific adapter
Steve Lhomme
git at videolan.org
Fri Nov 30 11:55:24 CET 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov 30 11:41:10 2018 +0100| [10887807847005ba6881a8f04b9618921489f57d] | committer: Steve Lhomme
d3d11: allow creating a device for a specific adapter
Not used for now but it works.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=10887807847005ba6881a8f04b9618921489f57d
---
modules/codec/avcodec/d3d11va.c | 2 +-
modules/video_chroma/d3d11_fmt.c | 10 ++++++----
modules/video_chroma/d3d11_fmt.h | 4 ++--
modules/video_output/win32/direct3d11.c | 2 +-
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index d687c22a06..6c6d00aae0 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -436,7 +436,7 @@ static int D3dCreateDevice(vlc_va_t *va)
/* */
if (!sys->d3d_dev.d3ddevice)
{
- hr = D3D11_CreateDevice(va, &sys->hd3d, true, &sys->d3d_dev);
+ hr = D3D11_CreateDevice(va, &sys->hd3d, NULL, true, &sys->d3d_dev);
if (FAILED(hr)) {
msg_Err(va, "D3D11CreateDevice failed. (hr=0x%lX)", hr);
return VLC_EGENERIC;
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index a887cd14cc..2710cbe569 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -266,6 +266,7 @@ HRESULT D3D11_CreateDeviceExternal(vlc_object_t *obj, ID3D11DeviceContext *d3d11
#undef D3D11_CreateDevice
HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *hd3d,
+ IDXGIAdapter *adapter,
bool hw_decoding, d3d11_device_t *out)
{
#if !VLC_WINSTORE_APP
@@ -311,10 +312,11 @@ HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *hd3d,
D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL_9_2, D3D_FEATURE_LEVEL_9_1
};
- for (UINT driver = 0; driver < ARRAY_SIZE(driverAttempts); driver++) {
- hr = D3D11CreateDevice(NULL, driverAttempts[driver], NULL, creationFlags,
- D3D11_features, ARRAY_SIZE(D3D11_features), D3D11_SDK_VERSION,
- &out->d3ddevice, &out->feature_level, &out->d3dcontext);
+ for (UINT driver = 0; driver < adapter ? 1 : ARRAY_SIZE(driverAttempts); driver++) {
+ hr = D3D11CreateDevice(adapter, adapter ? D3D_DRIVER_TYPE_UNKNOWN : driverAttempts[driver],
+ NULL, creationFlags,
+ D3D11_features, ARRAY_SIZE(D3D11_features), D3D11_SDK_VERSION,
+ &out->d3ddevice, &out->feature_level, &out->d3dcontext);
if (SUCCEEDED(hr)) {
msg_Dbg(obj, "Created the D3D11 device type %d level %x.",
driverAttempts[driver], out->feature_level);
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index bd1fbe6490..a2eb803f7f 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -105,9 +105,9 @@ int D3D11_AllocateResourceView(vlc_object_t *obj, ID3D11Device *d3ddevice,
ID3D11ShaderResourceView *output[D3D11_MAX_SHADER_VIEW]);
#define D3D11_AllocateResourceView(a,b,c,d,e,f) D3D11_AllocateResourceView(VLC_OBJECT(a),b,c,d,e,f)
-HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *,
+HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *, IDXGIAdapter *,
bool hw_decoding, d3d11_device_t *out);
-#define D3D11_CreateDevice(a,b,c,d) D3D11_CreateDevice( VLC_OBJECT(a), b, c, d )
+#define D3D11_CreateDevice(a,b,c,d,e) D3D11_CreateDevice( VLC_OBJECT(a), b, c, d, e )
HRESULT D3D11_CreateDeviceExternal(vlc_object_t *obj, ID3D11DeviceContext *,
bool hw_decoding, d3d11_device_t *out);
#define D3D11_CreateDeviceExternal(a,b,c,d) \
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index c2d6c7d1ed..d59cee71ef 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1195,7 +1195,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp)
DXGI_SWAP_CHAIN_DESC1 scd;
- hr = D3D11_CreateDevice(vd, &sys->hd3d,
+ hr = D3D11_CreateDevice(vd, &sys->hd3d, NULL,
is_d3d11_opaque(vd->source.i_chroma),
&sys->d3d_dev);
if (FAILED(hr)) {
More information about the vlc-commits
mailing list