Fix build errors in WinUI 3 sample app

このコミットが含まれているのは:
Sergio Pedri committed 2023-01-21 21:20:57 +01:00
1 親 9a8183340e
コミット 52bd37a641
6ファイル変更
+27 -9

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

+8
ファイルの表示
@@ -1,9 +1,11 @@
using System;
using CommunityToolkit.Diagnostics;
using ComputeSharp.D2D1;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.UI.Xaml;
#endif
namespace ComputeSharp.SwapChain.Core.Shaders;
@@ -14,6 +16,7 @@ namespace ComputeSharp.SwapChain.Core.Shaders;
public sealed class D2D1ShaderRunner<T> : ID2D1ShaderRunner
where T : unmanaged, ID2D1PixelShader
{
#if WINDOWS_UWP
/// <summary>
/// The <see cref="Func{T1,T2,T3TResult}"/> instance used to create shaders to run.
/// </summary>
@@ -23,6 +26,7 @@ public sealed class D2D1ShaderRunner<T> : ID2D1ShaderRunner
/// The reusable <see cref="PixelShaderEffect{T}"/> instance to use to render frames.
/// </summary>
private readonly PixelShaderEffect<T> pixelShaderEffect;
#endif
/// <summary>
/// Creates a new <see cref="D2D1ShaderRunner{T}"/> instance.
@@ -32,10 +36,13 @@ public sealed class D2D1ShaderRunner<T> : ID2D1ShaderRunner
{
Guard.IsNotNull(shaderFactory);
#if WINDOWS_UWP
this.shaderFactory = shaderFactory;
this.pixelShaderEffect = new PixelShaderEffect<T>();
#endif
}
#if WINDOWS_UWP
/// <inheritdoc/>
public void Execute(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args)
{
@@ -48,4 +55,5 @@ public sealed class D2D1ShaderRunner<T> : ID2D1ShaderRunner
// Draw the shader
args.DrawingSession.DrawImage(this.pixelShaderEffect);
}
#endif
}
+5 -1
ファイルの表示
@@ -1,16 +1,20 @@
#if WINDOWS_UWP
using Microsoft.Graphics.Canvas.UI.Xaml;
#endif
namespace ComputeSharp.SwapChain.Core.Shaders;
/// <summary>
/// An interface for a shader runner to be used with a Win2D <see cref="CanvasAnimatedControl"/>.
/// An interface for a shader runner to be used with a Win2D renderer.
/// </summary>
public interface ID2D1ShaderRunner
{
#if WINDOWS_UWP
/// <summary>
/// Draws a new frame on a target <see cref="ICanvasAnimatedControl"/> instance.
/// </summary>
/// <param name="sender">The target <see cref="ICanvasAnimatedControl"/> instance.</param>
/// <param name="args">The <see cref="CanvasAnimatedDrawEventArgs"/> instance to use to draw the new frame.</param>
void Execute(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args);
#endif
}
@@ -1,16 +1,16 @@
#if WINDOWS_UWP
using System.IO;
using CommunityToolkit.Diagnostics;
using ComputeSharp.D2D1;
using ComputeSharp.D2D1.Interop;
using ComputeSharp.D2D1.Uwp;
#endif
using ComputeSharp.SwapChain.Shaders.D2D1;
#if WINDOWS_UWP
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.UI.Xaml;
#else
using ComputeSharp.WinUI;
#endif
using Windows.ApplicationModel;
#endif
#nullable enable
@@ -21,6 +21,7 @@ namespace ComputeSharp.SwapChain.Core.Shaders.Runners;
/// </summary>
public sealed class D2D1ContouredLayersRunner : ID2D1ShaderRunner
{
#if WINDOWS_UWP
/// <summary>
/// The reusable <see cref="PixelShaderEffect{T}"/> instance to use to render frames.
/// </summary>
@@ -75,4 +76,5 @@ public sealed class D2D1ContouredLayersRunner : ID2D1ShaderRunner
// Draw the shader
args.DrawingSession.DrawImage(this.pixelShaderEffect);
}
#endif
}