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;