Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored WASM rendering, added MT support for dispatcher #15709

Merged
merged 4 commits into from
May 14, 2024

Conversation

kekekeks
Copy link
Member

@kekekeks kekekeks commented May 13, 2024

  1. Removed previous hacks with fake platform graphics context and special cased ISkiaGpu, we are now using a proper IGlContext implementation with MakeCurrent that actually works as it supposed to.
  2. Refactored canvas management in a way that can work with .NET 9 MT - canvas can be converted to OffscreenCanvas and transferred to a web worker
  3. Changed render loop and dispatcher to be MT-compatible (.NET 9 MT currently doesn't support JSType.Function)

Note that the rest of the backend isn't MT-ready, so input and resize still won't work in MT mode.

@kekekeks kekekeks force-pushed the feature/web-render-refactor branch from ba2bd7d to 44402a9 Compare May 13, 2024 16:55
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048403-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

maxkatz6
maxkatz6 previously approved these changes May 14, 2024
@maxkatz6

This comment was marked as resolved.

@maxkatz6
Copy link
Member

After hack-fixing previous error by also checking Environment.Version >= 9 I see this:

[Visual]Exception in render loop: 'System.DllNotFoundException: *
dotnet.native.js:1268    at Avalonia.OpenGL.GlBasicInfoInterface.Initialize(Func`2 getProcAddress) in /Users/maxkatz6/repos/Avalonia/src/Avalonia.OpenGL/DevGenerators/Generator.GetProcAddressInitializationGenerator/globalAvalonia.OpenGL.GlBasicInfoInterface.cs:line 38
dotnet.native.js:1268    at Avalonia.OpenGL.GlBasicInfoInterface..ctor(Func`2 getProcAddress) in /Users/maxkatz6/repos/Avalonia/src/Avalonia.OpenGL/GlBasicInfoInterface.cs:line 13
dotnet.native.js:1268    at Avalonia.OpenGL.GlInterface.GlContextInfo.Create(GlVersion version, Func`2 getProcAddress) in /Users/maxkatz6/repos/Avalonia/src/Avalonia.OpenGL/GlInterface.cs:line 32
dotnet.native.js:1268    at Avalonia.OpenGL.GlInterface..ctor(GlVersion version, Func`2 getProcAddress) in /Users/maxkatz6/repos/Avalonia/src/Avalonia.OpenGL/GlInterface.cs:line 48
dotnet.native.js:1268    at Avalonia.Browser.Rendering.WebGlContext..ctor(Int32 contextId, GlVersion version, Int32 sampleCount, Int32 stencilSize) in /Users/maxkatz6/repos/Avalonia/src/Browser/Avalonia.Browser/Rendering/BrowserWebGlRenderTarget.cs:line 114
dotnet.native.js:1268    at Avalonia.Browser.Rendering.BrowserWebGlRenderTarget..ctor(JSObject js, Func`1 sizeGetter) in /Users/maxkatz6/repos/Avalonia/src/Browser/Avalonia.Browser/Rendering/BrowserWebGlRenderTarget.cs:line 31
dotnet.native.js:1268    at Avalonia.Browser.Rendering.BrowserRenderTarget.GetRenderTarget(Int32 id, Func`1 sizeGetter) in /Users/maxkatz6/repos/Avalonia/src/Browser/Avalonia.Browser/Rendering/WebRenderTarget.cs:line 31
dotnet.native.js:1268    at Avalonia.Browser.Rendering.RenderTargetBrowserSurface.BrowserPlatformGraphics.get_Target() in /Users/maxkatz6/repos/Avalonia/src/Browser/Avalonia.Browser/Rendering/RenderTargetBrowserSurface.cs:line 63
dotnet.native.js:1268    at Avalonia.Browser.Rendering.RenderTargetBrowserSurface.BrowserPlatformGraphics.get_IsReady() in /Users/maxkatz6/repos/Avalonia/src/Browser/Avalonia.Browser/Rendering/RenderTargetBrowserSurface.cs:line 65
dotnet.native.js:1268    at Avalonia.Rendering.PlatformRenderInterfaceContextManager.get_IsReady() in /Users/maxkatz6/repos/Avalonia/src/Avalonia.Base/Rendering/PlatformRenderInterfaceContextManager.cs:line 25
dotnet.native.js:1268    at Avalonia.Rendering.Composition.Server.ServerCompositor.RenderCore(Boolean catchExceptions) in /Users/maxkatz6/repos/Avalonia/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs:line 221
dotnet.native.js:1268    at Avalonia.Rendering.Composition.Server.ServerCompositor.RenderReentrancySafe(Boolean catchExceptions) in /Users/maxkatz6/repos/Avalonia/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs:line 194
dotnet.native.js:1268    at Avalonia.Rendering.Composition.Server.ServerCompositor.Render(Boolean catchExceptions) in /Users/maxkatz6/repos/Avalonia/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs:line 174
dotnet.native.js:1268    at Avalonia.Rendering.Composition.Server.ServerCompositor.Render() in /Users/maxkatz6/repos/Avalonia/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositor.cs:line 163
dotnet.native.js:1268    at Avalonia.Rendering.RenderLoop.TimerTick(TimeSpan time) in /Users/maxkatz6/repos/Avalonia/src/Avalonia.Base/Rendering/RenderLoop.cs:line 111' (RenderLoop #660812652)

Note sure what to do here. That's running on .NET 8 SDK without threading.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048435-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0048443-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@kekekeks kekekeks enabled auto-merge May 14, 2024 13:41
@kekekeks kekekeks added this pull request to the merge queue May 14, 2024
Merged via the queue into master with commit 864ecfd May 14, 2024
11 checks passed
@kekekeks kekekeks deleted the feature/web-render-refactor branch May 14, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants