csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
39 lines
1.3 KiB
using System;
|
|
using Avalonia;
|
|
using Avalonia.Logging;
|
|
using Avalonia.Vulkan;
|
|
|
|
namespace GpuInterop
|
|
{
|
|
public static class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var demoType = OperatingSystem.IsWindows() && args.AsSpan().Contains("--d3d") ? DemoType.D3D11 : DemoType.Vulkan;
|
|
BuildAvaloniaAppCore(demoType).StartWithClassicDesktopLifetime(args);
|
|
}
|
|
|
|
public static AppBuilder BuildAvaloniaApp() => BuildAvaloniaAppCore(DemoType.Vulkan);
|
|
|
|
private static AppBuilder BuildAvaloniaAppCore(DemoType demoType) =>
|
|
AppBuilder
|
|
.Configure(() => new App { DemoType = demoType })
|
|
.UsePlatformDetect()
|
|
.With(new Win32PlatformOptions
|
|
{
|
|
RenderingMode = [demoType == DemoType.D3D11 ? Win32RenderingMode.AngleEgl : Win32RenderingMode.Vulkan]
|
|
})
|
|
.With(new X11PlatformOptions
|
|
{
|
|
RenderingMode = [X11RenderingMode.Vulkan]
|
|
})
|
|
.With(new VulkanOptions
|
|
{
|
|
VulkanInstanceCreationOptions = new VulkanInstanceCreationOptions
|
|
{
|
|
UseDebug = true
|
|
}
|
|
})
|
|
.LogToTrace(LogEventLevel.Debug, "Vulkan");
|
|
}
|
|
}
|
|
|