Browse Source

Remove AvaloniaNativePlatformOptions.UseGpu as it's not supported in 11.0 (always uses GPU)

pull/11898/head
Max Katz 3 years ago
parent
commit
d42a40fda7
  1. 24
      src/Avalonia.Native/AvaloniaNativePlatform.cs
  2. 6
      src/Avalonia.Native/AvaloniaNativePlatformExtensions.cs
  3. 2
      src/Avalonia.Native/WindowImpl.cs
  4. 5
      src/Avalonia.Native/WindowImplBase.cs

24
src/Avalonia.Native/AvaloniaNativePlatform.cs

@ -123,20 +123,18 @@ namespace Avalonia.Native
hotkeys.MoveCursorToTheEndOfLineWithSelection.Add(new KeyGesture(Key.Right, hotkeys.CommandModifiers | hotkeys.SelectionModifiers));
AvaloniaLocator.CurrentMutable.Bind<PlatformHotkeyConfiguration>().ToConstant(hotkeys);
if (_options.UseGpu)
// TODO: add software and metal support via RenderingMode options param
try
{
_platformGl = new AvaloniaNativeGlPlatformGraphics(_factory.ObtainGlDisplay());
AvaloniaLocator.CurrentMutable
.Bind<IPlatformGraphics>().ToConstant(_platformGl);
}
catch (Exception)
{
try
{
_platformGl = new AvaloniaNativeGlPlatformGraphics(_factory.ObtainGlDisplay());
AvaloniaLocator.CurrentMutable
.Bind<IPlatformGraphics>().ToConstant(_platformGl);
}
catch (Exception)
{
// ignored
}
// ignored
}
Compositor = new Compositor(_platformGl, true);

6
src/Avalonia.Native/AvaloniaNativePlatformExtensions.cs

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Avalonia.Controls;
using Avalonia.Native;
@ -30,11 +31,6 @@ namespace Avalonia
/// </summary>
public class AvaloniaNativePlatformOptions
{
/// <summary>
/// Determines whether to use GPU for rendering in your project. The default value is true.
/// </summary>
public bool UseGpu { get; set; } = true;
/// <summary>
/// Embeds popups to the window when set to true. The default value is false.
/// </summary>

2
src/Avalonia.Native/WindowImpl.cs

@ -24,7 +24,7 @@ namespace Avalonia.Native
private bool _canResize = true;
internal WindowImpl(IAvaloniaNativeFactory factory, AvaloniaNativePlatformOptions opts,
AvaloniaNativeGlPlatformGraphics glFeature) : base(factory, opts, glFeature)
AvaloniaNativeGlPlatformGraphics glFeature) : base(factory, glFeature)
{
_opts = opts;
_glFeature = glFeature;

5
src/Avalonia.Native/WindowImplBase.cs

@ -67,11 +67,10 @@ namespace Avalonia.Native
private PlatformBehaviorInhibition _platformBehaviorInhibition;
private WindowTransparencyLevel _transparencyLevel = WindowTransparencyLevel.None;
internal WindowBaseImpl(IAvaloniaNativeFactory factory, AvaloniaNativePlatformOptions opts,
AvaloniaNativeGlPlatformGraphics glFeature)
internal WindowBaseImpl(IAvaloniaNativeFactory factory, AvaloniaNativeGlPlatformGraphics glFeature)
{
_factory = factory;
_gpu = opts.UseGpu && glFeature != null;
_gpu = glFeature != null;
_keyboard = AvaloniaLocator.Current.GetService<IKeyboardDevice>();
_mouse = new MouseDevice();

Loading…
Cancel
Save