Merge pull request #327 from Sergio0694/dev/trim-uwp-sample
Enable full trimming for UWP sample app
このコミットが含まれているのは:
6ファイル変更
+32
-41
検索条件に一致するファイルはありません
+1
-1
@@ -13,10 +13,10 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Constants\Event.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Converters\RenderingPauseConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Converters\ResolutionScaleConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Models\ComputeShader.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Services\DebugAnalyticsService.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Services\IAnalyticsService.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Shaders\Runners\ContouredLayersRunner.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\MainViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\ShaderRunnerViewModel.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -3,7 +3,6 @@ using CommunityToolkit.Diagnostics;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using ComputeSharp.SwapChain.Core.Constants;
|
||||
using ComputeSharp.SwapChain.Core.Models;
|
||||
using ComputeSharp.SwapChain.Core.Services;
|
||||
using ComputeSharp.SwapChain.Core.Shaders.Runners;
|
||||
using ComputeSharp.SwapChain.Shaders;
|
||||
@@ -101,26 +100,26 @@ public sealed partial class MainViewModel : ObservableObject
|
||||
/// <summary>
|
||||
/// Gets the collection of available compute shader.
|
||||
/// </summary>
|
||||
public IReadOnlyList<ComputeShader> ComputeShaderOptions { get; } = new ComputeShader[]
|
||||
public IReadOnlyList<ShaderRunnerViewModel> ComputeShaderOptions { get; } = new ShaderRunnerViewModel[]
|
||||
{
|
||||
new("Colorful infinity", new ShaderRunner<ColorfulInfinity>(static time => new((float)time.TotalSeconds))),
|
||||
new("Extruded truchet", new ShaderRunner<ExtrudedTruchetPattern>(static time => new((float)time.TotalSeconds))),
|
||||
new("Fractal tiling", new ShaderRunner<FractalTiling>(static time => new((float)time.TotalSeconds))),
|
||||
new("Menger Journey", new ShaderRunner<MengerJourney>(static time => new((float)time.TotalSeconds))),
|
||||
new("Octagrams", new ShaderRunner<Octagrams>(static time => new((float)time.TotalSeconds))),
|
||||
new("Protean clouds", new ShaderRunner<ProteanClouds>(static time => new((float)time.TotalSeconds))),
|
||||
new("Two tiled truchet", new ShaderRunner<TwoTiledTruchet>(static time => new((float)time.TotalSeconds))),
|
||||
new("Pyramid pattern", new ShaderRunner<PyramidPattern>(static time => new((float)time.TotalSeconds))),
|
||||
new("Triangle grid contouring", new ShaderRunner<TriangleGridContouring>(static time => new((float)time.TotalSeconds))),
|
||||
new("Contoured layers", new ContouredLayersRunner())
|
||||
new(typeof(ColorfulInfinity), new ShaderRunner<ColorfulInfinity>(static time => new((float)time.TotalSeconds))),
|
||||
new(typeof(ExtrudedTruchetPattern),new ShaderRunner<ExtrudedTruchetPattern>(static time => new((float)time.TotalSeconds))),
|
||||
new(typeof(FractalTiling),new ShaderRunner<FractalTiling>(static time => new((float)time.TotalSeconds))),
|
||||
new(typeof(MengerJourney),new ShaderRunner<MengerJourney>(static time => new((float)time.TotalSeconds))),
|
||||
new(typeof(Octagrams),new ShaderRunner<Octagrams>(static time => new((float)time.TotalSeconds))),
|
||||
new(typeof(ProteanClouds),new ShaderRunner<ProteanClouds>(static time => new((float)time.TotalSeconds))),
|
||||
new(typeof(TwoTiledTruchet),new ShaderRunner<TwoTiledTruchet>(static time => new((float)time.TotalSeconds))),
|
||||
new(typeof(PyramidPattern),new ShaderRunner<PyramidPattern>(static time => new((float)time.TotalSeconds))),
|
||||
new(typeof(TriangleGridContouring),new ShaderRunner<TriangleGridContouring>(static time => new((float)time.TotalSeconds))),
|
||||
new(typeof(ContouredLayers),new ContouredLayersRunner())
|
||||
};
|
||||
|
||||
private ComputeShader selectedComputeShader;
|
||||
private ShaderRunnerViewModel selectedComputeShader;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected compute shader.
|
||||
/// </summary>
|
||||
public ComputeShader SelectedComputeShader
|
||||
public ShaderRunnerViewModel SelectedComputeShader
|
||||
{
|
||||
get => this.selectedComputeShader;
|
||||
set
|
||||
@@ -130,7 +129,7 @@ public sealed partial class MainViewModel : ObservableObject
|
||||
if (SetProperty(ref this.selectedComputeShader, value) &&
|
||||
value is not null)
|
||||
{
|
||||
this.analyticsService.Log(Event.SelectedComputeShaderChanged, (nameof(value.ShaderRunner), value.ShaderRunner));
|
||||
this.analyticsService.Log(Event.SelectedComputeShaderChanged, (nameof(value.ShaderType), value.ShaderType.Name));
|
||||
|
||||
value.IsSelected = true;
|
||||
}
|
||||
|
||||
+12
-14
@@ -1,35 +1,33 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
#if WINDOWS_UWP
|
||||
using ComputeSharp.Uwp;
|
||||
#else
|
||||
using ComputeSharp.WinUI;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp.SwapChain.Core.Models;
|
||||
namespace ComputeSharp.SwapChain.Core.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// A model for a compute shader.
|
||||
/// A viewmodel for a compute shader.
|
||||
/// </summary>
|
||||
/// <remarks>This can be converted to a record when bindings are fixed, see notes in the XAML code.</remarks>
|
||||
public sealed class ComputeShader : ObservableObject
|
||||
public sealed class ShaderRunnerViewModel : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ComputeShader"/> instance.
|
||||
/// Creates a new <see cref="ShaderRunnerViewModel"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the shader.</param>
|
||||
/// <param name="shaderType">The <see cref="Type"/> instance for the actual shader to execute.</param>
|
||||
/// <param name="shaderRunner">The <see cref="IShaderRunner"/> instance to execute.</param>
|
||||
public ComputeShader(string name, IShaderRunner shaderRunner)
|
||||
public ShaderRunnerViewModel(Type shaderType, IShaderRunner shaderRunner)
|
||||
{
|
||||
Name = name;
|
||||
ShaderType = shaderType;
|
||||
ShaderRunner = shaderRunner;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the shader.
|
||||
/// Gets the <see cref="Type"/> instance for the actual shader to execute.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
public Type ShaderType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IShaderRunner"/> instance to execute.
|
||||
@@ -46,4 +44,4 @@ public sealed class ComputeShader : ObservableObject
|
||||
get => this.isSelected;
|
||||
set => SetProperty(ref this.isSelected, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,5 @@
|
||||
-->
|
||||
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Application>
|
||||
|
||||
<!-- Shader types need their info preserved for logging -->
|
||||
<Type Name="ComputeSharp.Uwp.ShaderRunner`1" Activate="Required Public" />
|
||||
<Namespace Name="ComputeSharp.SwapChain.Core.Shaders.Runners" Activate="Required Public" />
|
||||
<Namespace Name="ComputeSharp.SwapChain.Shaders" Activate="Required Public" />
|
||||
</Application>
|
||||
<Application/>
|
||||
</Directives>
|
||||
@@ -7,9 +7,9 @@
|
||||
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
|
||||
xmlns:converters="using:ComputeSharp.SwapChain.Core.Converters"
|
||||
xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media"
|
||||
xmlns:models="using:ComputeSharp.SwapChain.Core.Models"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
|
||||
xmlns:viewmodels="using:ComputeSharp.SwapChain.Core.ViewModels"
|
||||
SizeChanged="UserControl_SizeChanged">
|
||||
|
||||
<Grid x:Name="Root">
|
||||
@@ -108,7 +108,7 @@
|
||||
<ListView.ItemTemplate>
|
||||
|
||||
<!-- Shader template -->
|
||||
<DataTemplate x:DataType="models:ComputeShader">
|
||||
<DataTemplate x:DataType="viewmodels:ShaderRunnerViewModel">
|
||||
<controls:ConstrainedBox
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:media="using:CommunityToolkit.WinUI.UI.Media"
|
||||
xmlns:models="using:ComputeSharp.SwapChain.Core.Models"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI.UI"
|
||||
xmlns:viewmodels="using:ComputeSharp.SwapChain.Core.ViewModels"
|
||||
SizeChanged="UserControl_SizeChanged"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<ListView.ItemTemplate>
|
||||
|
||||
<!-- Shader template -->
|
||||
<DataTemplate x:DataType="models:ComputeShader">
|
||||
<DataTemplate x:DataType="viewmodels:ShaderRunnerViewModel">
|
||||
<controls:ConstrainedBox
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする