mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Core - Made graphics context providable by UI
Windows - Implemented Vulkan graphics context Splash screen - Tweaked design
This commit is contained in:
parent
b2987b5190
commit
34407aaeec
3
src/.idea/.idea.Artemis/.idea/avalonia.xml
generated
3
src/.idea/.idea.Artemis/.idea/avalonia.xml
generated
@ -18,6 +18,8 @@
|
||||
<entry key="Artemis.UI.Windows/App.axaml" value="Artemis.UI.Windows/Artemis.UI.Windows.csproj" />
|
||||
<entry key="Artemis.UI/DefaultTypes/PropertyInput/ColorGradientPropertyInputView.axaml" value="Artemis.UI.Windows/Artemis.UI.Windows.csproj" />
|
||||
<entry key="Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/Plugins/PluginFeatureView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/Plugins/PluginSettingsView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml" value="Artemis.UI.Windows/Artemis.UI.Windows.csproj" />
|
||||
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
@ -26,6 +28,7 @@
|
||||
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/Root/SplashView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
<entry key="Artemis.UI/Screens/VisualScripting/NodeView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
|
||||
|
||||
@ -232,6 +232,7 @@ namespace Artemis.Core.Services
|
||||
_pluginManagementService.CopyBuiltInPlugins();
|
||||
_pluginManagementService.LoadPlugins(StartupArguments, IsElevated);
|
||||
|
||||
_rgbService.ApplyPreferredGraphicsContext(StartupArguments.Contains("--force-software-render"));
|
||||
_rgbService.SetRenderPaused(false);
|
||||
OnInitialized();
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.Services;
|
||||
|
||||
public interface IGraphicsContextProvider
|
||||
{
|
||||
IReadOnlyCollection<string> GraphicsContextNames { get; }
|
||||
IManagedGraphicsContext? GetGraphicsContext(string name);
|
||||
}
|
||||
@ -40,7 +40,7 @@ namespace Artemis.Core.Services
|
||||
/// Gets a boolean indicating whether the render pipeline is open
|
||||
/// </summary>
|
||||
bool RenderOpen { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a boolean indicating whether to flush the RGB.NET LEDs during next update
|
||||
/// </summary>
|
||||
@ -56,6 +56,12 @@ namespace Artemis.Core.Services
|
||||
/// </summary>
|
||||
void CloseRender();
|
||||
|
||||
/// <summary>
|
||||
/// Applies the current value of the <c>Core.PreferredGraphicsContext</c> setting to the graphics context.
|
||||
/// </summary>
|
||||
/// <param name="forceSoftware">A boolean to indicate whether or not to force the graphics context to software mode.</param>
|
||||
void ApplyPreferredGraphicsContext(bool forceSoftware);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the graphics context to the provided <paramref name="managedGraphicsContext"></paramref>.
|
||||
/// <para>Note: The old graphics context will be used until the next frame starts rendering and is disposed afterwards.</para>
|
||||
@ -139,10 +145,10 @@ namespace Artemis.Core.Services
|
||||
void DisableDevice(ArtemisDevice device);
|
||||
|
||||
/// <summary>
|
||||
/// Pauses or resumes rendering, method won't return until the current frame finished rendering
|
||||
/// Pauses or resumes rendering, method won't return until the current frame finished rendering
|
||||
/// </summary>
|
||||
/// <param name="paused"></param>
|
||||
/// <returns><see langword="true"/> if the pause state was changed; otherwise <see langword="false"/>.</returns>
|
||||
/// <returns><see langword="true" /> if the pause state was changed; otherwise <see langword="false" />.</returns>
|
||||
bool SetRenderPaused(bool paused);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -8,6 +8,7 @@ using Artemis.Core.Services.Models;
|
||||
using Artemis.Core.SkiaSharp;
|
||||
using Artemis.Storage.Entities.Surface;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using Ninject;
|
||||
using RGB.NET.Core;
|
||||
using Serilog;
|
||||
|
||||
@ -22,21 +23,27 @@ namespace Artemis.Core.Services
|
||||
private readonly List<ArtemisDevice> _devices;
|
||||
private readonly List<ArtemisDevice> _enabledDevices;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IKernel _kernel;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly PluginSetting<double> _renderScaleSetting;
|
||||
private readonly PluginSetting<int> _targetFrameRateSetting;
|
||||
private readonly PluginSetting<string> _preferredGraphicsContext;
|
||||
private readonly SKTextureBrush _textureBrush = new(null) {CalculationMode = RenderMode.Absolute};
|
||||
private Dictionary<Led, ArtemisLed> _ledMap;
|
||||
private ListLedGroup? _surfaceLedGroup;
|
||||
private SKTexture? _texture;
|
||||
|
||||
public RgbService(ILogger logger, ISettingsService settingsService, IPluginManagementService pluginManagementService, IDeviceRepository deviceRepository)
|
||||
public RgbService(ILogger logger, IKernel kernel, ISettingsService settingsService, IPluginManagementService pluginManagementService, IDeviceRepository deviceRepository)
|
||||
{
|
||||
_logger = logger;
|
||||
_kernel = kernel;
|
||||
_settingsService = settingsService;
|
||||
_pluginManagementService = pluginManagementService;
|
||||
_deviceRepository = deviceRepository;
|
||||
_targetFrameRateSetting = settingsService.GetSetting("Core.TargetFrameRate", 30);
|
||||
_renderScaleSetting = settingsService.GetSetting("Core.RenderScale", 0.25);
|
||||
_preferredGraphicsContext = _settingsService.GetSetting("Core.PreferredGraphicsContext", "Vulkan");
|
||||
|
||||
Surface = new RGBSurface();
|
||||
Utilities.RenderScaleMultiplier = (int) (1 / _renderScaleSetting.Value);
|
||||
@ -46,6 +53,7 @@ namespace Artemis.Core.Services
|
||||
Surface.SurfaceLayoutChanged += SurfaceOnLayoutChanged;
|
||||
_targetFrameRateSetting.SettingChanged += TargetFrameRateSettingOnSettingChanged;
|
||||
_renderScaleSetting.SettingChanged += RenderScaleSettingOnSettingChanged;
|
||||
_preferredGraphicsContext.SettingChanged += PreferredGraphicsContextOnSettingChanged;
|
||||
_enabledDevices = new List<ArtemisDevice>();
|
||||
_devices = new List<ArtemisDevice>();
|
||||
_ledMap = new Dictionary<Led, ArtemisLed>();
|
||||
@ -61,6 +69,7 @@ namespace Artemis.Core.Services
|
||||
Utilities.ShutdownRequested += UtilitiesOnShutdownRequested;
|
||||
}
|
||||
|
||||
|
||||
public TimerUpdateTrigger UpdateTrigger { get; }
|
||||
|
||||
protected virtual void OnDeviceRemoved(DeviceEventArgs e)
|
||||
@ -135,13 +144,18 @@ namespace Artemis.Core.Services
|
||||
private void RenderScaleSettingOnSettingChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Utilities.RenderScaleMultiplier = (int) (1 / _renderScaleSetting.Value);
|
||||
|
||||
|
||||
_texture?.Invalidate();
|
||||
foreach (ArtemisDevice artemisDevice in Devices)
|
||||
artemisDevice.CalculateRenderProperties();
|
||||
OnLedsChanged();
|
||||
}
|
||||
|
||||
private void PreferredGraphicsContextOnSettingChanged(object? sender, EventArgs e)
|
||||
{
|
||||
ApplyPreferredGraphicsContext(false);
|
||||
}
|
||||
|
||||
public IReadOnlyCollection<ArtemisDevice> EnabledDevices { get; }
|
||||
public IReadOnlyCollection<ArtemisDevice> Devices { get; }
|
||||
public IReadOnlyDictionary<Led, ArtemisLed> LedMap { get; private set; }
|
||||
@ -271,6 +285,7 @@ namespace Artemis.Core.Services
|
||||
|
||||
private IManagedGraphicsContext? _newGraphicsContext;
|
||||
|
||||
|
||||
public SKTexture OpenRender()
|
||||
{
|
||||
if (RenderOpen)
|
||||
@ -333,6 +348,40 @@ namespace Artemis.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyPreferredGraphicsContext(bool forceSoftware)
|
||||
{
|
||||
if (forceSoftware)
|
||||
{
|
||||
_logger.Warning("Startup argument '--force-software-render' is applied, forcing software rendering");
|
||||
UpdateGraphicsContext(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_preferredGraphicsContext.Value == "Software")
|
||||
{
|
||||
UpdateGraphicsContext(null);
|
||||
return;
|
||||
}
|
||||
|
||||
IGraphicsContextProvider? provider = _kernel.TryGet<IGraphicsContextProvider>();
|
||||
if (provider == null)
|
||||
{
|
||||
_logger.Warning("No graphics context provider found, defaulting to software rendering");
|
||||
UpdateGraphicsContext(null);
|
||||
return;
|
||||
}
|
||||
|
||||
IManagedGraphicsContext? context = provider.GetGraphicsContext(_preferredGraphicsContext.Value);
|
||||
if (context == null)
|
||||
{
|
||||
_logger.Warning("No graphics context named '{Context}' found, defaulting to software rendering", _preferredGraphicsContext.Value);
|
||||
UpdateGraphicsContext(null);
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateGraphicsContext(context);
|
||||
}
|
||||
|
||||
public void UpdateGraphicsContext(IManagedGraphicsContext? managedGraphicsContext)
|
||||
{
|
||||
if (ReferenceEquals(managedGraphicsContext, Constants.ManagedGraphicsContext))
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
<PackageReference Include="Microsoft.Win32" Version="2.0.1" />
|
||||
<PackageReference Include="RawInput.Sharp" Version="0.0.4" />
|
||||
<PackageReference Include="ReactiveUI" Version="17.1.50" />
|
||||
<PackageReference Include="SkiaSharp.Vulkan.SharpVk" Version="2.80.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj" />
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Artemis.UI.Shared.Providers;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared.Providers;
|
||||
using Artemis.UI.Windows.Providers;
|
||||
using Ninject.Modules;
|
||||
|
||||
@ -12,6 +13,7 @@ public class WindowsModule : NinjectModule
|
||||
public override void Load()
|
||||
{
|
||||
Kernel!.Bind<ICursorProvider>().To<CursorProvider>().InSingletonScope();
|
||||
Kernel!.Bind<IGraphicsContextProvider>().To<GraphicsContextProvider>().InSingletonScope();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
26
src/Artemis.UI.Windows/Providers/GraphicsContextProvider.cs
Normal file
26
src/Artemis.UI.Windows/Providers/GraphicsContextProvider.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.Core.SkiaSharp;
|
||||
using Artemis.UI.Windows.SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Windows.Providers;
|
||||
|
||||
public class GraphicsContextProvider : IGraphicsContextProvider
|
||||
{
|
||||
private VulkanContext? _vulkanContext;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyCollection<string> GraphicsContextNames => new List<string> {"Vulkan"}.AsReadOnly();
|
||||
|
||||
/// <inheritdoc />
|
||||
public IManagedGraphicsContext? GetGraphicsContext(string name)
|
||||
{
|
||||
if (name == "Vulkan")
|
||||
{
|
||||
_vulkanContext ??= new VulkanContext();
|
||||
return _vulkanContext;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
21
src/Artemis.UI.Windows/SkiaSharp/Vulkan/Kernel32.cs
Normal file
21
src/Artemis.UI.Windows/SkiaSharp/Vulkan/Kernel32.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Artemis.UI.Windows.SkiaSharp.Vulkan;
|
||||
|
||||
internal class Kernel32
|
||||
{
|
||||
private const string kernel32 = "kernel32.dll";
|
||||
|
||||
static Kernel32()
|
||||
{
|
||||
CurrentModuleHandle = GetModuleHandle(null);
|
||||
if (CurrentModuleHandle == IntPtr.Zero)
|
||||
throw new Exception("Could not get module handle.");
|
||||
}
|
||||
|
||||
public static IntPtr CurrentModuleHandle { get; }
|
||||
|
||||
[DllImport(kernel32, CallingConvention = CallingConvention.Winapi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
|
||||
public static extern IntPtr GetModuleHandle([MarshalAs(UnmanagedType.LPTStr)] string lpModuleName);
|
||||
}
|
||||
34
src/Artemis.UI.Windows/SkiaSharp/Vulkan/VkContext.cs
Normal file
34
src/Artemis.UI.Windows/SkiaSharp/Vulkan/VkContext.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using SharpVk;
|
||||
using SharpVk.Khronos;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Windows.SkiaSharp.Vulkan;
|
||||
|
||||
internal class VkContext : IDisposable
|
||||
{
|
||||
public virtual Instance Instance { get; protected set; }
|
||||
|
||||
public virtual PhysicalDevice PhysicalDevice { get; protected set; }
|
||||
|
||||
public virtual Surface Surface { get; protected set; }
|
||||
|
||||
public virtual Device Device { get; protected set; }
|
||||
|
||||
public virtual Queue GraphicsQueue { get; protected set; }
|
||||
|
||||
public virtual Queue PresentQueue { get; protected set; }
|
||||
|
||||
public virtual uint GraphicsFamily { get; protected set; }
|
||||
|
||||
public virtual uint PresentFamily { get; protected set; }
|
||||
|
||||
public virtual GRVkGetProcedureAddressDelegate GetProc { get; protected set; }
|
||||
|
||||
public virtual GRSharpVkGetProcedureAddressDelegate SharpVkGetProc { get; protected set; }
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
Instance?.Dispose();
|
||||
}
|
||||
}
|
||||
87
src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs
Normal file
87
src/Artemis.UI.Windows/SkiaSharp/Vulkan/Win32VkContext.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Avalonia.Win32;
|
||||
using SharpVk;
|
||||
using SharpVk.Khronos;
|
||||
|
||||
namespace Artemis.UI.Windows.SkiaSharp.Vulkan;
|
||||
|
||||
internal sealed class Win32VkContext : VkContext
|
||||
{
|
||||
public Win32VkContext()
|
||||
{
|
||||
Window = new WindowImpl();
|
||||
Instance = Instance.Create(null, new[] {"VK_KHR_surface", "VK_KHR_win32_surface"});
|
||||
PhysicalDevice = Instance.EnumeratePhysicalDevices().First();
|
||||
Surface = Instance.CreateWin32Surface(Kernel32.CurrentModuleHandle, Window.Handle.Handle);
|
||||
|
||||
(GraphicsFamily, PresentFamily) = FindQueueFamilies();
|
||||
|
||||
DeviceQueueCreateInfo[] queueInfos =
|
||||
{
|
||||
new() {QueueFamilyIndex = GraphicsFamily, QueuePriorities = new[] {1f}},
|
||||
new() {QueueFamilyIndex = PresentFamily, QueuePriorities = new[] {1f}}
|
||||
};
|
||||
Device = PhysicalDevice.CreateDevice(queueInfos, null, null);
|
||||
GraphicsQueue = Device.GetQueue(GraphicsFamily, 0);
|
||||
PresentQueue = Device.GetQueue(PresentFamily, 0);
|
||||
|
||||
GetProc = Proc;
|
||||
|
||||
SharpVkGetProc = (name, instance, device) =>
|
||||
{
|
||||
if (device != null)
|
||||
return device.GetProcedureAddress(name);
|
||||
if (instance != null)
|
||||
return instance.GetProcedureAddress(name);
|
||||
|
||||
// SharpVk includes the static functions on Instance, but this is not actually correct
|
||||
// since the functions are static, they are not tied to an instance. For example,
|
||||
// VkCreateInstance is not found on an instance, it is creating said instance.
|
||||
// Other libraries, such as VulkanCore, use another type to do this.
|
||||
return Instance.GetProcedureAddress(name);
|
||||
};
|
||||
}
|
||||
|
||||
public WindowImpl Window { get; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
Window.Dispose();
|
||||
}
|
||||
|
||||
private IntPtr Proc(string name, IntPtr instanceHandle, IntPtr deviceHandle)
|
||||
{
|
||||
if (deviceHandle != IntPtr.Zero)
|
||||
return Device.GetProcedureAddress(name);
|
||||
|
||||
return Instance.GetProcedureAddress(name);
|
||||
}
|
||||
|
||||
private (uint, uint) FindQueueFamilies()
|
||||
{
|
||||
QueueFamilyProperties[] queueFamilyProperties = PhysicalDevice.GetQueueFamilyProperties();
|
||||
|
||||
var graphicsFamily = queueFamilyProperties
|
||||
.Select((properties, index) => new {properties, index})
|
||||
.SkipWhile(pair => !pair.properties.QueueFlags.HasFlag(QueueFlags.Graphics))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (graphicsFamily == null)
|
||||
throw new Exception("Unable to find graphics queue");
|
||||
|
||||
uint? presentFamily = default;
|
||||
|
||||
for (uint i = 0; i < queueFamilyProperties.Length; ++i)
|
||||
{
|
||||
if (PhysicalDevice.GetSurfaceSupport(i, Surface))
|
||||
presentFamily = i;
|
||||
}
|
||||
|
||||
if (!presentFamily.HasValue)
|
||||
throw new Exception("Unable to find present queue");
|
||||
|
||||
return ((uint) graphicsFamily.index, presentFamily.Value);
|
||||
}
|
||||
}
|
||||
64
src/Artemis.UI.Windows/SkiaSharp/VulkanContext.cs
Normal file
64
src/Artemis.UI.Windows/SkiaSharp/VulkanContext.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using Artemis.Core.SkiaSharp;
|
||||
using Artemis.UI.Exceptions;
|
||||
using Artemis.UI.Windows.SkiaSharp.Vulkan;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Windows.SkiaSharp
|
||||
{
|
||||
public class VulkanContext : IManagedGraphicsContext
|
||||
{
|
||||
private readonly GRVkBackendContext _vulkanBackendContext;
|
||||
private readonly Win32VkContext _vulkanContext;
|
||||
|
||||
public VulkanContext()
|
||||
{
|
||||
// Try everything in separate try-catch blocks to provide some accuracy in error reporting
|
||||
try
|
||||
{
|
||||
_vulkanContext = new Win32VkContext();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisGraphicsContextException("Failed to create Vulkan context", e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_vulkanBackendContext = new GRVkBackendContext
|
||||
{
|
||||
VkInstance = (IntPtr) _vulkanContext.Instance.RawHandle.ToUInt64(),
|
||||
VkPhysicalDevice = (IntPtr) _vulkanContext.PhysicalDevice.RawHandle.ToUInt64(),
|
||||
VkDevice = (IntPtr) _vulkanContext.Device.RawHandle.ToUInt64(),
|
||||
VkQueue = (IntPtr) _vulkanContext.GraphicsQueue.RawHandle.ToUInt64(),
|
||||
GraphicsQueueIndex = _vulkanContext.GraphicsFamily,
|
||||
GetProcedureAddress = _vulkanContext.GetProc
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisGraphicsContextException("Failed to create Vulkan backend context", e);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
GraphicsContext = GRContext.CreateVulkan(_vulkanBackendContext);
|
||||
if (GraphicsContext == null)
|
||||
throw new ArtemisGraphicsContextException("GRContext.CreateVulkan returned null");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArtemisGraphicsContextException("Failed to create Vulkan graphics context", e);
|
||||
}
|
||||
|
||||
GraphicsContext.Flush();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public GRContext GraphicsContext { get; }
|
||||
}
|
||||
}
|
||||
@ -90,6 +90,16 @@
|
||||
"Splat": "14.1.45"
|
||||
}
|
||||
},
|
||||
"SkiaSharp.Vulkan.SharpVk": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.80.3, )",
|
||||
"resolved": "2.80.3",
|
||||
"contentHash": "IeR9oOHBsJUqpuVs23XgZXnrFV6WuOTaLpFhLVlXt2XILWIRrlrqx1PILgJm5bLqesceJLYZyMxVb/Ow7/uReA==",
|
||||
"dependencies": {
|
||||
"SharpVk": "0.4.2",
|
||||
"SkiaSharp": "2.80.3"
|
||||
}
|
||||
},
|
||||
"Avalonia.Angle.Windows.Natives": {
|
||||
"type": "Transitive",
|
||||
"resolved": "2.1.0.2020091801",
|
||||
@ -738,6 +748,15 @@
|
||||
"Serilog": "2.10.0"
|
||||
}
|
||||
},
|
||||
"SharpVk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.2",
|
||||
"contentHash": "0CzZJWKw6CTmxKOXzCCyTKCD7tZB6g2+tm2VSSCXWTHlIMHxlRzbH5BaqkYCGo9Y23wp0hPuz2U3NifMH1VI6w==",
|
||||
"dependencies": {
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.4.0",
|
||||
"System.ValueTuple": "4.4.0"
|
||||
}
|
||||
},
|
||||
"ShimSkiaSharp": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.5.12",
|
||||
|
||||
@ -3,8 +3,10 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:svg="clr-namespace:Avalonia.Svg.Skia;assembly=Avalonia.Svg.Skia"
|
||||
xmlns:root="clr-namespace:Artemis.UI.Screens.Root"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Root.SplashView"
|
||||
x:DataType="root:SplashViewModel"
|
||||
Icon="/Assets/Images/Logo/application.ico"
|
||||
Title="Artemis 2.0"
|
||||
Height="450"
|
||||
@ -20,12 +22,13 @@
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBlock Grid.Row="1"
|
||||
Classes="h5"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Bottom"
|
||||
TextWrapping="Wrap">
|
||||
Artemis is initializing...
|
||||
</TextBlock>
|
||||
<TextBlock Grid.Row="2" HorizontalAlignment="Center" Text="{Binding Status}" />
|
||||
<TextBlock Grid.Row="2" Classes="subtitle" HorizontalAlignment="Center" Text="{CompiledBinding Status}" />
|
||||
<ProgressBar Grid.Row="3" IsIndeterminate="True" Margin="16 0" />
|
||||
</Grid>
|
||||
</Window>
|
||||
@ -55,7 +55,7 @@ namespace Artemis.UI.Screens.Root
|
||||
|
||||
private void PluginManagementServiceOnPluginFeatureEnabling(object? sender, PluginFeatureEventArgs e)
|
||||
{
|
||||
Status = "Enabling: " + e.PluginFeature.GetType().Name.Humanize();
|
||||
Status = "Enabling: " + e.PluginFeature.Info.Name;
|
||||
}
|
||||
|
||||
private void PluginManagementServiceOnPluginFeatureEnabled(object? sender, PluginFeatureEventArgs e)
|
||||
|
||||
@ -13,6 +13,7 @@ using Artemis.Core.Services;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared;
|
||||
using Avalonia;
|
||||
using DynamicData;
|
||||
using FluentAvalonia.Styling;
|
||||
using ReactiveUI;
|
||||
using Serilog.Events;
|
||||
@ -26,15 +27,19 @@ namespace Artemis.UI.Screens.Settings
|
||||
private readonly IDebugService _debugService;
|
||||
private readonly FluentAvaloniaTheme _fluentAvaloniaTheme;
|
||||
|
||||
public GeneralTabViewModel(ISettingsService settingsService, IPluginManagementService pluginManagementService, IDebugService debugService)
|
||||
public GeneralTabViewModel(ISettingsService settingsService, IPluginManagementService pluginManagementService, IDebugService debugService, IGraphicsContextProvider? graphicsContextProvider)
|
||||
{
|
||||
DisplayName = "General";
|
||||
_settingsService = settingsService;
|
||||
_debugService = debugService;
|
||||
_fluentAvaloniaTheme = AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>();
|
||||
|
||||
|
||||
List<LayerBrushProvider> layerBrushProviders = pluginManagementService.GetFeaturesOfType<LayerBrushProvider>();
|
||||
LayerBrushDescriptors = new ObservableCollection<LayerBrushDescriptor>(layerBrushProviders.SelectMany(l => l.LayerBrushDescriptors));
|
||||
GraphicsContexts = new ObservableCollection<string> {"Software"};
|
||||
if (graphicsContextProvider != null)
|
||||
GraphicsContexts.AddRange(graphicsContextProvider.GraphicsContextNames);
|
||||
|
||||
_defaultLayerBrushDescriptor = _settingsService.GetSetting("ProfileEditor.DefaultLayerBrushDescriptor", new LayerBrushReference
|
||||
{
|
||||
LayerBrushProviderId = "Artemis.Plugins.LayerBrushes.Color.ColorBrushProvider-92a9d6ba",
|
||||
@ -46,7 +51,7 @@ namespace Artemis.UI.Screens.Settings
|
||||
ShowSetupWizard = ReactiveCommand.Create(ExecuteShowSetupWizard);
|
||||
ShowDebugger = ReactiveCommand.Create(ExecuteShowDebugger);
|
||||
ShowDataFolder = ReactiveCommand.Create(ExecuteShowDataFolder);
|
||||
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
UIColorScheme.SettingChanged += UIColorSchemeOnSettingChanged;
|
||||
@ -73,12 +78,7 @@ namespace Artemis.UI.Screens.Settings
|
||||
public ReactiveCommand<Unit, Unit> ShowDataFolder { get; }
|
||||
|
||||
public ObservableCollection<LayerBrushDescriptor> LayerBrushDescriptors { get; }
|
||||
|
||||
public ObservableCollection<string> GraphicsContexts { get; } = new()
|
||||
{
|
||||
"Software",
|
||||
"Vulkan"
|
||||
};
|
||||
public ObservableCollection<string> GraphicsContexts { get; }
|
||||
|
||||
public ObservableCollection<RenderSettingViewModel> RenderScales { get; } = new()
|
||||
{
|
||||
@ -111,7 +111,7 @@ namespace Artemis.UI.Screens.Settings
|
||||
get => RenderScales.FirstOrDefault(s => Math.Abs(s.Value - CoreRenderScale.Value) < 0.01);
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
if (value != null)
|
||||
CoreRenderScale.Value = value.Value;
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ namespace Artemis.UI.Screens.Settings
|
||||
get => TargetFrameRates.FirstOrDefault(s => Math.Abs(s.Value - CoreTargetFrameRate.Value) < 0.01);
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
if (value != null)
|
||||
CoreTargetFrameRate.Value = (int) value.Value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
void RegisterBuiltInDataModelInputs();
|
||||
void RegisterBuiltInPropertyEditors();
|
||||
void RegisterControllers();
|
||||
void ApplyPreferredGraphicsContext();
|
||||
void RegisterBuiltInNodeTypes();
|
||||
}
|
||||
}
|
||||
@ -90,11 +90,7 @@ public class RegistrationService : IRegistrationService
|
||||
public void RegisterControllers()
|
||||
{
|
||||
}
|
||||
|
||||
public void ApplyPreferredGraphicsContext()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void RegisterBuiltInNodeTypes()
|
||||
{
|
||||
_nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(bool), new SKColor(0xFFCD3232));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user