From 1988ed16dbc5ff721833eccbdb8040a57114b06f Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 18 Nov 2008 09:27:58 +0100 Subject: [PATCH] dxgi: Implement IDXGIFactory::EnumAdapters(). --- dlls/d3d10/tests/device.c | 4 ++-- dlls/dxgi/factory.c | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/d3d10/tests/device.c b/dlls/d3d10/tests/device.c index 3ad91133e3d..8399cdb7bb2 100644 --- a/dlls/d3d10/tests/device.c +++ b/dlls/d3d10/tests/device.c @@ -57,11 +57,11 @@ static void test_device_interfaces(ID3D10Device *device) if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIObject, (void **)&obj))) IUnknown_Release(obj); - todo_wine ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIObject (%#x)\n", hr); + ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIObject (%#x)\n", hr); if (SUCCEEDED(hr = ID3D10Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&obj))) IUnknown_Release(obj); - todo_wine ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIDevice (%#x)\n", hr); + ok(SUCCEEDED(hr), "ID3D10Device does not implement IDXGIDevice (%#x)\n", hr); } START_TEST(device) diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c index 92b6cb5ef53..03db0969137 100644 --- a/dlls/dxgi/factory.c +++ b/dlls/dxgi/factory.c @@ -119,9 +119,24 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IWineDXGIFactory *iface, static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *iface, UINT adapter_idx, IDXGIAdapter **adapter) { - FIXME("iface %p, adapter_idx %u, adapter %p stub!\n", iface, adapter_idx, adapter); + struct dxgi_factory *This = (struct dxgi_factory *)iface; - return E_NOTIMPL; + TRACE("iface %p, adapter_idx %u, adapter %p\n", iface, adapter_idx, adapter); + + if (!adapter) return DXGI_ERROR_INVALID_CALL; + + if (adapter_idx >= This->adapter_count) + { + *adapter = NULL; + return DXGI_ERROR_NOT_FOUND; + } + + *adapter = (IDXGIAdapter *)This->adapters[adapter_idx]; + IDXGIAdapter_AddRef(*adapter); + + TRACE("Returning adapter %p\n", *adapter); + + return S_OK; } static HRESULT STDMETHODCALLTYPE dxgi_factory_MakeWindowAssociation(IWineDXGIFactory *iface, HWND window, UINT flags)