forked from amkovkov/GranuSightSoftware2
feat: CameraView OpenGL render
This commit is contained in:
+40
-24
@@ -1,31 +1,49 @@
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Console;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.OpenGL.Egl;
|
||||
using GSS2.Core;
|
||||
using GSS2.Core.Analysis.AmineContent.Database;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Vulkan;
|
||||
using GSS2.Test.Logging;
|
||||
|
||||
using ConsoleFormatter = GSS2.Test.Logging.ConsoleFormatter;
|
||||
|
||||
namespace GSS2.Test;
|
||||
using ConsoleFormatter = GSS2.Test.Logging.ConsoleFormatter;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static IHost ApplicationHost { get; }
|
||||
|
||||
static Program()
|
||||
{
|
||||
ApplicationHost = BuildHostApp();
|
||||
}
|
||||
public static IHost ApplicationHost { get; } = BuildHostApp();
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
var builder = BuildAvaloniaApp();
|
||||
|
||||
if (args.Contains("--drm"))
|
||||
{
|
||||
if (!args.Contains("--console"))
|
||||
SilenceConsole();
|
||||
return builder.StartLinuxDrm(args, "/dev/dri/card1", 1.0);
|
||||
}
|
||||
if (args.Contains("--help"))
|
||||
{
|
||||
Console.WriteLine($"Usage of {Assembly.GetEntryAssembly()?.GetName().Name}:");
|
||||
Console.WriteLine($"\t--help - show this help");
|
||||
Console.WriteLine($"\t--drm - use DRM rendering mode");
|
||||
Console.WriteLine($"\t--console - in DRM rendering mode do not suppress console output");
|
||||
return 0;
|
||||
}
|
||||
return builder.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
|
||||
private static void SilenceConsole()
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
Console.CursorVisible = false;
|
||||
while (true)
|
||||
Console.ReadKey(true);
|
||||
})
|
||||
{ IsBackground = true }.Start();
|
||||
}
|
||||
|
||||
private static IHost BuildHostApp()
|
||||
@@ -70,16 +88,14 @@ public class Program
|
||||
private static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.UseSkia()
|
||||
.LogToTrace()
|
||||
.With(new X11PlatformOptions
|
||||
{
|
||||
RenderingMode = [X11RenderingMode.Vulkan]
|
||||
RenderingMode = [X11RenderingMode.Egl]
|
||||
})
|
||||
.With(new VulkanOptions
|
||||
.With(new EglDisplayOptions
|
||||
{
|
||||
VulkanInstanceCreationOptions = new VulkanInstanceCreationOptions
|
||||
{
|
||||
UseDebug = true
|
||||
}
|
||||
})
|
||||
.LogToTrace();
|
||||
SupportsContextSharing = true
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user