From 6863c2bc8a50689bf0fae703cf52d2ceaee56df5 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 19 Jun 2022 18:11:51 +0200 Subject: [PATCH] Add .NET Standard 2.0 polyfill types for DRED support --- .../um/d3d12/D3D12_AUTO_BREADCRUMB_NODE1.cs | 36 ++++++++++++ .../um/d3d12/D3D12_AUTO_BREADCRUMB_OP.cs | 56 +++++++++++++++++++ .../D3D12_DRED_AUTO_BREADCRUMB_OUTPUT1.cs | 13 +++++ .../um/d3d12/D3D12_DRED_BREADCRUMB_CONTEXT.cs | 15 +++++ .../d3d12/ID3D12DeviceRemovedExtendedData1.cs | 50 +++++++++++++++++ .../TerraFX.Interop.Windows.projitems | 5 ++ 6 files changed, 175 insertions(+) create mode 100644 src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_NODE1.cs create mode 100644 src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_OP.cs create mode 100644 src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_AUTO_BREADCRUMB_OUTPUT1.cs create mode 100644 src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_BREADCRUMB_CONTEXT.cs create mode 100644 src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_NODE1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_NODE1.cs new file mode 100644 index 00000000..a5376c65 --- /dev/null +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_NODE1.cs @@ -0,0 +1,36 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 +// Original source is Copyright © Microsoft. Licensed under the MIT license + +namespace TerraFX.Interop.DirectX +{ + internal unsafe partial struct D3D12_AUTO_BREADCRUMB_NODE1 + { + [NativeTypeName("const char *")] + public sbyte* pCommandListDebugNameA; + + [NativeTypeName("const wchar_t *")] + public ushort* pCommandListDebugNameW; + + [NativeTypeName("const char *")] + public sbyte* pCommandQueueDebugNameA; + + [NativeTypeName("const wchar_t *")] + public ushort* pCommandQueueDebugNameW; + public ID3D12GraphicsCommandList* pCommandList; + public ID3D12CommandQueue* pCommandQueue; + public uint BreadcrumbCount; + + [NativeTypeName("const UINT *")] + public uint* pLastBreadcrumbValue; + + [NativeTypeName("const D3D12_AUTO_BREADCRUMB_OP *")] + public D3D12_AUTO_BREADCRUMB_OP* pCommandHistory; + + [NativeTypeName("const struct D3D12_AUTO_BREADCRUMB_NODE1 *")] + public D3D12_AUTO_BREADCRUMB_NODE1* pNext; + public uint BreadcrumbContextsCount; + public D3D12_DRED_BREADCRUMB_CONTEXT* pBreadcrumbContexts; + } +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_OP.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_OP.cs new file mode 100644 index 00000000..95dd83ec --- /dev/null +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_AUTO_BREADCRUMB_OP.cs @@ -0,0 +1,56 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 +// Original source is Copyright © Microsoft. Licensed under the MIT license + +namespace TerraFX.Interop.DirectX +{ + internal enum D3D12_AUTO_BREADCRUMB_OP + { + D3D12_AUTO_BREADCRUMB_OP_SETMARKER = 0, + D3D12_AUTO_BREADCRUMB_OP_BEGINEVENT = 1, + D3D12_AUTO_BREADCRUMB_OP_ENDEVENT = 2, + D3D12_AUTO_BREADCRUMB_OP_DRAWINSTANCED = 3, + D3D12_AUTO_BREADCRUMB_OP_DRAWINDEXEDINSTANCED = 4, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEINDIRECT = 5, + D3D12_AUTO_BREADCRUMB_OP_DISPATCH = 6, + D3D12_AUTO_BREADCRUMB_OP_COPYBUFFERREGION = 7, + D3D12_AUTO_BREADCRUMB_OP_COPYTEXTUREREGION = 8, + D3D12_AUTO_BREADCRUMB_OP_COPYRESOURCE = 9, + D3D12_AUTO_BREADCRUMB_OP_COPYTILES = 10, + D3D12_AUTO_BREADCRUMB_OP_RESOLVESUBRESOURCE = 11, + D3D12_AUTO_BREADCRUMB_OP_CLEARRENDERTARGETVIEW = 12, + D3D12_AUTO_BREADCRUMB_OP_CLEARUNORDEREDACCESSVIEW = 13, + D3D12_AUTO_BREADCRUMB_OP_CLEARDEPTHSTENCILVIEW = 14, + D3D12_AUTO_BREADCRUMB_OP_RESOURCEBARRIER = 15, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEBUNDLE = 16, + D3D12_AUTO_BREADCRUMB_OP_PRESENT = 17, + D3D12_AUTO_BREADCRUMB_OP_RESOLVEQUERYDATA = 18, + D3D12_AUTO_BREADCRUMB_OP_BEGINSUBMISSION = 19, + D3D12_AUTO_BREADCRUMB_OP_ENDSUBMISSION = 20, + D3D12_AUTO_BREADCRUMB_OP_DECODEFRAME = 21, + D3D12_AUTO_BREADCRUMB_OP_PROCESSFRAMES = 22, + D3D12_AUTO_BREADCRUMB_OP_ATOMICCOPYBUFFERUINT = 23, + D3D12_AUTO_BREADCRUMB_OP_ATOMICCOPYBUFFERUINT64 = 24, + D3D12_AUTO_BREADCRUMB_OP_RESOLVESUBRESOURCEREGION = 25, + D3D12_AUTO_BREADCRUMB_OP_WRITEBUFFERIMMEDIATE = 26, + D3D12_AUTO_BREADCRUMB_OP_DECODEFRAME1 = 27, + D3D12_AUTO_BREADCRUMB_OP_SETPROTECTEDRESOURCESESSION = 28, + D3D12_AUTO_BREADCRUMB_OP_DECODEFRAME2 = 29, + D3D12_AUTO_BREADCRUMB_OP_PROCESSFRAMES1 = 30, + D3D12_AUTO_BREADCRUMB_OP_BUILDRAYTRACINGACCELERATIONSTRUCTURE = 31, + D3D12_AUTO_BREADCRUMB_OP_EMITRAYTRACINGACCELERATIONSTRUCTUREPOSTBUILDINFO = 32, + D3D12_AUTO_BREADCRUMB_OP_COPYRAYTRACINGACCELERATIONSTRUCTURE = 33, + D3D12_AUTO_BREADCRUMB_OP_DISPATCHRAYS = 34, + D3D12_AUTO_BREADCRUMB_OP_INITIALIZEMETACOMMAND = 35, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEMETACOMMAND = 36, + D3D12_AUTO_BREADCRUMB_OP_ESTIMATEMOTION = 37, + D3D12_AUTO_BREADCRUMB_OP_RESOLVEMOTIONVECTORHEAP = 38, + D3D12_AUTO_BREADCRUMB_OP_SETPIPELINESTATE1 = 39, + D3D12_AUTO_BREADCRUMB_OP_INITIALIZEEXTENSIONCOMMAND = 40, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEEXTENSIONCOMMAND = 41, + D3D12_AUTO_BREADCRUMB_OP_DISPATCHMESH = 42, + D3D12_AUTO_BREADCRUMB_OP_ENCODEFRAME = 43, + D3D12_AUTO_BREADCRUMB_OP_RESOLVEENCODEROUTPUTMETADATA = 44, + } +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_AUTO_BREADCRUMB_OUTPUT1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_AUTO_BREADCRUMB_OUTPUT1.cs new file mode 100644 index 00000000..57b9e182 --- /dev/null +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_AUTO_BREADCRUMB_OUTPUT1.cs @@ -0,0 +1,13 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 +// Original source is Copyright © Microsoft. Licensed under the MIT license + +namespace TerraFX.Interop.DirectX +{ + internal unsafe partial struct D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1 + { + [NativeTypeName("const D3D12_AUTO_BREADCRUMB_NODE1 *")] + public D3D12_AUTO_BREADCRUMB_NODE1* pHeadAutoBreadcrumbNode; + } +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_BREADCRUMB_CONTEXT.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_BREADCRUMB_CONTEXT.cs new file mode 100644 index 00000000..bf5f8904 --- /dev/null +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/D3D12_DRED_BREADCRUMB_CONTEXT.cs @@ -0,0 +1,15 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 +// Original source is Copyright © Microsoft. Licensed under the MIT license + +namespace TerraFX.Interop.DirectX +{ + internal unsafe partial struct D3D12_DRED_BREADCRUMB_CONTEXT + { + public uint BreadcrumbIndex; + + [NativeTypeName("const wchar_t *")] + public ushort* pContextString; + } +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs new file mode 100644 index 00000000..2e7d0d58 --- /dev/null +++ b/src/TerraFX.Interop.Windows/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs @@ -0,0 +1,50 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from d3d12.h in Microsoft.Direct3D.D3D12 v1.600.10 +// Original source is Copyright © Microsoft. Licensed under the MIT license + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using TerraFX.Interop.Windows; + +namespace TerraFX.Interop.DirectX +{ + [Guid("9727A022-CF1D-4DDA-9EBA-EFFA653FC506")] + [NativeTypeName("struct ID3D12DeviceRemovedExtendedData1 : ID3D12DeviceRemovedExtendedData")] + [NativeInheritance("ID3D12DeviceRemovedExtendedData")] + internal unsafe partial struct ID3D12DeviceRemovedExtendedData1 + { + public void** lpVtbl; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + [VtblIndex(0)] + public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject) + { + return ((delegate* unmanaged[Stdcall])(lpVtbl[0]))((ID3D12DeviceRemovedExtendedData1*)Unsafe.AsPointer(ref this), riid, ppvObject); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + [VtblIndex(1)] + [return: NativeTypeName("ULONG")] + public uint AddRef() + { + return ((delegate* unmanaged[Stdcall])(lpVtbl[1]))((ID3D12DeviceRemovedExtendedData1*)Unsafe.AsPointer(ref this)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + [VtblIndex(2)] + [return: NativeTypeName("ULONG")] + public uint Release() + { + return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((ID3D12DeviceRemovedExtendedData1*)Unsafe.AsPointer(ref this)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + [VtblIndex(5)] + public HRESULT GetAutoBreadcrumbsOutput1(D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1* pOutput) + { + return ((delegate* unmanaged[Stdcall])(lpVtbl[5]))((ID3D12DeviceRemovedExtendedData1*)Unsafe.AsPointer(ref this), pOutput); + } + } +} \ No newline at end of file diff --git a/src/TerraFX.Interop.Windows/TerraFX.Interop.Windows.projitems b/src/TerraFX.Interop.Windows/TerraFX.Interop.Windows.projitems index a3bd5273..bbf1838f 100644 --- a/src/TerraFX.Interop.Windows/TerraFX.Interop.Windows.projitems +++ b/src/TerraFX.Interop.Windows/TerraFX.Interop.Windows.projitems @@ -72,6 +72,8 @@ + + @@ -98,6 +100,8 @@ + + @@ -189,6 +193,7 @@ +