Fix EffectFactory marshalling on .NET Native

このコミットが含まれているのは:
Sergio Pedri committed 2023-04-23 13:04:23 +02:00
1 親 39e67a3ba0
コミット cba80806d6
5ファイル変更
+36 -6

検索条件に一致するファイルはありません

+4 -1
ファイルの表示
@@ -341,4 +341,7 @@ ASALocalRun/
samples/**/city_*.jpg
# XML docs files
src/**/ComputeSharp*.xml
src/**/ComputeSharp*.xml
# Preserve .rd.xml files
!src/**/ComputeSharp*.rd.xml
+2 -2
ファイルの表示
@@ -123,12 +123,12 @@ internal unsafe struct ICanvasEffectFactoryNative
/// <summary>
/// The IUnknown vtable.
/// </summary>
internal IUnknownVftbl IUnknownVftbl;
private IUnknownVftbl IUnknownVftbl;
/// <summary>
/// Function pointer for <see cref="CreateWrapperFromAbi"/>.
/// </summary>
internal delegate* unmanaged[Stdcall]<IntPtr, ICanvasDevice*, ID2D1Effect*, float, IInspectable**, int> CreateWrapper;
private delegate* unmanaged[Stdcall]<IntPtr, ICanvasDevice*, ID2D1Effect*, float, IInspectable**, int> CreateWrapper;
/// <inheritdoc cref="Interface.CreateWrapper"/>
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })]
+3 -3
ファイルの表示
@@ -145,17 +145,17 @@ internal unsafe struct ICanvasImageInterop
/// <summary>
/// The IUnknown vtable.
/// </summary>
internal IUnknownVftbl IUnknownVftbl;
private IUnknownVftbl IUnknownVftbl;
/// <summary>
/// Function pointer for <see cref="GetDeviceFromAbi"/>.
/// </summary>
internal delegate* unmanaged[Stdcall]<IntPtr, ICanvasDevice**, WIN2D_GET_DEVICE_ASSOCIATION_TYPE*, int> GetDevice;
private delegate* unmanaged[Stdcall]<IntPtr, ICanvasDevice**, WIN2D_GET_DEVICE_ASSOCIATION_TYPE*, int> GetDevice;
/// <summary>
/// Function pointer for <see cref="GetD2DImageFromAbi"/>.
/// </summary>
internal delegate* unmanaged[Stdcall]<IntPtr, ICanvasDevice*, ID2D1DeviceContext*, WIN2D_GET_D2D_IMAGE_FLAGS, float, float*, ID2D1Image**, int> GetD2DImage;
private delegate* unmanaged[Stdcall]<IntPtr, ICanvasDevice*, ID2D1DeviceContext*, WIN2D_GET_D2D_IMAGE_FLAGS, float, float*, ID2D1Image**, int> GetD2DImage;
/// <inheritdoc cref="Interface.GetDevice"/>
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })]
+9
ファイルの表示
@@ -15,6 +15,15 @@
<NoWarn>$(NoWarn);NETSDK1023</NoWarn>
</PropertyGroup>
<!--
Bundle the .rd.xml directives as embedded resource so they're picked up automatically.
See: https://devblogs.microsoft.com/dotnet/net-native-deep-dive-making-your-library-great/.
-->
<ItemGroup>
<None Remove="Properties\ComputeSharp.D2D1.Uwp.rd.xml" />
<EmbeddedResource Include="Properties\ComputeSharp.D2D1.Uwp.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Win2D.uwp" Version="1.27.0-preview3" />
</ItemGroup>
+18
ファイルの表示
@@ -0,0 +1,18 @@
<!--
Runtime directives for ComputeSharp.D2D1.Uwp.
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919.
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="ComputeSharp.D2D1.Uwp">
<!--
Ensure that MCG generates CCWs for PixelShaderEffect<T>.EffectFactory types. By default,
this would not be the case, because the type only implements a single [ComImport] interface,
which MCG assumes would only be used for native -> RCW scenarios. As such, without adding this
directive, trying to QueryInterface on a CCW retrieved from an EffectFactory instance would
throw a MissingInteropDataException. With this instead, the object can correctly be marshalled
to native. This is necessary because the CCW is passed to Win2D as an ICanvasEffectFactoryNative.
-->
<Type Name="ComputeSharp.D2D1.Uwp.PixelShaderEffect{T}.EffectFactory" MarshalObject="All"/>
</Library>
</Directives>