using ABI.Microsoft.Graphics.Canvas; using ComputeSharp.D2D1.Interop; using ComputeSharp.Interop; using Microsoft.Graphics.Canvas; using Microsoft.Graphics.Canvas.Effects; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; namespace ComputeSharp.D2D1.Uwp; /// /// A custom implementation powered by a supplied shader type. /// /// The type of shader to use to render frames. public sealed partial class PixelShaderEffect : IReferenceTrackedObject, ICanvasEffect, ICanvasImageInterop.Interface where T : unmanaged, ID2D1PixelShader { /// /// The value for the current instance. /// private ReferenceTracker referenceTracker; /// /// Lock object used to synchronize calls to APIs. /// private readonly object lockObject = new(); /// /// Flag to track whether a given call is recursively invoked by , to avoid graph cycles. /// private volatile int isInsideGetD2DImage; /// /// The current device the effect is realized on, if one is available (this is the underlying COM object for ). /// private ComPtr canvasDevice; /// /// The underlying D2D1 device the effect is realized on, if one is available (this is the D2D device backing ). /// private ComPtr d2D1RealizationDevice; /// /// The current realized , if one is available. /// private ComPtr d2D1Effect; /// /// The backing field for . /// private T constantBuffer; /// /// The backing field for . /// private D2D1TransformMapper? transformMapper; /// /// The backing field for . /// private bool cacheOutput; /// /// The backing field for . /// private D2D1_BUFFER_PRECISION d2D1BufferPrecision; /// /// Creates a new instance. /// public PixelShaderEffect() { this.referenceTracker = new ReferenceTracker(this); Sources = new SourceCollection(this); ResourceTextureManagers = new ResourceTextureManagerCollection(this); } }