Needed by Affinity Photo.
The headers are needed for MinGW.
-- v4: apisetschema: Add ext-ms-win-dxcore-l1-1-0. dxcore: Add DXCoreCreateAdapterFactory() stub. dxcore: Add stub DLL. include: Add dxcore.h file. include: Add dxcore_interface.h file.
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/Makefile.in | 1 + include/dxcore_interface.h | 233 +++++++++++++++++++++++++++++++++++++ 2 files changed, 234 insertions(+) create mode 100644 include/dxcore_interface.h
diff --git a/include/Makefile.in b/include/Makefile.in index adbc4165b48..1adad2785b4 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -282,6 +282,7 @@ SOURCES = \ dwrite_1.idl \ dwrite_2.idl \ dwrite_3.idl \ + dxcore_interface.h \ dxdiag.h \ dxerr8.h \ dxerr9.h \ diff --git a/include/dxcore_interface.h b/include/dxcore_interface.h new file mode 100644 index 00000000000..018aee05b43 --- /dev/null +++ b/include/dxcore_interface.h @@ -0,0 +1,233 @@ +/* + * 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 + */ + +#ifndef __DXCORE_INTERFACE__ +#define __DXCORE_INTERFACE__ + +#include <stdarg.h> +#include <stdint.h> +#include <ole2.h> + +#ifdef __cplusplus +#define REFLUID const LUID & +#else +#define REFLUID const LUID * +#endif + +typedef enum DXCoreAdapterProperty +{ + InstanceLuid = 0, + DriverVersion = 1, + DriverDescription = 2, + HardwareID = 3, + KmdModelVersion = 4, + ComputePreemptionGranularity = 5, + GraphicsPreemptionGranularity = 6, + DedicatedAdapterMemory = 7, + DedicatedSystemMemory = 8, + SharedSystemMemory = 9, + AcgCompatible = 10, + IsHardware = 11, + IsIntegrated = 12, + IsDetachable = 13, + HardwareIDParts = 14, +} DXCoreAdapterProperty; + +typedef enum DXCoreAdapterState +{ + IsDriverUpdateInProgress = 0, + AdapterMemoryBudget = 1, +} DXCoreAdapterState; + +typedef enum DXCoreSegmentGroup +{ + Local = 0, + NonLocal = 1, +} DXCoreSegmentGroup; + +typedef enum DXCoreNotificationType +{ + AdapterListStale = 0, + AdapterNoLongerValid = 1, + AdapterBudgetChange = 2, + AdapterHardwareContentProtectionTeardown = 3, +} DXCoreNotificationType; + +typedef enum DXCoreAdapterPreference +{ + Hardware = 0, + MinimumPower = 1, + HighPerformance = 2, +} DXCoreAdapterPreference; + +typedef struct DXCoreHardwareID +{ + uint32_t vendorID; + uint32_t deviceID; + uint32_t subSysID; + uint32_t revision; +} DXCoreHardwareID; + +typedef struct DXCoreHardwareIDParts +{ + uint32_t vendorID; + uint32_t deviceID; + uint32_t subSystemID; + uint32_t subVendorID; + uint32_t revisionID; +} DXCoreHardwareIDParts; + +typedef struct DXCoreAdapterMemoryBudgetNodeSegmentGroup +{ + uint32_t nodeIndex; + DXCoreSegmentGroup segmentGroup; +} DXCoreAdapterMemoryBudgetNodeSegmentGroup; + +typedef struct DXCoreAdapterMemoryBudget +{ + uint64_t budget; + uint64_t currentUsage; + uint64_t availableForReservation; + uint64_t currentReservation; +} DXCoreAdapterMemoryBudget; + +typedef void (WINAPI *PFN_DXCORE_NOTIFICATION_CALLBACK)(DXCoreNotificationType type, IUnknown *object, void *context); + +DEFINE_GUID(IID_IDXCoreAdapterFactory, 0x78ee5945, 0xc36e, 0x4b13, 0xa6, 0x69, 0x00, 0x5d, 0xd1, 0x1c, 0x0f, 0x06); +DEFINE_GUID(IID_IDXCoreAdapterList, 0x526c7776, 0x40e9, 0x459b, 0xb7, 0x11, 0xf3, 0x2a, 0xd7, 0x6d, 0xfc, 0x28); +DEFINE_GUID(IID_IDXCoreAdapter, 0xf0db4c7f, 0xfe5a, 0x42a2, 0xbd, 0x62, 0xf2, 0xa6, 0xcf, 0x6f, 0xc8, 0x3e); +DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D11_GRAPHICS, 0x8c47866b, 0x7583, 0x450d, 0xf0, 0xf0, 0x6b, 0xad, 0xa8, 0x95, 0xaf, 0x4b); +DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, 0x0c9ece4d, 0x2f6e, 0x4f01, 0x8c, 0x96, 0xe8, 0x9e, 0x33, 0x1b, 0x47, 0xb1); +DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE, 0x248e2800, 0xa793, 0x4724, 0xab, 0xaa, 0x23, 0xa6, 0xde, 0x1b, 0xe0, 0x90); + +#undef INTERFACE +#define INTERFACE IDXCoreAdapter +DECLARE_INTERFACE_IID_(IDXCoreAdapter, IUnknown, "526c7776-40e9-459b-b711-f32ad76dfc28") +{ + /* IUnknown methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /* IDXCoreAdapter methods */ + STDMETHOD_(BOOL, IsValid) (THIS) PURE; + STDMETHOD_(BOOL, IsAttributeSupported) (THIS_ GUID attribute) PURE; + STDMETHOD_(BOOL, IsPropertySupported) (THIS_ DXCoreAdapterProperty property) PURE; + STDMETHOD(GetProperty) (THIS_ DXCoreAdapterProperty property, size_t *buffer_size, void *buffer) PURE; + STDMETHOD(GetPropertySize) (THIS_ DXCoreAdapterProperty property, size_t *buffer_size) PURE; + STDMETHOD_(BOOL, IsQueryStateSupported) (THIS_ DXCoreAdapterState property) PURE; + STDMETHOD(QueryState) (THIS_ DXCoreAdapterState state, size_t input_size, const void *input_state, size_t buffer_size, void *buffer) PURE; + STDMETHOD_(BOOL, IsSetStateSupported) (THIS_ DXCoreAdapterState property) PURE; + STDMETHOD(SetState) (THIS_ DXCoreAdapterState state, size_t input_size, const void *input_state, size_t data_size, const void *input_data) PURE; + STDMETHOD(GetFactory) (THIS_ REFIID riid, IUnknown **ppv) PURE; + + #ifdef __cplusplus + template <class T> + HRESULT GetProperty(DXCoreAdapterProperty property, (sizeof(T)) T *buffer) + { + return GetProperty(property, sizeof(T), (void *)buffer); + } + + template <class T1, class T2> + HRESULT QueryState(DXCoreAdapterState state, (sizeof(T1)) const T1 *input_state, (sizeof(T2)) T2 *buffer) + { + return QueryState(state, sizeof(T1), (const void *)input_state, sizeof(T2), (void *)buffer); + } + + template <class T> + HRESULT QueryState(DXCoreAdapterState state, (sizeof(T)) T *buffer) + { + return QueryState(state, 0, NULL, sizeof(T), (void *)buffer); + } + + template <class T1, class T2> + HRESULT SetState(DXCoreAdapterState state, const T1 *input_state, const T2 *input_data) + { + return SetState(state, sizeof(T1), (const void *)input_state, sizeof(T2), (const void *)input_data); + } + + template <class T> + HRESULT GetFactory(T **ppv) + { + return GetFactory(IID_PPV_ARGS(ppv)); + } + #endif +}; + +#undef INTERFACE +#define INTERFACE IDXCoreAdapterList +DECLARE_INTERFACE_IID_(IDXCoreAdapterList, IUnknown, "526c7776-40e9-459b-b711-f32ad76dfc28") +{ + /* IUnknown methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /* IDXCoreAdapterList methods */ + STDMETHOD(GetAdapter) (THIS_ uint32_t index, REFIID riid, void **ppv) PURE; + STDMETHOD_(uint32_t, GetAdapterCount) (THIS) PURE; + STDMETHOD_(BOOL, IsStale) (THIS) PURE; + STDMETHOD(GetFactory) (THIS_ REFIID riid, void **ppv) PURE; + STDMETHOD(Sort) (THIS_ uint32_t num_preferences, const DXCoreAdapterPreference *preferences) PURE; + STDMETHOD_(BOOL, IsAdapterPreferenceSupported) (THIS_ DXCoreAdapterPreference preference) PURE; + + #ifdef __cplusplus + template<class T> + HRESULT STDMETHODCALLTYPE GetAdapter(uint32_t index, T **ppv) + { + return GetAdapter(index, IID_PPV_ARGS(ppv)); + } + + template <class T> + HRESULT GetFactory(T **ppv) + { + return GetFactory(IID_PPV_ARGS(ppv)); + } + #endif +}; + +#undef INTERFACE +#define INTERFACE IDXCoreAdapterFactory +DECLARE_INTERFACE_IID_(IDXCoreAdapterFactory, IUnknown, "78ee5945-c36e-4b13-a669-005dd11c0f06") +{ + /* IUnknown methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + /* IDXCoreAdapterFactory methods */ + STDMETHOD(CreateAdapterList) (THIS_ uint32_t num_attributes, const GUID *filter_attributes, REFIID riid, void **ppv) PURE; + STDMETHOD(GetAdapterByLuid) (THIS_ REFLUID adapter_luid, REFIID riid, void **ppv) PURE; + STDMETHOD_(BOOL, IsNotificationTypeSupported) (THIS_ DXCoreNotificationType type) PURE; + STDMETHOD(RegisterEventNotification) (THIS_ IUnknown *dxcore_object, DXCoreNotificationType type, PFN_DXCORE_NOTIFICATION_CALLBACK callback, + void *callback_context, uint32_t *event_cookie) PURE; + STDMETHOD(UnregisterEventNotification) (THIS_ uint32_t event_cookie) PURE; + + #ifdef __cplusplus + template<class T> + HRESULT STDMETHODCALLTYPE CreateAdapterList(uint32_t num_attributes, const GUID *filter_attributes, T **ppv) + { + return CreateAdapterList(num_attributes, filter_attributes, IID_PPV_ARGS(ppv)); + } + + template<class T> + HRESULT STDMETHODCALLTYPE GetAdapterByLuid(const LUID &adapter_luid, T **ppv) + { + return GetAdapterByLuid(adapter_luid, IID_PPV_ARGS(ppv)); + } + #endif +}; + +#endif /* __DXCORE_INTERFACE__ */
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- include/Makefile.in | 1 + include/dxcore.h | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 include/dxcore.h
diff --git a/include/Makefile.in b/include/Makefile.in index 1adad2785b4..c0f2e873837 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -282,6 +282,7 @@ SOURCES = \ dwrite_1.idl \ dwrite_2.idl \ dwrite_3.idl \ + dxcore.h \ dxcore_interface.h \ dxdiag.h \ dxerr8.h \ diff --git a/include/dxcore.h b/include/dxcore.h new file mode 100644 index 00000000000..3a02b8facf0 --- /dev/null +++ b/include/dxcore.h @@ -0,0 +1,21 @@ +/* + * 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_interface.h" + +HRESULT WINAPI DXCoreCreateAdapterFactory(REFIID,void **);
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- configure.ac | 1 + dlls/dxcore/Makefile.in | 1 + dlls/dxcore/dxcore.spec | 1 + 3 files changed, 3 insertions(+) create mode 100644 dlls/dxcore/Makefile.in create mode 100644 dlls/dxcore/dxcore.spec
diff --git a/configure.ac b/configure.ac index e17d28c8601..9a47d9ba5f3 100644 --- a/configure.ac +++ b/configure.ac @@ -2595,6 +2595,7 @@ WINE_CONFIG_MAKEFILE(dlls/dwmapi/tests) 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/dxdiagn) WINE_CONFIG_MAKEFILE(dlls/dxdiagn/tests) WINE_CONFIG_MAKEFILE(dlls/dxgi) diff --git a/dlls/dxcore/Makefile.in b/dlls/dxcore/Makefile.in new file mode 100644 index 00000000000..36aa27db1aa --- /dev/null +++ b/dlls/dxcore/Makefile.in @@ -0,0 +1 @@ +MODULE = dxcore.dll diff --git a/dlls/dxcore/dxcore.spec b/dlls/dxcore/dxcore.spec new file mode 100644 index 00000000000..1ba59c2f632 --- /dev/null +++ b/dlls/dxcore/dxcore.spec @@ -0,0 +1 @@ +@ stub DXCoreCreateAdapterFactory
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/dxcore/Makefile.in | 3 +++ dlls/dxcore/dxcore.spec | 2 +- dlls/dxcore/main.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 dlls/dxcore/main.c
diff --git a/dlls/dxcore/Makefile.in b/dlls/dxcore/Makefile.in index 36aa27db1aa..85eeb58cee3 100644 --- a/dlls/dxcore/Makefile.in +++ b/dlls/dxcore/Makefile.in @@ -1 +1,4 @@ MODULE = dxcore.dll + +C_SRCS = \ + main.c diff --git a/dlls/dxcore/dxcore.spec b/dlls/dxcore/dxcore.spec index 1ba59c2f632..bac714eefbf 100644 --- a/dlls/dxcore/dxcore.spec +++ b/dlls/dxcore/dxcore.spec @@ -1 +1 @@ -@ stub DXCoreCreateAdapterFactory +@ stdcall DXCoreCreateAdapterFactory(ptr ptr) diff --git a/dlls/dxcore/main.c b/dlls/dxcore/main.c new file mode 100644 index 00000000000..dcc294d04fa --- /dev/null +++ b/dlls/dxcore/main.c @@ -0,0 +1,28 @@ +/* + * 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; +}
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by Affinity Photo. --- dlls/apisetschema/apisetschema.spec | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/apisetschema/apisetschema.spec b/dlls/apisetschema/apisetschema.spec index 122cd1209ba..dbfb4458426 100644 --- a/dlls/apisetschema/apisetschema.spec +++ b/dlls/apisetschema/apisetschema.spec @@ -344,6 +344,7 @@ apiset ext-ms-win-dx-d3d9-l1-1-0 = d3d9.dll apiset ext-ms-win-dx-d3dkmt-gdi-l1-1-0 = gdi32.dll apiset ext-ms-win-dx-ddraw-l1-1-0 = ddraw.dll apiset ext-ms-win-dx-dinput8-l1-1-0 = dinput8.dll +apiset ext-ms-win-dxcore-l1-1-0 = dxcore.dll apiset ext-ms-win-eventing-pdh-l1-1-2 = pdh.dll apiset ext-ms-win-eventing-tdh-ext-l1-1-0 = tdh.dll apiset ext-ms-win-eventing-tdh-priv-l1-1-0 = tdh.dll
David Kahurani (@kahurani) commented about include/dxcore_interface.h:
- {
return QueryState(state, 0, NULL, sizeof(T), (void *)buffer);
- }
- template <class T1, class T2>
- HRESULT SetState(DXCoreAdapterState state, const T1 *input_state, const T2 *input_data)
- {
return SetState(state, sizeof(T1), (const void *)input_state, sizeof(T2), (const void *)input_data);
- }
- template <class T>
- HRESULT GetFactory(T **ppv)
- {
return GetFactory(IID_PPV_ARGS(ppv));
- }
- #endif
It seems like a few things are not correct with this code. This might not be important seeing the design of the code is still being discussed.
i) Casting to a constant which is what is happening for instance here `HRESULT GetProperty(DXCoreAdapterProperty property, (`**`sizeof`**`(T)) T `**`*`**`buffer)` . `sizeof` is a compile time operator which means if `sizeof(T)` evaluates to 5, for instance, this code is equivalent to `HRESULT GetProperty(DXCoreAdapterProperty property, (`**`5`**`) T `**`*`**`buffer)` . You can only cast to a type, of which 5 is not.
ii) Some functions, for instance, `STDMETHOD(GetProperty) (THIS_ DXCoreAdapterProperty property, `**`size_t`**` `**`*`**`buffer_size, `**`void`**` `**`*`**`buffer) PURE;` accept a buffer_size which is a pointer but instead of passing a pointer when overloading it, you pass `sizeof(T)` which, of course, is not a pointer.
From the looks of it, it looks like by using the templates, you are trying to overload the functions so it might be worth noting that by using templates you change the syntax used for calling the method to something like `Getfactory<int>(ppv)` . I am not sure this is a desired effect or a side effect of using the templates hence I am noting.
From the looks of it, it looks like by using the templates, you are trying to overload the functions so it might be worth noting that by using templates you change the syntax used for calling the method to something like `Getfactory<int>(ppv)` . I am not sure this is a desired effect or a side effect of using the templates hence I am noting.
In C++, you do not need to specify function template arguments if the compiler can infer them from the function arguments. And if *all* the template arguments can be inferred, you can elide the angled brackets entirely. If you had a valid `IDXCoreAdapter* adapter;` pointer and an `IDXCoreAdapterFactory* factory;` declaration, the call, then, would just be `adapter->GetFactory(&factory)` in the code. This simplified syntax is the whole point of the helper method templates.
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
- */
+#ifndef __DXCORE_INTERFACE__ +#define __DXCORE_INTERFACE__
+#include <stdarg.h> +#include <stdint.h> +#include <ole2.h>
+#ifdef __cplusplus +#define REFLUID const LUID & +#else +#define REFLUID const LUID * +#endif
+typedef enum DXCoreAdapterProperty
In C++ these are `enum class`, which is different from `enum` as the value won't be in the global namespace and you'd have to do `DXCoreAdapterProperty::InstanceLuid` for instance.
However, C doesn't have `enum class` and we want the headers to be compatible with our C code, so I suggest maybe doing something like:
```suggestion:-0+0 #ifdef __cplusplus #define DECLARE_ENUM_CLASS(x) enum class x #else #define DECLARE_ENUM_CLASS(x) typedef enum x x; enum x #endif
DECLARE_ENUM_CLASS(DXCoreAdapterProperty) { ... }; ```
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
+typedef struct DXCoreAdapterMemoryBudgetNodeSegmentGroup +{
- uint32_t nodeIndex;
- DXCoreSegmentGroup segmentGroup;
+} DXCoreAdapterMemoryBudgetNodeSegmentGroup;
+typedef struct DXCoreAdapterMemoryBudget +{
- uint64_t budget;
- uint64_t currentUsage;
- uint64_t availableForReservation;
- uint64_t currentReservation;
+} DXCoreAdapterMemoryBudget;
+typedef void (WINAPI *PFN_DXCORE_NOTIFICATION_CALLBACK)(DXCoreNotificationType type, IUnknown *object, void *context);
```suggestion:-0+0 typedef void (STDMETHODCALLTYPE *PFN_DXCORE_NOTIFICATION_CALLBACK)(DXCoreNotificationType type, IUnknown *object, void *context); ```
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
- uint64_t availableForReservation;
- uint64_t currentReservation;
+} DXCoreAdapterMemoryBudget;
+typedef void (WINAPI *PFN_DXCORE_NOTIFICATION_CALLBACK)(DXCoreNotificationType type, IUnknown *object, void *context);
+DEFINE_GUID(IID_IDXCoreAdapterFactory, 0x78ee5945, 0xc36e, 0x4b13, 0xa6, 0x69, 0x00, 0x5d, 0xd1, 0x1c, 0x0f, 0x06); +DEFINE_GUID(IID_IDXCoreAdapterList, 0x526c7776, 0x40e9, 0x459b, 0xb7, 0x11, 0xf3, 0x2a, 0xd7, 0x6d, 0xfc, 0x28); +DEFINE_GUID(IID_IDXCoreAdapter, 0xf0db4c7f, 0xfe5a, 0x42a2, 0xbd, 0x62, 0xf2, 0xa6, 0xcf, 0x6f, 0xc8, 0x3e); +DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D11_GRAPHICS, 0x8c47866b, 0x7583, 0x450d, 0xf0, 0xf0, 0x6b, 0xad, 0xa8, 0x95, 0xaf, 0x4b); +DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, 0x0c9ece4d, 0x2f6e, 0x4f01, 0x8c, 0x96, 0xe8, 0x9e, 0x33, 0x1b, 0x47, 0xb1); +DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE, 0x248e2800, 0xa793, 0x4724, 0xab, 0xaa, 0x23, 0xa6, 0xde, 0x1b, 0xe0, 0x90);
+#undef INTERFACE +#define INTERFACE IDXCoreAdapter +DECLARE_INTERFACE_IID_(IDXCoreAdapter, IUnknown, "526c7776-40e9-459b-b711-f32ad76dfc28")
```suggestion:-0+0 DECLARE_INTERFACE_IID_(IDXCoreAdapter, IUnknown, "f0db4c7f-fe5a-42a2-bd62-f2a6cf6fc83e") ```
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
+DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, 0x0c9ece4d, 0x2f6e, 0x4f01, 0x8c, 0x96, 0xe8, 0x9e, 0x33, 0x1b, 0x47, 0xb1); +DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE, 0x248e2800, 0xa793, 0x4724, 0xab, 0xaa, 0x23, 0xa6, 0xde, 0x1b, 0xe0, 0x90);
+#undef INTERFACE +#define INTERFACE IDXCoreAdapter +DECLARE_INTERFACE_IID_(IDXCoreAdapter, IUnknown, "526c7776-40e9-459b-b711-f32ad76dfc28") +{
- /* IUnknown methods */
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- /* IDXCoreAdapter methods */
- STDMETHOD_(BOOL, IsValid) (THIS) PURE;
- STDMETHOD_(BOOL, IsAttributeSupported) (THIS_ GUID attribute) PURE;
- STDMETHOD_(BOOL, IsPropertySupported) (THIS_ DXCoreAdapterProperty property) PURE;
- STDMETHOD(GetProperty) (THIS_ DXCoreAdapterProperty property, size_t *buffer_size, void *buffer) PURE;
```suggestion:-0+0 STDMETHOD(GetProperty) (THIS_ DXCoreAdapterProperty property, size_t buffer_size, void *buffer) PURE; ```
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
+#undef INTERFACE +#define INTERFACE IDXCoreAdapter +DECLARE_INTERFACE_IID_(IDXCoreAdapter, IUnknown, "526c7776-40e9-459b-b711-f32ad76dfc28") +{
- /* IUnknown methods */
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- /* IDXCoreAdapter methods */
- STDMETHOD_(BOOL, IsValid) (THIS) PURE;
- STDMETHOD_(BOOL, IsAttributeSupported) (THIS_ GUID attribute) PURE;
- STDMETHOD_(BOOL, IsPropertySupported) (THIS_ DXCoreAdapterProperty property) PURE;
- STDMETHOD(GetProperty) (THIS_ DXCoreAdapterProperty property, size_t *buffer_size, void *buffer) PURE;
- STDMETHOD(GetPropertySize) (THIS_ DXCoreAdapterProperty property, size_t *buffer_size) PURE;
- STDMETHOD_(BOOL, IsQueryStateSupported) (THIS_ DXCoreAdapterState property) PURE;
- STDMETHOD(QueryState) (THIS_ DXCoreAdapterState state, size_t input_size, const void *input_state, size_t buffer_size, void *buffer) PURE;
```suggestion:-0+0 STDMETHOD(QueryState) (THIS_ DXCoreAdapterState state, size_t state_details_size, const void *state_details, size_t buffer_size, void *buffer) PURE; ```
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
+DECLARE_INTERFACE_IID_(IDXCoreAdapter, IUnknown, "526c7776-40e9-459b-b711-f32ad76dfc28") +{
- /* IUnknown methods */
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- /* IDXCoreAdapter methods */
- STDMETHOD_(BOOL, IsValid) (THIS) PURE;
- STDMETHOD_(BOOL, IsAttributeSupported) (THIS_ GUID attribute) PURE;
- STDMETHOD_(BOOL, IsPropertySupported) (THIS_ DXCoreAdapterProperty property) PURE;
- STDMETHOD(GetProperty) (THIS_ DXCoreAdapterProperty property, size_t *buffer_size, void *buffer) PURE;
- STDMETHOD(GetPropertySize) (THIS_ DXCoreAdapterProperty property, size_t *buffer_size) PURE;
- STDMETHOD_(BOOL, IsQueryStateSupported) (THIS_ DXCoreAdapterState property) PURE;
- STDMETHOD(QueryState) (THIS_ DXCoreAdapterState state, size_t input_size, const void *input_state, size_t buffer_size, void *buffer) PURE;
- STDMETHOD_(BOOL, IsSetStateSupported) (THIS_ DXCoreAdapterState property) PURE;
- STDMETHOD(SetState) (THIS_ DXCoreAdapterState state, size_t input_size, const void *input_state, size_t data_size, const void *input_data) PURE;
```suggestion:-0+0 STDMETHOD(SetState) (THIS_ DXCoreAdapterState state, size_t state_details_size, const void *state_details, size_t buffer_size, const void *buffer) PURE; ```
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- /* IDXCoreAdapter methods */
- STDMETHOD_(BOOL, IsValid) (THIS) PURE;
- STDMETHOD_(BOOL, IsAttributeSupported) (THIS_ GUID attribute) PURE;
- STDMETHOD_(BOOL, IsPropertySupported) (THIS_ DXCoreAdapterProperty property) PURE;
- STDMETHOD(GetProperty) (THIS_ DXCoreAdapterProperty property, size_t *buffer_size, void *buffer) PURE;
- STDMETHOD(GetPropertySize) (THIS_ DXCoreAdapterProperty property, size_t *buffer_size) PURE;
- STDMETHOD_(BOOL, IsQueryStateSupported) (THIS_ DXCoreAdapterState property) PURE;
- STDMETHOD(QueryState) (THIS_ DXCoreAdapterState state, size_t input_size, const void *input_state, size_t buffer_size, void *buffer) PURE;
- STDMETHOD_(BOOL, IsSetStateSupported) (THIS_ DXCoreAdapterState property) PURE;
- STDMETHOD(SetState) (THIS_ DXCoreAdapterState state, size_t input_size, const void *input_state, size_t data_size, const void *input_data) PURE;
- STDMETHOD(GetFactory) (THIS_ REFIID riid, IUnknown **ppv) PURE;
- #ifdef __cplusplus
- template <class T>
- HRESULT GetProperty(DXCoreAdapterProperty property, (sizeof(T)) T *buffer)
```suggestion:-0+0 HRESULT GetProperty(DXCoreAdapterProperty property, T *buffer) ```
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
- STDMETHOD_(BOOL, IsSetStateSupported) (THIS_ DXCoreAdapterState property) PURE;
- STDMETHOD(SetState) (THIS_ DXCoreAdapterState state, size_t input_size, const void *input_state, size_t data_size, const void *input_data) PURE;
- STDMETHOD(GetFactory) (THIS_ REFIID riid, IUnknown **ppv) PURE;
- #ifdef __cplusplus
- template <class T>
- HRESULT GetProperty(DXCoreAdapterProperty property, (sizeof(T)) T *buffer)
- {
return GetProperty(property, sizeof(T), (void *)buffer);
- }
- template <class T1, class T2>
- HRESULT QueryState(DXCoreAdapterState state, (sizeof(T1)) const T1 *input_state, (sizeof(T2)) T2 *buffer)
- {
return QueryState(state, sizeof(T1), (const void *)input_state, sizeof(T2), (void *)buffer);
- }
```suggestion:-3+0 HRESULT QueryState(DXCoreAdapterState state, const T1 *state_details, T2 *buffer) { return QueryState(state, sizeof(T1), (const void *)state_details, sizeof(T2), (void *)buffer); } ```
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
- #ifdef __cplusplus
- template <class T>
- HRESULT GetProperty(DXCoreAdapterProperty property, (sizeof(T)) T *buffer)
- {
return GetProperty(property, sizeof(T), (void *)buffer);
- }
- template <class T1, class T2>
- HRESULT QueryState(DXCoreAdapterState state, (sizeof(T1)) const T1 *input_state, (sizeof(T2)) T2 *buffer)
- {
return QueryState(state, sizeof(T1), (const void *)input_state, sizeof(T2), (void *)buffer);
- }
- template <class T>
- HRESULT QueryState(DXCoreAdapterState state, (sizeof(T)) T *buffer)
```suggestion:-0+0 HRESULT QueryState(DXCoreAdapterState state, T *buffer) ```
Rémi Bernon (@rbernon) commented about include/dxcore_interface.h:
- HRESULT QueryState(DXCoreAdapterState state, (sizeof(T1)) const T1 *input_state, (sizeof(T2)) T2 *buffer)
- {
return QueryState(state, sizeof(T1), (const void *)input_state, sizeof(T2), (void *)buffer);
- }
- template <class T>
- HRESULT QueryState(DXCoreAdapterState state, (sizeof(T)) T *buffer)
- {
return QueryState(state, 0, NULL, sizeof(T), (void *)buffer);
- }
- template <class T1, class T2>
- HRESULT SetState(DXCoreAdapterState state, const T1 *input_state, const T2 *input_data)
- {
return SetState(state, sizeof(T1), (const void *)input_state, sizeof(T2), (const void *)input_data);
- }
```suggestion:-4+0 template <class T1, class T2> HRESULT SetState(DXCoreAdapterState state, const T1 *state_details, const T2 *buffer) { return SetState(state, sizeof(T1), (const void *)state_details, sizeof(T2), (const void *)buffer); } ```
On Thu Aug 24 11:54:18 2023 +0000, Rémi Bernon wrote:
In C++ these are `enum class`, which is different from `enum` as the value won't be in the global namespace and you'd have to do `DXCoreAdapterProperty::InstanceLuid` for instance. However, C doesn't have `enum class` and we want the headers to be compatible with our C code, so I suggest maybe doing something like:
#ifdef __cplusplus #define DECLARE_ENUM_CLASS(x) enum class x #else #define DECLARE_ENUM_CLASS(x) typedef enum x x; enum x #endif DECLARE_ENUM_CLASS(DXCoreAdapterProperty) { ... };
(Probably best to merge the #ifdef with the other #ifdef above)
In C++ these are `enum class`, which is different from `enum` as the value won't be in the global namespace and you'd have to do `DXCoreAdapterProperty::InstanceLuid` for instance.
In that case, you may wish to prefix the enumerator names for C.