From c3c1bf050918eae4b74ef2ee486a3b90b9b1fa57 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 24 Nov 2023 03:20:32 +0100 Subject: [PATCH] Also use [MemberFunction] in handwritten CCW types --- ...lShaderEffect.ID2D1DrawTransformMethods.cs | 17 +++--- ...ixelShaderEffect.ID2D1EffectImplMethods.cs | 13 +++-- .../Interop/Effects/PixelShaderEffect.cs | 28 +++++----- ...ManagerImpl.ID2D1ResourceTextureManager.cs | 11 ++-- ...mpl.ID2D1ResourceTextureManagerInternal.cs | 11 ++-- .../D2D1ResourceTextureManagerImpl.cs | 20 +++---- ...teContextImpl.ID2D1DrawInfoUpdateContex.cs | 13 +++-- ...tImpl.ID2D1DrawInfoUpdateContexInternal.cs | 9 +-- .../D2D1DrawInfoUpdateContextImpl.cs | 20 +++---- ...ransformMapperImpl.ID2D1TransformMapper.cs | 12 ++-- ...MapperImpl.ID2D1TransformMapperInternal.cs | 9 +-- .../D2D1TransformMapperImpl.cs | 20 +++---- .../Interop/ID3D12AllocationImpl.cs | 16 +++--- .../ID3D12MemoryAllocatorFactoryImpl.cs | 16 +++--- .../Interop/ID3D12MemoryAllocatorImpl.cs | 16 +++--- .../IWICStreamExtensions.IBufferWriter.cs | 56 +++++++++---------- .../Interop/IWICStreamExtensions.Stream.cs | 56 +++++++++---------- .../Helpers/DeviceHelper.IDXGIFactory6.cs | 16 +++--- 18 files changed, 183 insertions(+), 176 deletions(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs index 670ff504..38781454 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Extensions; using ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers; @@ -15,7 +16,7 @@ partial struct PixelShaderEffect private static unsafe class ID2D1DrawTransformMethods { /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int QueryInterface(PixelShaderEffect* @this, Guid* riid, void** ppvObject) { @this = (PixelShaderEffect*)&((void**)@this)[-1]; @@ -24,7 +25,7 @@ partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint AddRef(PixelShaderEffect* @this) { @this = (PixelShaderEffect*)&((void**)@this)[-1]; @@ -33,7 +34,7 @@ partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint Release(PixelShaderEffect* @this) { @this = (PixelShaderEffect*)&((void**)@this)[-1]; @@ -42,7 +43,7 @@ partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint GetInputCount(PixelShaderEffect* @this) { @this = (PixelShaderEffect*)&((void**)@this)[-1]; @@ -60,7 +61,7 @@ partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int MapOutputRectToInputRects(PixelShaderEffect* @this, RECT* outputRect, RECT* inputRects, uint inputRectsCount) { @this = (PixelShaderEffect*)&((void**)@this)[-1]; @@ -108,7 +109,7 @@ partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int MapInputRectsToOutputRect(PixelShaderEffect* @this, RECT* inputRects, RECT* inputOpaqueSubRects, uint inputRectCount, RECT* outputRect, RECT* outputOpaqueSubRect) { @this = (PixelShaderEffect*)&((void**)@this)[-1]; @@ -200,7 +201,7 @@ partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int MapInvalidRect(PixelShaderEffect* @this, uint inputIndex, RECT invalidInputRect, RECT* invalidOutputRect) { @this = (PixelShaderEffect*)&((void**)@this)[-1]; @@ -240,7 +241,7 @@ partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int SetDrawInfo(PixelShaderEffect* @this, ID2D1DrawInfo* drawInfo) { @this = (PixelShaderEffect*)&((void**)@this)[-1]; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs index eee5e906..99309334 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Extensions; using ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; @@ -18,28 +19,28 @@ internal unsafe partial struct PixelShaderEffect private static class ID2D1EffectImplMethods { /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int QueryInterface(PixelShaderEffect* @this, Guid* riid, void** ppvObject) { return @this->QueryInterface(riid, ppvObject); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint AddRef(PixelShaderEffect* @this) { return @this->AddRef(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint Release(PixelShaderEffect* @this) { return @this->Release(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int Initialize(PixelShaderEffect* @this, ID2D1EffectContext* effectContext, ID2D1TransformGraph* transformGraph) { try @@ -81,7 +82,7 @@ internal unsafe partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int PrepareForRender(PixelShaderEffect* @this, D2D1_CHANGE_TYPE changeType) { try @@ -145,7 +146,7 @@ internal unsafe partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int SetGraph(PixelShaderEffect* @this, ID2D1TransformGraph* transformGraph) { return E.E_NOTIMPL; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs index 8d5e847f..2bd23ae0 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs @@ -32,22 +32,22 @@ internal unsafe partial struct PixelShaderEffect void** lpVtbl = (void**)D2D1AssemblyAssociatedMemory.Allocate(sizeof(void*) * 14); // ID2D1EffectImpl - lpVtbl[0] = (delegate* unmanaged)&ID2D1EffectImplMethods.QueryInterface; - lpVtbl[1] = (delegate* unmanaged)&ID2D1EffectImplMethods.AddRef; - lpVtbl[2] = (delegate* unmanaged)&ID2D1EffectImplMethods.Release; - lpVtbl[3] = (delegate* unmanaged)&ID2D1EffectImplMethods.Initialize; - lpVtbl[4] = (delegate* unmanaged)&ID2D1EffectImplMethods.PrepareForRender; - lpVtbl[5] = (delegate* unmanaged)&ID2D1EffectImplMethods.SetGraph; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&ID2D1EffectImplMethods.QueryInterface; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&ID2D1EffectImplMethods.AddRef; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&ID2D1EffectImplMethods.Release; + lpVtbl[3] = (delegate* unmanaged[MemberFunction])&ID2D1EffectImplMethods.Initialize; + lpVtbl[4] = (delegate* unmanaged[MemberFunction])&ID2D1EffectImplMethods.PrepareForRender; + lpVtbl[5] = (delegate* unmanaged[MemberFunction])&ID2D1EffectImplMethods.SetGraph; // ID2D1DrawTransform - lpVtbl[6 + 0] = (delegate* unmanaged)&ID2D1DrawTransformMethods.QueryInterface; - lpVtbl[6 + 1] = (delegate* unmanaged)&ID2D1DrawTransformMethods.AddRef; - lpVtbl[6 + 2] = (delegate* unmanaged)&ID2D1DrawTransformMethods.Release; - lpVtbl[6 + 3] = (delegate* unmanaged)&ID2D1DrawTransformMethods.GetInputCount; - lpVtbl[6 + 4] = (delegate* unmanaged)&ID2D1DrawTransformMethods.MapOutputRectToInputRects; - lpVtbl[6 + 5] = (delegate* unmanaged)&ID2D1DrawTransformMethods.MapInputRectsToOutputRect; - lpVtbl[6 + 6] = (delegate* unmanaged)&ID2D1DrawTransformMethods.MapInvalidRect; - lpVtbl[6 + 7] = (delegate* unmanaged)&ID2D1DrawTransformMethods.SetDrawInfo; + lpVtbl[6 + 0] = (delegate* unmanaged[MemberFunction])&ID2D1DrawTransformMethods.QueryInterface; + lpVtbl[6 + 1] = (delegate* unmanaged[MemberFunction])&ID2D1DrawTransformMethods.AddRef; + lpVtbl[6 + 2] = (delegate* unmanaged[MemberFunction])&ID2D1DrawTransformMethods.Release; + lpVtbl[6 + 3] = (delegate* unmanaged[MemberFunction])&ID2D1DrawTransformMethods.GetInputCount; + lpVtbl[6 + 4] = (delegate* unmanaged[MemberFunction])&ID2D1DrawTransformMethods.MapOutputRectToInputRects; + lpVtbl[6 + 5] = (delegate* unmanaged[MemberFunction])&ID2D1DrawTransformMethods.MapInputRectsToOutputRect; + lpVtbl[6 + 6] = (delegate* unmanaged[MemberFunction])&ID2D1DrawTransformMethods.MapInvalidRect; + lpVtbl[6 + 7] = (delegate* unmanaged[MemberFunction])&ID2D1DrawTransformMethods.SetDrawInfo; return lpVtbl; } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs index 076bb4ac..976b6e65 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; @@ -125,28 +126,28 @@ unsafe partial struct D2D1ResourceTextureManagerImpl private static class ID2D1ResourceTextureManagerMethods { /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int QueryInterface(D2D1ResourceTextureManagerImpl* @this, Guid* riid, void** ppvObject) { return @this->QueryInterface(riid, ppvObject); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint AddRef(D2D1ResourceTextureManagerImpl* @this) { return @this->AddRef(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint Release(D2D1ResourceTextureManagerImpl* @this) { return @this->Release(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int Initialize( D2D1ResourceTextureManagerImpl* @this, Guid* resourceId, @@ -165,7 +166,7 @@ unsafe partial struct D2D1ResourceTextureManagerImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int Update( D2D1ResourceTextureManagerImpl* @this, uint* minimumExtents, diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs index a9492d0a..9c720156 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Extensions; using ComputeSharp.D2D1.Shaders.Interop.Extensions; @@ -15,7 +16,7 @@ partial struct D2D1ResourceTextureManagerImpl private static unsafe class ID2D1ResourceTextureManagerInternalMethods { /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int QueryInterface(D2D1ResourceTextureManagerImpl* @this, Guid* riid, void** ppvObject) { @this = (D2D1ResourceTextureManagerImpl*)&((void**)@this)[-1]; @@ -24,7 +25,7 @@ partial struct D2D1ResourceTextureManagerImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint AddRef(D2D1ResourceTextureManagerImpl* @this) { @this = (D2D1ResourceTextureManagerImpl*)&((void**)@this)[-1]; @@ -33,7 +34,7 @@ partial struct D2D1ResourceTextureManagerImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint Release(D2D1ResourceTextureManagerImpl* @this) { @this = (D2D1ResourceTextureManagerImpl*)&((void**)@this)[-1]; @@ -42,7 +43,7 @@ partial struct D2D1ResourceTextureManagerImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int Initialize(D2D1ResourceTextureManagerImpl* @this, ID2D1EffectContext* effectContext, uint* dimensions) { @this = (D2D1ResourceTextureManagerImpl*)&((void**)@this)[-1]; @@ -105,7 +106,7 @@ partial struct D2D1ResourceTextureManagerImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int GetResourceTexture(D2D1ResourceTextureManagerImpl* @this, ID2D1ResourceTexture** resourceTexture) { @this = (D2D1ResourceTextureManagerImpl*)&((void**)@this)[-1]; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs index 583b4175..cd302088 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs @@ -31,18 +31,18 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl void** lpVtbl = (void**)D2D1AssemblyAssociatedMemory.Allocate(sizeof(void*) * 10); // ID2D1ResourceTextureManager - lpVtbl[0] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.QueryInterface; - lpVtbl[1] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.AddRef; - lpVtbl[2] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.Release; - lpVtbl[3] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.Initialize; - lpVtbl[4] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.Update; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerMethods.QueryInterface; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerMethods.AddRef; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerMethods.Release; + lpVtbl[3] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerMethods.Initialize; + lpVtbl[4] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerMethods.Update; // ID2D1ResourceTextureManagerInternal - lpVtbl[5 + 0] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.QueryInterface; - lpVtbl[5 + 1] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.AddRef; - lpVtbl[5 + 2] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.Release; - lpVtbl[5 + 3] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.Initialize; - lpVtbl[5 + 4] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.GetResourceTexture; + lpVtbl[5 + 0] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerInternalMethods.QueryInterface; + lpVtbl[5 + 1] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerInternalMethods.AddRef; + lpVtbl[5 + 2] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerInternalMethods.Release; + lpVtbl[5 + 3] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerInternalMethods.Initialize; + lpVtbl[5 + 4] = (delegate* unmanaged[MemberFunction])&ID2D1ResourceTextureManagerInternalMethods.GetResourceTexture; return lpVtbl; } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContex.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContex.cs index 9672e376..11c8757b 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContex.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContex.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; @@ -13,28 +14,28 @@ partial struct D2D1DrawInfoUpdateContextImpl private static unsafe class ID2D1DrawInfoUpdateContextMethods { /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int QueryInterface(D2D1DrawInfoUpdateContextImpl* @this, Guid* riid, void** ppvObject) { return @this->QueryInterface(riid, ppvObject); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint AddRef(D2D1DrawInfoUpdateContextImpl* @this) { return @this->AddRef(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint Release(D2D1DrawInfoUpdateContextImpl* @this) { return @this->Release(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int GetConstantBufferSize(D2D1DrawInfoUpdateContextImpl* @this, uint* size) { if (size is null) @@ -53,7 +54,7 @@ partial struct D2D1DrawInfoUpdateContextImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int GetConstantBuffer(D2D1DrawInfoUpdateContextImpl* @this, byte* buffer, uint bufferCount) { if (buffer is null) @@ -85,7 +86,7 @@ partial struct D2D1DrawInfoUpdateContextImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int SetConstantBuffer(D2D1DrawInfoUpdateContextImpl* @this, byte* buffer, uint bufferCount) { if (buffer is null) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContexInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContexInternal.cs index 2507c776..7bd14d01 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContexInternal.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContexInternal.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; @@ -22,7 +23,7 @@ unsafe partial struct D2D1DrawInfoUpdateContextImpl private static class ID2D1DrawInfoUpdateContextInternalMethods { /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int QueryInterface(D2D1DrawInfoUpdateContextImpl* @this, Guid* riid, void** ppvObject) { @this = (D2D1DrawInfoUpdateContextImpl*)&((void**)@this)[-1]; @@ -31,7 +32,7 @@ unsafe partial struct D2D1DrawInfoUpdateContextImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint AddRef(D2D1DrawInfoUpdateContextImpl* @this) { @this = (D2D1DrawInfoUpdateContextImpl*)&((void**)@this)[-1]; @@ -40,7 +41,7 @@ unsafe partial struct D2D1DrawInfoUpdateContextImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint Release(D2D1DrawInfoUpdateContextImpl* @this) { @this = (D2D1DrawInfoUpdateContextImpl*)&((void**)@this)[-1]; @@ -49,7 +50,7 @@ unsafe partial struct D2D1DrawInfoUpdateContextImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int Close(D2D1DrawInfoUpdateContextImpl* @this) { @this = (D2D1DrawInfoUpdateContextImpl*)&((void**)@this)[-1]; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs index 8560794f..9de0751c 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs @@ -31,18 +31,18 @@ internal unsafe partial struct D2D1DrawInfoUpdateContextImpl void** lpVtbl = (void**)D2D1AssemblyAssociatedMemory.Allocate(sizeof(void*) * 10); // ID2D1ResourceTextureManager - lpVtbl[0] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.QueryInterface; - lpVtbl[1] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.AddRef; - lpVtbl[2] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.Release; - lpVtbl[3] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.GetConstantBufferSize; - lpVtbl[4] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.GetConstantBuffer; - lpVtbl[5] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.SetConstantBuffer; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextMethods.QueryInterface; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextMethods.AddRef; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextMethods.Release; + lpVtbl[3] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextMethods.GetConstantBufferSize; + lpVtbl[4] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextMethods.GetConstantBuffer; + lpVtbl[5] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextMethods.SetConstantBuffer; // ID2D1ResourceTextureManagerInternal - lpVtbl[6 + 0] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextInternalMethods.QueryInterface; - lpVtbl[6 + 1] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextInternalMethods.AddRef; - lpVtbl[6 + 2] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextInternalMethods.Release; - lpVtbl[6 + 3] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextInternalMethods.Close; + lpVtbl[6 + 0] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextInternalMethods.QueryInterface; + lpVtbl[6 + 1] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextInternalMethods.AddRef; + lpVtbl[6 + 2] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextInternalMethods.Release; + lpVtbl[6 + 3] = (delegate* unmanaged[MemberFunction])&ID2D1DrawInfoUpdateContextInternalMethods.Close; return lpVtbl; } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs index d86241e0..f7fd92d9 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs @@ -17,28 +17,28 @@ unsafe partial struct D2D1TransformMapperImpl private static class ID2D1TransformMapperMethods { /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int QueryInterface(D2D1TransformMapperImpl* @this, Guid* riid, void** ppvObject) { return @this->QueryInterface(riid, ppvObject); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint AddRef(D2D1TransformMapperImpl* @this) { return @this->AddRef(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint Release(D2D1TransformMapperImpl* @this) { return @this->Release(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int MapInputRectsToOutputRect( D2D1TransformMapperImpl* @this, ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext, @@ -82,7 +82,7 @@ unsafe partial struct D2D1TransformMapperImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int MapOutputRectToInputRects( D2D1TransformMapperImpl* @this, RECT* outputRect, @@ -116,7 +116,7 @@ unsafe partial struct D2D1TransformMapperImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int MapInvalidRect( D2D1TransformMapperImpl* @this, uint inputIndex, diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapperInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapperInternal.cs index 0eb493bb..c0e1f10d 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapperInternal.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapperInternal.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; @@ -13,7 +14,7 @@ unsafe partial struct D2D1TransformMapperImpl private static class ID2D1TransformMapperInternalMethods { /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int QueryInterface(D2D1TransformMapperImpl* @this, Guid* riid, void** ppvObject) { @this = (D2D1TransformMapperImpl*)&((void**)@this)[-1]; @@ -22,7 +23,7 @@ unsafe partial struct D2D1TransformMapperImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint AddRef(D2D1TransformMapperImpl* @this) { @this = (D2D1TransformMapperImpl*)&((void**)@this)[-1]; @@ -31,7 +32,7 @@ unsafe partial struct D2D1TransformMapperImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static uint Release(D2D1TransformMapperImpl* @this) { @this = (D2D1TransformMapperImpl*)&((void**)@this)[-1]; @@ -40,7 +41,7 @@ unsafe partial struct D2D1TransformMapperImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] public static int GetManagedWrapperHandle(D2D1TransformMapperImpl* @this, void** ppvHandle) { @this = (D2D1TransformMapperImpl*)&((void**)@this)[-1]; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs index 217974da..94763090 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs @@ -33,18 +33,18 @@ internal unsafe partial struct D2D1TransformMapperImpl void** lpVtbl = (void**)D2D1AssemblyAssociatedMemory.Allocate(sizeof(void*) * 10); // ID2D1ResourceTextureManager - lpVtbl[0] = (delegate* unmanaged)&ID2D1TransformMapperMethods.QueryInterface; - lpVtbl[1] = (delegate* unmanaged)&ID2D1TransformMapperMethods.AddRef; - lpVtbl[2] = (delegate* unmanaged)&ID2D1TransformMapperMethods.Release; - lpVtbl[3] = (delegate* unmanaged)&ID2D1TransformMapperMethods.MapInputRectsToOutputRect; - lpVtbl[4] = (delegate* unmanaged)&ID2D1TransformMapperMethods.MapOutputRectToInputRects; - lpVtbl[5] = (delegate* unmanaged)&ID2D1TransformMapperMethods.MapInvalidRect; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperMethods.QueryInterface; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperMethods.AddRef; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperMethods.Release; + lpVtbl[3] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperMethods.MapInputRectsToOutputRect; + lpVtbl[4] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperMethods.MapOutputRectToInputRects; + lpVtbl[5] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperMethods.MapInvalidRect; // ID2D1TransformMapperInternal - lpVtbl[6 + 0] = (delegate* unmanaged)&ID2D1TransformMapperInternalMethods.QueryInterface; - lpVtbl[6 + 1] = (delegate* unmanaged)&ID2D1TransformMapperInternalMethods.AddRef; - lpVtbl[6 + 2] = (delegate* unmanaged)&ID2D1TransformMapperInternalMethods.Release; - lpVtbl[6 + 3] = (delegate* unmanaged)&ID2D1TransformMapperInternalMethods.GetManagedWrapperHandle; + lpVtbl[6 + 0] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperInternalMethods.QueryInterface; + lpVtbl[6 + 1] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperInternalMethods.AddRef; + lpVtbl[6 + 2] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperInternalMethods.Release; + lpVtbl[6 + 3] = (delegate* unmanaged[MemberFunction])&ID2D1TransformMapperInternalMethods.GetManagedWrapperHandle; return lpVtbl; } diff --git a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12AllocationImpl.cs b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12AllocationImpl.cs index 653e3881..19d64333 100644 --- a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12AllocationImpl.cs +++ b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12AllocationImpl.cs @@ -27,10 +27,10 @@ internal unsafe struct ID3D12AllocationImpl { void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(ID3D12AllocationImpl), sizeof(void*) * 4); - lpVtbl[0] = (delegate* unmanaged)&QueryInterface; - lpVtbl[1] = (delegate* unmanaged)&AddRef; - lpVtbl[2] = (delegate* unmanaged)&Release; - lpVtbl[3] = (delegate* unmanaged)&GetD3D12Resource; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&QueryInterface; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&AddRef; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&Release; + lpVtbl[3] = (delegate* unmanaged[MemberFunction])&GetD3D12Resource; return lpVtbl; } @@ -99,7 +99,7 @@ internal unsafe struct ID3D12AllocationImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int QueryInterface(ID3D12AllocationImpl* @this, Guid* riid, void** ppvObject) { if (ppvObject is null) @@ -123,14 +123,14 @@ internal unsafe struct ID3D12AllocationImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint AddRef(ID3D12AllocationImpl* @this) { return (uint)Interlocked.Increment(ref @this->referenceCount); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint Release(ID3D12AllocationImpl* @this) { uint referenceCount = (uint)Interlocked.Decrement(ref @this->referenceCount); @@ -154,7 +154,7 @@ internal unsafe struct ID3D12AllocationImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int GetD3D12Resource(ID3D12AllocationImpl* @this, ID3D12Resource** resource) { if (resource is null) diff --git a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs index df852d45..667b23ce 100644 --- a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs +++ b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs @@ -30,10 +30,10 @@ internal unsafe struct ID3D12MemoryAllocatorFactoryImpl { void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(ID3D12MemoryAllocatorFactoryImpl), sizeof(void*) * 4); - lpVtbl[0] = (delegate* unmanaged)&QueryInterface; - lpVtbl[1] = (delegate* unmanaged)&AddRef; - lpVtbl[2] = (delegate* unmanaged)&Release; - lpVtbl[3] = (delegate* unmanaged)&CreateAllocator; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&QueryInterface; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&AddRef; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&Release; + lpVtbl[3] = (delegate* unmanaged[MemberFunction])&CreateAllocator; return lpVtbl; } @@ -115,28 +115,28 @@ internal unsafe struct ID3D12MemoryAllocatorFactoryImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int QueryInterface(ID3D12MemoryAllocatorFactoryImpl* @this, Guid* riid, void** ppvObject) { return @this->QueryInterface(riid, ppvObject); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint AddRef(ID3D12MemoryAllocatorFactoryImpl* @this) { return (uint)Interlocked.Increment(ref @this->referenceCount); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint Release(ID3D12MemoryAllocatorFactoryImpl* @this) { return @this->Release(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int CreateAllocator( ID3D12MemoryAllocatorFactoryImpl* @this, ID3D12Device* device, diff --git a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorImpl.cs b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorImpl.cs index 90663630..97b5841d 100644 --- a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorImpl.cs +++ b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorImpl.cs @@ -30,10 +30,10 @@ internal unsafe struct ID3D12MemoryAllocatorImpl { void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(ID3D12MemoryAllocator), sizeof(void*) * 4); - lpVtbl[0] = (delegate* unmanaged)&QueryInterface; - lpVtbl[1] = (delegate* unmanaged)&AddRef; - lpVtbl[2] = (delegate* unmanaged)&Release; - lpVtbl[3] = (delegate* unmanaged)&AllocateResource; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&QueryInterface; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&AddRef; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&Release; + lpVtbl[3] = (delegate* unmanaged[MemberFunction])&AllocateResource; return lpVtbl; } @@ -123,7 +123,7 @@ internal unsafe struct ID3D12MemoryAllocatorImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int QueryInterface(ID3D12MemoryAllocatorImpl* @this, Guid* riid, void** ppvObject) { if (ppvObject is null) @@ -147,21 +147,21 @@ internal unsafe struct ID3D12MemoryAllocatorImpl } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint AddRef(ID3D12MemoryAllocatorImpl* @this) { return @this->AddRef(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint Release(ID3D12MemoryAllocatorImpl* @this) { return @this->Release(); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int AllocateResource( ID3D12MemoryAllocatorImpl* @this, D3D12_RESOURCE_DESC* resourceDescription, diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs index 2304c1b5..7b2fd788 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs @@ -50,20 +50,20 @@ unsafe partial class IWICStreamExtensions { void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(IBufferWriterWrapper), sizeof(void*) * 14); - lpVtbl[0] = (delegate* unmanaged)&QueryInterface; - lpVtbl[1] = (delegate* unmanaged)&AddRef; - lpVtbl[2] = (delegate* unmanaged)&Release; - lpVtbl[3] = (delegate* unmanaged)&Read; - lpVtbl[4] = (delegate* unmanaged)&Write; - lpVtbl[5] = (delegate* unmanaged)&Seek; - lpVtbl[6] = (delegate* unmanaged)&SetSize; - lpVtbl[7] = (delegate* unmanaged)&CopyTo; - lpVtbl[8] = (delegate* unmanaged)&Commit; - lpVtbl[9] = (delegate* unmanaged)&Revert; - lpVtbl[10] = (delegate* unmanaged)&LockRegion; - lpVtbl[11] = (delegate* unmanaged)&UnlockRegion; - lpVtbl[12] = (delegate* unmanaged)&Stat; - lpVtbl[13] = (delegate* unmanaged)&Clone; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&QueryInterface; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&AddRef; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&Release; + lpVtbl[3] = (delegate* unmanaged[MemberFunction])&Read; + lpVtbl[4] = (delegate* unmanaged[MemberFunction])&Write; + lpVtbl[5] = (delegate* unmanaged[MemberFunction])&Seek; + lpVtbl[6] = (delegate* unmanaged[MemberFunction])&SetSize; + lpVtbl[7] = (delegate* unmanaged[MemberFunction])&CopyTo; + lpVtbl[8] = (delegate* unmanaged[MemberFunction])&Commit; + lpVtbl[9] = (delegate* unmanaged[MemberFunction])&Revert; + lpVtbl[10] = (delegate* unmanaged[MemberFunction])&LockRegion; + lpVtbl[11] = (delegate* unmanaged[MemberFunction])&UnlockRegion; + lpVtbl[12] = (delegate* unmanaged[MemberFunction])&Stat; + lpVtbl[13] = (delegate* unmanaged[MemberFunction])&Clone; return lpVtbl; } @@ -128,7 +128,7 @@ unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int QueryInterface(IBufferWriterWrapper* @this, Guid* riid, void** ppvObject) { if (ppvObject is null) @@ -153,14 +153,14 @@ unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint AddRef(IBufferWriterWrapper* @this) { return (uint)Interlocked.Increment(ref @this->referenceCount); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint Release(IBufferWriterWrapper* @this) { uint referenceCount = (uint)Interlocked.Decrement(ref @this->referenceCount); @@ -176,14 +176,14 @@ unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Read(IBufferWriterWrapper* @this, void* pv, uint cb, uint* pcbRead) { return STG_E_INVALIDFUNCTION; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Write(IBufferWriterWrapper* @this, void* pv, uint cb, uint* pcbWritten) { if (pv == null) @@ -219,56 +219,56 @@ unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Seek(IBufferWriterWrapper* @this, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition) { return STG_E_INVALIDFUNCTION; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT SetSize(IBufferWriterWrapper* @this, ULARGE_INTEGER libNewSize) { return STG_E_INVALIDFUNCTION; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT CopyTo(IBufferWriterWrapper* @this, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) { return E_NOTIMPL; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Commit(IBufferWriterWrapper* @this, uint grfCommitFlags) { return S_OK; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Revert(IBufferWriterWrapper* @this) { return STG_E_INVALIDFUNCTION; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT LockRegion(IBufferWriterWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType) { return STG_E_INVALIDFUNCTION; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT UnlockRegion(IBufferWriterWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType) { return STG_E_INVALIDFUNCTION; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Stat(IBufferWriterWrapper* @this, STATSTG* pstatstg, uint grfStatFlag) { if (pstatstg == null) @@ -300,7 +300,7 @@ unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Clone(IBufferWriterWrapper* @this, IStream** ppstm) { return STG_E_INVALIDFUNCTION; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs index 48455f8c..64fe382b 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs @@ -52,20 +52,20 @@ internal static unsafe partial class IWICStreamExtensions { void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(IStreamWrapper), sizeof(void*) * 14); - lpVtbl[0] = (delegate* unmanaged)&QueryInterface; - lpVtbl[1] = (delegate* unmanaged)&AddRef; - lpVtbl[2] = (delegate* unmanaged)&Release; - lpVtbl[3] = (delegate* unmanaged)&Read; - lpVtbl[4] = (delegate* unmanaged)&Write; - lpVtbl[5] = (delegate* unmanaged)&Seek; - lpVtbl[6] = (delegate* unmanaged)&SetSize; - lpVtbl[7] = (delegate* unmanaged)&CopyTo; - lpVtbl[8] = (delegate* unmanaged)&Commit; - lpVtbl[9] = (delegate* unmanaged)&Revert; - lpVtbl[10] = (delegate* unmanaged)&LockRegion; - lpVtbl[11] = (delegate* unmanaged)&UnlockRegion; - lpVtbl[12] = (delegate* unmanaged)&Stat; - lpVtbl[13] = (delegate* unmanaged)&Clone; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&QueryInterface; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&AddRef; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&Release; + lpVtbl[3] = (delegate* unmanaged[MemberFunction])&Read; + lpVtbl[4] = (delegate* unmanaged[MemberFunction])&Write; + lpVtbl[5] = (delegate* unmanaged[MemberFunction])&Seek; + lpVtbl[6] = (delegate* unmanaged[MemberFunction])&SetSize; + lpVtbl[7] = (delegate* unmanaged[MemberFunction])&CopyTo; + lpVtbl[8] = (delegate* unmanaged[MemberFunction])&Commit; + lpVtbl[9] = (delegate* unmanaged[MemberFunction])&Revert; + lpVtbl[10] = (delegate* unmanaged[MemberFunction])&LockRegion; + lpVtbl[11] = (delegate* unmanaged[MemberFunction])&UnlockRegion; + lpVtbl[12] = (delegate* unmanaged[MemberFunction])&Stat; + lpVtbl[13] = (delegate* unmanaged[MemberFunction])&Clone; return lpVtbl; } @@ -130,7 +130,7 @@ internal static unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int QueryInterface(IStreamWrapper* @this, Guid* riid, void** ppvObject) { if (ppvObject is null) @@ -155,14 +155,14 @@ internal static unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint AddRef(IStreamWrapper* @this) { return (uint)Interlocked.Increment(ref @this->referenceCount); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint Release(IStreamWrapper* @this) { uint referenceCount = (uint)Interlocked.Decrement(ref @this->referenceCount); @@ -178,7 +178,7 @@ internal static unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Read(IStreamWrapper* @this, void* pv, uint cb, uint* pcbRead) { if (pv == null) @@ -226,7 +226,7 @@ internal static unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Write(IStreamWrapper* @this, void* pv, uint cb, uint* pcbWritten) { if (pv == null) @@ -262,7 +262,7 @@ internal static unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Seek(IStreamWrapper* @this, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition) { SeekOrigin origin = (SeekOrigin)dwOrigin; @@ -300,7 +300,7 @@ internal static unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT SetSize(IStreamWrapper* @this, ULARGE_INTEGER libNewSize) { if (libNewSize.QuadPart > long.MaxValue) @@ -321,14 +321,14 @@ internal static unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT CopyTo(IStreamWrapper* @this, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) { return E_NOTIMPL; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Commit(IStreamWrapper* @this, uint grfCommitFlags) { try @@ -344,28 +344,28 @@ internal static unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Revert(IStreamWrapper* @this) { return STG_E_INVALIDFUNCTION; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT LockRegion(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType) { return STG_E_INVALIDFUNCTION; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT UnlockRegion(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType) { return STG_E_INVALIDFUNCTION; } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Stat(IStreamWrapper* @this, STATSTG* pstatstg, uint grfStatFlag) { if (pstatstg == null) @@ -433,7 +433,7 @@ internal static unsafe partial class IWICStreamExtensions } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static HRESULT Clone(IStreamWrapper* @this, IStream** ppstm) { return STG_E_INVALIDFUNCTION; diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs index cd4b9c15..31f394a1 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs @@ -116,10 +116,10 @@ partial class DeviceHelper new Span(lpVtbl, 30).Clear(); - lpVtbl[2] = (delegate* unmanaged)&Release; - lpVtbl[7] = (delegate* unmanaged)&EnumAdapters; - lpVtbl[27] = (delegate* unmanaged)&EnumWarpAdapter; - lpVtbl[29] = (delegate* unmanaged)&EnumAdapterByGpuPreference; + lpVtbl[2] = (delegate* unmanaged[MemberFunction])&Release; + lpVtbl[7] = (delegate* unmanaged[MemberFunction])&EnumAdapters; + lpVtbl[27] = (delegate* unmanaged[MemberFunction])&EnumWarpAdapter; + lpVtbl[29] = (delegate* unmanaged[MemberFunction])&EnumAdapterByGpuPreference; return lpVtbl; } @@ -150,7 +150,7 @@ partial class DeviceHelper } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static uint Release(IDXGIFactory4As6Backcompat* @this) { @this->dxgiFactory4.Dispose(); @@ -161,21 +161,21 @@ partial class DeviceHelper } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int EnumAdapters(IDXGIFactory4As6Backcompat* @this, uint Adapter, IDXGIAdapter** ppAdapter) { return @this->dxgiFactory4.Get()->EnumAdapters(Adapter, ppAdapter); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int EnumWarpAdapter(IDXGIFactory4As6Backcompat* @this, Guid* riid, void** ppvAdapter) { return @this->dxgiFactory4.Get()->EnumWarpAdapter(riid, ppvAdapter); } /// - [UnmanagedCallersOnly] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] private static int EnumAdapterByGpuPreference(IDXGIFactory4As6Backcompat* @this, uint Adapter, DXGI_GPU_PREFERENCE GpuPreference, Guid* riid, void** ppvAdapter) { return @this->dxgiFactory4.Get()->EnumAdapters1(Adapter, (IDXGIAdapter1**)ppvAdapter);