AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.76k stars 2.23k forks source link

Hardware-accelerated Skia RenderTargetBitmap #2616

Open kekekeks opened 5 years ago

kekekeks commented 5 years ago

For now it was disabled because of threading issues and memory corruption: https://github.com/AvaloniaUI/Avalonia/pull/2615

It can be easily reproduced on Linux with GLX and requires some less trivial steps on Windows with EGL/ANGLE. Haven't checked on OSX, but I suspect that the firework there would be even more spectacular.

I had several attempts to fix it in rtb-gl-fixes branch, but it seems that we need to have two GrContext instances with appropriate locking model.

kekekeks commented 5 years ago

Basically we need something like this: ___________

with proper locks to avoid concurrent access to: 1) GrContext 2) OpenGL 3) SkSurface 4) OpenGL texture

Also, we need to make sure that GrContext/OpenGL context are properly switched when drawing context is created and destroyed.

kekekeks commented 5 years ago

Note: some requirements that any other proposed solution has to meet