Add EffectGraph.SetOutputNode API to change output
このコミットが含まれているのは:
1 親
a24f49c0e2
コミット
296ca9f6de
8ファイル変更
+435
-100
検索条件に一致するファイルはありません
@@ -86,7 +86,7 @@ public abstract class PixelShaderEffect : CanvasEffect
|
||||
/// <inheritdoc/>
|
||||
protected override void BuildEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.RegisterAndSetOutputNode(Effect, new PixelShaderEffect<T>());
|
||||
effectGraph.RegisterOutputNode(Effect, new PixelShaderEffect<T>());
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public sealed class D2D1ContouredLayersEffect : PixelShaderEffect
|
||||
PixelShaderEffect<ContouredLayers> pixelShaderEffect = new() { ResourceTextureManagers = { [0] = resourceTextureManager } };
|
||||
|
||||
// Register the pixel shader effect as the output node in the effect graph
|
||||
effectGraph.RegisterAndSetOutputNode(PixelShaderEffect, pixelShaderEffect);
|
||||
effectGraph.RegisterOutputNode(PixelShaderEffect, pixelShaderEffect);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -81,7 +81,7 @@ internal abstract class PixelShaderEffect : CanvasEffect
|
||||
/// <inheritdoc/>
|
||||
protected override void BuildEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.RegisterAndSetOutputNode(Effect, new PixelShaderEffect<T>());
|
||||
effectGraph.RegisterOutputNode(Effect, new PixelShaderEffect<T>());
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -80,7 +80,7 @@ partial class CanvasEffect
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(canvasImage);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
default(InvalidOperationException).ThrowIf(!this.owner.isBuildingEffectGraph);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != InvalidationType.Creation);
|
||||
|
||||
// Use a new dummy object as key to register the anonymous effect node. This is cheaper than having to maintain a different
|
||||
// data structure (eg. a HashSet<ICanvasImage> instance) just to hold the anonymous effects that may be registered. This way,
|
||||
@@ -109,7 +109,7 @@ partial class CanvasEffect
|
||||
default(ArgumentNullException).ThrowIfNull(effectNode);
|
||||
default(ArgumentNullException).ThrowIfNull(canvasImage);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
default(InvalidOperationException).ThrowIf(!this.owner.isBuildingEffectGraph);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != InvalidationType.Creation);
|
||||
|
||||
// Try to add the new canvas image associated with the input effect node marker.
|
||||
// This must not have been previously added from another RegisterNode call.
|
||||
@@ -130,16 +130,15 @@ partial class CanvasEffect
|
||||
/// correctly track the image ownership, so that it can be disposed when the current effect instance is disposed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If performing lookups on <paramref name="canvasImage"/> is required, use the <see cref="RegisterAndSetOutputNode{T}(EffectNode{T}, T)"/> overload.
|
||||
/// If performing lookups on <paramref name="canvasImage"/> is required, use the <see cref="RegisterOutputNode{T}(EffectNode{T}, T)"/> overload.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <inheritdoc cref="RegisterNode(ICanvasImage)"/>
|
||||
public void RegisterAndSetOutputNode(ICanvasImage canvasImage)
|
||||
public void RegisterOutputNode(ICanvasImage canvasImage)
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(canvasImage);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
default(InvalidOperationException).ThrowIf(!this.owner.isBuildingEffectGraph);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.canvasImage is not null);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != InvalidationType.Creation);
|
||||
|
||||
// Register the anonymous effect node with a dummy object, same as above
|
||||
_ = this.owner.transformNodes.TryAdd(new object(), canvasImage);
|
||||
@@ -153,14 +152,13 @@ partial class CanvasEffect
|
||||
/// Additionally, it also marks the input <see cref="ICanvasImage"/> object as the output node for the effect graph being built.
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="RegisterNode"/>
|
||||
public void RegisterAndSetOutputNode<T>(EffectNode<T> effectNode, T canvasImage)
|
||||
public void RegisterOutputNode<T>(EffectNode<T> effectNode, T canvasImage)
|
||||
where T : class, ICanvasImage
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(effectNode);
|
||||
default(ArgumentNullException).ThrowIfNull(canvasImage);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
default(InvalidOperationException).ThrowIf(!this.owner.isBuildingEffectGraph);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.canvasImage is not null);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != InvalidationType.Creation);
|
||||
|
||||
// Try to add the output node as in the method above (but with an extra check before doing so)
|
||||
if (!this.owner.transformNodes.TryAdd(effectNode, canvasImage))
|
||||
@@ -171,6 +169,35 @@ partial class CanvasEffect
|
||||
// Store the output node for later use
|
||||
this.owner.canvasImage = canvasImage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a previously registered <see cref="EffectNode{T}"/> instance as the output node for the effect graph.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of <see cref="ICanvasImage"/> object that will be used as output image.</typeparam>
|
||||
/// <param name="effectNode">The <see cref="EffectNode{T}"/> instance to set as output node for the effect graph.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="effectNode"/> is <see langword="null"/>.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown if the current <see cref="EffectGraph"/> instance is not valid.</exception>
|
||||
/// <exception cref="ArgumentException">Thrown if <paramref name="effectNode"/> is not registered in the effect graph.</exception>
|
||||
/// <remarks>
|
||||
/// This method can be called from both <see cref="BuildEffectGraph"/> and <see cref="ConfigureEffectGraph"/>. It can be used for
|
||||
/// efficiently changing the output node of a graph, without having to rebuild it. For instance, this can be used for effects that
|
||||
/// have multiple paths that can be taken for their inputs, depending on the value of some property describing the effect behavior.
|
||||
/// </remarks>
|
||||
public void SetOutputNode<T>(EffectNode<T> effectNode)
|
||||
where T : class, ICanvasImage
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(effectNode);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
|
||||
// Get the canvas image for the registered effect node (which has to exist at this point)
|
||||
if (!this.owner.transformNodes.TryGetValue(effectNode, out ICanvasImage? canvasImage))
|
||||
{
|
||||
default(ArgumentException).Throw(nameof(effectNode), "The specified output node is not registered in the effect graph.");
|
||||
}
|
||||
|
||||
// Store the new output node
|
||||
this.owner.canvasImage = canvasImage;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -73,27 +73,32 @@ unsafe partial class CanvasEffect
|
||||
{
|
||||
default(ObjectDisposedException).ThrowIf(this.isDisposed, this);
|
||||
|
||||
// Build the effect graph and get the output node, if missing
|
||||
if (this.canvasImage is null)
|
||||
// Build the effect graph (the output node might not have been set yet)
|
||||
if (this.invalidationType == InvalidationType.Creation)
|
||||
{
|
||||
this.isBuildingEffectGraph = true;
|
||||
|
||||
DisposeEffectGraph();
|
||||
BuildEffectGraph(new EffectGraph(this));
|
||||
|
||||
this.isBuildingEffectGraph = false;
|
||||
|
||||
default(InvalidOperationException).ThrowIf(this.canvasImage is null);
|
||||
// We successfully got past the effect graph creation, so update the current
|
||||
// invalidation state. This ensures that even if the configuration failed, the
|
||||
// next time the effect is drawn again the graph won't be created again too.
|
||||
this.invalidationType = InvalidationType.Update;
|
||||
}
|
||||
|
||||
// Configure the effect graph, if the effect is invalidated
|
||||
if (this.isInvalidated)
|
||||
if (this.invalidationType == InvalidationType.Update)
|
||||
{
|
||||
ConfigureEffectGraph(new EffectGraph(this));
|
||||
|
||||
this.isInvalidated = false;
|
||||
// The effect graph is now ready to go: no further work will be done before drawing
|
||||
// unless it is explicitly invalidated again, using either creation or update mode.
|
||||
this.invalidationType = default;
|
||||
}
|
||||
|
||||
// At this point, there must be an output canvas image being set.
|
||||
// If not, it means a derived type has forgot to set an output node.
|
||||
default(InvalidOperationException).ThrowIf(this.canvasImage is null);
|
||||
|
||||
return this.canvasImage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,22 +29,9 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop.I
|
||||
private ICanvasImage? canvasImage;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the current instance is within a call to <see cref="BuildEffectGraph"/>.
|
||||
/// Indicates the current invalidation state for the effect graph (which controls the logic in <see cref="GetCanvasImage"/>).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is used to validate method calls from within <see cref="EffectGraph"/>. That is, the
|
||||
/// <see cref="EffectGraph.RegisterNode"/> APIs will use this to detect whether they can be called.
|
||||
/// </remarks>
|
||||
private bool isBuildingEffectGraph;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the current state has been invalidated (requiring <see cref="ConfigureEffectGraph"/> to be called).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is initially <see langword="true"/> so that <see cref="ConfigureEffectGraph"/> will always be called when
|
||||
/// first creating the image, even if the effect has not bee invalidated. This ensures default parameters are set.
|
||||
/// </remarks>
|
||||
private bool isInvalidated = true;
|
||||
private InvalidationType invalidationType = InvalidationType.Creation;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the effect is disposed.
|
||||
@@ -134,18 +121,13 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop.I
|
||||
{
|
||||
lock (this.transformNodes)
|
||||
{
|
||||
// If the effect graph should be created again, dispose the image and throw it away
|
||||
if (invalidationType == InvalidationType.Creation)
|
||||
{
|
||||
this.canvasImage?.Dispose();
|
||||
|
||||
this.canvasImage = null;
|
||||
}
|
||||
|
||||
// For both invalidation types, always mark the internal state as not being valid anymore.
|
||||
// The next time the image is requested, the effect graph will be configured if needed.
|
||||
// This matches the default value for the field (which is needed for the first realization).
|
||||
this.isInvalidated = true;
|
||||
// This method only updates the invalidation type. The next time the effect is drawn,
|
||||
// the current graph (if existing) will be disposed automatically before building a
|
||||
// new one. If the invalidation mode just needs an update, no disposal will happen.
|
||||
// The new invalidation type is always set to the maximum between the current one and
|
||||
// the requested one. This means that eg. if the current invalidation type is creation,
|
||||
// and a property only needing an update is set, the creation request will persist.
|
||||
this.invalidationType = (InvalidationType)Math.Max((byte)this.invalidationType, (byte)invalidationType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,17 +209,8 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop.I
|
||||
/// <summary>
|
||||
/// Indicates the invalidation type to request when invoking <see cref="InvalidateEffectGraph"/> and related methods.
|
||||
/// </summary>
|
||||
protected enum InvalidationType
|
||||
protected enum InvalidationType : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Fully invalidates the effect graph, causing it to be created again the next time it is needed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This will cause the last returned <see cref="ICanvasImage"/> instance to be disposed and discarded,
|
||||
/// and <see cref="BuildEffectGraph"/> to be called again the next time the effect is used for drawing.
|
||||
/// </remarks>
|
||||
Creation,
|
||||
|
||||
/// <summary>
|
||||
/// Invalidates the state of the effect graph, causing it to be configured again the next time it is used.
|
||||
/// </summary>
|
||||
@@ -251,6 +224,15 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop.I
|
||||
/// This is much less expensive than creating the effect graph again, and should be preferred if possible.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
Update
|
||||
Update,
|
||||
|
||||
/// <summary>
|
||||
/// Fully invalidates the effect graph, causing it to be created again the next time it is needed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This will cause the last returned <see cref="ICanvasImage"/> instance to be disposed and discarded,
|
||||
/// and <see cref="BuildEffectGraph"/> to be called again the next time the effect is used for drawing.
|
||||
/// </remarks>
|
||||
Creation
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
using System.Threading.Tasks;
|
||||
using ComputeSharp.D2D1.UI.Tests.Helpers;
|
||||
#if WINDOWS_UWP
|
||||
using ComputeSharp.D2D1.Uwp;
|
||||
#else
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
#endif
|
||||
using ComputeSharp.SwapChain.Shaders.D2D1;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TerraFX.Interop.Windows;
|
||||
using Windows.Foundation;
|
||||
using Windows.Storage;
|
||||
using Windows.UI;
|
||||
|
||||
#nullable enable
|
||||
|
||||
@@ -17,7 +27,7 @@ namespace ComputeSharp.D2D1.UI.Tests;
|
||||
public partial class CanvasEffectTests
|
||||
{
|
||||
[TestMethod]
|
||||
public unsafe void CanvasEffect_IsRealizedAndInvalidatedCorrectly()
|
||||
public void CanvasEffect_IsRealizedAndInvalidatedCorrectly()
|
||||
{
|
||||
EffectWithNoInputs effect = new();
|
||||
|
||||
@@ -66,32 +76,50 @@ public partial class CanvasEffectTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(InvalidOperationException))]
|
||||
public unsafe void CanvasEffect_EffectRegisteringMultipleOutputNodes()
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void CanvasEffect_EffectSettingNotRegisteredOutputNode()
|
||||
{
|
||||
EffectRegisteringMultipleOutputNodes effect = new();
|
||||
EffectSettingNotRegisteredOutputNode effect = new();
|
||||
|
||||
using CanvasRenderTarget renderTarget = new(new CanvasDevice(), 128, 128, 96.0f);
|
||||
using CanvasDrawingSession drawingSession = renderTarget.CreateDrawingSession();
|
||||
try
|
||||
{
|
||||
using CanvasRenderTarget renderTarget = new(new CanvasDevice(), 128, 128, 96.0f);
|
||||
using CanvasDrawingSession drawingSession = renderTarget.CreateDrawingSession();
|
||||
|
||||
drawingSession.DrawImage(effect);
|
||||
drawingSession.DrawImage(effect);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Assert.IsTrue(effect.WasConfigureEffectGraphCalled);
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(InvalidOperationException))]
|
||||
public unsafe void CanvasEffect_EffectNotRegisteringAnOutputNode()
|
||||
public void CanvasEffect_EffectNotRegisteringAnOutputNode()
|
||||
{
|
||||
EffectNotRegisteringAnOutputNode effect = new();
|
||||
|
||||
using CanvasRenderTarget renderTarget = new(new CanvasDevice(), 128, 128, 96.0f);
|
||||
using CanvasDrawingSession drawingSession = renderTarget.CreateDrawingSession();
|
||||
try
|
||||
{
|
||||
using CanvasRenderTarget renderTarget = new(new CanvasDevice(), 128, 128, 96.0f);
|
||||
using CanvasDrawingSession drawingSession = renderTarget.CreateDrawingSession();
|
||||
|
||||
drawingSession.DrawImage(effect);
|
||||
drawingSession.DrawImage(effect);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Assert.IsTrue(effect.WasConfigureEffectGraphCalled);
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public unsafe void CanvasEffect_EffectRegisteringNodesMultipleTimes1()
|
||||
public void CanvasEffect_EffectRegisteringNodesMultipleTimes1()
|
||||
{
|
||||
EffectRegisteringNodesMultipleTimes1 effect = new();
|
||||
|
||||
@@ -103,7 +131,7 @@ public partial class CanvasEffectTests
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public unsafe void CanvasEffect_EffectRegisteringNodesMultipleTimes2()
|
||||
public void CanvasEffect_EffectRegisteringNodesMultipleTimes2()
|
||||
{
|
||||
EffectRegisteringNodesMultipleTimes2 effect = new();
|
||||
|
||||
@@ -114,7 +142,7 @@ public partial class CanvasEffectTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public unsafe void CanvasEffect_EffectRegisteringNullObjects()
|
||||
public void CanvasEffect_EffectRegisteringNullObjects()
|
||||
{
|
||||
EffectRegisteringNullObjects effect = new();
|
||||
|
||||
@@ -125,7 +153,7 @@ public partial class CanvasEffectTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public unsafe void CanvasEffect_EffectConfiguringGraphIncorrectly()
|
||||
public void CanvasEffect_EffectConfiguringGraphIncorrectly()
|
||||
{
|
||||
EffectConfiguringGraphIncorrectly effect = new();
|
||||
|
||||
@@ -136,7 +164,7 @@ public partial class CanvasEffectTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public unsafe void CanvasEffect_EffectOnlyUsingAnonymousNodes()
|
||||
public void CanvasEffect_EffectOnlyUsingAnonymousNodes()
|
||||
{
|
||||
EffectOnlyUsingAnonymousNodes effect = new();
|
||||
|
||||
@@ -147,7 +175,7 @@ public partial class CanvasEffectTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public unsafe void CanvasEffect_EffectUsingEffectGraphInInvalidState()
|
||||
public void CanvasEffect_EffectUsingEffectGraphInInvalidState()
|
||||
{
|
||||
EffectUsingEffectGraphInInvalidState effect = new();
|
||||
|
||||
@@ -157,6 +185,200 @@ public partial class CanvasEffectTests
|
||||
drawingSession.DrawImage(effect);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task CanvasEffect_PixelShaderSwitchEffect()
|
||||
{
|
||||
PixelShaderSwitchEffect effect = new();
|
||||
|
||||
async Task TestAsync(string shaderName)
|
||||
{
|
||||
Color[] pixelColors;
|
||||
|
||||
using CanvasDevice canvasDevice = new();
|
||||
|
||||
// Same logic as in the shader tests
|
||||
using (CanvasRenderTarget renderTarget = new(canvasDevice, 1280, 720, 96.0f))
|
||||
{
|
||||
using (CanvasDrawingSession drawingSession = renderTarget.CreateDrawingSession())
|
||||
{
|
||||
drawingSession.DrawImage(effect);
|
||||
}
|
||||
|
||||
pixelColors = renderTarget.GetPixelColors();
|
||||
}
|
||||
|
||||
StorageFile imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Assets/Shaders/{shaderName}.png"));
|
||||
|
||||
using Stream stream = await imageFile.OpenStreamForReadAsync();
|
||||
using CanvasBitmap expected = await CanvasBitmap.LoadAsync(canvasDevice, stream.AsRandomAccessStream());
|
||||
using CanvasBitmap actual = CanvasBitmap.CreateFromColors(canvasDevice, pixelColors, 1280, 720);
|
||||
|
||||
TolerantImageComparer.AssertEqual(expected, actual, threshold: 0.00001f);
|
||||
}
|
||||
|
||||
// Every time the effect is re-drawn, a different shader is set as the output node
|
||||
await TestAsync(nameof(HelloWorld));
|
||||
await TestAsync(nameof(ColorfulInfinity));
|
||||
await TestAsync(nameof(FractalTiling));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CanvasEffect_EffectTestingDisposal()
|
||||
{
|
||||
EffectTestingDisposal effect = new();
|
||||
|
||||
using CanvasRenderTarget renderTarget = new(new CanvasDevice(), 128, 128, 96.0f);
|
||||
using CanvasDrawingSession drawingSession = renderTarget.CreateDrawingSession();
|
||||
|
||||
// Force creating the graph (the drawing fails because the effects are dummies)
|
||||
try
|
||||
{
|
||||
drawingSession.DrawImage(effect);
|
||||
}
|
||||
catch (Exception e) when (e.HResult == E.E_FAIL)
|
||||
{
|
||||
}
|
||||
|
||||
Assert.AreEqual(1, effect.Effects1.Count);
|
||||
Assert.AreEqual(1, effect.Effects2.Count);
|
||||
Assert.AreEqual(1, effect.Effects3.Count);
|
||||
Assert.AreEqual(0, effect.Effects1[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects2[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects3[0].NumberOfDisposeCalls);
|
||||
|
||||
effect.InvalidateCreation();
|
||||
|
||||
// Effects aren't disposed yet until we redraw
|
||||
Assert.AreEqual(1, effect.Effects1.Count);
|
||||
Assert.AreEqual(1, effect.Effects2.Count);
|
||||
Assert.AreEqual(1, effect.Effects3.Count);
|
||||
Assert.AreEqual(0, effect.Effects1[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects2[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects3[0].NumberOfDisposeCalls);
|
||||
|
||||
// Redraw, which builds a new effect graph and disposes the old one
|
||||
try
|
||||
{
|
||||
drawingSession.DrawImage(effect);
|
||||
}
|
||||
catch (Exception e) when (e.HResult == E.E_FAIL)
|
||||
{
|
||||
}
|
||||
|
||||
Assert.AreEqual(2, effect.Effects1.Count);
|
||||
Assert.AreEqual(2, effect.Effects2.Count);
|
||||
Assert.AreEqual(2, effect.Effects3.Count);
|
||||
Assert.AreEqual(1, effect.Effects1[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects1[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects2[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects3[1].NumberOfDisposeCalls);
|
||||
|
||||
// Redrawing now doesn't change anything
|
||||
try
|
||||
{
|
||||
drawingSession.DrawImage(effect);
|
||||
}
|
||||
catch (Exception e) when (e.HResult == E.E_FAIL)
|
||||
{
|
||||
}
|
||||
|
||||
Assert.AreEqual(2, effect.Effects1.Count);
|
||||
Assert.AreEqual(2, effect.Effects2.Count);
|
||||
Assert.AreEqual(2, effect.Effects3.Count);
|
||||
Assert.AreEqual(1, effect.Effects1[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects1[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects2[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects3[1].NumberOfDisposeCalls);
|
||||
|
||||
effect.InvalidateUpdate();
|
||||
|
||||
// Invalidating with update mode also doesn't do anything here
|
||||
Assert.AreEqual(2, effect.Effects1.Count);
|
||||
Assert.AreEqual(2, effect.Effects2.Count);
|
||||
Assert.AreEqual(2, effect.Effects3.Count);
|
||||
Assert.AreEqual(1, effect.Effects1[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects1[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects2[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects3[1].NumberOfDisposeCalls);
|
||||
|
||||
// Redraw, and also verify the disposal state wasn't changed
|
||||
try
|
||||
{
|
||||
drawingSession.DrawImage(effect);
|
||||
}
|
||||
catch (Exception e) when (e.HResult == E.E_FAIL)
|
||||
{
|
||||
}
|
||||
|
||||
Assert.AreEqual(2, effect.Effects1.Count);
|
||||
Assert.AreEqual(2, effect.Effects2.Count);
|
||||
Assert.AreEqual(2, effect.Effects3.Count);
|
||||
Assert.AreEqual(1, effect.Effects1[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects1[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects2[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects3[1].NumberOfDisposeCalls);
|
||||
|
||||
// Verify that invalidating with update after creation is ignored
|
||||
effect.InvalidateCreation();
|
||||
effect.InvalidateUpdate();
|
||||
|
||||
Assert.AreEqual(2, effect.Effects1.Count);
|
||||
Assert.AreEqual(2, effect.Effects2.Count);
|
||||
Assert.AreEqual(2, effect.Effects3.Count);
|
||||
Assert.AreEqual(1, effect.Effects1[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects1[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects2[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects3[1].NumberOfDisposeCalls);
|
||||
|
||||
// Redraw, disposing the old graph once again
|
||||
try
|
||||
{
|
||||
drawingSession.DrawImage(effect);
|
||||
}
|
||||
catch (Exception e) when (e.HResult == E.E_FAIL)
|
||||
{
|
||||
}
|
||||
|
||||
Assert.AreEqual(3, effect.Effects1.Count);
|
||||
Assert.AreEqual(3, effect.Effects2.Count);
|
||||
Assert.AreEqual(3, effect.Effects3.Count);
|
||||
Assert.AreEqual(1, effect.Effects1[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects1[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects1[2].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects2[2].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(0, effect.Effects3[2].NumberOfDisposeCalls);
|
||||
|
||||
// Finally dispose the effect
|
||||
effect.Dispose();
|
||||
|
||||
Assert.AreEqual(3, effect.Effects1.Count);
|
||||
Assert.AreEqual(3, effect.Effects2.Count);
|
||||
Assert.AreEqual(3, effect.Effects3.Count);
|
||||
Assert.AreEqual(1, effect.Effects1[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[0].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects1[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[1].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects1[2].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects2[2].NumberOfDisposeCalls);
|
||||
Assert.AreEqual(1, effect.Effects3[2].NumberOfDisposeCalls);
|
||||
}
|
||||
|
||||
private sealed class EffectWithNoInputs : CanvasEffect
|
||||
{
|
||||
private static readonly EffectNode<PixelShaderEffect<ShaderWithNoInputs>> Effect = new();
|
||||
@@ -185,7 +407,7 @@ public partial class CanvasEffectTests
|
||||
{
|
||||
NumberOfBuildEffectGraphCalls++;
|
||||
|
||||
effectGraph.RegisterAndSetOutputNode(Effect, new PixelShaderEffect<ShaderWithNoInputs>());
|
||||
effectGraph.RegisterOutputNode(Effect, new PixelShaderEffect<ShaderWithNoInputs>());
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
@@ -203,22 +425,28 @@ public partial class CanvasEffectTests
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class EffectRegisteringMultipleOutputNodes : CanvasEffect
|
||||
private sealed class EffectSettingNotRegisteredOutputNode : CanvasEffect
|
||||
{
|
||||
public bool WasConfigureEffectGraphCalled { get; private set; }
|
||||
|
||||
protected override void BuildEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.RegisterAndSetOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
effectGraph.RegisterAndSetOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
effectGraph.RegisterOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
effectGraph.RegisterOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
Assert.Fail();
|
||||
WasConfigureEffectGraphCalled = true;
|
||||
|
||||
effectGraph.SetOutputNode(new EffectNode<ColorSourceEffect>());
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class EffectNotRegisteringAnOutputNode : CanvasEffect
|
||||
{
|
||||
public bool WasConfigureEffectGraphCalled { get; private set; }
|
||||
|
||||
protected override void BuildEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.RegisterNode(new ColorSourceEffect());
|
||||
@@ -228,7 +456,7 @@ public partial class CanvasEffectTests
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
Assert.Fail();
|
||||
WasConfigureEffectGraphCalled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +467,7 @@ public partial class CanvasEffectTests
|
||||
EffectNode<ColorSourceEffect> node = new();
|
||||
|
||||
effectGraph.RegisterNode(node, new ColorSourceEffect());
|
||||
effectGraph.RegisterAndSetOutputNode(node, new ColorSourceEffect());
|
||||
effectGraph.RegisterOutputNode(node, new ColorSourceEffect());
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
@@ -256,7 +484,7 @@ public partial class CanvasEffectTests
|
||||
|
||||
effectGraph.RegisterNode(node, new ColorSourceEffect());
|
||||
effectGraph.RegisterNode(node, new ColorSourceEffect());
|
||||
effectGraph.RegisterAndSetOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
effectGraph.RegisterOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
@@ -274,10 +502,10 @@ public partial class CanvasEffectTests
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterNode(null!, new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterNode(new EffectNode<ColorSourceEffect>(), null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterNode(null!, (ColorSourceEffect?)null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterAndSetOutputNode(null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterAndSetOutputNode(null!, new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterAndSetOutputNode(new EffectNode<ColorSourceEffect>(), null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterAndSetOutputNode(null!, (ColorSourceEffect)null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterOutputNode(null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterOutputNode(null!, new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterOutputNode(new EffectNode<ColorSourceEffect>(), null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => default(EffectGraph).RegisterOutputNode(null!, (ColorSourceEffect)null!));
|
||||
|
||||
void* ptr = &effectGraph;
|
||||
|
||||
@@ -285,12 +513,12 @@ public partial class CanvasEffectTests
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterNode(null!, new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterNode(new EffectNode<ColorSourceEffect>(), null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterNode(null!, (ColorSourceEffect?)null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterAndSetOutputNode(null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterAndSetOutputNode(null!, new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterAndSetOutputNode(new EffectNode<ColorSourceEffect>(), null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterAndSetOutputNode(null!, (ColorSourceEffect)null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterOutputNode(null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterOutputNode(null!, new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterOutputNode(new EffectNode<ColorSourceEffect>(), null!));
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).RegisterOutputNode(null!, (ColorSourceEffect)null!));
|
||||
|
||||
effectGraph.RegisterAndSetOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
effectGraph.RegisterOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
@@ -313,7 +541,7 @@ public partial class CanvasEffectTests
|
||||
{
|
||||
effectGraph.RegisterNode(EffectNode1, this.effect1);
|
||||
effectGraph.RegisterNode(EffectNode2, this.effect2);
|
||||
effectGraph.RegisterAndSetOutputNode(EffectNode3, this.effect3);
|
||||
effectGraph.RegisterOutputNode(EffectNode3, this.effect3);
|
||||
}
|
||||
|
||||
protected override unsafe void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
@@ -323,7 +551,7 @@ public partial class CanvasEffectTests
|
||||
_ = Assert.ThrowsException<ArgumentNullException>(() => (*(EffectGraph*)ptr).GetNode((EffectNode<ColorSourceEffect>)null!));
|
||||
_ = Assert.ThrowsException<ArgumentException>(() => (*(EffectGraph*)ptr).GetNode(new EffectNode<ColorSourceEffect>()));
|
||||
_ = Assert.ThrowsException<InvalidOperationException>(() => (*(EffectGraph*)ptr).RegisterNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<InvalidOperationException>(() => (*(EffectGraph*)ptr).RegisterAndSetOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<InvalidOperationException>(() => (*(EffectGraph*)ptr).RegisterOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect()));
|
||||
|
||||
Assert.AreSame(effectGraph.GetNode(EffectNode1), this.effect1);
|
||||
Assert.AreSame(effectGraph.GetNode(EffectNode2), this.effect2);
|
||||
@@ -337,7 +565,7 @@ public partial class CanvasEffectTests
|
||||
{
|
||||
effectGraph.RegisterNode(new ColorSourceEffect());
|
||||
effectGraph.RegisterNode(new ColorSourceEffect());
|
||||
effectGraph.RegisterAndSetOutputNode(new ColorSourceEffect());
|
||||
effectGraph.RegisterOutputNode(new ColorSourceEffect());
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
@@ -351,10 +579,10 @@ public partial class CanvasEffectTests
|
||||
{
|
||||
_ = Assert.ThrowsException<InvalidOperationException>(() => default(EffectGraph).RegisterNode(new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<InvalidOperationException>(() => default(EffectGraph).RegisterNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<InvalidOperationException>(() => default(EffectGraph).RegisterAndSetOutputNode(new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<InvalidOperationException>(() => default(EffectGraph).RegisterAndSetOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<InvalidOperationException>(() => default(EffectGraph).RegisterOutputNode(new ColorSourceEffect()));
|
||||
_ = Assert.ThrowsException<InvalidOperationException>(() => default(EffectGraph).RegisterOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect()));
|
||||
|
||||
effectGraph.RegisterAndSetOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
effectGraph.RegisterOutputNode(new EffectNode<ColorSourceEffect>(), new ColorSourceEffect());
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
@@ -363,6 +591,99 @@ public partial class CanvasEffectTests
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class PixelShaderSwitchEffect : CanvasEffect
|
||||
{
|
||||
private static readonly EffectNode<PixelShaderEffect<HelloWorld>> HelloWorldNode = new();
|
||||
private static readonly EffectNode<PixelShaderEffect<ColorfulInfinity>> ColorfulInfinityNode = new();
|
||||
private static readonly EffectNode<PixelShaderEffect<FractalTiling>> FractalTilingNode = new();
|
||||
|
||||
private int step;
|
||||
|
||||
protected override void BuildEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.RegisterNode(HelloWorldNode, new PixelShaderEffect<HelloWorld> { ConstantBuffer = new HelloWorld(0, new int2(1280, 720)) });
|
||||
effectGraph.RegisterNode(ColorfulInfinityNode, new PixelShaderEffect<ColorfulInfinity> { ConstantBuffer = new ColorfulInfinity(0, new int2(1280, 720)) });
|
||||
effectGraph.RegisterNode(FractalTilingNode, new PixelShaderEffect<FractalTiling> { ConstantBuffer = new FractalTiling(0, new int2(1280, 720)) });
|
||||
effectGraph.SetOutputNode(HelloWorldNode);
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
switch (this.step++)
|
||||
{
|
||||
case 0: break;
|
||||
case 1:
|
||||
effectGraph.SetOutputNode(ColorfulInfinityNode);
|
||||
break;
|
||||
case 2:
|
||||
effectGraph.SetOutputNode(FractalTilingNode);
|
||||
break;
|
||||
default:
|
||||
Assert.Fail();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class EffectTestingDisposal : CanvasEffect
|
||||
{
|
||||
private static readonly EffectNode<DummyCanvasImageTrackingDisposal> EffectNode1 = new();
|
||||
private static readonly EffectNode<DummyCanvasImageTrackingDisposal> EffectNode2 = new();
|
||||
private static readonly EffectNode<DummyCanvasImageTrackingDisposal> EffectNode3 = new();
|
||||
public readonly List<DummyCanvasImageTrackingDisposal> Effects1 = new();
|
||||
public readonly List<DummyCanvasImageTrackingDisposal> Effects2 = new();
|
||||
public readonly List<DummyCanvasImageTrackingDisposal> Effects3 = new();
|
||||
|
||||
public void InvalidateCreation()
|
||||
{
|
||||
InvalidateEffectGraph(InvalidationType.Creation);
|
||||
}
|
||||
|
||||
public void InvalidateUpdate()
|
||||
{
|
||||
InvalidateEffectGraph(InvalidationType.Update);
|
||||
}
|
||||
|
||||
protected override void BuildEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
this.Effects1.Add(new DummyCanvasImageTrackingDisposal());
|
||||
this.Effects2.Add(new DummyCanvasImageTrackingDisposal());
|
||||
this.Effects3.Add(new DummyCanvasImageTrackingDisposal());
|
||||
|
||||
effectGraph.RegisterNode(EffectNode1, this.Effects1[^1]);
|
||||
effectGraph.RegisterNode(EffectNode2, this.Effects2[^1]);
|
||||
effectGraph.RegisterOutputNode(EffectNode3, this.Effects3[^1]);
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class DummyCanvasImageTrackingDisposal : ICanvasImage
|
||||
{
|
||||
public int NumberOfDisposeCalls { get; private set; }
|
||||
|
||||
public Rect GetBounds(ICanvasResourceCreator resourceCreator)
|
||||
{
|
||||
Assert.Fail();
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public Rect GetBounds(ICanvasResourceCreator resourceCreator, Matrix3x2 transform)
|
||||
{
|
||||
Assert.Fail();
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
NumberOfDisposeCalls++;
|
||||
}
|
||||
}
|
||||
|
||||
[D2DInputCount(0)]
|
||||
[AutoConstructor]
|
||||
private partial struct ShaderWithNoInputs : ID2D1PixelShader
|
||||
|
||||
@@ -132,7 +132,7 @@ public class ShadersTests
|
||||
|
||||
protected override void BuildEffectGraph(EffectGraph effectGraph)
|
||||
{
|
||||
effectGraph.RegisterAndSetOutputNode(Effect, new PixelShaderEffect<T>());
|
||||
effectGraph.RegisterOutputNode(Effect, new PixelShaderEffect<T>());
|
||||
}
|
||||
|
||||
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする