From e6a22dc1594111a0f2d5c3dc08682cd08282c438 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 24 Apr 2023 15:34:56 +0200 Subject: [PATCH] Register wrappers created from registered factories --- .../PixelShaderEffect{T}.ICanvasEffectFactoryNative.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.ICanvasEffectFactoryNative.cs b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.ICanvasEffectFactoryNative.cs index ea1f07a6..c8f2b37a 100644 --- a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.ICanvasEffectFactoryNative.cs +++ b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.ICanvasEffectFactoryNative.cs @@ -104,6 +104,11 @@ unsafe partial class PixelShaderEffect resource->CopyTo(ref @this.d2D1Effect).Assert(); } + // Register the new wrapper for the input resource. This has to be done manually in this + // case, as the effect is not being realized through the usual path from GetD2DImage. + ResourceManager.RegisterWrapper((IUnknown*)resource, this); + + // Unwrap the PixelShaderEffect and return its CCW to the caller RcwMarshaller.GetNativeObject(@this, wrapper); return S.S_OK;