diff --git a/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.ICanvasImageInterop.cs b/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.ICanvasImageInterop.cs index ec8b40cb..cce1ce96 100644 --- a/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.ICanvasImageInterop.cs +++ b/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.ICanvasImageInterop.cs @@ -195,26 +195,12 @@ unsafe partial class PixelShaderEffect // D2D1PixelShaderEffect APIs specifically need an ID2D1Factory1 (as ID2D1Factory1::RegisterEffectFromString is used) d2D1Factory.CopyTo(d2D1Factory1.GetAddressOf()).Assert(); - bool isPossiblyRegistered = true; - - // If the effect hasn't been initialized explicitly, initialize it now - if (!PixelShaderEffect.For.TryGetId(out Guid effectId)) - { - PixelShaderEffect.For.Initialize(null); - - effectId = PixelShaderEffect.For.Id; - isPossiblyRegistered = false; - } - fixed (ID2D1Effect** d2D1Effect = this.d2D1Effect) { - HRESULT hresult = D2DERR.D2DERR_EFFECT_IS_NOT_REGISTERED; + Guid effectId = PixelShaderEffect.For.Instance.Id; // Try to create an instance of the effect in use and store it in the current object - if (isPossiblyRegistered) - { - hresult = deviceContext->CreateEffect(effectId: &effectId, effect: d2D1Effect); - } + HRESULT hresult = deviceContext->CreateEffect(effectId: &effectId, effect: d2D1Effect); // Check if creation failed due to the effect not being registered. In that case, register // it and then try again. This is much faster than check whether the effect is registered @@ -222,7 +208,7 @@ unsafe partial class PixelShaderEffect if (hresult == D2DERR.D2DERR_EFFECT_IS_NOT_REGISTERED) { // Register the effect with the factory (pass the same D2D1 draw transform mapper factory that was used before) - D2D1PixelShaderEffect.RegisterForD2D1Factory1(d2D1Factory1.Get(), PixelShaderEffect.For.D2D1DrawTransformMapperFactory, out _); + D2D1PixelShaderEffect.RegisterForD2D1Factory1(d2D1Factory1.Get(), out _); // Try to create the effect again hresult = deviceContext->CreateEffect(effectId: &effectId, effect: d2D1Effect); diff --git a/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.Properties.cs b/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.Properties.cs index 9904cecc..92d56049 100644 --- a/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.Properties.cs +++ b/src/ComputeSharp.D2D1.Uwp/PixelShaderEffect{T}.Properties.cs @@ -1,5 +1,4 @@ using System; -using ComputeSharp.D2D1.Interop.Effects; using Microsoft.Graphics.Canvas; using Windows.Graphics.Effects; @@ -8,20 +7,6 @@ namespace ComputeSharp.D2D1.Uwp; /// partial class PixelShaderEffect { - /// - /// Configures the to use for effects of type . - /// - /// The factory of instances to use for each created effect. - /// Thrown if initialization is attempted with a mismatched transform factory. - /// - /// Initialization can only be done once, and is shared across all effects of type . - /// Initializing an effect is not necessary before using it: if no transform has been set, the default one will be used. - /// - public static void ConfigureD2D1TransformMapperFactory(ID2D1TransformMapperFactory? d2D1DrawTransformMapperFactory) - { - PixelShaderEffect.For.Initialize(d2D1DrawTransformMapperFactory); - } - /// /// Gets or sets the current value in use. ///