From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58133 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58192 --- dlls/dxcore/dxcore.c | 28 ++++++++++++++++++++++++++-- dlls/dxcore/tests/dxcore.c | 4 ++++ 2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/dxcore/dxcore.c b/dlls/dxcore/dxcore.c index 3592753745c..338783ccf1b 100644 --- a/dlls/dxcore/dxcore.c +++ b/dlls/dxcore/dxcore.c @@ -31,6 +31,8 @@ struct dxcore_adapter_list { IDXCoreAdapterList IDXCoreAdapterList_iface; LONG refcount; + + uint32_t adapter_count; };
static inline struct dxcore_adapter_list *impl_from_IDXCoreAdapterList(IDXCoreAdapterList *iface) @@ -89,8 +91,11 @@ static HRESULT STDMETHODCALLTYPE dxcore_adapter_list_GetAdapter(IDXCoreAdapterLi
static uint32_t STDMETHODCALLTYPE dxcore_adapter_list_GetAdapterCount(IDXCoreAdapterList *iface) { - FIXME("iface %p stub!\n", iface); - return 0; + struct dxcore_adapter_list *list = impl_from_IDXCoreAdapterList(iface); + + TRACE("iface %p\n", iface); + + return list->adapter_count; }
static BOOL STDMETHODCALLTYPE dxcore_adapter_list_IsStale(IDXCoreAdapterList *iface) @@ -187,6 +192,20 @@ static ULONG STDMETHODCALLTYPE dxcore_adapter_factory_Release(IDXCoreAdapterFact return refcount; }
+static HRESULT get_adapters(struct dxcore_adapter_list *list) +{ + struct wined3d *wined3d = wined3d_create(0); + HRESULT hr = S_OK; + + if (!wined3d) + return E_FAIL; + + list->adapter_count = wined3d_get_adapter_count(wined3d); + + wined3d_decref(wined3d); + return hr; +} + static HRESULT STDMETHODCALLTYPE dxcore_adapter_factory_CreateAdapterList(IDXCoreAdapterFactory *iface, uint32_t num_attributes, const GUID *filter_attributes, REFIID riid, void **out) { @@ -209,6 +228,11 @@ static HRESULT STDMETHODCALLTYPE dxcore_adapter_factory_CreateAdapterList(IDXCor
list->IDXCoreAdapterList_iface.lpVtbl = &dxcore_adapter_list_vtbl; list->refcount = 1; + if (FAILED(hr = get_adapters(list))) + { + IDXCoreAdapterList_Release(&list->IDXCoreAdapterList_iface); + return hr; + }
hr = IDXCoreAdapterList_QueryInterface(&list->IDXCoreAdapterList_iface, riid, out); IDXCoreAdapterList_Release(&list->IDXCoreAdapterList_iface); diff --git a/dlls/dxcore/tests/dxcore.c b/dlls/dxcore/tests/dxcore.c index bff14524ae4..0c21952a95d 100644 --- a/dlls/dxcore/tests/dxcore.c +++ b/dlls/dxcore/tests/dxcore.c @@ -46,6 +46,7 @@ static void test_DXCoreCreateAdapterFactory(void) IDXCoreAdapterFactory *factory = (void *)0xdeadbeef; IDXCoreAdapterList *list2 = (void *)0xdeadbeef; IDXCoreAdapterList *list = (void *)0xdeadbeef; + uint32_t adapter_count = 0; LONG refcount; HRESULT hr;
@@ -97,6 +98,9 @@ static void test_DXCoreCreateAdapterFactory(void) check_interface(list, &IID_IDXCoreAdapter, FALSE); check_interface(list, &IID_IDXCoreAdapterFactory, FALSE);
+ adapter_count = IDXCoreAdapterList_GetAdapterCount(list); + ok(adapter_count != 0, "got adapter_count 0.\n"); + refcount = IDXCoreAdapterList_Release(list); ok(refcount == 0, "got refcount %ld.\n", refcount); refcount = IDXCoreAdapterFactory_Release(factory);