diff --git a/samples/ComputeSharp.NativeLibrary.WinRT/HelloWorldEffect.cs b/samples/ComputeSharp.NativeLibrary.WinRT/HelloWorldEffect.cs index 5927c4f6..282bb3ac 100644 --- a/samples/ComputeSharp.NativeLibrary.WinRT/HelloWorldEffect.cs +++ b/samples/ComputeSharp.NativeLibrary.WinRT/HelloWorldEffect.cs @@ -26,7 +26,7 @@ public sealed partial class HelloWorldEffect : CanvasEffect public float Time { get => this.time; - set => SetAndInvalidateEffectGraph(ref this.time, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.time, value); } /// @@ -35,7 +35,7 @@ public sealed partial class HelloWorldEffect : CanvasEffect public Rect DispatchArea { get => this.dispatchArea; - set => SetAndInvalidateEffectGraph(ref this.dispatchArea, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.dispatchArea, value); } /// diff --git a/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/PixelShaderEffect.cs b/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/PixelShaderEffect.cs index 349880ff..b6abc6e3 100644 --- a/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/PixelShaderEffect.cs +++ b/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/PixelShaderEffect.cs @@ -31,7 +31,7 @@ internal abstract partial class PixelShaderEffect : CanvasEffect public TimeSpan ElapsedTime { get => this.elapsedTime; - set => SetAndInvalidateEffectGraph(ref this.elapsedTime, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.elapsedTime, value); } /// @@ -40,7 +40,7 @@ internal abstract partial class PixelShaderEffect : CanvasEffect public int ScreenWidth { get => this.screenWidth; - set => SetAndInvalidateEffectGraph(ref this.screenWidth, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.screenWidth, value); } /// @@ -49,7 +49,7 @@ internal abstract partial class PixelShaderEffect : CanvasEffect public int ScreenHeight { get => this.screenHeight; - set => SetAndInvalidateEffectGraph(ref this.screenHeight, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.screenHeight, value); } /// diff --git a/samples/ComputeSharp.SwapChain.D2D1.Uwp/Backend/PixelShaderEffect.cs b/samples/ComputeSharp.SwapChain.D2D1.Uwp/Backend/PixelShaderEffect.cs index dd97480f..4472f98b 100644 --- a/samples/ComputeSharp.SwapChain.D2D1.Uwp/Backend/PixelShaderEffect.cs +++ b/samples/ComputeSharp.SwapChain.D2D1.Uwp/Backend/PixelShaderEffect.cs @@ -31,7 +31,7 @@ internal abstract partial class PixelShaderEffect : CanvasEffect public TimeSpan ElapsedTime { get => this.elapsedTime; - set => SetAndInvalidateEffectGraph(ref this.elapsedTime, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.elapsedTime, value); } /// @@ -40,7 +40,7 @@ internal abstract partial class PixelShaderEffect : CanvasEffect public int ScreenWidth { get => this.screenWidth; - set => SetAndInvalidateEffectGraph(ref this.screenWidth, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.screenWidth, value); } /// @@ -49,7 +49,7 @@ internal abstract partial class PixelShaderEffect : CanvasEffect public int ScreenHeight { get => this.screenHeight; - set => SetAndInvalidateEffectGraph(ref this.screenHeight, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.screenHeight, value); } /// diff --git a/samples/ComputeSharp.SwapChain.WinUI/Shaders/PixelShaderEffect.cs b/samples/ComputeSharp.SwapChain.WinUI/Shaders/PixelShaderEffect.cs index f9273e44..69f2a8e8 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Shaders/PixelShaderEffect.cs +++ b/samples/ComputeSharp.SwapChain.WinUI/Shaders/PixelShaderEffect.cs @@ -31,7 +31,7 @@ public abstract partial class PixelShaderEffect : CanvasEffect public TimeSpan ElapsedTime { get => this.elapsedTime; - set => SetAndInvalidateEffectGraph(ref this.elapsedTime, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.elapsedTime, value); } /// @@ -40,7 +40,7 @@ public abstract partial class PixelShaderEffect : CanvasEffect public int ScreenWidth { get => this.screenWidth; - set => SetAndInvalidateEffectGraph(ref this.screenWidth, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.screenWidth, value); } /// @@ -49,7 +49,7 @@ public abstract partial class PixelShaderEffect : CanvasEffect public int ScreenHeight { get => this.screenHeight; - set => SetAndInvalidateEffectGraph(ref this.screenHeight, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.screenHeight, value); } /// diff --git a/src/ComputeSharp.D2D1.UI/CanvasEffect.cs b/src/ComputeSharp.D2D1.UI/CanvasEffect.cs index cc02d189..3d70e7ff 100644 --- a/src/ComputeSharp.D2D1.UI/CanvasEffect.cs +++ b/src/ComputeSharp.D2D1.UI/CanvasEffect.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using Microsoft.Graphics.Canvas; @@ -144,7 +145,7 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop /// The storage for the effect property value. /// The new effect property value to set. /// The invalidation type to request. - protected void SetAndInvalidateEffectGraph([NotNullIfNotNull(nameof(value))] ref T storage, T value, CanvasEffectInvalidationType invalidationType = CanvasEffectInvalidationType.Update) + protected void SetPropertyAndInvalidateEffectGraph([NotNullIfNotNull(nameof(value))] ref T storage, T value, CanvasEffectInvalidationType invalidationType = CanvasEffectInvalidationType.Update) { if (EqualityComparer.Default.Equals(storage, value)) { @@ -156,6 +157,14 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop InvalidateEffectGraph(invalidationType); } + /// + [Obsolete("Use 'SetPropertyAndInvalidateEffectGraph' instead.")] + [EditorBrowsable(EditorBrowsableState.Never)] + protected void SetAndInvalidateEffectGraph([NotNullIfNotNull(nameof(value))] ref T storage, T value, CanvasEffectInvalidationType invalidationType = CanvasEffectInvalidationType.Update) + { + SetPropertyAndInvalidateEffectGraph(ref storage, value, invalidationType); + } + /// /// Disposes any disposable resources in the current instance. /// diff --git a/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/CanvasEffectTests.cs b/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/CanvasEffectTests.cs index 9b34fb4f..6c892674 100644 --- a/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/CanvasEffectTests.cs +++ b/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/CanvasEffectTests.cs @@ -390,13 +390,13 @@ public partial class CanvasEffectTests public int Value { get => this.value; - set => SetAndInvalidateEffectGraph(ref this.value, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.value, value); } public int ValueWithReload { get => this.value; - set => SetAndInvalidateEffectGraph(ref this.value, value, CanvasEffectInvalidationType.Creation); + set => SetPropertyAndInvalidateEffectGraph(ref this.value, value, CanvasEffectInvalidationType.Creation); } public int NumberOfBuildEffectGraphCalls { get; private set; } diff --git a/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/ShadersTests.cs b/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/ShadersTests.cs index 98854516..f4484414 100644 --- a/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/ShadersTests.cs +++ b/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/ShadersTests.cs @@ -120,7 +120,7 @@ public class ShadersTests public T ConstantBuffer { get => this.constantBuffer; - set => SetAndInvalidateEffectGraph(ref this.constantBuffer, value); + set => SetPropertyAndInvalidateEffectGraph(ref this.constantBuffer, value); } protected override void BuildEffectGraph(CanvasEffectGraph effectGraph)