diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b41c31fe..8d463907 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -326,6 +326,13 @@ jobs: run: > msbuild samples\ComputeSharp.NativeLibrary.WinRT\ComputeSharp.NativeLibrary.WinRT.csproj /restore -t:publish /p:Configuration=Release /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}} + + # Publish the WinUI 3 sample app with NativeAOT + - if: matrix.platform == 'x64' + name: Publish ComputeSharp.SwapChain.WinUI + run: > + msbuild samples\ComputeSharp.SwapChain.WinUI\ComputeSharp.SwapChain.WinUI.csproj /restore -t:publish + /p:Configuration=Release /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}} # Download the NuGet packages generated in the previous job and use them # to build and run the sample project referencing them. This is used as diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj index b796eefd..313f8c0c 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj +++ b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj @@ -10,29 +10,68 @@ win-$(Platform).pubxml true true + + https://api.nuget.org/v3/index.json; + https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-MainLatest/nuget/v3/index.json; + + + + + + + false + $(WarningsNotAsErrors);IL2059 + + + + + + + false + + + true + + + 2 + + + + + false + true + + + + + true + true + true + false + Speed - - - - - - - Assets\Textures\RustyMetal.png - - - - - - - + + + + \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-x64.pubxml b/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-x64.pubxml index 69645733..bb66783c 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-x64.pubxml +++ b/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-x64.pubxml @@ -6,13 +6,7 @@ x64 win-x64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true true - False - False - True - \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.WinUI/Shaders/PixelShaderEffect.cs b/samples/ComputeSharp.SwapChain.WinUI/Shaders/PixelShaderEffect.cs index f4dcf177..f9273e44 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Shaders/PixelShaderEffect.cs +++ b/samples/ComputeSharp.SwapChain.WinUI/Shaders/PixelShaderEffect.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.SwapChain.Core.Shaders; /// /// An base effect for an animated pixel shader. /// -public abstract class PixelShaderEffect : CanvasEffect +public abstract partial class PixelShaderEffect : CanvasEffect { /// /// The current elapsed time. @@ -57,7 +57,7 @@ public abstract class PixelShaderEffect : CanvasEffect /// /// The type of pixel shader to render. /// The input factory. - public sealed class For(For.Factory factory) : PixelShaderEffect + public sealed partial class For(For.Factory factory) : PixelShaderEffect where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor { /// diff --git a/samples/ComputeSharp.SwapChain.WinUI/Shaders/Runners/D2D1ContouredLayersRunner.cs b/samples/ComputeSharp.SwapChain.WinUI/Shaders/Runners/D2D1ContouredLayersRunner.cs index a49c6659..70c2ec39 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Shaders/Runners/D2D1ContouredLayersRunner.cs +++ b/samples/ComputeSharp.SwapChain.WinUI/Shaders/Runners/D2D1ContouredLayersRunner.cs @@ -11,7 +11,7 @@ namespace ComputeSharp.SwapChain.Core.Shaders.Runners; /// /// A specialized for . /// -public sealed class D2D1ContouredLayersEffect : PixelShaderEffect +public sealed partial class D2D1ContouredLayersEffect : PixelShaderEffect { /// /// The reusable node to use to render frames. diff --git a/samples/ComputeSharp.SwapChain.WinUI/ViewModels/MainViewModel.cs b/samples/ComputeSharp.SwapChain.WinUI/ViewModels/MainViewModel.cs index 7abe34bf..e9dd941b 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ViewModels/MainViewModel.cs +++ b/samples/ComputeSharp.SwapChain.WinUI/ViewModels/MainViewModel.cs @@ -7,6 +7,8 @@ using ComputeSharp.SwapChain.Core.Shaders.Runners; using ComputeSharp.SwapChain.Shaders; using ComputeSharp.WinUI; +#pragma warning disable IDE0300 // CsWinRT does not support marshalling collection expression (https://github.com/microsoft/CsWinRT/issues/1661) + namespace ComputeSharp.SwapChain.Core.ViewModels; /// @@ -68,13 +70,13 @@ public sealed partial class MainViewModel : ObservableObject /// /// Gets the available resolution scaling options (as percentage values). /// - public IList ResolutionScaleOptions { get; } = [25, 50, 75, 100]; + public IList ResolutionScaleOptions { get; } = new int[] { 25, 50, 75, 100 }; /// /// Gets the collection of available compute shader. /// - public IReadOnlyList ComputeShaderOptions { get; } = - [ + public IReadOnlyList ComputeShaderOptions { get; } = new ShaderRunnerViewModel[] + { new( nameof(ColorfulInfinity), new ShaderRunner(static time => new((float)time.TotalSeconds)), @@ -112,7 +114,7 @@ public sealed partial class MainViewModel : ObservableObject nameof(TerracedHills), new ShaderRunner(static time => new((float)time.TotalSeconds)), new PixelShaderEffect.For(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))), - ]; + }; /// /// Checks whether the resolution scale can currently be expliclty set. diff --git a/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml b/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml index 7ae8318a..86866901 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml +++ b/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml @@ -2,13 +2,13 @@ x:Class="ComputeSharp.SwapChain.WinUI.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:animations="using:CommunityToolkit.WinUI.UI.Animations" + xmlns:animations="using:CommunityToolkit.WinUI.Animations" xmlns:computesharp="using:ComputeSharp.WinUI" - xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls" + xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:converters="using:ComputeSharp.SwapChain.Core.Converters" xmlns:enums="using:ComputeSharp.SwapChain.Core.Enums" - xmlns:media="using:CommunityToolkit.WinUI.UI.Media" - xmlns:ui="using:CommunityToolkit.WinUI.UI" + xmlns:media="using:CommunityToolkit.WinUI.Media" + xmlns:ui="using:CommunityToolkit.WinUI" xmlns:viewModels="using:ComputeSharp.SwapChain.Core.ViewModels" xmlns:views="using:ComputeSharp.SwapChain.WinUI.Views" SizeChanged="Window_SizeChanged"> diff --git a/src/ComputeSharp.WinUI/ComputeSharp.WinUI.csproj b/src/ComputeSharp.WinUI/ComputeSharp.WinUI.csproj index 6509d14e..5f2f2c25 100644 --- a/src/ComputeSharp.WinUI/ComputeSharp.WinUI.csproj +++ b/src/ComputeSharp.WinUI/ComputeSharp.WinUI.csproj @@ -20,7 +20,7 @@ - +