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

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

+1
ファイルの表示
@@ -420,6 +420,7 @@ Global
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
samples\ComputeSharp.SwapChain.Core.Shared\ComputeSharp.SwapChain.Core.Shared.projitems*{0071701e-b9c5-4098-be5f-ef556c4553c6}*SharedItemsImports = 5
samples\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems*{0071701e-b9c5-4098-be5f-ef556c4553c6}*SharedItemsImports = 5
samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems*{0071701e-b9c5-4098-be5f-ef556c4553c6}*SharedItemsImports = 5
samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems*{0800bd51-499d-44c2-9417-fd1f7fdfe9c4}*SharedItemsImports = 13
src\ComputeSharp.UI\ComputeSharp.UI.projitems*{0c82ede1-5b8a-4df3-87da-700b29d5e265}*SharedItemsImports = 13
+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
}
+4 -1
ファイルの表示
@@ -55,10 +55,13 @@
<ItemGroup>
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
<ProjectReference Include="..\..\src\ComputeSharp.D2D1\ComputeSharp.D2D1.csproj" />
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.SourceGenerators\ComputeSharp.D2D1.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
<ProjectReference Include="..\..\src\ComputeSharp.WinUI\ComputeSharp.WinUI.csproj" />
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
</ItemGroup>
<Import Project="..\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems" Label="Shared" />
<Import Project="..\ComputeSharp.SwapChain.Core.Shared\ComputeSharp.SwapChain.Core.Shared.projitems" Label="Shared" />
<Import Project="..\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems" Label="Shared" />
<Import Project="..\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems" Label="Shared" />
</Project>
+4 -4
ファイルの表示
@@ -196,25 +196,25 @@
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[0]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[0]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
IsEnabled="{x:Bind ViewModel.IsResolutionScaleOptionEnabled, Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[0])}" />
<ToggleMenuFlyoutItem
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[1]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[1]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
IsEnabled="{x:Bind ViewModel.IsResolutionScaleOptionEnabled, Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[1])}" />
<ToggleMenuFlyoutItem
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[2]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[2]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
IsEnabled="{x:Bind ViewModel.IsResolutionScaleOptionEnabled, Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[2])}" />
<ToggleMenuFlyoutItem
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[3]}"
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[3]), Mode=OneWay}"
IsEnabled="{x:Bind converters:BoolConverter.Not(ViewModel.IsDynamicResolutionEnabled), Mode=OneWay}"
IsEnabled="{x:Bind ViewModel.IsResolutionScaleOptionEnabled, Mode=OneWay}"
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[3])}" />
</MenuFlyout>
</Button.Flyout>