Port WinUI 3 sample app to UWP
検索条件に一致するファイルはありません
@@ -58,7 +58,9 @@ 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.Uwp", "src\ComputeSharp.Uwp\ComputeSharp.Uwp.csproj", "{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Uwp", "src\ComputeSharp.Uwp\ComputeSharp.Uwp.csproj", "{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.SwapChain.Uwp", "samples\ComputeSharp.SwapChain.Uwp\ComputeSharp.SwapChain.Uwp.csproj", "{FBD388A5-7855-4408-98FF-E689F509DB5A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
@@ -332,6 +334,58 @@ 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
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|x64.Build.0 = Debug|x64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Debug|x86.Build.0 = Debug|x86
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|ARM.Build.0 = Release|ARM
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|x64.ActiveCfg = Release|x64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|x64.Build.0 = Release|x64
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|x86.ActiveCfg = Release|x86
|
||||
{AFAAFDC9-BE42-45D4-8C79-0EE8C8EDBF52}.Release|x86.Build.0 = Release|x86
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|Any CPU.Deploy.0 = Debug|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{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}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|x86.Build.0 = Debug|x86
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|Any CPU.Build.0 = Release|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|Any CPU.Deploy.0 = Release|x64
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|ARM.Build.0 = Release|ARM
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{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
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|x86.ActiveCfg = Release|x86
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|x86.Build.0 = Release|x86
|
||||
{FBD388A5-7855-4408-98FF-E689F509DB5A}.Release|x86.Deploy.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -351,6 +405,7 @@ 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}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4664C5E3-0340-4E22-BCFD-98AAEDF5F2DC}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<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>
|
||||
@@ -0,0 +1,72 @@
|
||||
using ComputeSharp.SwapChain.Uwp.Views;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using Windows.UI;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
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()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// 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.4 KiB |
|
変更後 幅: | 高さ: | サイズ: 208 KiB |
|
変更後 幅: | 高さ: | サイズ: 7.5 KiB |
|
変更後 幅: | 高さ: | サイズ: 2.9 KiB |
|
変更後 幅: | 高さ: | サイズ: 1.6 KiB |
|
変更後 幅: | 高さ: | サイズ: 1.2 KiB |
|
変更後 幅: | 高さ: | サイズ: 1.4 KiB |
|
変更後 幅: | 高さ: | サイズ: 3.1 KiB |
@@ -0,0 +1,209 @@
|
||||
<?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)' == '' ">x86</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.19041.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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<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>;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>;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>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Converters\RenderingPauseConverter.cs" />
|
||||
<Compile Include="Converters\ResolutionScaleConverter.cs" />
|
||||
<Compile Include="Models\ComputeShader.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Shaders\Runners\ContouredLayersRunner.cs" />
|
||||
<Compile Include="ViewModels\MainViewModel.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\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="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\StoreLogo.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\ColorfulInfinity.cs" Link="Shaders\ColorfulInfinity.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\ContouredLayers.cs" Link="Shaders\ContouredLayers.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\ExtrudedTruchetPattern.cs" Link="Shaders\ExtrudedTruchetPattern.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\FractalTiling.cs" Link="Shaders\FractalTiling.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\MengerJourney.cs" Link="Shaders\MengerJourney.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\TwoTiledTruchet.cs" Link="Shaders\TwoTiledTruchet.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\Octagrams.cs" Link="Shaders\Octagrams.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\ProteanClouds.cs" Link="Shaders\ProteanClouds.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\PyramidPattern.cs" Link="Shaders\PyramidPattern.cs" />
|
||||
<Compile Include="..\ComputeSharp.SwapChain\Shaders\TriangleGridContouring.cs" Link="Shaders\TriangleGridContouring.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||
<Version>6.2.13</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Toolkit.Mvvm">
|
||||
<Version>7.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls.Core">
|
||||
<Version>7.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Media">
|
||||
<Version>7.1.1</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.Uwp\ComputeSharp.Uwp.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Page Include="Views\MainView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<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" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,20 @@
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// A class with some static converters for rendering state.
|
||||
/// </summary>
|
||||
public static class RenderingPauseConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a symbol for an input rendering state.
|
||||
/// </summary>
|
||||
/// <param name="value">Whether or not the rendering is currently paaused.</param>
|
||||
/// <returns>A symbol representing the next action for the rendering.</returns>
|
||||
public static Symbol ConvertPausedToSymbol(bool value)
|
||||
{
|
||||
return value ? Symbol.Play : Symbol.Pause;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace ComputeSharp.SwapChain.Uwp.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// A class with some static converters for resolution scale settings.
|
||||
/// </summary>
|
||||
public static class ResolutionScaleConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a resolution scale to a formatted string.
|
||||
/// </summary>
|
||||
/// <param name="value">The input resolution scale (in percentage).</param>
|
||||
/// <returns>A formatted percentage string for <paramref name="value"/>.</returns>
|
||||
public static string ConvertPercentageToFormattedString(int value)
|
||||
{
|
||||
return $"{value}%";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a percentage value to a scaled value in the [0, 1] range.
|
||||
/// </summary>
|
||||
/// <param name="value">The input percentage value to scale.</param>
|
||||
/// <returns>The input percentage scaled to the [0, 1] range.</returns>
|
||||
public static double ConvertPercentageToScale(int value)
|
||||
{
|
||||
return value / 100.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Microsoft.Toolkit.Mvvm.ComponentModel;
|
||||
using ComputeSharp.Uwp;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A model 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
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ComputeShader"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the shader.</param>
|
||||
/// <param name="shaderRunner">The <see cref="IShaderRunner"/> instance to execute.</param>
|
||||
public ComputeShader(string name, IShaderRunner shaderRunner)
|
||||
{
|
||||
Name = name;
|
||||
ShaderRunner = shaderRunner;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the shader.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IShaderRunner"/> instance to execute.
|
||||
/// </summary>
|
||||
public IShaderRunner ShaderRunner { get; }
|
||||
|
||||
private bool isSelected;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the current shader is selected.
|
||||
/// </summary>
|
||||
public bool IsSelected
|
||||
{
|
||||
get => this.isSelected;
|
||||
set => SetProperty(ref this.isSelected, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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="b102e1fa-3ee9-43e9-abfe-4c7201abf89a"
|
||||
Publisher="CN=Sergio"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="b102e1fa-3ee9-43e9-abfe-4c7201abf89a" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>ComputeSharp.SwapChain.Uwp</DisplayName>
|
||||
<PublisherDisplayName>Sergio</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.SwapChain.Uwp"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||
Description="ComputeSharp.SwapChain.Uwp"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" uap5:Optional="true" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
</Package>
|
||||
@@ -0,0 +1,29 @@
|
||||
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)]
|
||||
@@ -0,0 +1,21 @@
|
||||
<!--
|
||||
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>
|
||||
</Application>
|
||||
</Directives>
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ComputeSharp.SwapChain.Shaders;
|
||||
using ComputeSharp.Uwp;
|
||||
using Windows.ApplicationModel;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp.Shaders.Runners
|
||||
{
|
||||
/// <summary>
|
||||
/// A specialized <see cref="IShaderRunner"/> for <see cref="ContouredLayers"/>.
|
||||
/// </summary>
|
||||
public sealed class ContouredLayersRunner : IShaderRunner
|
||||
{
|
||||
/// <summary>
|
||||
/// A texture for <c>\Textures\RustyMetal.png</c>.
|
||||
/// </summary>
|
||||
private ReadOnlyTexture2D<Rgba32, Float4>? texture;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute(IReadWriteTexture2D<Float4> texture, TimeSpan timespan)
|
||||
{
|
||||
if (this.texture is null)
|
||||
{
|
||||
string filename = Path.Combine(Package.Current.InstalledLocation.Path, "Assets", "Textures", "RustyMetal.png");
|
||||
|
||||
this.texture = Gpu.Default.LoadReadOnlyTexture2D<Rgba32, Float4>(filename.AsSpan());
|
||||
}
|
||||
|
||||
Gpu.Default.ForEach(texture, new ContouredLayers((float)timespan.TotalSeconds, this.texture));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
using System.Collections.Generic;
|
||||
using ComputeSharp.SwapChain.Shaders;
|
||||
using ComputeSharp.SwapChain.Uwp.Models;
|
||||
using ComputeSharp.SwapChain.Uwp.Shaders.Runners;
|
||||
using ComputeSharp.Uwp;
|
||||
using Microsoft.Toolkit.Mvvm.ComponentModel;
|
||||
using Microsoft.Toolkit.Mvvm.Input;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// The viewmodel for for a view that allows users to select shaders and customize settings.
|
||||
/// </summary>
|
||||
public sealed class MainViewModel : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="MainViewModel"/> instance.
|
||||
/// </summary>
|
||||
public MainViewModel()
|
||||
{
|
||||
this.isDynamicResolutionEnabled = true;
|
||||
this.selectedResolutionScale = 100;
|
||||
this.selectedComputeShader = ComputeShaderOptions[0];
|
||||
this.selectedComputeShader.IsSelected = true;
|
||||
|
||||
SetResolutionScaleCommand = new RelayCommand<int>(SetResolutionScale);
|
||||
ToggleRenderingPausedCommand = new RelayCommand(ToggleRenderingPaused);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the available resolution scaling options (as percentage values).
|
||||
/// </summary>
|
||||
public IList<int> ResolutionScaleOptions { get; } = new[] { 25, 50, 75, 100 };
|
||||
|
||||
private bool isDynamicResolutionEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the dynamic resolution is enabled.
|
||||
/// </summary>
|
||||
public bool IsDynamicResolutionEnabled
|
||||
{
|
||||
get => this.isDynamicResolutionEnabled;
|
||||
set => SetProperty(ref this.isDynamicResolutionEnabled, value);
|
||||
}
|
||||
|
||||
private int selectedResolutionScale;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the currently selected resolution scale setting (as percentage valaue).
|
||||
/// </summary>
|
||||
public int SelectedResolutionScale
|
||||
{
|
||||
get => this.selectedResolutionScale;
|
||||
private set => SetProperty(ref this.selectedResolutionScale, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command that sets <see cref="SelectedResolutionScale"/>.
|
||||
/// </summary>
|
||||
public IRelayCommand SetResolutionScaleCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets <see cref="SelectedResolutionScale"/>.
|
||||
/// </summary>
|
||||
private void SetResolutionScale(int resolutionScale)
|
||||
{
|
||||
SelectedResolutionScale = resolutionScale;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of available compute shader.
|
||||
/// </summary>
|
||||
public IReadOnlyList<ComputeShader> ComputeShaderOptions { get; } = new ComputeShader[]
|
||||
{
|
||||
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())
|
||||
};
|
||||
|
||||
private ComputeShader selectedComputeShader;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected compute shader.
|
||||
/// </summary>
|
||||
public ComputeShader SelectedComputeShader
|
||||
{
|
||||
get => this.selectedComputeShader;
|
||||
set
|
||||
{
|
||||
this.selectedComputeShader.IsSelected = false;
|
||||
|
||||
if (SetProperty(ref this.selectedComputeShader, value) &&
|
||||
value is not null)
|
||||
{
|
||||
value.IsSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isRenderingPaused;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the rendering is currently paused.
|
||||
/// </summary>
|
||||
public bool IsRenderingPaused
|
||||
{
|
||||
get => this.isRenderingPaused;
|
||||
set => SetProperty(ref this.isRenderingPaused, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command that toggles <see cref="IsRenderingPaused"/>.
|
||||
/// </summary>
|
||||
public IRelayCommand ToggleRenderingPausedCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Toggles <see cref="IsRenderingPaused"/>.
|
||||
/// </summary>
|
||||
private void ToggleRenderingPaused()
|
||||
{
|
||||
IsRenderingPaused = !IsRenderingPaused;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
<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:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
|
||||
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
|
||||
xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations"
|
||||
xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media"
|
||||
xmlns:computesharp="using:ComputeSharp.Uwp"
|
||||
xmlns:converters="using:ComputeSharp.SwapChain.Uwp.Converters"
|
||||
xmlns:viewmodels="using:ComputeSharp.SwapChain.Uwp.ViewModels"
|
||||
xmlns:models="using:ComputeSharp.SwapChain.Uwp.Models"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400">
|
||||
|
||||
<Grid x:Name="Root">
|
||||
<Grid.DataContext>
|
||||
<viewmodels:MainViewModel x:Name="ViewModel"/>
|
||||
</Grid.DataContext>
|
||||
<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 Duration="0:0:0.5" From="0" To="1.0"/>
|
||||
</animations:Implicit.ShowAnimations>
|
||||
<animations:Implicit.HideAnimations>
|
||||
<animations:OpacityAnimation Duration="0:0:0.5" From="1.0" To="0"/>
|
||||
</animations:Implicit.HideAnimations>
|
||||
<Border.Background>
|
||||
<media:AcrylicBrush
|
||||
TintColor="#FF222222"
|
||||
TintOpacity="0.2"
|
||||
BlurAmount="12"
|
||||
TextureUri="ms-appx:///Assets/Misc/noise_low.png"/>
|
||||
</Border.Background>
|
||||
|
||||
<!--Shadow panel with the shaders list-->
|
||||
<controls:DropShadowPanel
|
||||
ShadowOpacity="1"
|
||||
BlurRadius="20"
|
||||
OffsetY="-2"
|
||||
OffsetX="-12"
|
||||
IsMasked="True"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalAlignment="Bottom">
|
||||
<animations:Implicit.ShowAnimations>
|
||||
<animations:TranslationAnimation Duration="0:0:0.5" From="0,320,0" To="0"/>
|
||||
</animations:Implicit.ShowAnimations>
|
||||
<animations:Implicit.HideAnimations>
|
||||
<animations:TranslationAnimation Duration="0:0:0.5" From="0" To="0,320,0"/>
|
||||
</animations:Implicit.HideAnimations>
|
||||
<Border
|
||||
Height="320"
|
||||
Margin="-20,0,-20,0"
|
||||
Background="#FF222222">
|
||||
|
||||
<!--Shaders list-->
|
||||
<ListView
|
||||
ItemsSource="{x:Bind ViewModel.ComputeShaderOptions}"
|
||||
SelectionMode="Single"
|
||||
SelectedItem="{x:Bind ViewModel.SelectedComputeShader, Mode=TwoWay}"
|
||||
ScrollViewer.HorizontalScrollMode="Enabled"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
ScrollViewer.VerticalScrollMode="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Hidden">
|
||||
<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="models:ComputeShader">
|
||||
<Grid
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
ui:UIElementExtensions.ClipToBounds="True">
|
||||
|
||||
<!--Shader preview-->
|
||||
<computesharp:ComputeShaderPanel
|
||||
Width="568"
|
||||
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
|
||||
BorderThickness="4"
|
||||
BorderBrush="White"
|
||||
Visibility="{x:Bind IsSelected, Mode=OneWay}">
|
||||
<Polygon
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Right"
|
||||
Points="0,0 32,0 32,32"
|
||||
Fill="White"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</Border>
|
||||
</controls:DropShadowPanel>
|
||||
</Border>
|
||||
</Grid.Resources>
|
||||
|
||||
<!--Shader-->
|
||||
<computesharp:ComputeShaderPanel
|
||||
x:Name="ShaderPanel"
|
||||
Grid.Row="1"
|
||||
ShaderRunner="{x:Bind ViewModel.SelectedComputeShader.ShaderRunner, Mode=OneWay}"
|
||||
IsDynamicResolutionEnabled="{x:Bind ViewModel.IsDynamicResolutionEnabled, Mode=OneWay}"
|
||||
ResolutionScale="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToScale(ViewModel.SelectedResolutionScale), Mode=OneWay}"
|
||||
IsPaused="{x:Bind ViewModel.IsRenderingPaused, Mode=OneWay}"/>
|
||||
|
||||
<!--Settings panel-->
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="20"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="48">
|
||||
|
||||
<!--Shader pause button-->
|
||||
<Button
|
||||
Padding="20"
|
||||
CornerRadius="9999"
|
||||
ToolTipService.ToolTip="Select shader"
|
||||
Command="{x:Bind ViewModel.ToggleRenderingPausedCommand}">
|
||||
<SymbolIcon Symbol="{x:Bind converters:RenderingPauseConverter.ConvertPausedToSymbol(ViewModel.IsRenderingPaused), Mode=OneWay}"/>
|
||||
</Button>
|
||||
|
||||
<!--Shader selection button-->
|
||||
<Button
|
||||
Padding="20"
|
||||
CornerRadius="9999"
|
||||
ToolTipService.ToolTip="Select shader"
|
||||
Click="OpenShaderSelectionPanelButton_Click">
|
||||
<SymbolIcon Symbol="Pictures"/>
|
||||
</Button>
|
||||
|
||||
<!--Settings button-->
|
||||
<Button
|
||||
Padding="20"
|
||||
CornerRadius="9999"
|
||||
ToolTipService.ToolTip="Settings">
|
||||
<SymbolIcon Symbol="Setting"/>
|
||||
<Button.Flyout>
|
||||
<MenuFlyout>
|
||||
<ToggleMenuFlyoutItem
|
||||
Text="Dynamic resolution"
|
||||
IsChecked="{x:Bind ViewModel.IsDynamicResolutionEnabled, Mode=TwoWay}"/>
|
||||
<MenuFlyoutSeparator/>
|
||||
<ToggleMenuFlyoutItem
|
||||
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[0])}"
|
||||
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
|
||||
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[0]}"
|
||||
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[0]), Mode=OneWay}"/>
|
||||
<ToggleMenuFlyoutItem
|
||||
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[1])}"
|
||||
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
|
||||
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[1]}"
|
||||
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[1]), Mode=OneWay}"/>
|
||||
<ToggleMenuFlyoutItem
|
||||
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[2])}"
|
||||
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
|
||||
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[2]}"
|
||||
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[2]), Mode=OneWay}"/>
|
||||
<ToggleMenuFlyoutItem
|
||||
Text="{x:Bind converters:ResolutionScaleConverter.ConvertPercentageToFormattedString(ViewModel.ResolutionScaleOptions[3])}"
|
||||
Command="{x:Bind ViewModel.SetResolutionScaleCommand}"
|
||||
CommandParameter="{x:Bind ViewModel.ResolutionScaleOptions[3]}"
|
||||
IsChecked="{x:Bind ViewModel.SelectedResolutionScale.Equals(ViewModel.ResolutionScaleOptions[3]), Mode=OneWay}"/>
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!--Invisible title bar-->
|
||||
<Rectangle
|
||||
x:Name="TitleBarRectangle"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="32"
|
||||
Fill="Transparent"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Input;
|
||||
|
||||
namespace ComputeSharp.SwapChain.Uwp.Views;
|
||||
|
||||
public sealed partial class MainView : UserControl
|
||||
{
|
||||
public MainView()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
// Opens the shader selection panel
|
||||
private void OpenShaderSelectionPanelButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Root.Resources.Remove("ShaderSelectionPanel");
|
||||
Root.Children.Add(ShaderSelectionPanel);
|
||||
}
|
||||
|
||||
// Hides the shader selection panel
|
||||
private void ShaderSelectionPanel_Tapped(object sender, TappedRoutedEventArgs e)
|
||||
{
|
||||
Root.Children.Remove(ShaderSelectionPanel);
|
||||
}
|
||||
}
|
||||