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 | 25 +++++++++++++++++++++++-- dlls/dxcore/tests/dxcore.c | 4 ++++ 2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/dxcore/dxcore.c b/dlls/dxcore/dxcore.c index 337cb50a4ae..f63f1c9f3b9 100644 --- a/dlls/dxcore/dxcore.c +++ b/dlls/dxcore/dxcore.c @@ -31,6 +31,8 @@ struct dxcore_adapter_list { IDXCoreAdapterList IDXCoreAdapterList_iface; LONG ref; + + uint32_t adapter_count; };
static inline struct dxcore_adapter_list *impl_from_IDXCoreAdapterList( IDXCoreAdapterList *iface ) @@ -84,8 +86,9 @@ static HRESULT WINAPI dxcore_adapter_list_GetAdapter( IDXCoreAdapterList *iface,
static uint32_t WINAPI dxcore_adapter_list_GetAdapterCount( IDXCoreAdapterList *iface ) { - FIXME( "iface %p stub!\n", iface ); - return 0; + struct dxcore_adapter_list *impl = impl_from_IDXCoreAdapterList( iface ); + TRACE( "iface %p\n", iface ); + return impl->adapter_count; }
static BOOL WINAPI dxcore_adapter_list_IsStale( IDXCoreAdapterList *iface ) @@ -176,6 +179,19 @@ static ULONG WINAPI dxcore_adapter_factory_statics_Release( IDXCoreAdapterFactor return ref; }
+static HRESULT get_adapters( struct dxcore_adapter_list *impl ) +{ + struct wined3d *wined3d = wined3d_create( 0 ); + HRESULT hr = S_OK; + + if (!wined3d) return E_FAIL; + + impl->adapter_count = wined3d_get_adapter_count( wined3d ); + + wined3d_decref( wined3d ); + return hr; +} + static HRESULT WINAPI dxcore_adapter_factory_statics_CreateAdapterList( IDXCoreAdapterFactory *iface, uint32_t num_attributes, const GUID *filter_attributes, REFIID riid, void **ppv ) { @@ -192,6 +208,11 @@ static HRESULT WINAPI dxcore_adapter_factory_statics_CreateAdapterList( IDXCoreA
impl->IDXCoreAdapterList_iface.lpVtbl = &dxcore_adapter_list_vtbl; impl->ref = 1; + if (FAILED(hr = get_adapters( impl ))) + { + IDXCoreAdapterList_Release( &impl->IDXCoreAdapterList_iface ); + return hr; + }
hr = IDXCoreAdapterList_QueryInterface( &impl->IDXCoreAdapterList_iface, riid, ppv ); IDXCoreAdapterList_Release( &impl->IDXCoreAdapterList_iface ); diff --git a/dlls/dxcore/tests/dxcore.c b/dlls/dxcore/tests/dxcore.c index 451c7153b0f..c50bf1aa999 100644 --- a/dlls/dxcore/tests/dxcore.c +++ b/dlls/dxcore/tests/dxcore.c @@ -46,6 +46,7 @@ static void test_DXCoreCreateAdapterFactory(void) IDXCoreAdapterFactory *adapter_factory = (void *)0xdeadbeef; IDXCoreAdapterList *adapter_list2 = (void *)0xdeadbeef; IDXCoreAdapterList *adapter_list = (void *)0xdeadbeef; + uint32_t adapter_count = 0; HRESULT hr; LONG ref;
@@ -96,6 +97,9 @@ static void test_DXCoreCreateAdapterFactory(void) check_interface( adapter_list, &IID_IDXCoreAdapter, FALSE ); check_interface( adapter_list, &IID_IDXCoreAdapterFactory, FALSE );
+ adapter_count = IDXCoreAdapterList_GetAdapterCount( adapter_list ); + ok( adapter_count != 0, "IDXCoreAdapterList_GetAdapterCount returned 0.\n" ); + ref = IDXCoreAdapterList_Release( adapter_list ); ok( ref == 0, "got ref %ld.\n", ref ); ref = IDXCoreAdapterFactory_Release( adapter_factory );