Improved sample UI, implemented shader selector
検索条件に一致するファイルはありません
@@ -49,6 +49,35 @@
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\..\tests\ComputeSharp.Tests\Assets\ColorfulInfinity.png">
|
||||
<Link>Images\Shaders\ColorfulInfinity.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\..\..\tests\ComputeSharp.Tests\Assets\ExtrudedTruchetPattern.png">
|
||||
<Link>Images\Shaders\ExtrudedTruchetPattern.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\..\..\tests\ComputeSharp.Tests\Assets\FractalTiling.png">
|
||||
<Link>Images\Shaders\FractalTiling.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\..\..\tests\ComputeSharp.Tests\Assets\MengerJourney.png">
|
||||
<Link>Images\Shaders\MengerJourney.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\..\..\tests\ComputeSharp.Tests\Assets\Octagrams.png">
|
||||
<Link>Images\Shaders\Octagrams.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\..\..\tests\ComputeSharp.Tests\Assets\ProteanClouds.png">
|
||||
<Link>Images\Shaders\ProteanClouds.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\..\..\tests\ComputeSharp.Tests\Assets\TwoTiledTruchet.png">
|
||||
<Link>Images\Shaders\TwoTiledTruchet.png</Link>
|
||||
</Content>
|
||||
<Content Include="Images\Misc\noise_low.png" />
|
||||
<Content Include="Images\Shaders\Blurred\ColorfulInfinity.png" />
|
||||
<Content Include="Images\Shaders\Blurred\ExtrudedTruchetPattern.png" />
|
||||
<Content Include="Images\Shaders\Blurred\FractalTiling.png" />
|
||||
<Content Include="Images\Shaders\Blurred\MengerJourney.png" />
|
||||
<Content Include="Images\Shaders\Blurred\Octagrams.png" />
|
||||
<Content Include="Images\Shaders\Blurred\ProteanClouds.png" />
|
||||
<Content Include="Images\Shaders\Blurred\TwoTiledTruchet.png" />
|
||||
<Content Include="Images\SplashScreen.scale-200.png" />
|
||||
<Content Include="Images\LockScreenLogo.scale-200.png" />
|
||||
<Content Include="Images\Square150x150Logo.scale-200.png" />
|
||||
|
||||
|
変更後 幅: | 高さ: | サイズ: 208 KiB |
|
変更後 幅: | 高さ: | サイズ: 219 KiB |
|
変更後 幅: | 高さ: | サイズ: 300 KiB |
|
変更後 幅: | 高さ: | サイズ: 356 KiB |
|
変更後 幅: | 高さ: | サイズ: 294 KiB |
|
変更後 幅: | 高さ: | サイズ: 167 KiB |
|
変更後 幅: | 高さ: | サイズ: 272 KiB |
|
変更後 幅: | 高さ: | サイズ: 210 KiB |
@@ -1,4 +1,5 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using ComputeSharp.SwapChain.WinUI.Views;
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="7.0.1" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Core" Version="7.0.1" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Layout" Version="7.0.1" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Media" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.ProjectReunion" Version="0.5.6" />
|
||||
<PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.5.6" />
|
||||
<PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.5.6" />
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using ComputeSharp.SwapChain.WinUI.Models;
|
||||
|
||||
namespace ComputeSharp.SwapChain.WinUI.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// A class with some static converters for <see cref="ComputeShader"/>.
|
||||
/// </summary>
|
||||
public static class ComputeShaderConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a <see cref="ComputeShader"/> instance to a <see cref="Uri"/> with the thumbnail image.
|
||||
/// </summary>
|
||||
/// <param name="value">The input <see cref="ComputeShader"/> instance.</param>
|
||||
/// <returns>A <see cref="Uri"/> with the thumbnail image for <paramref name="value"/>.</returns>
|
||||
public static Uri ConvertComputeShaderToThumbnailUri(ComputeShader value)
|
||||
{
|
||||
return new($"ms-appx:///Images/Shaders/{value.ShaderRunner.GetType().GenericTypeArguments[0].Name}.png");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="ComputeShader"/> instance to a <see cref="Uri"/> with the background image.
|
||||
/// </summary>
|
||||
/// <param name="value">The input <see cref="ComputeShader"/> instance.</param>
|
||||
/// <returns>A <see cref="Uri"/> with the background image for <paramref name="value"/>.</returns>
|
||||
public static Uri ConvertComputeShaderToBackgroundUri(ComputeShader value)
|
||||
{
|
||||
return new($"ms-appx:///Images/Shaders/Blurred/{value.ShaderRunner.GetType().GenericTypeArguments[0].Name}.png");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<Window
|
||||
x:Class="ComputeSharp.SwapChain.WinUI.MainWindow"
|
||||
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:computesharp="using:ComputeSharp.WinUI"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Margin="12" Spacing="20" Orientation="Horizontal">
|
||||
<Button Content="Colors" Click="Colors_Click"/>
|
||||
<Button Content="Extruded truchet" Click="ExtrudedTruchet_Click"/>
|
||||
<Button Content="Fractal tiles" Click="Tiles_Click"/>
|
||||
<Button Content="Menger journey" Click="Journey_Click"/>
|
||||
<Button Content="Octagrams" Click="Octagrams_Click"/>
|
||||
<Button Content="Protean clouds" Click="Clouds_Click"/>
|
||||
<Button Content="Two tiled truchet" Click="TiledTruched_Click"/>
|
||||
</StackPanel>
|
||||
<computesharp:ComputeShaderPanel x:Name="ShaderPanel" Grid.Row="1" />
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,52 +0,0 @@
|
||||
using ComputeSharp.SwapChain.Shaders;
|
||||
using ComputeSharp.WinUI;
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace ComputeSharp.SwapChain.WinUI
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty window that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
private void Colors_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ShaderPanel.ShaderRunner = new ShaderRunner<ColorfulInfinity>(static (texture, time) => new(texture, (float)time.TotalSeconds));
|
||||
}
|
||||
|
||||
private void ExtrudedTruchet_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ShaderPanel.ShaderRunner = new ShaderRunner<ExtrudedTruchetPattern>(static (texture, time) => new(texture, (float)time.TotalSeconds));
|
||||
}
|
||||
|
||||
private void Tiles_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ShaderPanel.ShaderRunner = new ShaderRunner<FractalTiling>(static (texture, time) => new(texture, (float)time.TotalSeconds));
|
||||
}
|
||||
|
||||
private void Journey_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ShaderPanel.ShaderRunner = new ShaderRunner<MengerJourney>(static (texture, time) => new(texture, (float)time.TotalSeconds));
|
||||
}
|
||||
|
||||
private void Octagrams_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ShaderPanel.ShaderRunner = new ShaderRunner<Octagrams>(static (texture, time) => new(texture, (float)time.TotalSeconds));
|
||||
}
|
||||
|
||||
private void Clouds_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ShaderPanel.ShaderRunner = new ShaderRunner<ProteanClouds>(static (texture, time) => new(texture, (float)time.TotalSeconds));
|
||||
}
|
||||
|
||||
private void TiledTruched_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.ShaderPanel.ShaderRunner = new ShaderRunner<TwoTiledTruchet>(static (texture, time) => new(texture, (float)time.TotalSeconds));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ComputeSharp.WinUI;
|
||||
|
||||
namespace ComputeSharp.SwapChain.WinUI.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,74 @@
|
||||
using System.Collections.Generic;
|
||||
using ComputeSharp.SwapChain.Shaders;
|
||||
using ComputeSharp.WinUI;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ComputeSharp.SwapChain.WinUI.Models;
|
||||
|
||||
namespace ComputeSharp.SwapChain.WinUI.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.selectedResolutionScale = 100;
|
||||
this.selectedComputeShader = ComputeShaderOptions[0];
|
||||
this.selectedComputeShader.IsSelected = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the available resolution scaling options (as percentage values).
|
||||
/// </summary>
|
||||
public IReadOnlyList<int> ResolutionScaleOptions { get; } = new[] { 25, 50, 75, 100 };
|
||||
|
||||
private int selectedResolutionScale;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected resolution scale setting (as percentage valaue).
|
||||
/// </summary>
|
||||
public int SelectedResolutionScale
|
||||
{
|
||||
get => this.selectedResolutionScale;
|
||||
set => SetProperty(ref this.selectedResolutionScale, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of available compute shader.
|
||||
/// </summary>
|
||||
public IReadOnlyList<ComputeShader> ComputeShaderOptions { get; } = new ComputeShader[]
|
||||
{
|
||||
new("Colorful infinity", new ShaderRunner<ColorfulInfinity>(static (texture, time) => new(texture, (float)time.TotalSeconds))),
|
||||
new("Extruded truchet", new ShaderRunner<ExtrudedTruchetPattern>(static (texture, time) => new(texture, (float)time.TotalSeconds))),
|
||||
new("Fractal tiling", new ShaderRunner<FractalTiling>(static (texture, time) => new(texture, (float)time.TotalSeconds))),
|
||||
new("Menger Journey", new ShaderRunner<MengerJourney>(static (texture, time) => new(texture, (float)time.TotalSeconds))),
|
||||
new("Octagrams", new ShaderRunner<Octagrams>(static (texture, time) => new(texture, (float)time.TotalSeconds))),
|
||||
new("Protean clouds", new ShaderRunner<ProteanClouds>(static (texture, time) => new(texture, (float)time.TotalSeconds))),
|
||||
new("Two tiled truchet", new ShaderRunner<TwoTiledTruchet>(static (texture, time) => new(texture, (float)time.TotalSeconds)))
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
<Window
|
||||
x:Class="ComputeSharp.SwapChain.WinUI.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI.UI"
|
||||
xmlns:animations="using:CommunityToolkit.WinUI.UI.Animations"
|
||||
xmlns:media="using:CommunityToolkit.WinUI.UI.Media"
|
||||
xmlns:computesharp="using:ComputeSharp.WinUI"
|
||||
xmlns:converters="using:ComputeSharp.SwapChain.WinUI.Converters"
|
||||
xmlns:viewmodels="using:ComputeSharp.SwapChain.WinUI.ViewModels"
|
||||
xmlns:models="using:ComputeSharp.SwapChain.WinUI.Models"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid x:Name="Root">
|
||||
<Grid.DataContext>
|
||||
<viewmodels:MainViewModel x:Name="ViewModel"/>
|
||||
</Grid.DataContext>
|
||||
|
||||
<!--Shader-->
|
||||
<computesharp:ComputeShaderPanel
|
||||
x:Name="ShaderPanel"
|
||||
Grid.Row="1"
|
||||
ShaderRunner="{x:Bind ViewModel.SelectedComputeShader.ShaderRunner, Mode=OneWay}"
|
||||
ResolutionScale="{x:Bind ViewModel.SelectedResolutionScale, Mode=OneWay}"/>
|
||||
|
||||
<!--Invisible title bar-->
|
||||
<Rectangle
|
||||
x:Name="TitleBarRectangle"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="32"
|
||||
Fill="Transparent"/>
|
||||
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="20"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="48">
|
||||
|
||||
<!--Shader selection button-->
|
||||
<Button
|
||||
Padding="20"
|
||||
CornerRadius="9999"
|
||||
ToolTipService.ToolTip="Select shader"
|
||||
Click="Button_Click">
|
||||
<SymbolIcon Symbol="Pictures"/>
|
||||
</Button>
|
||||
|
||||
<!--Settings button-->
|
||||
<Button
|
||||
Padding="20"
|
||||
CornerRadius="9999"
|
||||
ToolTipService.ToolTip="Settings">
|
||||
<SymbolIcon Symbol="Setting"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!--Shader selection panel-->
|
||||
<Border
|
||||
x:Name="ShaderSelectionPanel"
|
||||
IsTapEnabled="True"
|
||||
Tapped="ShaderSelectionPanel_Tapped"
|
||||
Visibility="Collapsed">
|
||||
<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
|
||||
BackgroundSource="Backdrop"
|
||||
TintColor="#FF222222"
|
||||
TintOpacity="0.2"
|
||||
BlurAmount="12"
|
||||
TextureUri="ms-appx:///Images/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 aand 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">
|
||||
<controls:ImageEx Source="{x:Bind converters:ComputeShaderConverter.ConvertComputeShaderToBackgroundUri((models:ComputeShader))}"/>
|
||||
<controls:DropShadowPanel
|
||||
BlurRadius="20"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
OffsetX="32"
|
||||
OffsetY="32">
|
||||
<controls:ImageEx
|
||||
Margin="32"
|
||||
Source="{x:Bind converters:ComputeShaderConverter.ConvertComputeShaderToThumbnailUri((models:ComputeShader))}"
|
||||
Stretch="Uniform" />
|
||||
</controls:DropShadowPanel>
|
||||
|
||||
<!--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>
|
||||
</Window>
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
|
||||
namespace ComputeSharp.SwapChain.WinUI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// A view for <see cref="MainViewModel"/>.
|
||||
/// </summary>
|
||||
public sealed partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.ExtendsContentIntoTitleBar = true;
|
||||
|
||||
SetTitleBar(TitleBarRectangle);
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShaderSelectionPanel.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void ShaderSelectionPanel_Tapped(object sender, TappedRoutedEventArgs e)
|
||||
{
|
||||
ShaderSelectionPanel.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ namespace ComputeSharp.WinUI
|
||||
dxgiSwapChainDesc1.BufferUsage = FX.DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
|
||||
dxgiFactory2.Get()->CreateSwapChainForComposition(
|
||||
(IUnknown*)d3D12CommandQueue.Get(),
|
||||
(IUnknown*)this.d3D12CommandQueue.Get(),
|
||||
&dxgiSwapChainDesc1,
|
||||
null,
|
||||
dxgiSwapChain1).Assert();
|
||||
@@ -255,8 +255,8 @@ namespace ComputeSharp.WinUI
|
||||
fixed (ID3D12Resource** d3D12Resource0 = this.d3D12Resource0)
|
||||
fixed (ID3D12Resource** d3D12Resource1 = this.d3D12Resource1)
|
||||
{
|
||||
dxgiSwapChain1.Get()->GetBuffer(0, FX.__uuidof<ID3D12Resource>(), (void**)d3D12Resource0).Assert();
|
||||
dxgiSwapChain1.Get()->GetBuffer(1, FX.__uuidof<ID3D12Resource>(), (void**)d3D12Resource1).Assert();
|
||||
this.dxgiSwapChain1.Get()->GetBuffer(0, FX.__uuidof<ID3D12Resource>(), (void**)d3D12Resource0).Assert();
|
||||
this.dxgiSwapChain1.Get()->GetBuffer(1, FX.__uuidof<ID3D12Resource>(), (void**)d3D12Resource1).Assert();
|
||||
}
|
||||
|
||||
// Get the index of the initial back buffer
|
||||
|
||||