From f5f094e632d7c2d7091a0315c66179d27ef8ed39 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 11 Aug 2022 15:32:44 +0200 Subject: [PATCH] Centralize function pointer accessors in T4 templates --- .../ComputeSharp.Core.csproj | 4 +- .../ComputeSharp.D2D1.csproj | 4 +- .../Effects/PixelShaderEffect.Properties.cs | 49 +- .../Effects/PixelShaderEffect.Properties.g.cs | 725 +++++++++++++++--- .../Effects/PixelShaderEffect.Properties.tt | 56 +- .../UnmanagedCallersOnlyAttribute.cs | 14 + 6 files changed, 721 insertions(+), 131 deletions(-) diff --git a/src/ComputeSharp.Core/ComputeSharp.Core.csproj b/src/ComputeSharp.Core/ComputeSharp.Core.csproj index 6578e44d..23c797b5 100644 --- a/src/ComputeSharp.Core/ComputeSharp.Core.csproj +++ b/src/ComputeSharp.Core/ComputeSharp.Core.csproj @@ -24,9 +24,9 @@ - Hlsl.Void.tt True True + Hlsl.Void.tt True @@ -137,8 +137,8 @@ - Hlsl.Void.g.cs TextTemplatingFileGenerator + Hlsl.Void.g.cs TextTemplatingFileGenerator diff --git a/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj b/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj index 9627172c..3125ca55 100644 --- a/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj +++ b/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj @@ -26,11 +26,11 @@ - + True True PixelShaderEffect.Properties.tt - + diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs index 751b5fab..4fe6dbaf 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; @@ -21,19 +22,51 @@ unsafe partial struct PixelShaderEffect private delegate int PropertySetBindingDelegate(IUnknown* effect, byte* data, uint dataSize); /// - /// A cached instance wrapping . + /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetConstantBufferWrapper = GetConstantBuffer; + private static readonly PropertyGetFunctionDelegate GetConstantBufferWrapper = GetConstantBufferImpl; /// - /// A cached instance wrapping . + /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetConstantBufferWrapper = SetConstantBuffer; + private static readonly PropertySetBindingDelegate SetConstantBufferWrapper = SetConstantBufferImpl; #endif + /// + /// Gets the get accessor for the constant buffer. + /// + public static delegate* unmanaged[Stdcall] GetConstantBuffer + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetConstantBufferImpl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetConstantBufferWrapper); +#endif + } + } + + /// + /// Gets the set accessor for the constant buffer. + /// + public static delegate* unmanaged[Stdcall] SetConstantBuffer + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetConstantBufferImpl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetConstantBufferWrapper); +#endif + } + } + /// - [UnmanagedCallersOnly] - private static int GetConstantBuffer(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetConstantBufferImpl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { PixelShaderEffect* @this = (PixelShaderEffect*)effect; @@ -54,8 +87,8 @@ unsafe partial struct PixelShaderEffect } /// - [UnmanagedCallersOnly] - private static int SetConstantBuffer(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetConstantBufferImpl(IUnknown* effect, byte* data, uint dataSize) { PixelShaderEffect* @this = (PixelShaderEffect*)effect; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.g.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.g.cs index 2ca4ba00..9e1ae4e4 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.g.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.g.cs @@ -1,4 +1,8 @@ -using TerraFX.Interop.DirectX; +using System.Runtime.CompilerServices; +#if !NET6_OR_GREATER +using System.Runtime.InteropServices; +#endif +using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; #if !NET6_0_OR_GREATER using UnmanagedCallersOnlyAttribute = ComputeSharp.NetStandard.System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute; @@ -13,384 +17,881 @@ unsafe partial struct PixelShaderEffect /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager0Wrapper = GetResourceTextureManager0; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager0Wrapper = GetResourceTextureManager0Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager0Wrapper = SetResourceTextureManager0; + private static readonly PropertySetBindingDelegate SetResourceTextureManager0Wrapper = SetResourceTextureManager0Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager1Wrapper = GetResourceTextureManager1; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager1Wrapper = GetResourceTextureManager1Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager1Wrapper = SetResourceTextureManager1; + private static readonly PropertySetBindingDelegate SetResourceTextureManager1Wrapper = SetResourceTextureManager1Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager2Wrapper = GetResourceTextureManager2; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager2Wrapper = GetResourceTextureManager2Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager2Wrapper = SetResourceTextureManager2; + private static readonly PropertySetBindingDelegate SetResourceTextureManager2Wrapper = SetResourceTextureManager2Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager3Wrapper = GetResourceTextureManager3; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager3Wrapper = GetResourceTextureManager3Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager3Wrapper = SetResourceTextureManager3; + private static readonly PropertySetBindingDelegate SetResourceTextureManager3Wrapper = SetResourceTextureManager3Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager4Wrapper = GetResourceTextureManager4; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager4Wrapper = GetResourceTextureManager4Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager4Wrapper = SetResourceTextureManager4; + private static readonly PropertySetBindingDelegate SetResourceTextureManager4Wrapper = SetResourceTextureManager4Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager5Wrapper = GetResourceTextureManager5; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager5Wrapper = GetResourceTextureManager5Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager5Wrapper = SetResourceTextureManager5; + private static readonly PropertySetBindingDelegate SetResourceTextureManager5Wrapper = SetResourceTextureManager5Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager6Wrapper = GetResourceTextureManager6; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager6Wrapper = GetResourceTextureManager6Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager6Wrapper = SetResourceTextureManager6; + private static readonly PropertySetBindingDelegate SetResourceTextureManager6Wrapper = SetResourceTextureManager6Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager7Wrapper = GetResourceTextureManager7; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager7Wrapper = GetResourceTextureManager7Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager7Wrapper = SetResourceTextureManager7; + private static readonly PropertySetBindingDelegate SetResourceTextureManager7Wrapper = SetResourceTextureManager7Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager8Wrapper = GetResourceTextureManager8; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager8Wrapper = GetResourceTextureManager8Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager8Wrapper = SetResourceTextureManager8; + private static readonly PropertySetBindingDelegate SetResourceTextureManager8Wrapper = SetResourceTextureManager8Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager9Wrapper = GetResourceTextureManager9; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager9Wrapper = GetResourceTextureManager9Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager9Wrapper = SetResourceTextureManager9; + private static readonly PropertySetBindingDelegate SetResourceTextureManager9Wrapper = SetResourceTextureManager9Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager10Wrapper = GetResourceTextureManager10; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager10Wrapper = GetResourceTextureManager10Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager10Wrapper = SetResourceTextureManager10; + private static readonly PropertySetBindingDelegate SetResourceTextureManager10Wrapper = SetResourceTextureManager10Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager11Wrapper = GetResourceTextureManager11; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager11Wrapper = GetResourceTextureManager11Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager11Wrapper = SetResourceTextureManager11; + private static readonly PropertySetBindingDelegate SetResourceTextureManager11Wrapper = SetResourceTextureManager11Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager12Wrapper = GetResourceTextureManager12; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager12Wrapper = GetResourceTextureManager12Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager12Wrapper = SetResourceTextureManager12; + private static readonly PropertySetBindingDelegate SetResourceTextureManager12Wrapper = SetResourceTextureManager12Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager13Wrapper = GetResourceTextureManager13; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager13Wrapper = GetResourceTextureManager13Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager13Wrapper = SetResourceTextureManager13; + private static readonly PropertySetBindingDelegate SetResourceTextureManager13Wrapper = SetResourceTextureManager13Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager14Wrapper = GetResourceTextureManager14; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager14Wrapper = GetResourceTextureManager14Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager14Wrapper = SetResourceTextureManager14; + private static readonly PropertySetBindingDelegate SetResourceTextureManager14Wrapper = SetResourceTextureManager14Impl; /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager15Wrapper = GetResourceTextureManager15; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager15Wrapper = GetResourceTextureManager15Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager15Wrapper = SetResourceTextureManager15; + private static readonly PropertySetBindingDelegate SetResourceTextureManager15Wrapper = SetResourceTextureManager15Impl; #endif + /// + /// Gets the get accessor for the resource manager at index 0. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager0 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager0Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager0Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 0. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager0 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager0Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager0Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 1. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager1 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager1Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager1Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 1. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager1 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager1Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager1Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 2. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager2 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager2Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager2Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 2. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager2 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager2Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager2Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 3. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager3 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager3Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager3Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 3. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager3 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager3Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager3Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 4. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager4 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager4Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager4Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 4. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager4 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager4Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager4Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 5. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager5 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager5Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager5Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 5. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager5 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager5Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager5Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 6. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager6 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager6Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager6Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 6. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager6 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager6Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager6Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 7. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager7 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager7Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager7Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 7. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager7 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager7Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager7Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 8. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager8 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager8Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager8Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 8. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager8 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager8Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager8Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 9. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager9 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager9Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager9Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 9. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager9 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager9Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager9Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 10. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager10 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager10Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager10Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 10. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager10 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager10Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager10Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 11. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager11 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager11Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager11Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 11. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager11 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager11Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager11Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 12. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager12 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager12Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager12Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 12. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager12 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager12Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager12Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 13. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager13 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager13Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager13Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 13. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager13 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager13Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager13Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 14. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager14 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager14Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager14Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 14. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager14 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager14Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager14Wrapper); +#endif + } + } + + /// + /// Gets the get accessor for the resource manager at index 15. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager15 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager15Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager15Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index 15. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager15 + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager15Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager15Wrapper); +#endif + } + } + /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager0(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager0Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(0, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager0(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager0Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(0, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager1(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager1Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(1, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager1(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager1Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(1, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager2(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager2Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(2, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager2(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager2Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(2, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager3(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager3Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(3, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager3(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager3Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(3, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager4(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager4Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(4, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager4(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager4Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(4, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager5(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager5Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(5, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager5(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager5Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(5, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager6(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager6Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(6, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager6(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager6Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(6, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager7(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager7Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(7, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager7(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager7Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(7, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager8(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager8Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(8, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager8(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager8Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(8, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager9(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager9Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(9, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager9(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager9Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(9, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager10(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager10Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(10, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager10(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager10Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(10, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager11(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager11Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(11, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager11(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager11Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(11, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager12(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager12Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(12, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager12(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager12Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(12, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager13(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager13Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(13, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager13(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager13Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(13, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager14(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager14Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(14, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager14(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager14Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(14, data, dataSize); } - /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager15(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager15Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(15, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager15(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager15Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(15, data, dataSize); } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.tt b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.tt index 18ff021e..7711750a 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.tt +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.tt @@ -1,6 +1,10 @@ <#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ output extension=".g.cs"#> +using System.Runtime.CompilerServices; +#if !NET6_OR_GREATER +using System.Runtime.InteropServices; +#endif using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; #if !NET6_0_OR_GREATER @@ -20,37 +24,75 @@ for (int i = 0; i < 16; i++) /// /// A cached instance wrapping . /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager<#=i#>Wrapper = GetResourceTextureManager<#=i#>; + private static readonly PropertyGetFunctionDelegate GetResourceTextureManager<#=i#>Wrapper = GetResourceTextureManager<#=i#>Impl; /// /// A cached instance wrapping . /// - private static readonly PropertySetBindingDelegate SetResourceTextureManager<#=i#>Wrapper = SetResourceTextureManager<#=i#>; + private static readonly PropertySetBindingDelegate SetResourceTextureManager<#=i#>Wrapper = SetResourceTextureManager<#=i#>Impl; <# if (i < 15) WriteLine(""); } #> #endif +<# +for (int i = 0; i < 16; i++) +{ +#> + /// + /// Gets the get accessor for the resource manager at index <#=i#>. + /// + public static delegate* unmanaged[Stdcall] GetResourceTextureManager<#=i#> + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &GetResourceTextureManager<#=i#>Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager<#=i#>Wrapper); +#endif + } + } + + /// + /// Gets the set accessor for the resource manager at index <#=i#>. + /// + public static delegate* unmanaged[Stdcall] SetResourceTextureManager<#=i#> + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { +#if NET6_0_OR_GREATER + return &SetResourceTextureManager<#=i#>Impl; +#else + return (delegate* unmanaged[Stdcall])(void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager<#=i#>Wrapper); +#endif + } + } + +<# +} +#> <# for (int i = 0; i < 16; i++) { #> /// - [UnmanagedCallersOnly] - private static int GetResourceTextureManager<#=i#>(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int GetResourceTextureManager<#=i#>Impl(IUnknown* effect, byte* data, uint dataSize, uint* actualSize) { return ((PixelShaderEffect*)effect)->GetResourceTextureManagerAtIndex(<#=i#>, data, dataSize, actualSize); } /// - [UnmanagedCallersOnly] - private static int SetResourceTextureManager<#=i#>(IUnknown* effect, byte* data, uint dataSize) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })] + private static int SetResourceTextureManager<#=i#>Impl(IUnknown* effect, byte* data, uint dataSize) { return ((PixelShaderEffect*)effect)->SetResourceTextureManagerAtIndex(<#=i#>, data, dataSize); } <# - if (i < 15) WriteLine(""); } #> } \ No newline at end of file diff --git a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs index b35b322b..0f25befe 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs @@ -3,6 +3,8 @@ using System; +#pragma warning disable CS0649 + namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; // This cannot be in System.Runtime.InteropServices, or Roslyn will recognize it /// @@ -14,4 +16,16 @@ namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; // This canno [AttributeUsage(AttributeTargets.Method, Inherited = false)] internal sealed class UnmanagedCallersOnlyAttribute : Attribute { + /// + /// Optional. If omitted, the runtime will use the default platform calling convention. + /// + /// + /// Supplied types must be from the official "System.Runtime.CompilerServices" namespace and be of the form "CallConvXXX". + /// + public Type[]? CallConvs; + + /// + /// Optional. If omitted, no named export is emitted during compilation. + /// + public string? EntryPoint; } \ No newline at end of file