Skip to content

Commit

Permalink
Merge pull request AvaloniaUI#7968 from AvaloniaUI/feature/win32-gpu-…
Browse files Browse the repository at this point in the history
…blacklist

add win32 egl gpu blacklist.
  • Loading branch information
jmacato authored and danwalmsley committed May 10, 2022
1 parent 0c2aa70 commit 4fab647
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Windows/Avalonia.Win32/Win32GlManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,23 @@ public static void Initialize()
{
var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay());

if (egl != null && opts.UseWindowsUIComposition)
if (egl != null)
{
WinUICompositorConnection.TryCreateAndRegister(egl, opts.CompositionBackdropCornerRadius);
if (opts.EglRendererBlacklist != null)
{
foreach (var item in opts.EglRendererBlacklist)
{
if (egl.PrimaryEglContext.GlInterface.Renderer.Contains(item))
{
return null;
}
}
}

if (opts.UseWindowsUIComposition)
{
WinUICompositorConnection.TryCreateAndRegister(egl, opts.CompositionBackdropCornerRadius);
}
}

return egl;
Expand Down
5 changes: 5 additions & 0 deletions src/Windows/Avalonia.Win32/Win32Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public class Win32PlatformOptions
/// GPU rendering will not be enabled if this is set to false.
/// </remarks>
public bool? AllowEglInitialization { get; set; }

public IList<string> EglRendererBlacklist { get; set; } = new List<string>
{
"Microsoft Basic Render"
};

/// <summary>
/// Enables multitouch support. The default value is true.
Expand Down

0 comments on commit 4fab647

Please sign in to comment.