From c50c47a312500e9bda5590965d7318e5c7570bcc Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <[email protected]>
Date: Fri, 17 Jun 2022 13:05:37 +0530
Subject: [PATCH] headers: Add dxcore.idl

Required for mesa.

Signed-off-by: Biswapriyo Nath <[email protected]>
---
 mingw-w64-crt/libsrc/dxguid.c        |   1 +
 mingw-w64-headers/Makefile.am        |   1 +
 mingw-w64-headers/include/dxcore.idl | 195 +++++++++++++++++++++++++++
 3 files changed, 197 insertions(+)
 create mode 100644 mingw-w64-headers/include/dxcore.idl

diff --git a/mingw-w64-crt/libsrc/dxguid.c b/mingw-w64-crt/libsrc/dxguid.c
index 1b026fa..e8a05ff 100644
--- a/mingw-w64-crt/libsrc/dxguid.c
+++ b/mingw-w64-crt/libsrc/dxguid.c
@@ -26,6 +26,7 @@
 #include <d3d12sdklayers.h>
 #include <d3d12shader.h>
 
+#include <dxcore.h>
 #include <dxgidebug.h>
 #include <dxgi.h>
 #include <dxgi1_2.h>
diff --git a/mingw-w64-headers/Makefile.am b/mingw-w64-headers/Makefile.am
index 96a8f47..f827f2b 100644
--- a/mingw-w64-headers/Makefile.am
+++ b/mingw-w64-headers/Makefile.am
@@ -125,6 +125,7 @@ IDL_SRCS = \
   include/dwrite_1.idl \
   include/dwrite_2.idl \
   include/dwrite_3.idl \
+  include/dxcore.idl \
   include/dxgi.idl \
   include/dxgi1_2.idl \
   include/dxgi1_3.idl \
diff --git a/mingw-w64-headers/include/dxcore.idl 
b/mingw-w64-headers/include/dxcore.idl
new file mode 100644
index 0000000..f833464
--- /dev/null
+++ b/mingw-w64-headers/include/dxcore.idl
@@ -0,0 +1,195 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+import "oaidl.idl";
+import "ocidl.idl";
+
+cpp_quote("#define _FACDXCORE 0x880")
+cpp_quote("#define MAKE_DXCORE_HRESULT(code) MAKE_HRESULT(1, _FACDXCORE, 
code)")
+
+cpp_quote("#if 0")
+typedef struct _LUID {
+  DWORD LowPart;
+  LONG HighPart;
+} LUID, *PLUID;
+cpp_quote("#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 vendorID;
+  UINT32 deviceID;
+  UINT32 subSysID;
+  UINT32 revision;
+} DXCoreHardwareID;
+
+typedef struct DXCoreHardwareIDParts {
+  UINT32 vendorID;
+  UINT32 deviceID;
+  UINT32 subSystemID;
+  UINT32 subVendorID;
+  UINT32 revisionID;
+} DXCoreHardwareIDParts;
+
+typedef struct DXCoreAdapterMemoryBudgetNodeSegmentGroup {
+  UINT32 nodeIndex;
+  DXCoreSegmentGroup segmentGroup;
+} DXCoreAdapterMemoryBudgetNodeSegmentGroup;
+
+typedef struct DXCoreAdapterMemoryBudget {
+  UINT64 budget;
+  UINT64 currentUsage;
+  UINT64 availableForReservation;
+  UINT64 currentReservation;
+} DXCoreAdapterMemoryBudget;
+
+cpp_quote("typedef void (WINAPI 
*PFN_DXCORE_NOTIFICATION_CALLBACK)(DXCoreNotificationType notificationType, 
IUnknown *object, void *context);")
+
+cpp_quote("DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D11_GRAPHICS, 0x8c47866b, 
0x7583, 0x450d, 0xf0, 0xf0, 0x6b, 0xad, 0xa8, 0x95, 0xaf, 0x4b);")
+cpp_quote("DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, 0x0c9ece4d, 
0x2f6e, 0x4f01, 0x8c, 0x96, 0xe8, 0x9e, 0x33, 0x1b, 0x47, 0xb1);")
+cpp_quote("DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE, 
0x248e2800, 0xa793, 0x4724, 0xab, 0xaa, 0x23, 0xa6, 0xde, 0x1b, 0xe0, 0x90);")
+
+[uuid(f0db4c7f-fe5a-42a2-bd62-f2a6cf6fc83e), object, local, 
pointer_default(unique)]
+interface IDXCoreAdapter : IUnknown
+{
+  boolean IsValid();
+
+  boolean IsAttributeSupported(
+    REFGUID attributeGUID);
+
+  boolean IsPropertySupported(
+    DXCoreAdapterProperty property);
+
+  HRESULT GetProperty(
+    DXCoreAdapterProperty property,
+    SIZE_T bufferSize,
+    void *propertyData);
+
+  HRESULT GetPropertySize(
+    DXCoreAdapterProperty property,
+    SIZE_T *bufferSize);
+
+  boolean IsQueryStateSupported(
+    DXCoreAdapterState property);
+
+  HRESULT QueryState(
+    DXCoreAdapterState state,
+    SIZE_T inputStateDetailsSize,
+    const void *inputStateDetails,
+    SIZE_T outputBufferSize,
+    void *outputBuffer);
+
+  boolean IsSetStateSupported(
+    DXCoreAdapterState property);
+
+  HRESULT SetState(
+    DXCoreAdapterState state,
+    SIZE_T inputStateDetailsSize,
+    const void *inputStateDetails,
+    SIZE_T inputDataSize,
+    const void *inputData);
+
+  HRESULT GetFactory(
+    REFIID riid,
+    void **ppvFactory);
+}
+
+[
+  uuid(526c7776-40e9-459b-b711-f32ad76dfc28),
+  object,
+  local,
+  pointer_default(unique)
+]
+interface IDXCoreAdapterList : IUnknown
+{
+  HRESULT GetAdapter(
+    UINT32 index,
+    REFIID riid,
+    void **ppvAdapter);
+
+  UINT32 GetAdapterCount();
+  boolean IsStale();
+
+  HRESULT GetFactory(
+    REFIID riid,
+     void **ppvFactory);
+
+  HRESULT Sort(
+    UINT32 numPreferences,
+    const DXCoreAdapterPreference *preferences);
+
+  boolean IsAdapterPreferenceSupported(
+    DXCoreAdapterPreference preference);
+}
+
+[uuid(78ee5945-c36e-4b13-a669-005dd11c0f06), object, local, 
pointer_default(unique)]
+interface IDXCoreAdapterFactory : IUnknown
+{
+  HRESULT CreateAdapterList(
+    UINT32 numAttributes,
+    const GUID *filterAttributes,
+    REFIID riid,
+    void **ppvAdapterList);
+
+  HRESULT GetAdapterByLuid(
+    const LUID adapterLUID,
+    REFIID riid,
+    void **ppvAdapter);
+
+  boolean IsNotificationTypeSupported(
+    DXCoreNotificationType notificationType);
+
+  HRESULT RegisterEventNotification(
+    IUnknown *dxCoreObject,
+    DXCoreNotificationType notificationType,
+    void *callbackFunction,
+    void *callbackContext,
+    UINT32 *eventCookie);
+
+  HRESULT UnregisterEventNotification(
+    UINT32 eventCookie);
+}
+
+cpp_quote("STDAPI DXCoreCreateAdapterFactory(REFIID riid, void **ppvFactory);")
-- 
2.36.1

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to