Commit 10887807 authored by Steve Lhomme's avatar Steve Lhomme

d3d11: allow creating a device for a specific adapter

Not used for now but it works.
parent 08ae5918
......@@ -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;
......
......@@ -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);
......
......@@ -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) \
......
......@@ -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)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment