Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58133
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58192
-- v2: dxcore: Implement IDXCoreAdapterList::GetAdapterCount(). dxcore: Partially implement IDXCoreAdapterFactory::CreateAdapterList(). dxcore/tests: Add IDXCoreAdapterFactory::CreateAdapterList() tests. dxcore: Implement DXCoreCreateAdapterFactory(). dxcore/tests: Add DXCoreCreateAdapterFactory() tests. include: Add dxcore C interface macros.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/dxcore_interface.h | 84 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+)
diff --git a/include/dxcore_interface.h b/include/dxcore_interface.h index 635a7f047a5..c156fc1bace 100644 --- a/include/dxcore_interface.h +++ b/include/dxcore_interface.h @@ -170,6 +170,40 @@ DECLARE_INTERFACE_IID_(IDXCoreAdapter, IUnknown, "f0db4c7f-fe5a-42a2-bd62-f2a6cf #endif };
+#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDXCoreAdapter_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDXCoreAdapter_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDXCoreAdapter_Release(p) (p)->lpVtbl->Release(p) +/*** IDXCoreAdapter methods ***/ +#define IDXCoreAdapter_IsValid(p) (p)->lpVtbl->IsValid(p) +#define IDXCoreAdapter_IsAttributeSupported(p,a) (p)->lpVtbl->IsAttributeSupported(p,a) +#define IDXCoreAdapter_IsPropertySupported(p,a) (p)->lpVtbl->IsPropertySupported(p,a) +#define IDXCoreAdapter_GetProperty(p,a,b,c) (p)->lpVtbl->GetProperty(p,a,b,c) +#define IDXCoreAdapter_GetPropertySize(p,a) (p)->lpVtbl->GetPropertySize(p,a) +#define IDXCoreAdapter_IsQueryStateSupported(p,a) (p)->lpVtbl->IsQueryStateSupported(p,a) +#define IDXCoreAdapter_QueryState(p,a,b,c,d,e) (p)->lpVtbl->QueryState(p,a,b,c,d,e) +#define IDXCoreAdapter_IsSetStateSupported(p,a) (p)->lpVtbl->IsSetStateSupported(p,a) +#define IDXCoreAdapter_SetState(p,a,b,c,d,e) (p)->lpVtbl->SetState(p,a,b,c,d,e) +#define IDXCoreAdapter_GetFactory(p,a,b) (p)->lpVtbl->GetFactory(p,a,b) +#else +/*** IUnknown methods ***/ +#define IDXCoreAdapter_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDXCoreAdapter_AddRef(p) (p)->AddRef() +#define IDXCoreAdapter_Release(p) (p)->Release() +/*** IDXCoreAdapter methods ***/ +#define IDXCoreAdapter_IsValid(p) (p)->IsValid() +#define IDXCoreAdapter_IsAttributeSupported(p,a) (p)->IsAttributeSupported(a) +#define IDXCoreAdapter_IsPropertySupported(p,a) (p)->IsPropertySupported(a) +#define IDXCoreAdapter_GetProperty(p,a,b,c) (p)->GetProperty(a,b,c) +#define IDXCoreAdapter_GetPropertySize(p,a) (p)->GetPropertySize(a) +#define IDXCoreAdapter_IsQueryStateSupported(p,a) (p)->IsQueryStateSupported(a) +#define IDXCoreAdapter_QueryState(p,a,b,c,d,e) (p)->QueryState(a,b,c,d,e) +#define IDXCoreAdapter_IsSetStateSupported(p,a) (p)->IsSetStateSupported(a) +#define IDXCoreAdapter_SetState(p,a,b,c,d,e) (p)->SetState(a,b,c,d,e) +#define IDXCoreAdapter_GetFactory(p,a,b) (p)->GetFactory(a,b) +#endif + #undef INTERFACE #define INTERFACE IDXCoreAdapterList DECLARE_INTERFACE_IID_(IDXCoreAdapterList, IUnknown, "526c7776-40e9-459b-b711-f32ad76dfc28") @@ -201,6 +235,32 @@ DECLARE_INTERFACE_IID_(IDXCoreAdapterList, IUnknown, "526c7776-40e9-459b-b711-f3 #endif };
+#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDXCoreAdapterList_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDXCoreAdapterList_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDXCoreAdapterList_Release(p) (p)->lpVtbl->Release(p) +/*** IDXCoreAdapterList methods ***/ +#define IDXCoreAdapterList_GetAdapter(p,a,b,c) (p)->lpVtbl->GetAdapter(p,a,b,c) +#define IDXCoreAdapterList_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDXCoreAdapterList_IsStale(p) (p)->lpVtbl->IsStale(p) +#define IDXCoreAdapterList_GetFactory(p,a,b) (p)->lpVtbl->GetFactory(p,a,b) +#define IDXCoreAdapterList_Sort(p,a) (p)->lpVtbl->Sort(p,a) +#define IDXCoreAdapterList_IsAdapterPreferenceSupported(p,a) (p)->lpVtbl->IsAdapterPreferenceSupported(p,a) +#else +/*** IUnknown methods ***/ +#define IDXCoreAdapterList_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDXCoreAdapterList_AddRef(p) (p)->AddRef() +#define IDXCoreAdapterList_Release(p) (p)->Release() +/*** IDXCoreAdapterList methods ***/ +#define IDXCoreAdapterList_GetAdapter(p,a,b) (p)->GetAdapter(a,b) +#define IDXCoreAdapterList_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDXCoreAdapterList_IsStale(p) (p)->IsStale() +#define IDXCoreAdapterList_GetFactory(p,a,b) (p)->GetFactory(a,b) +#define IDXCoreAdapterList_Sort(p,a) (p)->Sort(a) +#define IDXCoreAdapterList_IsAdapterPreferenceSupported(p,a) (p)->IsAdapterPreferenceSupported(a) +#endif + #undef INTERFACE #define INTERFACE IDXCoreAdapterFactory DECLARE_INTERFACE_IID_(IDXCoreAdapterFactory, IUnknown, "78ee5945-c36e-4b13-a669-005dd11c0f06") @@ -232,4 +292,28 @@ DECLARE_INTERFACE_IID_(IDXCoreAdapterFactory, IUnknown, "78ee5945-c36e-4b13-a669 #endif };
+#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IDXCoreAdapterFactory_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDXCoreAdapterFactory_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDXCoreAdapterFactory_Release(p) (p)->lpVtbl->Release(p) +/*** IDXCoreAdapterFactory methods ***/ +#define IDXCoreAdapterFactory_CreateAdapterList(p,a,b,c,d) (p)->lpVtbl->CreateAdapterList(p,a,b,c,d) +#define IDXCoreAdapterFactory_GetAdapterByLuid(p,a,b,c) (p)->lpVtbl->GetAdapterByLuid(p,a,b,c) +#define IDXCoreAdapterFactory_IsNotificationTypeSupported(p,a) (p)->lpVtbl->IsNotificationTypeSupported(p,a) +#define IDXCoreAdapterFactory_RegisterEventNotification(p,a,b,c,d,e) (p)->lpVtbl->RegisterEventNotification(p,a,b,c,d,e) +#define IDXCoreAdapterFactory_UnregisterEventNotification(p,a) (p)->lpVtbl->UnregisterEventNotification(p,a) +#else +/*** IUnknown methods ***/ +#define IDXCoreAdapterFactory_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDXCoreAdapterFactory_AddRef(p) (p)->AddRef() +#define IDXCoreAdapterFactory_Release(p) (p)->Release() +/*** IDXCoreAdapterFactory methods ***/ +#define IDXCoreAdapterFactory_CreateAdapterList(p,a,b,c,d) (p)->CreateAdapterList(a,b,c,d) +#define IDXCoreAdapterFactory_GetAdapterByLuid(p,a,b,c) (p)->GetAdapterByLuid(a,b,c) +#define IDXCoreAdapterFactory_IsNotificationTypeSupported(p,a) (p)->IsNotificationTypeSupported(a) +#define IDXCoreAdapterFactory_RegisterEventNotification(p,a,b,c,d,e) (p)->RegisterEventNotification(a,b,c,d,e) +#define IDXCoreAdapterFactory_UnregisterEventNotification(p,a) (p)->UnregisterEventNotification(a) +#endif + #endif /* __DXCORE_INTERFACE__ */
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- configure.ac | 1 + dlls/dxcore/tests/Makefile.in | 5 ++ dlls/dxcore/tests/dxcore.c | 102 ++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 dlls/dxcore/tests/Makefile.in create mode 100644 dlls/dxcore/tests/dxcore.c
diff --git a/configure.ac b/configure.ac index d1d07bc8f37..62f890f2ebf 100644 --- a/configure.ac +++ b/configure.ac @@ -2686,6 +2686,7 @@ WINE_CONFIG_MAKEFILE(dlls/dwrite) WINE_CONFIG_MAKEFILE(dlls/dwrite/tests) WINE_CONFIG_MAKEFILE(dlls/dx8vb) WINE_CONFIG_MAKEFILE(dlls/dxcore) +WINE_CONFIG_MAKEFILE(dlls/dxcore/tests) WINE_CONFIG_MAKEFILE(dlls/dxdiagn) WINE_CONFIG_MAKEFILE(dlls/dxdiagn/tests) WINE_CONFIG_MAKEFILE(dlls/dxgi) diff --git a/dlls/dxcore/tests/Makefile.in b/dlls/dxcore/tests/Makefile.in new file mode 100644 index 00000000000..841f1c9d14f --- /dev/null +++ b/dlls/dxcore/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = dxcore.dll +IMPORTS = uuid + +SOURCES = \ + dxcore.c diff --git a/dlls/dxcore/tests/dxcore.c b/dlls/dxcore/tests/dxcore.c new file mode 100644 index 00000000000..266a53f8f89 --- /dev/null +++ b/dlls/dxcore/tests/dxcore.c @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2025 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#define COBJMACROS +#include "initguid.h" +#include "dxcore.h" + +#include "wine/test.h" + +static HRESULT (WINAPI *pDXCoreCreateAdapterFactory)(REFIID riid, void **ppv); + +#define check_interface( obj, iid, supported ) check_interface_( __LINE__, obj, iid, supported ) +static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL supported ) +{ + IUnknown *iface = obj; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface( iface, iid, (void **)&unk ); + ok_(__FILE__, line)( hr == expected_hr, "got hr %#lx.\n", hr ); + if (SUCCEEDED(hr)) IUnknown_Release( unk ); +} + +static void test_DXCoreCreateAdapterFactory(void) +{ + IDXCoreAdapterFactory *adapter_factory2 = (void *)0xdeadbeef; + IDXCoreAdapterFactory *adapter_factory = (void *)0xdeadbeef; + HRESULT hr; + LONG ref; + + if (0) /* Crashes on w1064v1909 */ + { + todo_wine + hr = pDXCoreCreateAdapterFactory( NULL, NULL ); + ok( hr == E_POINTER, "got hr %#lx.\n", hr ); + } + hr = pDXCoreCreateAdapterFactory( &IID_IDXCoreAdapterFactory, NULL ); + todo_wine + ok( hr == E_POINTER || broken(hr == E_NOINTERFACE) /* w1064v1909 */, "got hr %#lx.\n", hr ); + hr = pDXCoreCreateAdapterFactory( &DXCORE_ADAPTER_ATTRIBUTE_D3D11_GRAPHICS, (void **)&adapter_factory ); + ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); + todo_wine + ok( adapter_factory == NULL || broken(adapter_factory == (void *)0xdeadbeef) /* w1064v1909 */, "got adapter_factory %p.\n", adapter_factory ); + + hr = pDXCoreCreateAdapterFactory( &IID_IDXCoreAdapterFactory, (void **)&adapter_factory ); + todo_wine + ok( hr == S_OK || broken(hr == E_NOINTERFACE) /* w1064v1909 */, "got hr %#lx.\n", hr ); + if (FAILED(hr)) return; + + hr = pDXCoreCreateAdapterFactory( &IID_IDXCoreAdapterFactory, (void **)&adapter_factory2 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( adapter_factory == adapter_factory2, "got adapter_factory %p, adapter_factory2 %p.\n", adapter_factory, adapter_factory2 ); + ref = IDXCoreAdapterFactory_Release( adapter_factory2 ); + ok( ref == 1, "got ref %ld.\n", ref ); + + check_interface( adapter_factory, &IID_IAgileObject, FALSE ); + check_interface( adapter_factory, &IID_IDXCoreAdapter, FALSE ); + check_interface( adapter_factory, &IID_IDXCoreAdapterList, FALSE ); + + ref = IDXCoreAdapterFactory_Release( adapter_factory ); + ok( ref == 0, "got ref %ld.\n", ref ); +} + +START_TEST(dxcore) +{ + HMODULE dxcore_handle = LoadLibraryA( "dxcore.dll" ); + if (!dxcore_handle) + { + win_skip( "Could not load dxcore.dll\n" ); + return; + } + pDXCoreCreateAdapterFactory = (void *)GetProcAddress( dxcore_handle, "DXCoreCreateAdapterFactory" ); + if (!pDXCoreCreateAdapterFactory) + { + win_skip( "Failed to get DXCoreCreateAdapterFactory address, skipping dxcore tests\n" ); + FreeLibrary( dxcore_handle ); + return; + } + + test_DXCoreCreateAdapterFactory(); + + FreeLibrary( dxcore_handle ); +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/dxcore/tests/dxcore.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/dlls/dxcore/tests/dxcore.c b/dlls/dxcore/tests/dxcore.c index 58424ee8b56..f41e3e21d69 100644 --- a/dlls/dxcore/tests/dxcore.c +++ b/dlls/dxcore/tests/dxcore.c @@ -44,6 +44,8 @@ static void test_DXCoreCreateAdapterFactory(void) { IDXCoreAdapterFactory *adapter_factory2 = (void *)0xdeadbeef; IDXCoreAdapterFactory *adapter_factory = (void *)0xdeadbeef; + IDXCoreAdapterList *adapter_list2 = (void *)0xdeadbeef; + IDXCoreAdapterList *adapter_list = (void *)0xdeadbeef; HRESULT hr; LONG ref;
@@ -72,6 +74,41 @@ static void test_DXCoreCreateAdapterFactory(void) check_interface( adapter_factory, &IID_IDXCoreAdapter, FALSE ); check_interface( adapter_factory, &IID_IDXCoreAdapterList, FALSE );
+ hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 0, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterList, (void **)&adapter_list ); + todo_wine + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + todo_wine + ok( adapter_list == NULL, "got adapter_list %p.\n", adapter_list ); + hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterFactory, (void **)&adapter_list ); + todo_wine + ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); + hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, NULL, &IID_IDXCoreAdapterFactory, (void **)&adapter_list ); + todo_wine + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterFactory, NULL ); + todo_wine + ok( hr == E_POINTER, "got hr %#lx.\n", hr ); + + hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterList, (void **)&adapter_list ); + todo_wine + ok( hr == S_OK, "got hr %#lx.\n", hr ); + hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterList, (void **)&adapter_list2 ); + todo_wine + ok( hr == S_OK, "got hr %#lx.\n", hr ); + todo_wine + ok( adapter_list != adapter_list2, "got same adapter_list %p, adapter_list2 %p.\n", adapter_list, adapter_list ); + if (SUCCEEDED(hr)) + { + ref = IDXCoreAdapterList_Release( adapter_list2 ); + ok( ref == 0, "got ref %ld.\n", ref ); + + check_interface( adapter_list, &IID_IAgileObject, FALSE ); + check_interface( adapter_list, &IID_IDXCoreAdapter, FALSE ); + check_interface( adapter_list, &IID_IDXCoreAdapterFactory, FALSE ); + + ref = IDXCoreAdapterList_Release( adapter_list ); + ok( ref == 0, "got ref %ld.\n", ref ); + } ref = IDXCoreAdapterFactory_Release( adapter_factory ); ok( ref == 0, "got ref %ld.\n", ref ); }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/dxcore/Makefile.in | 2 +- dlls/dxcore/dxcore.c | 146 +++++++++++++++++++++++++++++++++++++ dlls/dxcore/main.c | 28 ------- dlls/dxcore/tests/dxcore.c | 4 - 4 files changed, 147 insertions(+), 33 deletions(-) create mode 100644 dlls/dxcore/dxcore.c delete mode 100644 dlls/dxcore/main.c
diff --git a/dlls/dxcore/Makefile.in b/dlls/dxcore/Makefile.in index efee290e914..579cceded7e 100644 --- a/dlls/dxcore/Makefile.in +++ b/dlls/dxcore/Makefile.in @@ -3,4 +3,4 @@ MODULE = dxcore.dll EXTRADLLFLAGS = -Wb,--prefer-native
SOURCES = \ - main.c + dxcore.c diff --git a/dlls/dxcore/dxcore.c b/dlls/dxcore/dxcore.c new file mode 100644 index 00000000000..a07fe0c49e8 --- /dev/null +++ b/dlls/dxcore/dxcore.c @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2023 Mohamad Al-Jaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#define COBJMACROS +#include "initguid.h" +#include "dxcore.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dxcore); + +struct dxcore_adapter_factory_statics +{ + IDXCoreAdapterFactory IDXCoreAdapterFactory_iface; + LONG ref; +}; + +static inline struct dxcore_adapter_factory_statics *impl_from_IDXCoreAdapterFactory( IDXCoreAdapterFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct dxcore_adapter_factory_statics, IDXCoreAdapterFactory_iface ); +} + +static HRESULT WINAPI dxcore_adapter_factory_statics_QueryInterface( IDXCoreAdapterFactory *iface, REFIID iid, void **out ) +{ + struct dxcore_adapter_factory_statics *impl = impl_from_IDXCoreAdapterFactory( iface ); + + TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out ); + + if (IsEqualGUID( iid, &IID_IUnknown ) || + IsEqualGUID( iid, &IID_IDXCoreAdapterFactory )) + { + *out = &impl->IDXCoreAdapterFactory_iface; + IUnknown_AddRef( (IUnknown *)*out ); + return S_OK; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI dxcore_adapter_factory_statics_AddRef( IDXCoreAdapterFactory *iface ) +{ + struct dxcore_adapter_factory_statics *impl = impl_from_IDXCoreAdapterFactory( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p, ref %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI dxcore_adapter_factory_statics_Release( IDXCoreAdapterFactory *iface ) +{ + struct dxcore_adapter_factory_statics *impl = impl_from_IDXCoreAdapterFactory( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + + TRACE( "iface %p, ref %lu.\n", iface, ref ); + + if (!ref) free( impl ); + return ref; +} + +static HRESULT WINAPI dxcore_adapter_factory_statics_CreateAdapterList( IDXCoreAdapterFactory *iface, uint32_t num_attributes, + const GUID *filter_attributes, REFIID riid, void **ppv ) +{ + FIXME( "iface %p, num_attributes %u, filter_attributes %p, riid %s, ppv %p stub!\n", iface, num_attributes, filter_attributes, debugstr_guid( riid ), ppv ); + return E_NOTIMPL; +} + +static HRESULT WINAPI dxcore_adapter_factory_statics_GetAdapterByLuid( IDXCoreAdapterFactory *iface, REFLUID adapter_luid, REFIID riid, void **ppv ) +{ + FIXME( "iface %p, adapter_luid %p, riid %s, ppv %p stub!\n", iface, adapter_luid, debugstr_guid( riid ), ppv ); + return E_NOTIMPL; +} + +static BOOL WINAPI dxcore_adapter_factory_statics_IsNotificationTypeSupported( IDXCoreAdapterFactory *iface, DXCoreNotificationType type ) +{ + FIXME( "iface %p, type %u stub!\n", iface, type ); + return FALSE; +} + +static HRESULT WINAPI dxcore_adapter_factory_statics_RegisterEventNotification( IDXCoreAdapterFactory *iface, IUnknown *dxcore_object, + DXCoreNotificationType type, PFN_DXCORE_NOTIFICATION_CALLBACK callback, + void *callback_context, uint32_t *event_cookie ) +{ + FIXME( "iface %p, dxcore_object %p, type %u, callback %p, callback_context %p, event_cookie %p stub!\n", iface, dxcore_object, type, callback, callback_context, event_cookie ); + return E_NOTIMPL; +} + +static HRESULT WINAPI dxcore_adapter_factory_statics_UnregisterEventNotification( IDXCoreAdapterFactory *iface, uint32_t event_cookie ) +{ + FIXME( "iface %p, event_cookie %u stub!\n", iface, event_cookie ); + return E_NOTIMPL; +} + +static const struct IDXCoreAdapterFactoryVtbl dxcore_adapter_factory_statics_vtbl = +{ + /* IUnknown methods */ + dxcore_adapter_factory_statics_QueryInterface, + dxcore_adapter_factory_statics_AddRef, + dxcore_adapter_factory_statics_Release, + /* IDXCoreAdapterFactory methods */ + dxcore_adapter_factory_statics_CreateAdapterList, + dxcore_adapter_factory_statics_GetAdapterByLuid, + dxcore_adapter_factory_statics_IsNotificationTypeSupported, + dxcore_adapter_factory_statics_RegisterEventNotification, + dxcore_adapter_factory_statics_UnregisterEventNotification, +}; + +HRESULT WINAPI DXCoreCreateAdapterFactory( REFIID riid, void **ppv ) +{ + static struct dxcore_adapter_factory_statics *impl = NULL; + + TRACE( "riid %s, ppv %p\n", debugstr_guid( riid ), ppv ); + + if (!ppv) return E_POINTER; + if (!impl) + { + if (!(impl = calloc( 1, sizeof( *impl ) ))) + { + *ppv = NULL; + return E_OUTOFMEMORY; + } + + impl->IDXCoreAdapterFactory_iface.lpVtbl = &dxcore_adapter_factory_statics_vtbl; + impl->ref = 0; + } + + TRACE( "created IDXCoreAdapterFactory %p.\n", *ppv ); + return IDXCoreAdapterFactory_QueryInterface( &impl->IDXCoreAdapterFactory_iface, riid, ppv ); +} diff --git a/dlls/dxcore/main.c b/dlls/dxcore/main.c deleted file mode 100644 index dcc294d04fa..00000000000 --- a/dlls/dxcore/main.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2023 Mohamad Al-Jaf - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "dxcore.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(dxcore); - -HRESULT WINAPI DXCoreCreateAdapterFactory( REFIID riid, void **ppv ) -{ - FIXME( "riid %s, ppv %p stub!\n", debugstr_guid(riid), ppv ); - return E_NOINTERFACE; -} diff --git a/dlls/dxcore/tests/dxcore.c b/dlls/dxcore/tests/dxcore.c index 266a53f8f89..58424ee8b56 100644 --- a/dlls/dxcore/tests/dxcore.c +++ b/dlls/dxcore/tests/dxcore.c @@ -49,20 +49,16 @@ static void test_DXCoreCreateAdapterFactory(void)
if (0) /* Crashes on w1064v1909 */ { - todo_wine hr = pDXCoreCreateAdapterFactory( NULL, NULL ); ok( hr == E_POINTER, "got hr %#lx.\n", hr ); } hr = pDXCoreCreateAdapterFactory( &IID_IDXCoreAdapterFactory, NULL ); - todo_wine ok( hr == E_POINTER || broken(hr == E_NOINTERFACE) /* w1064v1909 */, "got hr %#lx.\n", hr ); hr = pDXCoreCreateAdapterFactory( &DXCORE_ADAPTER_ATTRIBUTE_D3D11_GRAPHICS, (void **)&adapter_factory ); ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); - todo_wine ok( adapter_factory == NULL || broken(adapter_factory == (void *)0xdeadbeef) /* w1064v1909 */, "got adapter_factory %p.\n", adapter_factory );
hr = pDXCoreCreateAdapterFactory( &IID_IDXCoreAdapterFactory, (void **)&adapter_factory ); - todo_wine ok( hr == S_OK || broken(hr == E_NOINTERFACE) /* w1064v1909 */, "got hr %#lx.\n", hr ); if (FAILED(hr)) return;
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/dxcore/Makefile.in | 3 +- dlls/dxcore/dxcore.c | 329 ++++++++++++++++++++++++++++++++++++- dlls/dxcore/tests/dxcore.c | 11 -- 3 files changed, 329 insertions(+), 14 deletions(-)
diff --git a/dlls/dxcore/Makefile.in b/dlls/dxcore/Makefile.in index 579cceded7e..fdeac08127f 100644 --- a/dlls/dxcore/Makefile.in +++ b/dlls/dxcore/Makefile.in @@ -1,4 +1,5 @@ -MODULE = dxcore.dll +MODULE = dxcore.dll +IMPORTS = dxgi
EXTRADLLFLAGS = -Wb,--prefer-native
diff --git a/dlls/dxcore/dxcore.c b/dlls/dxcore/dxcore.c index a07fe0c49e8..1dc984b57b8 100644 --- a/dlls/dxcore/dxcore.c +++ b/dlls/dxcore/dxcore.c @@ -21,11 +21,255 @@ #define COBJMACROS #include "initguid.h" #include "dxcore.h" +#include "dxgi1_6.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dxcore);
+struct dxcore_adapter +{ + IDXCoreAdapter IDXCoreAdapter_iface; + LONG ref; + + DXGI_ADAPTER_DESC3 desc; +}; + +static inline struct dxcore_adapter *impl_from_IDXCoreAdapter( IDXCoreAdapter *iface ) +{ + return CONTAINING_RECORD( iface, struct dxcore_adapter, IDXCoreAdapter_iface ); +} + +static HRESULT WINAPI dxcore_adapter_QueryInterface( IDXCoreAdapter *iface, REFIID iid, void **out ) +{ + struct dxcore_adapter *impl = impl_from_IDXCoreAdapter( iface ); + + TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out ); + + if (IsEqualGUID( iid, &IID_IUnknown ) || + IsEqualGUID( iid, &IID_IDXCoreAdapter )) + { + *out = &impl->IDXCoreAdapter_iface; + IUnknown_AddRef( (IUnknown *)*out ); + return S_OK; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI dxcore_adapter_AddRef( IDXCoreAdapter *iface ) +{ + struct dxcore_adapter *impl = impl_from_IDXCoreAdapter( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p, ref %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI dxcore_adapter_Release( IDXCoreAdapter *iface ) +{ + struct dxcore_adapter *impl = impl_from_IDXCoreAdapter( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + + TRACE( "iface %p, ref %lu.\n", iface, ref ); + + if (!ref) free( impl ); + return ref; +} + +static BOOL WINAPI dxcore_adapter_IsValid( IDXCoreAdapter *iface ) +{ + FIXME( "iface %p stub!\n", iface ); + return FALSE; +} + +static BOOL WINAPI dxcore_adapter_IsAttributeSupported( IDXCoreAdapter *iface, REFGUID attribute ) +{ + FIXME( "iface %p, attribute %s stub!\n", iface, debugstr_guid( attribute ) ); + return FALSE; +} + +static BOOL WINAPI dxcore_adapter_IsPropertySupported( IDXCoreAdapter *iface, DXCoreAdapterProperty property ) +{ + FIXME( "iface %p, property %u stub!\n", iface, property ); + return FALSE; +} + +static HRESULT WINAPI dxcore_adapter_GetProperty( IDXCoreAdapter *iface, DXCoreAdapterProperty property, size_t buffer_size, void *buffer ) +{ + FIXME( "iface %p, property %u, buffer_size %Iu, buffer %p stub!\n", iface, property, buffer_size, buffer ); + return E_NOTIMPL; +} + +static HRESULT WINAPI dxcore_adapter_GetPropertySize( IDXCoreAdapter *iface, DXCoreAdapterProperty property, size_t *buffer_size ) +{ + FIXME( "iface %p, property %u, buffer_size %p stub!\n", iface, property, buffer_size ); + return E_NOTIMPL; +} + +static BOOL WINAPI dxcore_adapter_IsQueryStateSupported( IDXCoreAdapter *iface, DXCoreAdapterState property ) +{ + FIXME( "iface %p, property %u stub!\n", iface, property ); + return FALSE; +} + +static HRESULT WINAPI dxcore_adapter_QueryState( IDXCoreAdapter *iface, DXCoreAdapterState state, size_t state_details_size, + const void *state_details, size_t buffer_size, void *buffer ) +{ + FIXME( "iface %p, state %u, state_details_size %Iu, state_details %p, buffer_size %Iu, buffer %p stub!\n", + iface, state, state_details_size, state_details, buffer_size, buffer ); + return E_NOTIMPL; +} + +static BOOL WINAPI dxcore_adapter_IsSetStateSupported( IDXCoreAdapter *iface, DXCoreAdapterState property ) +{ + FIXME( "iface %p, property %u stub!\n", iface, property ); + return FALSE; +} + +static HRESULT WINAPI dxcore_adapter_SetState( IDXCoreAdapter *iface, DXCoreAdapterState state, size_t state_details_size, + const void *state_details, size_t buffer_size, const void *buffer ) +{ + FIXME( "iface %p, state %u, state_details_size %Iu, state_details %p, buffer_size %Iu, buffer %p stub!\n", + iface, state, state_details_size, state_details, buffer_size, buffer ); + return E_NOTIMPL; +} + +static HRESULT WINAPI dxcore_adapter_GetFactory( IDXCoreAdapter *iface, REFIID riid, void **ppv ) +{ + FIXME( "iface %p, riid %s, ppv %p stub!\n", iface, debugstr_guid( riid ), ppv ); + return E_NOTIMPL; +} + +static const struct IDXCoreAdapterVtbl dxcore_adapter_vtbl = +{ + /* IUnknown methods */ + dxcore_adapter_QueryInterface, + dxcore_adapter_AddRef, + dxcore_adapter_Release, + /* IDXCoreAdapter methods */ + dxcore_adapter_IsValid, + dxcore_adapter_IsAttributeSupported, + dxcore_adapter_IsPropertySupported, + dxcore_adapter_GetProperty, + dxcore_adapter_GetPropertySize, + dxcore_adapter_IsQueryStateSupported, + dxcore_adapter_QueryState, + dxcore_adapter_IsSetStateSupported, + dxcore_adapter_SetState, + dxcore_adapter_GetFactory, +}; + +struct dxcore_adapter_list +{ + IDXCoreAdapterList IDXCoreAdapterList_iface; + LONG ref; + + struct dxcore_adapter **adapters; + uint32_t adapter_count; +}; + +static inline struct dxcore_adapter_list *impl_from_IDXCoreAdapterList( IDXCoreAdapterList *iface ) +{ + return CONTAINING_RECORD( iface, struct dxcore_adapter_list, IDXCoreAdapterList_iface ); +} + +static HRESULT WINAPI dxcore_adapter_list_QueryInterface( IDXCoreAdapterList *iface, REFIID iid, void **out ) +{ + struct dxcore_adapter_list *impl = impl_from_IDXCoreAdapterList( iface ); + + TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out ); + + if (IsEqualGUID( iid, &IID_IUnknown ) || + IsEqualGUID( iid, &IID_IDXCoreAdapterList )) + { + *out = &impl->IDXCoreAdapterList_iface; + IUnknown_AddRef( (IUnknown *)*out ); + return S_OK; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI dxcore_adapter_list_AddRef( IDXCoreAdapterList *iface ) +{ + struct dxcore_adapter_list *impl = impl_from_IDXCoreAdapterList( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p, ref %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI dxcore_adapter_list_Release( IDXCoreAdapterList *iface ) +{ + struct dxcore_adapter_list *impl = impl_from_IDXCoreAdapterList( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + + TRACE( "iface %p, ref %lu.\n", iface, ref ); + + if (!ref) + { + for (UINT i = 0; i < impl->adapter_count; i++) + if (impl->adapters[i]) IDXCoreAdapter_Release( &impl->adapters[i]->IDXCoreAdapter_iface ); + free( impl->adapters ); + free( impl ); + } + return ref; +} + +static HRESULT WINAPI dxcore_adapter_list_GetAdapter( IDXCoreAdapterList *iface, uint32_t index, REFIID riid, void **ppv ) +{ + FIXME( "iface %p, index %u, riid %s, ppv %p stub!\n", iface, index, debugstr_guid( riid ), ppv ); + return E_NOTIMPL; +} + +static uint32_t WINAPI dxcore_adapter_list_GetAdapterCount( IDXCoreAdapterList *iface ) +{ + FIXME( "iface %p stub!\n", iface ); + return 0; +} + +static BOOL WINAPI dxcore_adapter_list_IsStale( IDXCoreAdapterList *iface ) +{ + FIXME( "iface %p stub!\n", iface ); + return FALSE; +} + +static HRESULT WINAPI dxcore_adapter_list_GetFactory( IDXCoreAdapterList *iface, REFIID riid, void **ppv ) +{ + FIXME( "iface %p, riid %s, ppv %p stub!\n", iface, debugstr_guid( riid ), ppv ); + return E_NOTIMPL; +} + +static HRESULT WINAPI dxcore_adapter_list_Sort( IDXCoreAdapterList *iface, uint32_t num_preferences, const DXCoreAdapterPreference *preferences ) +{ + FIXME( "iface %p, num_preferences %u, preferences %p stub!\n", iface, num_preferences, preferences ); + return E_NOTIMPL; +} + +static BOOL WINAPI dxcore_adapter_list_IsAdapterPreferenceSupported( IDXCoreAdapterList *iface, DXCoreAdapterPreference preference ) +{ + FIXME( "iface %p, preference %u stub!\n", iface, preference ); + return FALSE; +} + +static const struct IDXCoreAdapterListVtbl dxcore_adapter_list_vtbl = +{ + /* IUnknown methods */ + dxcore_adapter_list_QueryInterface, + dxcore_adapter_list_AddRef, + dxcore_adapter_list_Release, + /* IDXCoreAdapterList methods */ + dxcore_adapter_list_GetAdapter, + dxcore_adapter_list_GetAdapterCount, + dxcore_adapter_list_IsStale, + dxcore_adapter_list_GetFactory, + dxcore_adapter_list_Sort, + dxcore_adapter_list_IsAdapterPreferenceSupported, +}; + struct dxcore_adapter_factory_statics { IDXCoreAdapterFactory IDXCoreAdapterFactory_iface; @@ -75,11 +319,92 @@ static ULONG WINAPI dxcore_adapter_factory_statics_Release( IDXCoreAdapterFactor return ref; }
+static HRESULT get_adapters( struct dxcore_adapter_list *impl ) +{ + IDXGIFactory6 *factory6 = NULL; + IDXGIAdapter4 *adapter4 = NULL; + HRESULT hr = CreateDXGIFactory2( 0, &IID_IDXGIFactory6, (void **)&factory6 ); + + if (FAILED(hr)) return hr; + + while (SUCCEEDED(IDXGIFactory6_EnumAdapterByGpuPreference( factory6, impl->adapter_count, DXGI_GPU_PREFERENCE_UNSPECIFIED, &IID_IDXGIAdapter4, (void **)&adapter4 ))) + { + impl->adapter_count++; + IDXGIAdapter4_Release( adapter4 ); + } + + if (!impl->adapter_count) + { + IDXGIFactory6_Release( factory6 ); + return S_OK; + } + + if (!(impl->adapters = calloc( impl->adapter_count, sizeof( *impl->adapters ) ))) + { + IDXGIFactory6_Release( factory6 ); + return E_OUTOFMEMORY; + } + + for (UINT i = 0; i < impl->adapter_count; i++) + { + struct dxcore_adapter *adapter = calloc( 1, sizeof( *adapter ) ); + DXGI_ADAPTER_DESC3 desc; + + if (!adapter) + { + hr = E_OUTOFMEMORY; + break; + } + if (FAILED(hr = IDXGIFactory6_EnumAdapterByGpuPreference( factory6, i, DXGI_GPU_PREFERENCE_UNSPECIFIED, &IID_IDXGIAdapter4, (void **)&adapter4 ))) + { + break; + } + if (FAILED(hr = IDXGIAdapter4_GetDesc3( adapter4, &desc ))) + { + IDXGIAdapter4_Release( adapter4 ); + break; + } + + adapter->IDXCoreAdapter_iface.lpVtbl = &dxcore_adapter_vtbl; + adapter->ref = 1; + adapter->desc = desc; + + impl->adapters[i] = adapter; + IDXGIAdapter4_Release( adapter4 ); + } + + IDXGIFactory6_Release( factory6 ); + return hr; +} + static HRESULT WINAPI dxcore_adapter_factory_statics_CreateAdapterList( IDXCoreAdapterFactory *iface, uint32_t num_attributes, const GUID *filter_attributes, REFIID riid, void **ppv ) { - FIXME( "iface %p, num_attributes %u, filter_attributes %p, riid %s, ppv %p stub!\n", iface, num_attributes, filter_attributes, debugstr_guid( riid ), ppv ); - return E_NOTIMPL; + struct dxcore_adapter_list *impl; + HRESULT hr; + + FIXME( "iface %p, num_attributes %u, filter_attributes %p, riid %s, ppv %p semi-stub!\n", iface, num_attributes, filter_attributes, debugstr_guid( riid ), ppv ); + + if (!ppv) return E_POINTER; + if (!num_attributes || !filter_attributes) + { + *ppv = NULL; + return E_INVALIDARG; + } + if (!(impl = calloc( 1, sizeof( *impl ) ))) return E_OUTOFMEMORY; + + 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 ); + TRACE( "created IDXCoreAdapterList %p.\n", *ppv ); + return hr; }
static HRESULT WINAPI dxcore_adapter_factory_statics_GetAdapterByLuid( IDXCoreAdapterFactory *iface, REFLUID adapter_luid, REFIID riid, void **ppv ) diff --git a/dlls/dxcore/tests/dxcore.c b/dlls/dxcore/tests/dxcore.c index f41e3e21d69..451c7153b0f 100644 --- a/dlls/dxcore/tests/dxcore.c +++ b/dlls/dxcore/tests/dxcore.c @@ -75,30 +75,20 @@ static void test_DXCoreCreateAdapterFactory(void) check_interface( adapter_factory, &IID_IDXCoreAdapterList, FALSE );
hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 0, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterList, (void **)&adapter_list ); - todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); - todo_wine ok( adapter_list == NULL, "got adapter_list %p.\n", adapter_list ); hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterFactory, (void **)&adapter_list ); - todo_wine ok( hr == E_NOINTERFACE, "got hr %#lx.\n", hr ); hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, NULL, &IID_IDXCoreAdapterFactory, (void **)&adapter_list ); - todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterFactory, NULL ); - todo_wine ok( hr == E_POINTER, "got hr %#lx.\n", hr );
hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterList, (void **)&adapter_list ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); hr = IDXCoreAdapterFactory_CreateAdapterList( adapter_factory, 1, &DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, &IID_IDXCoreAdapterList, (void **)&adapter_list2 ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); - todo_wine ok( adapter_list != adapter_list2, "got same adapter_list %p, adapter_list2 %p.\n", adapter_list, adapter_list ); - if (SUCCEEDED(hr)) - { ref = IDXCoreAdapterList_Release( adapter_list2 ); ok( ref == 0, "got ref %ld.\n", ref );
@@ -108,7 +98,6 @@ static void test_DXCoreCreateAdapterFactory(void)
ref = IDXCoreAdapterList_Release( adapter_list ); ok( ref == 0, "got ref %ld.\n", ref ); - } ref = IDXCoreAdapterFactory_Release( adapter_factory ); ok( ref == 0, "got ref %ld.\n", ref ); }
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 | 5 +++-- dlls/dxcore/tests/dxcore.c | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/dxcore/dxcore.c b/dlls/dxcore/dxcore.c index 1dc984b57b8..2dbf7eb0f34 100644 --- a/dlls/dxcore/dxcore.c +++ b/dlls/dxcore/dxcore.c @@ -227,8 +227,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 ) 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 );
Any particular reason for requesting a review from me? I don't have any particular experience with dxcore or dozen.
I don't think implementing dxcore on top of dxgi is the right approach. dxcore seems to expose more information than dxgi does. I would instead implement it directly over wined3d.
On Fri May 16 06:00:00 2025 +0000, Giovanni Mascellani wrote:
Any particular reason for requesting a review from me? I don't have any particular experience with dxcore or dozen.
I wasn't sure who to request review from for this. DXCore is closely related to d3d12. I thought this would be implemented over dxgi and you've been the most active CodeWeavers contributor to that module in the past 3 years.
But since wined3d is a better approach I'll request review from Elizabeth :)
On Fri May 16 05:59:56 2025 +0000, Elizabeth Figura wrote:
I don't think implementing dxcore on top of dxgi is the right approach. dxcore seems to expose more information than dxgi does. I would instead implement it directly over wined3d.
Sounds good, is the current style okay or do you want it to match the wined3d one?
@maljaf - I was hoping this would work for Photo AI as well. Any chance you can implement `dxcore_adapter_list_GetAdapter` while you're in there?
``` 10815.890:0020:0024:fixme:dxcore:dxcore_adapter_list_GetAdapter iface 0000000003B8C2C0, index 0, riid {f0db4c7f-fe5a-42a2-bd62-f2a6cf6fc83e}, ppv 000000000011CB28 stub! ```