Browse Source

Fixes #5281: Default to EGL initialization if no options are provided and OS is at least Windows 8

pull/5283/head
Sebastian Hartte 6 years ago
parent
commit
e3a7b78ec3
  1. 8
      src/Windows/Avalonia.Win32/Win32GlManager.cs

8
src/Windows/Avalonia.Win32/Win32GlManager.cs

@ -9,6 +9,8 @@ namespace Avalonia.Win32
{ {
static class Win32GlManager static class Win32GlManager
{ {
private static readonly Version Windows7 = new Version(6, 1);
public static void Initialize() public static void Initialize()
{ {
AvaloniaLocator.CurrentMutable.Bind<IPlatformOpenGlInterface>().ToLazy<IPlatformOpenGlInterface>(() => AvaloniaLocator.CurrentMutable.Bind<IPlatformOpenGlInterface>().ToLazy<IPlatformOpenGlInterface>(() =>
@ -20,13 +22,11 @@ namespace Avalonia.Win32
return wgl; return wgl;
} }
if (opts?.AllowEglInitialization == true || if (opts?.AllowEglInitialization ?? Win32Platform.WindowsVersion > Windows7)
((!opts?.AllowEglInitialization.HasValue ?? false) &&
Win32Platform.WindowsVersion > new Version(6, 1)))
{ {
var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay());
if (egl is { } && if (egl != null &&
opts?.UseWindowsUIComposition == true) opts?.UseWindowsUIComposition == true)
{ {
WinUICompositorConnection.TryCreateAndRegister(egl); WinUICompositorConnection.TryCreateAndRegister(egl);

Loading…
Cancel
Save