Skip to content

Commit 6c03af7

Browse files
Fix GPU Issue (macOS & Windows)
d tentative Fix GPU issue Update BrowserCefApp.cs Revert "Update Program.cs" This reverts commit fd3d568. Update Program.cs Tentative GPU fix (2) Update BrowserView.axaml.cs
1 parent e05b25c commit 6c03af7

6 files changed

Lines changed: 56 additions & 24 deletions

File tree

CefGlue.BrowserProcess/CefGlue.BrowserProcess.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<RuntimeIdentifiers>osx-x64;osx-arm64;win-x64;win-arm64;linux-x64;linux-arm64</RuntimeIdentifiers>
99
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
1010
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
11+
<ApplicationManifest>app.manifest</ApplicationManifest>
1112
<PublishCommonConfig>Configuration=$(Configuration);Platform=$(Platform);TargetFramework=$(TargetFramework);IsPublishing=True;PublishTrimmed=True;SelfContained=True;RuntimeIdentifier=</PublishCommonConfig>
1213
<IsEditbinEnabled>True</IsEditbinEnabled>
1314
</PropertyGroup>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<asmv1:assembly
4+
manifestVersion="1.0"
5+
xmlns="urn:schemas-microsoft-com:asm.v1"
6+
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
7+
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
8+
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
9+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
10+
11+
<assemblyIdentity version="135.0.170.0" name="CefSharp.BrowserSubprocess.app" />
12+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
13+
<security>
14+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
15+
<!-- UAC Manifest Options
16+
If you want to change the Windows User Account Control level replace the
17+
requestedExecutionLevel node with one of the following.
18+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
19+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
20+
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
21+
22+
Specifying requestedExecutionLevel node will disable file and registry virtualization.
23+
If you want to utilize File and Registry Virtualization for backward
24+
compatibility then delete the requestedExecutionLevel node.-->
25+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
26+
</requestedPrivileges>
27+
</security>
28+
</trustInfo>
29+
30+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
31+
<application>
32+
<!-- A list of all Windows versions that this application is designed to work with.
33+
Windows will automatically select the most compatible environment.-->
34+
35+
<!-- Windows 7 -->
36+
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
37+
<!-- Windows 8 -->
38+
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
39+
<!-- Windows 8.1 -->
40+
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
41+
<!-- Windows 10 -->
42+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
43+
</application>
44+
</compatibility>
45+
</asmv1:assembly>

CefGlue.Common/BrowserCefApp.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ protected override void OnBeforeCommandLineProcessing(string processType, CefCom
2121
{
2222
if (string.IsNullOrEmpty(processType))
2323
{
24-
if (CefRuntime.Platform == CefRuntimePlatform.Linux)
24+
if (CefRuntime.Platform == CefRuntimePlatform.Linux)
2525
{
26-
commandLine.AppendSwitch("no-zygote");
26+
commandLine.AppendSwitch("no-zygote", "1");
2727
}
28+
2829
if (CefRuntimeLoader.IsOSREnabled)
2930
{
3031
commandLine.AppendSwitch("disable-gpu", "1");

CefGlue.Demo.Avalonia/BrowserView.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public BrowserView()
2525
var browserWrapper = this.FindControl<Decorator>("browserWrapper");
2626

2727
browser = new AvaloniaCefBrowser();
28-
browser.Address = "https://www.google.com";
28+
browser.Address = "https://get.webgl.org/";
2929
browser.RegisterJavascriptObject(new BindingTestClass(), "boundBeforeLoadObject");
3030
browser.LoadStart += OnBrowserLoadStart;
3131
browser.TitleChanged += OnBrowserTitleChanged;

CefGlue.Demo.Avalonia/CefGlue.Demo.Avalonia.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030
<Import Project="$(ProjectDir)..\CefGlue.CopyLocal.props" />
3131

3232
<ItemGroup>
33-
<PackageReference Include="Avalonia.Desktop" />
3433
<PackageReference Include="Dotnet.Bundle" />
34+
<PackageReference Include="Avalonia.Desktop" />
35+
<PackageReference Include="Avalonia.ReactiveUI" />
3536
<PackageReference Include="Avalonia.Diagnostics" />
3637
</ItemGroup>
3738

CefGlue.Demo.Avalonia/Program.cs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.IO;
33
using Avalonia;
4+
using Avalonia.ReactiveUI;
45
using Xilium.CefGlue.Common;
56
using Xilium.CefGlue.Common.Shared;
67

@@ -16,27 +17,10 @@ static int Main(string[] args)
1617
var cachePath = Path.Combine(Path.GetTempPath(), "CefGlue_" + Guid.NewGuid().ToString().Replace("-", null));
1718

1819
AppDomain.CurrentDomain.ProcessExit += delegate { Cleanup(cachePath); };
19-
2020
AppBuilder.Configure<App>()
21-
.UsePlatformDetect()
22-
.With(new Win32PlatformOptions())
23-
.AfterSetup(_ => CefRuntimeLoader.Initialize(new CefSettings() {
24-
RootCachePath = cachePath,
25-
#if WINDOWLESS
26-
// its recommended to leave this off (false), since its less performant and can cause more issues
27-
WindowlessRenderingEnabled = true
28-
#else
29-
WindowlessRenderingEnabled = false
30-
#endif
31-
},
32-
customSchemes: new[] {
33-
new CustomScheme()
34-
{
35-
SchemeName = "test",
36-
SchemeHandlerFactory = new CustomSchemeHandler()
37-
}
38-
}))
39-
.StartWithClassicDesktopLifetime(args);
21+
.UsePlatformDetect()
22+
.UseReactiveUI()
23+
.StartWithClassicDesktopLifetime(args);
4024

4125
return 0;
4226
}

0 commit comments

Comments
 (0)