From 2998480f80cc82f435cd8d93e0c7d7a0d166a65e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 24 Nov 2023 09:28:42 +0100 Subject: [PATCH] Use [MemberFunction] for ID3DInclude CCW --- .../Shaders/Translation/D3DCompiler.ID3DInclude.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.ID3DInclude.cs b/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.ID3DInclude.cs index 0200e78c..41fc5c75 100644 --- a/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.ID3DInclude.cs +++ b/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.ID3DInclude.cs @@ -59,8 +59,8 @@ partial class D3DCompiler lpVtbl[0] = (void*)Marshal.GetFunctionPointerForDelegate(OpenWrapper); lpVtbl[1] = (void*)Marshal.GetFunctionPointerForDelegate(CloseWrapper); #else - lpVtbl[0] = (delegate* unmanaged)&Open; - lpVtbl[1] = (delegate* unmanaged)&Close; + lpVtbl[0] = (delegate* unmanaged[MemberFunction])&Open; + lpVtbl[1] = (delegate* unmanaged[MemberFunction])&Close; #endif return lpVtbl; @@ -90,7 +90,9 @@ partial class D3DCompiler } /// - [UnmanagedCallersOnly] +#if !SOURCE_GENERATOR + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] +#endif public static int Open(ID3DIncludeForD2DHelpers* @this, D3D_INCLUDE_TYPE IncludeType, sbyte* pFileName, void* pParentData, void** ppData, uint* pBytes) { #if SOURCE_GENERATOR @@ -109,7 +111,9 @@ partial class D3DCompiler } /// - [UnmanagedCallersOnly] +#if !SOURCE_GENERATOR + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])] +#endif public static int Close(ID3DIncludeForD2DHelpers* @this, void* pData) { return S_OK;