From 82152af1d6e566cf1618be39a01f72620c552d6a Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 14 Dec 2023 17:48:00 +0100 Subject: [PATCH] Avoid rooting IUnknown metadata info --- .../Interop/Effects/PixelShaderEffect.Globals{T}.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Globals{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Globals{T}.cs index 008ca967..2fb5b77a 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Globals{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Globals{T}.cs @@ -16,8 +16,12 @@ internal unsafe partial struct PixelShaderEffect /// /// The resulting effect factory. /// The HRESULT for the operation. + /// + /// The return type is intentionally * because delegate targets are considered + /// visible for reflection, so not using avoids metadata for it being rooted unnecessarily. + /// [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int FactoryDelegate(IUnknown** effectImpl); + public delegate int FactoryDelegate(void** effectImpl); /// /// A base type with global values for pixel shader effects. @@ -153,9 +157,9 @@ internal unsafe partial struct PixelShaderEffect } /// - private static int CreateEffect(IUnknown** effectImpl) + private static int CreateEffect(void** effectImpl) { - return PixelShaderEffect.Factory(Instance, effectImpl); + return PixelShaderEffect.Factory(Instance, (IUnknown**)effectImpl); } } } \ No newline at end of file