From a665936212626a58522ce5b202d7af1bbfe0b5cc Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 23 Nov 2023 17:13:50 +0100 Subject: [PATCH] Adopt IComObject.IID in ComputeSharp.Dxc --- .../um/d3d12shader/ID3D12ShaderReflection.cs | 29 ++++++++++++++++++- .../DirectX/um/dxcapi/IDxcUtils.cs | 29 ++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs index 8bad32c5..f34f7033 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("5A58797D-A72C-478D-8BA2-EFC6B0EFE88E")] [NativeTypeName("struct ID3D12ShaderReflection : IUnknown")] [NativeInheritance("IUnknown")] -internal unsafe partial struct ID3D12ShaderReflection +internal unsafe partial struct ID3D12ShaderReflection : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x7D, 0x79, 0x58, 0x5A, + 0x2C, 0xA7, + 0x8D, 0x47, + 0x8B, + 0xA2, + 0xEF, + 0xC6, + 0xB0, + 0xEF, + 0xE8, + 0x8E + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/IDxcUtils.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/IDxcUtils.cs index 158ccffa..832c3cb3 100644 --- a/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/IDxcUtils.cs +++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/IDxcUtils.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("4605C4CB-2019-492A-ADA4-65F20BB7D67F")] [NativeTypeName("struct IDxcUtils : IUnknown")] [NativeInheritance("IUnknown")] -internal unsafe partial struct IDxcUtils +internal unsafe partial struct IDxcUtils : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xCB, 0xC4, 0x05, 0x46, + 0x19, 0x20, + 0x2A, 0x49, + 0xAD, + 0xA4, + 0x65, + 0xF2, + 0x0B, + 0xB7, + 0xD6, + 0x7F + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)]