Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,493 changes: 1,493 additions & 0 deletions docs/SAMPLE_MEMORY_OPTIMIZATION.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);AVALONIA_SKIA_SHIM</DefineConstants>
<DefineConstants>$(DefineConstants);PROGPU_AVALONIA_BACKEND</DefineConstants>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
Expand Down
607 changes: 607 additions & 0 deletions samples/ControlCatalog.Desktop/ControlCatalogBenchmark.cs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions samples/ControlCatalog.Desktop/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static int Main(string[] args)
{
App.InitialPage = args[pageArgumentIndex + 1];
}
using var benchmark = ControlCatalogBenchmark.TryStart("ProGPU", App.InitialPage);

if (args.Contains("--wait-for-attach"))
{
Expand All @@ -45,6 +46,7 @@ static int Main(string[] args)
var builder = useSkiaShim
? BuildSkiaShimApp()
: BuildAvaloniaApp();
builder.AfterSetup(_ => benchmark?.Attach());

return builder.StartWithClassicDesktopLifetime(args);
}
Expand Down
68 changes: 68 additions & 0 deletions samples/ControlCatalog.Skia/ControlCatalog.Skia.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>ControlCatalog</AssemblyName>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<ApplicationManifest>..\ControlCatalog.Desktop\app.manifest</ApplicationManifest>
<AvaloniaForkRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\external\Avalonia'))</AvaloniaForkRoot>
<AvaloniaControlCatalogSourceRoot>$(AvaloniaForkRoot)\samples\ControlCatalog</AvaloniaControlCatalogSourceRoot>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\ControlCatalog.Desktop\ControlCatalogBenchmark.cs"
Link="ControlCatalogBenchmark.cs" />
<Compile Include="..\ControlCatalog\Pages\DialogsPage.xaml.cs"
Link="Pages\DialogsPage.xaml.cs" />
<Compile Include="..\ControlCatalog\ViewModels\PlatformInformationViewModel.cs"
Link="ViewModels\PlatformInformationViewModel.cs" />
<Compile Include="$(AvaloniaControlCatalogSourceRoot)\**\*.cs"
Exclude="$(AvaloniaControlCatalogSourceRoot)\Pages\DialogsPage.xaml.cs;$(AvaloniaControlCatalogSourceRoot)\ViewModels\PlatformInformationViewModel.cs">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
<Compile Update="$(AvaloniaControlCatalogSourceRoot)\**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<AvaloniaXaml Include="$(AvaloniaControlCatalogSourceRoot)\**\*.xaml;$(AvaloniaControlCatalogSourceRoot)\**\*.axaml">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<SubType>Designer</SubType>
</AvaloniaXaml>
<AvaloniaResource Include="$(AvaloniaControlCatalogSourceRoot)\Assets\**\*">
<Link>Assets\%(RecursiveDir)%(Filename)%(Extension)</Link>
</AvaloniaResource>
<EmbeddedResource Include="$(AvaloniaControlCatalogSourceRoot)\Assets\Fonts\SourceSansPro-Bold.ttf"
Link="Assets\Fonts\SourceSansPro-Bold.ttf" />
<EmbeddedResource Include="$(AvaloniaControlCatalogSourceRoot)\Assets\Fonts\SourceSansPro-BoldItalic.ttf"
Link="Assets\Fonts\SourceSansPro-BoldItalic.ttf" />
<EmbeddedResource Include="$(AvaloniaControlCatalogSourceRoot)\Assets\Fonts\SourceSansPro-Italic.ttf"
Link="Assets\Fonts\SourceSansPro-Italic.ttf" />
<EmbeddedResource Include="$(AvaloniaControlCatalogSourceRoot)\Assets\Fonts\SourceSansPro-Regular.ttf"
Link="Assets\Fonts\SourceSansPro-Regular.ttf" />
<EmbeddedResource Include="$(AvaloniaControlCatalogSourceRoot)\Pages\teapot.bin"
Link="Pages\teapot.bin" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Controls.ColorPicker" />
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Fonts.Inter" />
<PackageReference Include="Avalonia.HarfBuzz" />
<PackageReference Include="Avalonia.Skia" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Avalonia.Themes.Simple" />
<ProjectReference Include="..\MiniMvvm\MiniMvvm.csproj" />
<ProjectReference Include="..\SampleControls\ControlSamples.csproj" />
</ItemGroup>
<ItemGroup>
<AvaloniaXaml Update="$(AvaloniaControlCatalogSourceRoot)\NavHeaderItem.xaml">
<Generator>MSBuild:Compile</Generator>
</AvaloniaXaml>
</ItemGroup>
<Target Name="ValidateAvaloniaForkSources" BeforeTargets="PrepareForBuild">
<Error Condition="!Exists('$(AvaloniaControlCatalogSourceRoot)\App.xaml.cs')"
Text="The pinned Avalonia source submodule is missing. Run 'git submodule update --init external/Avalonia'." />
</Target>
</Project>
15 changes: 15 additions & 0 deletions samples/ControlCatalog.Skia/PORTING-NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PORTING NOTICE

This comparison host source-links the ControlCatalog from:

Repository: https://github.com/wieslawsoltes/Avalonia.git
Tag: progpu-avalonia-v12.0.5-preview.19
Commit: 5378af03f17a4d9d2845882229ffed7f67350037
Submodule path: external/Avalonia
Original path: samples/ControlCatalog

Only the host project and startup entry point are kept locally. They run the
same linked catalog with the native Avalonia Skia renderer so memory,
performance, and rendering output can be compared with the ProGPU host.

No Git history or commits were imported from the source repository.
31 changes: 31 additions & 0 deletions samples/ControlCatalog.Skia/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using Avalonia;
using ControlCatalog;
using ControlCatalog.Desktop;

namespace ControlCatalog.Skia;

internal static class Program
{
[STAThread]
private static int Main(string[] args)
{
var pageArgumentIndex = Array.IndexOf(args, "--page");
if (pageArgumentIndex >= 0 && pageArgumentIndex + 1 < args.Length)
{
App.InitialPage = args[pageArgumentIndex + 1];
}

using var benchmark = ControlCatalogBenchmark.TryStart("Skia", App.InitialPage);
var builder = BuildAvaloniaApp();
builder.AfterSetup(_ => benchmark?.Attach());
return builder.StartWithClassicDesktopLifetime(args);
}

private static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseHarfBuzz()
.WithInterFont()
.LogToTrace();
}
Loading
Loading