Skip to content

Commit 4fab647

Browse files
jmacatodanwalmsley
authored andcommitted
Merge pull request AvaloniaUI#7968 from AvaloniaUI/feature/win32-gpu-blacklist
add win32 egl gpu blacklist.
1 parent 0c2aa70 commit 4fab647

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/Windows/Avalonia.Win32/Win32GlManager.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,23 @@ public static void Initialize()
2424
{
2525
var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay());
2626

27-
if (egl != null && opts.UseWindowsUIComposition)
27+
if (egl != null)
2828
{
29-
WinUICompositorConnection.TryCreateAndRegister(egl, opts.CompositionBackdropCornerRadius);
29+
if (opts.EglRendererBlacklist != null)
30+
{
31+
foreach (var item in opts.EglRendererBlacklist)
32+
{
33+
if (egl.PrimaryEglContext.GlInterface.Renderer.Contains(item))
34+
{
35+
return null;
36+
}
37+
}
38+
}
39+
40+
if (opts.UseWindowsUIComposition)
41+
{
42+
WinUICompositorConnection.TryCreateAndRegister(egl, opts.CompositionBackdropCornerRadius);
43+
}
3044
}
3145

3246
return egl;

src/Windows/Avalonia.Win32/Win32Platform.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ public class Win32PlatformOptions
5656
/// GPU rendering will not be enabled if this is set to false.
5757
/// </remarks>
5858
public bool? AllowEglInitialization { get; set; }
59+
60+
public IList<string> EglRendererBlacklist { get; set; } = new List<string>
61+
{
62+
"Microsoft Basic Render"
63+
};
5964

6065
/// <summary>
6166
/// Enables multitouch support. The default value is true.

0 commit comments

Comments
 (0)