Update samples to use new EffectGraph APIs

このコミットが含まれているのは:
Sergio Pedri committed 2023-04-30 16:02:31 +02:00
1 親 4db990d03b
コミット 3fdd315d88
3ファイル変更
+26 -64

検索条件に一致するファイルはありません

+9 -23
ファイルの表示
@@ -5,7 +5,6 @@ using ComputeSharp.D2D1.Uwp;
#else
using ComputeSharp.D2D1.WinUI;
#endif
using Microsoft.Graphics.Canvas;
#nullable enable
@@ -65,16 +64,16 @@ public abstract class PixelShaderEffect : CanvasEffect
public sealed class For<T> : PixelShaderEffect
where T : unmanaged, ID2D1PixelShader
{
/// <summary>
/// The <see cref="PixelShaderEffect{T}"/> node in use.
/// </summary>
private static readonly EffectNode<PixelShaderEffect<T>> Effect = new();
/// <summary>
/// The <typeparamref name="T"/> factory to use.
/// </summary>
private readonly Factory factory;
/// <summary>
/// The <see cref="PixelShaderEffect{T}"/> instance in use.
/// </summary>
private PixelShaderEffect<T>? effect;
/// <summary>
/// Creates a new <see cref="For{T}"/> instance with the specified parameters.
/// </summary>
@@ -85,28 +84,15 @@ public abstract class PixelShaderEffect : CanvasEffect
}
/// <inheritdoc/>
protected override ICanvasImage BuildEffectGraph()
protected override void BuildEffectGraph(EffectGraph effectGraph)
{
this.effect = new PixelShaderEffect<T>();
return this.effect;
effectGraph.RegisterAndSetOutputNode(Effect, new PixelShaderEffect<T>());
}
/// <inheritdoc/>
protected override void ConfigureEffectGraph()
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
{
this.effect!.ConstantBuffer = this.factory(ElapsedTime, ScreenWidth, ScreenHeight);
}
/// <inheritdoc/>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
this.effect?.Dispose();
}
effectGraph.GetNode(Effect).ConstantBuffer = this.factory(ElapsedTime, ScreenWidth, ScreenHeight);
}
/// <summary>