Remove UWP sample app
検索条件に一致するファイルはありません
@@ -56,8 +56,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.WinUI", "src\C
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.SwapChain.WinUI", "samples\ComputeSharp.SwapChain.WinUI\ComputeSharp.SwapChain.WinUI.csproj", "{0071701E-B9C5-4098-BE5F-EF556C4553C6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.SwapChain.Uwp", "samples\ComputeSharp.SwapChain.Uwp\ComputeSharp.SwapChain.Uwp.csproj", "{FBD388A5-7855-4408-98FF-E689F509DB5A}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SwapChain.Shaders.Shared", "samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.shproj", "{0800BD51-499D-44C2-9417-FD1F7FDFE9C4}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SwapChain.Core.Shared", "samples\ComputeSharp.SwapChain.Core.Shared\ComputeSharp.SwapChain.Core.Shared.shproj", "{751BB05B-563D-4B3A-94C6-15E2D79D35EA}"
|
||||
@@ -282,18 +280,6 @@ Global
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Release|x64.ActiveCfg = Release|x64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Release|x64.Build.0 = Release|x64
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6}.Release|x64.Deploy.0 = Release|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|x64.Build.0 = Debug|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|x64.ActiveCfg = Release|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|x64.Build.0 = Release|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|x64.Deploy.0 = Release|x64
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
@@ -453,7 +439,6 @@ Global
|
||||
{A5997814-D8D2-4541-87AC-C3E53CAA67C0} = {8DCE343F-BA78-4FE1-B562-B57C603A8BAA}
|
||||
{514FF00E-BBF0-4D55-A47C-EEEB6208ADCE} = {8DCE343F-BA78-4FE1-B562-B57C603A8BAA}
|
||||
{0071701E-B9C5-4098-BE5F-EF556C4553C6} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{0800BD51-499D-44C2-9417-FD1F7FDFE9C4} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{751BB05B-563D-4B3A-94C6-15E2D79D35EA} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
|
||||
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
|
||||
@@ -511,8 +496,5 @@ Global
|
||||
src\TerraFX.Interop.Windows.Dynamic\TerraFX.Interop.Windows.Dynamic.projitems*{eb52cb67-4162-4722-874b-44ea8da5450e}*SharedItemsImports = 5
|
||||
src\TerraFX.Interop.Windows\TerraFX.Interop.Windows.projitems*{eb52cb67-4162-4722-874b-44ea8da5450e}*SharedItemsImports = 5
|
||||
samples\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems*{f8bf7666-7ccf-4fe4-b055-2eba4bcd4564}*SharedItemsImports = 13
|
||||
samples\ComputeSharp.SwapChain.Core.Shared\ComputeSharp.SwapChain.Core.Shared.projitems*{fbd388a5-7855-4408-98ff-e689f509db5a}*SharedItemsImports = 4
|
||||
samples\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems*{fbd388a5-7855-4408-98ff-e689f509db5a}*SharedItemsImports = 4
|
||||
samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems*{fbd388a5-7855-4408-98ff-e689f509db5a}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,13 +0,0 @@
|
||||
<Application
|
||||
x:Class="ComputeSharp.SwapChain.Uwp.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
||||
<ResourceDictionary Source="Controls/D2D1AnimatedPixelShaderPanel.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -1,101 +0,0 @@
|
||||
using System;
|
||||
using ComputeSharp.SwapChain.Core.Services;
|
||||
using ComputeSharp.SwapChain.Core.ViewModels;
|
||||
using ComputeSharp.SwapChain.Uwp.Services;
|
||||
using ComputeSharp.SwapChain.Uwp.Views;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using Windows.UI;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp;
|
||||
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
sealed partial class App : Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Application.Current"/>
|
||||
public static new App Current => (App)Application.Current;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current <see cref="IServiceProvider"/> instance.
|
||||
/// </summary>
|
||||
public IServiceProvider Services { get; } = ConfigureServices();
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||
{
|
||||
if (Window.Current.Content is not MainView)
|
||||
{
|
||||
StyleTitleBar();
|
||||
ExpandViewIntoTitleBar();
|
||||
|
||||
Window.Current.Content = new MainView();
|
||||
}
|
||||
|
||||
if (!e.PrelaunchActivated)
|
||||
{
|
||||
Window.Current.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the services for the application.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="IServiceProvider"/> instance to use.</returns>
|
||||
private static IServiceProvider ConfigureServices()
|
||||
{
|
||||
ServiceCollection services = new();
|
||||
|
||||
_ = services.AddAnalyticsService();
|
||||
_ = services.AddTransient(static services => new MainViewModel(services.GetRequiredService<IAnalyticsService>()));
|
||||
|
||||
return services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Styles the title bar buttons according to the theme in use
|
||||
/// </summary>
|
||||
private static void StyleTitleBar()
|
||||
{
|
||||
ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
|
||||
|
||||
// Transparent colors
|
||||
titleBar.ForegroundColor = Colors.Transparent;
|
||||
titleBar.BackgroundColor = Colors.Transparent;
|
||||
titleBar.ButtonBackgroundColor = Colors.Transparent;
|
||||
titleBar.InactiveBackgroundColor = Colors.Transparent;
|
||||
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
|
||||
|
||||
// Theme aware colors
|
||||
titleBar.ButtonForegroundColor = titleBar.ButtonHoverForegroundColor = titleBar.ButtonPressedForegroundColor = Colors.White;
|
||||
titleBar.ButtonHoverBackgroundColor = Color.FromArgb(0x20, 0xFF, 0xFF, 0xFF);
|
||||
titleBar.ButtonPressedBackgroundColor = Color.FromArgb(0x40, 0xFF, 0xFF, 0xFF);
|
||||
titleBar.ButtonInactiveForegroundColor = Color.FromArgb(0xC0, 0xFF, 0xFF, 0xFF);
|
||||
titleBar.InactiveForegroundColor = Color.FromArgb(0xA0, 0xA0, 0xA0, 0xA0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets up the app UI to be expanded into the title bar
|
||||
/// </summary>
|
||||
private static void ExpandViewIntoTitleBar()
|
||||
{
|
||||
CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
|
||||
|
||||
coreTitleBar.ExtendViewIntoTitleBar = true;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// <auto-generated/>
|
||||
#pragma warning disable
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> with some secret service tokens.
|
||||
/// </summary>
|
||||
public static class ServiceTokens
|
||||
{
|
||||
/// <summary>
|
||||
/// The secret token for the AppService connection.
|
||||
/// </summary>
|
||||
#if RELEASE
|
||||
internal const string AppService = "<APP_CENTER_TOKEN>";
|
||||
#else
|
||||
internal const string AppService = "";
|
||||
#endif
|
||||
}
|
||||
|
変更前 幅: | 高さ: | サイズ: 4.2 KiB |
|
変更前 幅: | 高さ: | サイズ: 5.6 KiB |
|
変更前 幅: | 高さ: | サイズ: 7.4 KiB |
|
変更前 幅: | 高さ: | サイズ: 11 KiB |
|
変更前 幅: | 高さ: | サイズ: 28 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.4 KiB |
|
変更前 幅: | 高さ: | サイズ: 208 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.8 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.8 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.0 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.3 KiB |
|
変更前 幅: | 高さ: | サイズ: 3.8 KiB |
|
変更前 幅: | 高さ: | サイズ: 4.5 KiB |
|
変更前 幅: | 高さ: | サイズ: 6.3 KiB |
|
変更前 幅: | 高さ: | サイズ: 8.1 KiB |
|
変更前 幅: | 高さ: | サイズ: 12 KiB |
|
変更前 幅: | 高さ: | サイズ: 31 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.4 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.8 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 4.1 KiB |
|
変更前 幅: | 高さ: | サイズ: 9.8 KiB |
|
変更前 幅: | 高さ: | サイズ: 529 B |
|
変更前 幅: | 高さ: | サイズ: 811 B |
|
変更前 幅: | 高さ: | サイズ: 2.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 737 B |
|
変更前 幅: | 高さ: | サイズ: 863 B |
|
変更前 幅: | 高さ: | サイズ: 529 B |
|
変更前 幅: | 高さ: | サイズ: 2.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 737 B |
|
変更前 幅: | 高さ: | サイズ: 863 B |
|
変更前 幅: | 高さ: | サイズ: 1.4 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.6 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.5 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.7 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.5 KiB |
|
変更前 幅: | 高さ: | サイズ: 529 B |
|
変更前 幅: | 高さ: | サイズ: 811 B |
|
変更前 幅: | 高さ: | サイズ: 1.2 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.9 KiB |
|
変更前 幅: | 高さ: | サイズ: 869 B |
|
変更前 幅: | 高さ: | サイズ: 1.4 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.4 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.4 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.6 KiB |
|
変更前 幅: | 高さ: | サイズ: 1.7 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.0 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.8 KiB |
|
変更前 幅: | 高さ: | サイズ: 2.6 KiB |
|
変更前 幅: | 高さ: | サイズ: 3.0 KiB |
|
変更前 幅: | 高さ: | サイズ: 3.3 KiB |
|
変更前 幅: | 高さ: | サイズ: 4.5 KiB |
|
変更前 幅: | 高さ: | サイズ: 12 KiB |
@@ -1,216 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
|
||||
<ProjectGuid>{FBD388A5-7855-4408-98FF-E689F509DB5A}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ComputeSharp.SwapChain.Uwp</RootNamespace>
|
||||
<AssemblyName>ComputeSharp.SwapChain.Uwp</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.22621.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
|
||||
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
|
||||
<AppxBundlePlatforms>x64;ARM64</AppxBundlePlatforms>
|
||||
<NoWarn>$(NoWarn);IDE0240</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>$(NoWarn);2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
|
||||
<OutputPath>bin\ARM64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>$(NoWarn);2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);SAMPLE_APP</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Assets\Generated\ServiceTokens.g.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\AppCenterService.cs" />
|
||||
<Compile Include="Services\ServiceCollectionExtensions.cs" />
|
||||
<Compile Include="Views\MainView.xaml.cs">
|
||||
<DependentUpon>MainView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\LargeTile.scale-100.png" />
|
||||
<Content Include="Assets\LargeTile.scale-125.png" />
|
||||
<Content Include="Assets\LargeTile.scale-150.png" />
|
||||
<Content Include="Assets\LargeTile.scale-200.png" />
|
||||
<Content Include="Assets\LargeTile.scale-400.png" />
|
||||
<Content Include="Assets\Misc\noise_low.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\ComputeSharp.SwapChain\Textures\RustyMetal.png">
|
||||
<Link>Assets\Textures\RustyMetal.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\SmallTile.scale-100.png" />
|
||||
<Content Include="Assets\SmallTile.scale-125.png" />
|
||||
<Content Include="Assets\SmallTile.scale-150.png" />
|
||||
<Content Include="Assets\SmallTile.scale-200.png" />
|
||||
<Content Include="Assets\SmallTile.scale-400.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-100.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-125.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-150.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-400.png" />
|
||||
<Content Include="Assets\Square150x150Logo.scale-100.png" />
|
||||
<Content Include="Assets\Square150x150Logo.scale-125.png" />
|
||||
<Content Include="Assets\Square150x150Logo.scale-150.png" />
|
||||
<Content Include="Assets\Square150x150Logo.scale-400.png" />
|
||||
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-16.png" />
|
||||
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-24.png" />
|
||||
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-256.png" />
|
||||
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-32.png" />
|
||||
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-48.png" />
|
||||
<Content Include="Assets\Square44x44Logo.altform-unplated_targetsize-16.png" />
|
||||
<Content Include="Assets\Square44x44Logo.altform-unplated_targetsize-256.png" />
|
||||
<Content Include="Assets\Square44x44Logo.altform-unplated_targetsize-32.png" />
|
||||
<Content Include="Assets\Square44x44Logo.altform-unplated_targetsize-48.png" />
|
||||
<Content Include="Assets\Square44x44Logo.scale-100.png" />
|
||||
<Content Include="Assets\Square44x44Logo.scale-125.png" />
|
||||
<Content Include="Assets\Square44x44Logo.scale-150.png" />
|
||||
<Content Include="Assets\Square44x44Logo.scale-400.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-16.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-24.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-256.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-32.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-48.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-100.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-125.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-150.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-200.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-400.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-100.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-125.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-150.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-400.png" />
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
<Content Include="Assets\LockScreenLogo.scale-200.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-200.png" />
|
||||
<Content Include="Assets\Square150x150Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics">
|
||||
<Version>8.2.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm">
|
||||
<Version>8.2.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ComputeSharp.D2D1.Uwp">
|
||||
<Version>2.2.0-preview1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ComputeSharp.Uwp">
|
||||
<Version>2.2.0-preview1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.AppCenter.Analytics">
|
||||
<Version>5.0.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.AppCenter.Crashes">
|
||||
<Version>5.0.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection">
|
||||
<Version>7.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||
<Version>6.2.14</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Primitives">
|
||||
<Version>7.1.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Media">
|
||||
<Version>7.1.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.UI.Xaml">
|
||||
<Version>2.8.5</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Controls\D2D1AnimatedPixelShaderPanel.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\MainView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<Import Project="..\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems" Label="Shared" />
|
||||
<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" />
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(SolutionDir)\build\CreateBlankServiceTokens.ps1</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,16 +0,0 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:ComputeSharp.SwapChain.Uwp.Views"
|
||||
xmlns:win2d="using:Microsoft.Graphics.Canvas.UI.Xaml">
|
||||
|
||||
<Style TargetType="local:D2D1AnimatedPixelShaderPanel">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:D2D1AnimatedPixelShaderPanel">
|
||||
<win2d:CanvasAnimatedControl x:Name="PART_CanvasAnimatedControl" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -1,55 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
|
||||
IgnorableNamespaces="uap uap5 mp">
|
||||
|
||||
<Identity
|
||||
Name="26577SergioPedri.ComputeSharpSampleApp"
|
||||
Publisher="CN=46C587B2-48EE-4200-9544-40C64534E565"
|
||||
Version="0.0.7.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="85b5430e-b15d-4364-a837-e4c49f3f3f77" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>ComputeSharp Sample App</DisplayName>
|
||||
<PublisherDisplayName>Sergio Pedri</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="ComputeSharp.SwapChain.Uwp.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="ComputeSharp Sample App"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||
Description="A sample app for ComputeSharp and its UWP shader panels"
|
||||
BackgroundColor="#005491">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square71x71Logo="Assets\SmallTile.png" Square310x310Logo="Assets\LargeTile.png" ShortName="ComputeSharp Sample App">
|
||||
<uap:ShowNameOnTiles>
|
||||
<uap:ShowOn Tile="square310x310Logo"/>
|
||||
<uap:ShowOn Tile="wide310x150Logo"/>
|
||||
</uap:ShowNameOnTiles>
|
||||
</uap:DefaultTile >
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" uap5:Optional="true" BackgroundColor="transparent"/>
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient"/>
|
||||
</Capabilities>
|
||||
</Package>
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ComputeSharp.SwapChain.Uwp")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ComputeSharp.SwapChain.Uwp")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[module: SkipLocalsInit]
|
||||
@@ -1,20 +0,0 @@
|
||||
<!--
|
||||
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
|
||||
developers. However, you can modify these parameters to modify the behavior of the .NET Native
|
||||
optimizer.
|
||||
|
||||
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
|
||||
|
||||
To fully enable reflection for App1.MyClass and all of its public/private members
|
||||
<Type Name="App1.MyClass" Dynamic="Required All"/>
|
||||
|
||||
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
|
||||
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
|
||||
|
||||
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
|
||||
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
|
||||
-->
|
||||
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Application/>
|
||||
</Directives>
|
||||
@@ -1,61 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ComputeSharp.SwapChain.Core.Services;
|
||||
using Microsoft.AppCenter;
|
||||
using Microsoft.AppCenter.Analytics;
|
||||
using Microsoft.AppCenter.Crashes;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp.Services;
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IAnalyticsService"/> implementation using AppCenter.
|
||||
/// </summary>
|
||||
public sealed class AppCenterService : IAnalyticsService
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum length for any property name and value
|
||||
/// </summary>
|
||||
/// <remarks>It's 125, but one character is reserved for the leading '|' to indicate trimming.</remarks>
|
||||
private const int PropertyStringMaxLength = 124;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public AppCenterService(string secret)
|
||||
{
|
||||
AppCenter.Start(secret, typeof(Crashes), typeof(Analytics));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Log(string title, params (string Property, object? Value)[]? data)
|
||||
{
|
||||
Analytics.TrackEvent(title, GetProperties(data));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Log(Exception exception, params (string Property, object? Value)[]? data)
|
||||
{
|
||||
Crashes.TrackError(exception, GetProperties(data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the additional logging properties from the input data.
|
||||
/// </summary>
|
||||
/// <param name="data">The optional event properties.</param>
|
||||
/// <returns>The additional logging properties to track.</returns>
|
||||
private static IDictionary<string, string>? GetProperties((string Property, object? Value)[]? data)
|
||||
{
|
||||
return
|
||||
data?.ToDictionary(
|
||||
pair => pair.Property,
|
||||
pair =>
|
||||
{
|
||||
string text = (pair.Value ?? "<NULL>").ToString();
|
||||
|
||||
return text.Length <= PropertyStringMaxLength
|
||||
? text
|
||||
: $"|{text.Substring(text.Length - PropertyStringMaxLength)}";
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using ComputeSharp.SwapChain.Core.Services;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for the <see cref="ServiceCollection"/> type.
|
||||
/// </summary>
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds the correct <see cref="IAnalyticsService"/> registration to the given <see cref="IServiceCollection"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="services">The input <see cref="IServiceCollection"/> instance to use to register services.</param>
|
||||
/// <returns>The same instance as <paramref name="services"/>.</returns>
|
||||
public static IServiceCollection AddAnalyticsService(this IServiceCollection services)
|
||||
{
|
||||
if (Guid.TryParse(ServiceTokens.AppService, out _) && !Debugger.IsAttached)
|
||||
{
|
||||
_ = services.AddSingleton<IAnalyticsService>(new AppCenterService(ServiceTokens.AppService));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = services.AddSingleton<IAnalyticsService>(new DebugAnalyticsService());
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
@@ -1,286 +0,0 @@
|
||||
<UserControl
|
||||
x:Class="ComputeSharp.SwapChain.Uwp.Views.MainView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations"
|
||||
xmlns:computesharp="using:ComputeSharp.Uwp"
|
||||
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
|
||||
xmlns:converters="using:ComputeSharp.SwapChain.Core.Converters"
|
||||
xmlns:enums="using:ComputeSharp.SwapChain.Core.Enums"
|
||||
xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
|
||||
xmlns:viewmodels="using:ComputeSharp.SwapChain.Core.ViewModels"
|
||||
xmlns:views="using:ComputeSharp.SwapChain.Uwp.Views"
|
||||
SizeChanged="UserControl_SizeChanged">
|
||||
|
||||
<Grid x:Name="Root">
|
||||
<Grid.Resources>
|
||||
|
||||
<!--
|
||||
Shader selection panel. This is declared as a resource and then added and removed to the visual
|
||||
tree entirely instead of just changing its visibility, so that the loaded panels can detect the
|
||||
change and stop their render loops. This avoids wasting GPU resources when the panel isn't visible.
|
||||
-->
|
||||
<Border
|
||||
x:Key="ShaderSelectionPanel"
|
||||
x:Name="ShaderSelectionPanel"
|
||||
IsTapEnabled="True"
|
||||
Tapped="ShaderSelectionPanel_Tapped">
|
||||
<animations:Implicit.ShowAnimations>
|
||||
<animations:OpacityAnimation
|
||||
From="0"
|
||||
To="1.0"
|
||||
Duration="0:0:0.5" />
|
||||
</animations:Implicit.ShowAnimations>
|
||||
<animations:Implicit.HideAnimations>
|
||||
<animations:OpacityAnimation
|
||||
From="1.0"
|
||||
To="0"
|
||||
Duration="0:0:0.5" />
|
||||
</animations:Implicit.HideAnimations>
|
||||
<Border.Background>
|
||||
<media:AcrylicBrush
|
||||
BlurAmount="12"
|
||||
TextureUri="ms-appx:///Assets/Misc/noise_low.png"
|
||||
TintColor="#FF222222"
|
||||
TintOpacity="0.2" />
|
||||
</Border.Background>
|
||||
|
||||
<!-- Shadow panel with the shaders list -->
|
||||
<Border
|
||||
x:Name="ShadersListContainerPanel"
|
||||
Height="320"
|
||||
Margin="-20,0,-20,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="#FF222222">
|
||||
<animations:Implicit.ShowAnimations>
|
||||
<animations:TranslationAnimation
|
||||
From="0,320,0"
|
||||
To="0"
|
||||
Duration="0:0:0.5" />
|
||||
</animations:Implicit.ShowAnimations>
|
||||
<animations:Implicit.HideAnimations>
|
||||
<animations:TranslationAnimation
|
||||
From="0"
|
||||
To="0,320,0"
|
||||
Duration="0:0:0.5" />
|
||||
</animations:Implicit.HideAnimations>
|
||||
<ui:Effects.Shadow>
|
||||
<media:AttachedCardShadow
|
||||
BlurRadius="20"
|
||||
CornerRadius="0"
|
||||
Opacity="1"
|
||||
Offset="-12,-2"
|
||||
Color="Black" />
|
||||
</ui:Effects.Shadow>
|
||||
|
||||
<!-- Shaders list -->
|
||||
<ListView
|
||||
ItemsSource="{x:Bind ViewModel.ComputeShaderOptions}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollMode="Enabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
||||
ScrollViewer.VerticalScrollMode="Disabled"
|
||||
SelectedItem="{x:Bind ViewModel.SelectedComputeShader, Mode=TwoWay}"
|
||||
SelectionMode="Single">
|
||||
<ListView.Resources>
|
||||
|
||||
<!--
|
||||
Lightweight styling to remove the selection background with the accent color, and
|
||||
to remove the padding and stretch the list items to occupy all the available space
|
||||
-->
|
||||
<SolidColorBrush x:Key="ListViewItemBackgroundSelected" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="ListViewItemBackgroundSelectedPointerOver" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="ListViewItemBackgroundSelectedPressed" Color="Transparent" />
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style>
|
||||
</ListView.Resources>
|
||||
<ListView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<ItemsStackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListView.ItemsPanel>
|
||||
<ListView.ItemTemplate>
|
||||
|
||||
<!-- Shader template -->
|
||||
<DataTemplate x:DataType="viewmodels:ShaderRunnerViewModel">
|
||||
<controls:ConstrainedBox
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
ui:UIElementExtensions.ClipToBounds="True"
|
||||
AspectRatio="16:9">
|
||||
<Grid>
|
||||
|
||||
<!-- Shader preview -->
|
||||
<computesharp:AnimatedComputeShaderPanel RenderingFailed="SelectionShaderPanel_RenderingFailed" ShaderRunner="{x:Bind ShaderRunner}" />
|
||||
|
||||
<!--
|
||||
Note: here we have a selection property to work around {x:Bind} not working correctly outside of the
|
||||
current template scope. Once that's fixed in WinUI 3, this can be rewritten as a multi-binding like this:
|
||||
Visibility="{x:Bind system:Object.ReferenceEquals((local:ComputeShader), ViewModel.SelectedComputeShader), Mode=OneWay}".
|
||||
When that is working, the ComputeShader.IsSelected property can also be removed, as it will no longer be needed.
|
||||
-->
|
||||
<Border
|
||||
BorderBrush="White"
|
||||
BorderThickness="4"
|
||||
Visibility="{x:Bind IsSelected, Mode=OneWay}">
|
||||
<Polygon
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Fill="White"
|
||||
Points="0,0 32,0 32,32" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</controls:ConstrainedBox>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid.Resources>
|
||||
|
||||
<!-- Shader switches (for DirectX 12 or Win2D) -->
|
||||
<controls:SwitchPresenter Grid.Row="1" Value="{x:Bind ViewModel.SelectedRenderingMode, Mode=OneWay}">
|
||||
<controls:Case IsDefault="True" Value="{x:Bind enums:RenderingMode.DirectX12}">
|
||||
|
||||
<!-- DirectX 12 shader -->
|
||||
<computesharp:AnimatedComputeShaderPanel
|
||||
IsDynamicResolutionEnabled="{x:Bind ViewModel.IsDynamicResolutionEnabled, Mode=OneWay}"
|
||||
IsPaused="{x:Bind ViewModel.IsRenderingPaused, Mode=OneWay}"
|
||||
IsVerticalSyncEnabled="{x:Bind ViewModel.IsVerticalSyncEnabled, Mode=OneWay}"
|
||||
RenderingFailed="MainShaderPanel_RenderingFailed"
|
||||
ResolutionScale="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToScale(ViewModel.SelectedResolutionScale), Mode=OneWay}"
|
||||
ShaderRunner="{x:Bind ViewModel.SelectedComputeShader.ShaderRunner, Mode=OneWay}" />
|
||||
</controls:Case>
|
||||
<controls:Case Value="{x:Bind enums:RenderingMode.Win2D}">
|
||||
|
||||
<!-- Win2D shader -->
|
||||
<views:D2D1AnimatedPixelShaderPanel IsPaused="{x:Bind ViewModel.IsRenderingPaused, Mode=OneWay}" PixelShaderEffect="{x:Bind ViewModel.SelectedComputeShader.PixelShaderEffect, Mode=OneWay}" />
|
||||
</controls:Case>
|
||||
</controls:SwitchPresenter>
|
||||
|
||||
<!-- Settings panel -->
|
||||
<StackPanel
|
||||
Margin="48"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Orientation="Horizontal"
|
||||
Spacing="20">
|
||||
|
||||
<!-- Shader pause button -->
|
||||
<Button
|
||||
Padding="20"
|
||||
Command="{x:Bind ViewModel.ToggleRenderingPausedCommand}"
|
||||
CornerRadius="9999"
|
||||
ToolTipService.ToolTip="Select shader">
|
||||
<SymbolIcon Symbol="{x:Bind converters:RenderingPauseConverter.ConvertPausedToSymbol(ViewModel.IsRenderingPaused), Mode=OneWay}" />
|
||||
</Button>
|
||||
|
||||
<!-- Shader selection button -->
|
||||
<Button
|
||||
Padding="20"
|
||||
Click="OpenShaderSelectionPanelButton_Click"
|
||||
CornerRadius="9999"
|
||||
ToolTipService.ToolTip="Select shader">
|
||||
<SymbolIcon Symbol="Pictures" />
|
||||
</Button>
|
||||
|
||||
<!-- Settings button -->
|
||||
<Button
|
||||
Padding="20"
|
||||
CornerRadius="9999"
|
||||
ToolTipService.ToolTip="Settings">
|
||||
<SymbolIcon Symbol="Setting" />
|
||||
<Button.Flyout>
|
||||
<MenuFlyout>
|
||||
<ToggleMenuFlyoutItem
|
||||
Command="{x:Bind ViewModel.SetRenderingModeCommand}"
|
||||
CommandParameter="{x:Bind enums:RenderingMode.DirectX12}"
|
||||
IsChecked="{x:Bind ViewModel.SelectedRenderingMode.Equals(enums:RenderingMode.DirectX12), Mode=OneWay}"
|
||||
Text="DirectX 12" />
|
||||
<ToggleMenuFlyoutItem
|
||||
Command="{x:Bind ViewModel.SetRenderingModeCommand}"
|
||||
CommandParameter="{x:Bind enums:RenderingMode.Win2D}"
|
||||
IsChecked="{x:Bind ViewModel.SelectedRenderingMode.Equals(enums:RenderingMode.Win2D), Mode=OneWay}"
|
||||
Text="Win2D (Direct2D)" />
|
||||
<MenuFlyoutSeparator />
|
||||
<ToggleMenuFlyoutItem
|
||||
IsChecked="{x:Bind ViewModel.IsVerticalSyncEnabled, Mode=TwoWay}"
|
||||
IsEnabled="{x:Bind ViewModel.SelectedRenderingMode.Equals(enums:RenderingMode.DirectX12), Mode=OneWay}"
|
||||
Text="Vertical sync" />
|
||||
<ToggleMenuFlyoutItem
|
||||
IsChecked="{x:Bind ViewModel.IsDynamicResolutionEnabled, Mode=TwoWay}"
|
||||
IsEnabled="{x:Bind ViewModel.SelectedRenderingMode.Equals(enums:RenderingMode.DirectX12), Mode=OneWay}"
|
||||
Text="Dynamic resolution" />
|
||||
<MenuFlyoutSeparator />
|
||||
<ToggleMenuFlyoutItem
|
||||
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 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 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 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 ViewModel.IsResolutionScaleOptionEnabled, Mode=OneWay}"
|
||||
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[3])}" />
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Invisible title bar -->
|
||||
<Rectangle
|
||||
x:Name="TitleBarRectangle"
|
||||
Height="32"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
Fill="Transparent" />
|
||||
|
||||
<!-- Info bar -->
|
||||
<muxc:InfoBar
|
||||
x:Name="RenderingErrorInfoBar"
|
||||
Title="Rendering error"
|
||||
Margin="80"
|
||||
Message="There was an error that caused the rendering to fail. Try pausing and starting the rendering again, or restarting the app. If the issue persists, please report it by opening an issue on GitHub."
|
||||
Severity="Error">
|
||||
<muxc:InfoBar.ActionButton>
|
||||
<HyperlinkButton Content="Report the issue" NavigateUri="https://github.com/Sergio0694/ComputeSharp/issues" />
|
||||
</muxc:InfoBar.ActionButton>
|
||||
<animations:Implicit.ShowAnimations>
|
||||
<animations:OpacityAnimation
|
||||
From="0"
|
||||
To="1.0"
|
||||
Duration="0:0:0.5" />
|
||||
<animations:TranslationAnimation
|
||||
From="0,20,0"
|
||||
To="0"
|
||||
Duration="0:0:0.5" />
|
||||
</animations:Implicit.ShowAnimations>
|
||||
<animations:Implicit.HideAnimations>
|
||||
<animations:OpacityAnimation To="0" Duration="0:0:0.5" />
|
||||
<animations:TranslationAnimation To="0,20,0" Duration="0:0:0.5" />
|
||||
</animations:Implicit.HideAnimations>
|
||||
</muxc:InfoBar>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,69 +0,0 @@
|
||||
using System;
|
||||
using ComputeSharp.SwapChain.Core.Constants;
|
||||
using ComputeSharp.SwapChain.Core.Services;
|
||||
using ComputeSharp.SwapChain.Core.ViewModels;
|
||||
using ComputeSharp.Uwp;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Input;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp.Views;
|
||||
|
||||
/// <summary>
|
||||
/// A view for <see cref="Core.ViewModels.MainViewModel"/>.
|
||||
/// </summary>
|
||||
public sealed partial class MainView : UserControl
|
||||
{
|
||||
public MainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = App.Current.Services.GetRequiredService<MainViewModel>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="MainViewModel"/> instance for the current view.
|
||||
/// </summary>
|
||||
public MainViewModel ViewModel => (MainViewModel)DataContext;
|
||||
|
||||
// Opens the shader selection panel
|
||||
private void OpenShaderSelectionPanelButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.Current.Services.GetRequiredService<IAnalyticsService>().Log(Event.OpenShaderSelectionPanel);
|
||||
|
||||
_ = this.Root.Resources.Remove(nameof(this.ShaderSelectionPanel));
|
||||
|
||||
this.Root.Children.Add(this.ShaderSelectionPanel);
|
||||
}
|
||||
|
||||
// Hides the shader selection panel
|
||||
private void ShaderSelectionPanel_Tapped(object sender, TappedRoutedEventArgs e)
|
||||
{
|
||||
App.Current.Services.GetRequiredService<IAnalyticsService>().Log(Event.CloseShaderSelectionPanel);
|
||||
|
||||
_ = this.Root.Children.Remove(this.ShaderSelectionPanel);
|
||||
}
|
||||
|
||||
// Updates the size of the shaders list panel
|
||||
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
this.ShadersListContainerPanel.Height = Math.Round(e.NewSize.Height * 0.35);
|
||||
}
|
||||
|
||||
// Logs rendering failed in the main panel
|
||||
private void MainShaderPanel_RenderingFailed(AnimatedComputeShaderPanel sender, RenderingFailedEventArgs args)
|
||||
{
|
||||
App.Current.Services.GetRequiredService<IAnalyticsService>().Log(args.Exception, (nameof(Error), Error.RenderingFailedOnMainPanel));
|
||||
|
||||
this.RenderingErrorInfoBar.IsOpen = true;
|
||||
}
|
||||
|
||||
// Logs rendering failed in a secondary panel
|
||||
private void SelectionShaderPanel_RenderingFailed(AnimatedComputeShaderPanel sender, RenderingFailedEventArgs args)
|
||||
{
|
||||
App.Current.Services.GetRequiredService<IAnalyticsService>().Log(args.Exception, (nameof(Error), Error.RenderingFailedOnSelectionPanel));
|
||||
|
||||
this.RenderingErrorInfoBar.IsOpen = true;
|
||||
}
|
||||
}
|
||||