From 899cdd4c12c8e7808e91eed2a959ae75798204c3 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 23 Nov 2023 17:12:24 +0100 Subject: [PATCH] Adopt IComObject.IID in ComputeSharp --- .../DirectX/shared/dxgi/IDXGIAdapter.cs | 29 ++++++++++++++++++- .../DirectX/shared/dxgi/IDXGIAdapter1.cs | 29 ++++++++++++++++++- .../DirectX/shared/dxgi1_4/IDXGIFactory4.cs | 29 ++++++++++++++++++- .../DirectX/shared/dxgi1_6/IDXGIFactory6.cs | 29 ++++++++++++++++++- .../um/d3d12/ID3D12CommandAllocator.cs | 29 ++++++++++++++++++- .../DirectX/um/d3d12/ID3D12CommandQueue.cs | 29 ++++++++++++++++++- .../DirectX/um/d3d12/ID3D12DescriptorHeap.cs | 29 ++++++++++++++++++- .../DirectX/um/d3d12/ID3D12Device.cs | 29 ++++++++++++++++++- .../d3d12/ID3D12DeviceRemovedExtendedData1.cs | 29 ++++++++++++++++++- ...D3D12DeviceRemovedExtendedDataSettings1.cs | 29 ++++++++++++++++++- .../DirectX/um/d3d12/ID3D12Fence.cs | 29 ++++++++++++++++++- .../um/d3d12/ID3D12GraphicsCommandList.cs | 29 ++++++++++++++++++- .../DirectX/um/d3d12/ID3D12PipelineState.cs | 29 ++++++++++++++++++- .../DirectX/um/d3d12/ID3D12Resource.cs | 29 ++++++++++++++++++- .../DirectX/um/d3d12/ID3D12RootSignature.cs | 29 ++++++++++++++++++- .../DirectX/um/d3d12sdklayers/ID3D12Debug.cs | 29 ++++++++++++++++++- .../DirectX/um/d3d12sdklayers/ID3D12Debug1.cs | 29 ++++++++++++++++++- .../um/d3d12sdklayers/ID3D12InfoQueue.cs | 29 ++++++++++++++++++- .../um/wincodec/IWICImagingFactory2.cs | 29 ++++++++++++++++++- .../IWICStreamExtensions.IBufferWriter.cs | 5 +--- .../Interop/IWICStreamExtensions.Stream.cs | 5 +--- .../Interop/Allocation/ID3D12Allocation.cs | 21 ++++++-------- .../Allocation/ID3D12MemoryAllocator.cs | 21 ++++++-------- .../ID3D12MemoryAllocatorFactory.cs | 21 ++++++-------- 24 files changed, 561 insertions(+), 63 deletions(-) diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter.cs index e4017ac6..5232e0eb 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("2411E7E1-12AC-4CCF-BD14-9798E8534DC0")] [NativeTypeName("struct IDXGIAdapter : IDXGIObject")] [NativeInheritance("IDXGIObject")] -internal unsafe partial struct IDXGIAdapter +internal unsafe partial struct IDXGIAdapter : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xE1, 0xE7, 0x11, 0x24, + 0xAC, 0x12, + 0xCF, 0x4C, + 0xBD, + 0x14, + 0x97, + 0x98, + 0xE8, + 0x53, + 0x4D, + 0xC0 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter1.cs index 2c1fcc3c..18a34a82 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter1.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter1.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("29038F61-3839-4626-91FD-086879011A05")] [NativeTypeName("struct IDXGIAdapter1 : IDXGIAdapter")] [NativeInheritance("IDXGIAdapter")] -internal unsafe partial struct IDXGIAdapter1 +internal unsafe partial struct IDXGIAdapter1 : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x61, 0x8F, 0x03, 0x29, + 0x39, 0x38, + 0x26, 0x46, + 0x91, + 0xFD, + 0x08, + 0x68, + 0x79, + 0x01, + 0x1A, + 0x05 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGIFactory4.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGIFactory4.cs index 05c8980c..1f94711a 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGIFactory4.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGIFactory4.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("1BC6EA02-EF36-464F-BF0C-21CA39E5168A")] [NativeTypeName("struct IDXGIFactory4 : IDXGIFactory3")] [NativeInheritance("IDXGIFactory3")] -internal unsafe partial struct IDXGIFactory4 +internal unsafe partial struct IDXGIFactory4 : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x02, 0xEA, 0xC6, 0x1B, + 0x36, 0xEF, + 0x4F, 0x46, + 0xBF, + 0x0C, + 0x21, + 0xCA, + 0x39, + 0xE5, + 0x16, + 0x8A + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_6/IDXGIFactory6.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_6/IDXGIFactory6.cs index a38db8df..91a5edb0 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_6/IDXGIFactory6.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_6/IDXGIFactory6.cs @@ -8,14 +8,41 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [SupportedOSPlatform("windows10.0.17134.0")] [Guid("C1B6694F-FF09-44A9-B03C-77900A0A1D17")] [NativeTypeName("struct IDXGIFactory6 : IDXGIFactory5")] [NativeInheritance("IDXGIFactory5")] -internal unsafe partial struct IDXGIFactory6 +internal unsafe partial struct IDXGIFactory6 : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x4F, 0x69, 0xB6, 0xC1, + 0x09, 0xFF, + 0xA9, 0x44, + 0xB0, + 0x3C, + 0x77, + 0x90, + 0x0A, + 0x0A, + 0x1D, + 0x17 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandAllocator.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandAllocator.cs index 18d51aff..3999aad2 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandAllocator.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandAllocator.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("6102DEE4-AF59-4B09-B999-B44D73F09B24")] [NativeTypeName("struct ID3D12CommandAllocator : ID3D12Pageable")] [NativeInheritance("ID3D12Pageable")] -internal unsafe partial struct ID3D12CommandAllocator +internal unsafe partial struct ID3D12CommandAllocator : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xE4, 0xDE, 0x02, 0x61, + 0x59, 0xAF, + 0x09, 0x4B, + 0xB9, + 0x99, + 0xB4, + 0x4D, + 0x73, + 0xF0, + 0x9B, + 0x24 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandQueue.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandQueue.cs index 7be75094..40413942 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandQueue.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandQueue.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("0EC870A6-5D7E-4C22-8CFC-5BAAE07616ED")] [NativeTypeName("struct ID3D12CommandQueue : ID3D12Pageable")] [NativeInheritance("ID3D12Pageable")] -internal unsafe partial struct ID3D12CommandQueue +internal unsafe partial struct ID3D12CommandQueue : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xA6, 0x70, 0xC8, 0x0E, + 0x7E, 0x5D, + 0x22, 0x4C, + 0x8C, + 0xFC, + 0x5B, + 0xAA, + 0xE0, + 0x76, + 0x16, + 0xED + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DescriptorHeap.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DescriptorHeap.cs index 632a9e4e..0202d5d5 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DescriptorHeap.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DescriptorHeap.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("8EFB471D-616C-4F49-90F7-127BB763FA51")] [NativeTypeName("struct ID3D12DescriptorHeap : ID3D12Pageable")] [NativeInheritance("ID3D12Pageable")] -internal unsafe partial struct ID3D12DescriptorHeap +internal unsafe partial struct ID3D12DescriptorHeap : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x1D, 0x47, 0xFB, 0x8E, + 0x6C, 0x61, + 0x49, 0x4F, + 0x90, + 0xF7, + 0x12, + 0x7B, + 0xB7, + 0x63, + 0xFA, + 0x51 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Device.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Device.cs index 76bf8e55..db90bce0 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Device.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Device.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("189819F1-1DB6-4B57-BE54-1821339B85F7")] [NativeTypeName("struct ID3D12Device : ID3D12Object")] [NativeInheritance("ID3D12Object")] -internal unsafe partial struct ID3D12Device +internal unsafe partial struct ID3D12Device : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xF1, 0x19, 0x98, 0x18, + 0xB6, 0x1D, + 0x57, 0x4B, + 0xBE, + 0x54, + 0x18, + 0x21, + 0x33, + 0x9B, + 0x85, + 0xF7 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs index 4948f45c..b3566019 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("9727A022-CF1D-4DDA-9EBA-EFFA653FC506")] [NativeTypeName("struct ID3D12DeviceRemovedExtendedData1 : ID3D12DeviceRemovedExtendedData")] [NativeInheritance("ID3D12DeviceRemovedExtendedData")] -internal unsafe partial struct ID3D12DeviceRemovedExtendedData1 +internal unsafe partial struct ID3D12DeviceRemovedExtendedData1 : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x22, 0xA0, 0x27, 0x97, + 0x1D, 0xCF, + 0xDA, 0x4D, + 0x9E, + 0xBA, + 0xEF, + 0xFA, + 0x65, + 0x3F, + 0xC5, + 0x06 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs index 34db62bb..30fad304 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("DBD5AE51-3317-4F0A-ADF9-1D7CEDCAAE0B")] [NativeTypeName("struct ID3D12DeviceRemovedExtendedDataSettings1 : ID3D12DeviceRemovedExtendedDataSettings")] [NativeInheritance("ID3D12DeviceRemovedExtendedDataSettings")] -internal unsafe partial struct ID3D12DeviceRemovedExtendedDataSettings1 +internal unsafe partial struct ID3D12DeviceRemovedExtendedDataSettings1 : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x51, 0xAE, 0xD5, 0xDB, + 0x17, 0x33, + 0x0A, 0x4F, + 0xAD, + 0xF9, + 0x1D, + 0x7C, + 0xED, + 0xCA, + 0xAE, + 0x0B + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Fence.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Fence.cs index ccac1cc3..0eedd723 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Fence.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Fence.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("0A753DCF-C4D8-4B91-ADF6-BE5A60D95A76")] [NativeTypeName("struct ID3D12Fence : ID3D12Pageable")] [NativeInheritance("ID3D12Pageable")] -internal unsafe partial struct ID3D12Fence +internal unsafe partial struct ID3D12Fence : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xCF, 0x3D, 0x75, 0x0A, + 0xD8, 0xC4, + 0x91, 0x4B, + 0xAD, + 0xF6, + 0xBE, + 0x5A, + 0x60, + 0xD9, + 0x5A, + 0x76 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs index bbfe072c..58a2ae9c 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("5B160D0F-AC1B-4185-8BA8-B3AE42A5A455")] [NativeTypeName("struct ID3D12GraphicsCommandList : ID3D12CommandList")] [NativeInheritance("ID3D12CommandList")] -internal unsafe partial struct ID3D12GraphicsCommandList +internal unsafe partial struct ID3D12GraphicsCommandList : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x0F, 0x0D, 0x16, 0x5B, + 0x1B, 0xAC, + 0x85, 0x41, + 0x8B, + 0xA8, + 0xB3, + 0xAE, + 0x42, + 0xA5, + 0xA4, + 0x55 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12PipelineState.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12PipelineState.cs index b7befbc5..559014fa 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12PipelineState.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12PipelineState.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("765A30F3-F624-4C6F-A828-ACE948622445")] [NativeTypeName("struct ID3D12PipelineState : ID3D12Pageable")] [NativeInheritance("ID3D12Pageable")] -internal unsafe partial struct ID3D12PipelineState +internal unsafe partial struct ID3D12PipelineState : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xF3, 0x30, 0x5A, 0x76, + 0x24, 0xF6, + 0x6F, 0x4C, + 0xA8, + 0x28, + 0xAC, + 0xE9, + 0x48, + 0x62, + 0x24, + 0x45 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Resource.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Resource.cs index 459b0ae4..271a54bd 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Resource.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Resource.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("696442BE-A72E-4059-BC79-5B5C98040FAD")] [NativeTypeName("struct ID3D12Resource : ID3D12Pageable")] [NativeInheritance("ID3D12Pageable")] -internal unsafe partial struct ID3D12Resource +internal unsafe partial struct ID3D12Resource : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xBE, 0x42, 0x64, 0x69, + 0x2E, 0xA7, + 0x59, 0x40, + 0xBC, + 0x79, + 0x5B, + 0x5C, + 0x98, + 0x04, + 0x0F, + 0xAD + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12RootSignature.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12RootSignature.cs index efdda716..7f01ef15 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12RootSignature.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12RootSignature.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("C54A6B66-72DF-4EE8-8BE5-A946A1429214")] [NativeTypeName("struct ID3D12RootSignature : ID3D12DeviceChild")] [NativeInheritance("ID3D12DeviceChild")] -internal unsafe partial struct ID3D12RootSignature +internal unsafe partial struct ID3D12RootSignature : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x66, 0x6B, 0x4A, 0xC5, + 0xDF, 0x72, + 0xE8, 0x4E, + 0x8B, + 0xE5, + 0xA9, + 0x46, + 0xA1, + 0x42, + 0x92, + 0x14 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug.cs index f47b361b..422733ff 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("344488B7-6846-474B-B989-F027448245E0")] [NativeTypeName("struct ID3D12Debug : IUnknown")] [NativeInheritance("IUnknown")] -internal unsafe partial struct ID3D12Debug +internal unsafe partial struct ID3D12Debug : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xB7, 0x88, 0x44, 0x34, + 0x46, 0x68, + 0x4B, 0x47, + 0xB9, + 0x89, + 0xF0, + 0x27, + 0x44, + 0x82, + 0x45, + 0xE0 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs index 547e396c..622e0fbe 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("AFFAA4CA-63FE-4D8E-B8AD-159000AF4304")] [NativeTypeName("struct ID3D12Debug1 : IUnknown")] [NativeInheritance("IUnknown")] -internal unsafe partial struct ID3D12Debug1 +internal unsafe partial struct ID3D12Debug1 : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xCA, 0xA4, 0xFA, 0xAF, + 0xFE, 0x63, + 0x8E, 0x4D, + 0xB8, + 0xAD, + 0x15, + 0x90, + 0x00, + 0xAF, + 0x43, + 0x04 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs index 7073b416..34ee5074 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("0742A90B-C387-483F-B946-30A7E4E61458")] [NativeTypeName("struct ID3D12InfoQueue : IUnknown")] [NativeInheritance("IUnknown")] -internal unsafe partial struct ID3D12InfoQueue +internal unsafe partial struct ID3D12InfoQueue : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x0B, 0xA9, 0x42, 0x07, + 0x87, 0xC3, + 0x3F, 0x48, + 0xB9, + 0x46, + 0x30, + 0xA7, + 0xE4, + 0xE6, + 0x14, + 0x58 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICImagingFactory2.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICImagingFactory2.cs index 5c6451f9..ec8e4979 100644 --- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICImagingFactory2.cs +++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICImagingFactory2.cs @@ -8,14 +8,41 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [SupportedOSPlatform("windows8.0")] [Guid("7B816B45-1996-4476-B132-DE9E247C8AF0")] [NativeTypeName("struct IWICImagingFactory2 : IWICImagingFactory")] [NativeInheritance("IWICImagingFactory")] -internal unsafe partial struct IWICImagingFactory2 +internal unsafe partial struct IWICImagingFactory2 : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x45, 0x6B, 0x81, 0x7B, + 0x96, 0x19, + 0x76, 0x44, + 0xB1, + 0x32, + 0xDE, + 0x9E, + 0x24, + 0x7C, + 0x8A, + 0xF0 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs index ba509cb3..efaa6cd0 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs @@ -35,11 +35,8 @@ unsafe partial class IWICStreamExtensions /// /// A manual CCW implementation for an object wrapping an instance. /// - private unsafe partial struct IBufferWriterWrapper //: IUnknown.Interface + private unsafe partial struct IBufferWriterWrapper { - ///// - //static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw(); - /// /// The shared vtable pointer for instances. /// diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs index 926e6948..79e2274f 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs @@ -37,11 +37,8 @@ internal static unsafe partial class IWICStreamExtensions /// /// A manual CCW implementation for an object wrapping a instance. /// - private unsafe partial struct IStreamWrapper //: IUnknown.Interface + private unsafe partial struct IStreamWrapper { - ///// - //static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw(); - /// /// The shared vtable pointer for instances. /// diff --git a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs index ee15a951..2685eb79 100644 --- a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs +++ b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; -#pragma warning disable CS0649 +#pragma warning disable CS0649, IDE0055 namespace ComputeSharp.Interop.Allocation; @@ -11,16 +11,16 @@ namespace ComputeSharp.Interop.Allocation; /// An allocation wrapper for a native object. /// [Guid("D42D5782-2DE7-4539-A817-482E3AA01E2E")] -internal unsafe struct ID3D12Allocation //: IUnknown.Interface +internal unsafe struct ID3D12Allocation : IComObject { - /// - /// Gets the for (D42D5782-2DE7-4539-A817-482E3AA01E2E). - /// - public static ref readonly Guid Guid + /// + static Guid* IComObject.IID { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - ReadOnlySpan data = new byte[] { + ReadOnlySpan data = + [ 0x82, 0x57, 0x2D, 0xD4, 0xE7, 0x2D, 0x39, 0x45, @@ -31,15 +31,12 @@ internal unsafe struct ID3D12Allocation //: IUnknown.Interface 0xA0, 0x1E, 0x2E - }; + ]; - return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); } } - ///// - //static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid)); - /// /// The vtable for the current instance. /// diff --git a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs index 840732aa..e863b9e7 100644 --- a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs +++ b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; -#pragma warning disable CS0649 +#pragma warning disable CS0649, IDE0055 namespace ComputeSharp.Interop.Allocation; @@ -11,16 +11,16 @@ namespace ComputeSharp.Interop.Allocation; /// An object that can allocate resources for a given instance. /// [Guid("2D5E55D2-9244-431F-868E-0D90AAB6E575")] -internal unsafe struct ID3D12MemoryAllocator //: IUnknown.Interface +internal unsafe struct ID3D12MemoryAllocator : IComObject { - /// - /// Gets the for (2D5E55D2-9244-431F-868E-0D90AAB6E575). - /// - public static ref readonly Guid Guid + /// + static Guid* IComObject.IID { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - ReadOnlySpan data = new byte[] { + ReadOnlySpan data = + [ 0xD2, 0x55, 0x5E, 0x2D, 0x44, 0x92, 0x1F, 0x43, @@ -31,15 +31,12 @@ internal unsafe struct ID3D12MemoryAllocator //: IUnknown.Interface 0xB6, 0xE5, 0x75 - }; + ]; - return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); } } - ///// - //static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid)); - /// /// The vtable for the current instance. /// diff --git a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs index bb41a71e..6fd74668 100644 --- a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs +++ b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; -#pragma warning disable CS0649 +#pragma warning disable CS0649, IDE0055 namespace ComputeSharp.Interop.Allocation; @@ -11,16 +11,16 @@ namespace ComputeSharp.Interop.Allocation; /// A factory type for objects. /// [Guid("CC1E74A7-786D-40F4-8AE2-F8B7A255587E")] -internal unsafe struct ID3D12MemoryAllocatorFactory //: IUnknown.Interface +internal unsafe struct ID3D12MemoryAllocatorFactory : IComObject { - /// - /// Gets the for (CC1E74A7-786D-40F4-8AE2-F8B7A255587E). - /// - public static ref readonly Guid Guid + /// + static Guid* IComObject.IID { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - ReadOnlySpan data = new byte[] { + ReadOnlySpan data = + [ 0xA7, 0x74, 0x1E, 0xCC, 0x6D, 0x78, 0xF4, 0x40, @@ -31,15 +31,12 @@ internal unsafe struct ID3D12MemoryAllocatorFactory //: IUnknown.Interface 0x55, 0x58, 0x7E - }; + ]; - return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + return (Guid*) Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); } } - ///// - //static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid)); - /// /// The vtable for the current instance. ///