From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/dxcore/dxcore.c | 34 ++++++++++++++++++++++++++++++++-- dlls/dxcore/tests/dxcore.c | 9 +++++---- 2 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/dlls/dxcore/dxcore.c b/dlls/dxcore/dxcore.c index 4cd07069efe..83f9f33a5d4 100644 --- a/dlls/dxcore/dxcore.c +++ b/dlls/dxcore/dxcore.c @@ -517,8 +517,38 @@ static HRESULT STDMETHODCALLTYPE dxcore_adapter_factory_CreateAdapterList(IDXCor static HRESULT STDMETHODCALLTYPE dxcore_adapter_factory_GetAdapterByLuid(IDXCoreAdapterFactory *iface, REFLUID adapter_luid, REFIID riid, void **out) { - FIXME("iface %p, adapter_luid %p, riid %s, out %p stub!\n", iface, adapter_luid, debugstr_guid(riid), out); - return E_NOTIMPL; + struct dxcore_adapter *adapter; + struct wined3d *wined3d; + uint32_t count; + HRESULT hr; + + TRACE("iface %p, adapter_luid %p, riid %s, out %p.\n", iface, adapter_luid, debugstr_guid(riid), out); + + if (!(wined3d = wined3d_create(0))) + return E_FAIL; + + count = wined3d_get_adapter_count(wined3d); + for (uint32_t i = 0; i < count; ++i) + { + struct wined3d_adapter_identifier adapter_id = {0}; + + wined3d_adapter_get_identifier(wined3d_get_adapter(wined3d, i), 0, &adapter_id); + + if (!memcmp(adapter_luid, &adapter_id.adapter_luid, sizeof(LUID))) + { + wined3d_decref(wined3d); + + if (FAILED(hr = dxcore_adapter_create(&adapter_id, &adapter))) + return hr; + + hr = IDXCoreAdapter_QueryInterface(&adapter->IDXCoreAdapter_iface, riid, out); + IDXCoreAdapter_Release(&adapter->IDXCoreAdapter_iface); + return hr; + } + } + + wined3d_decref(wined3d); + return E_INVALIDARG; }
static BOOL STDMETHODCALLTYPE dxcore_adapter_factory_IsNotificationTypeSupported(IDXCoreAdapterFactory *iface, DXCoreNotificationType type) diff --git a/dlls/dxcore/tests/dxcore.c b/dlls/dxcore/tests/dxcore.c index c3cb954b9ad..018c86cf3ec 100644 --- a/dlls/dxcore/tests/dxcore.c +++ b/dlls/dxcore/tests/dxcore.c @@ -87,9 +87,11 @@ static void test_DXCoreCreateAdapterFactory(void) check_interface(factory, &IID_IDXCoreAdapter, FALSE); check_interface(factory, &IID_IDXCoreAdapterList, FALSE);
- hr = IDXCoreAdapterFactory_CreateAdapterList(factory, 0, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterList, (void **)&list); + hr = IDXCoreAdapterFactory_CreateAdapterList(factory, 0, NULL, &IID_IDXCoreAdapterList, (void **)&list); ok(hr == E_INVALIDARG, "got hr %#lx.\n", hr); ok(list == NULL, "got list %p.\n", list); + hr = IDXCoreAdapterFactory_CreateAdapterList(factory, 0, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterList, (void **)&list); + ok(hr == E_INVALIDARG, "got hr %#lx.\n", hr); hr = IDXCoreAdapterFactory_CreateAdapterList(factory, 1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterFactory, (void **)&list); ok(hr == E_NOINTERFACE, "got hr %#lx.\n", hr); hr = IDXCoreAdapterFactory_CreateAdapterList(factory, 1, NULL, &IID_IDXCoreAdapterFactory, (void **)&list); @@ -283,9 +285,8 @@ static void test_GetAdapterByLuid(void) ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IDXCoreAdapterFactory_GetAdapterByLuid(factory, &luid, &IID_IDXCoreAdapter, (void **)&adapter2); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - IDXCoreAdapter_Release(adapter2); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + IDXCoreAdapter_Release(adapter2);
IDXCoreAdapter_Release(adapter); }