beto-rodriguez / LiveCharts2

Simple, flexible, interactive & powerful charts, maps and gauges for .Net, LiveCharts2 can now practically run everywhere Maui, Uno Platform, Blazor-wasm, WPF, WinForms, Xamarin, Avalonia, WinUI, UWP.
https://livecharts.dev
MIT License
4.38k stars 572 forks source link

Use hardware-accelerated SKGLView #1645

Closed Kay-STL closed 2 weeks ago

Kay-STL commented 1 month ago

Is your feature request related to a problem? Please describe. In real-time charts that require high performance, using SKGLView rather than SKCanvasView results in much better frametimes. SKCanvasView is inherently software-rendered, whereas SKGLView is hardware-accelerated.

Describe the solution you'd like Not 100% sure yet, mainly just want to ask a few questions first - namely, whether entirely switching to SKGLView would be feasible or not due to e.g. view incompatibility or other issues, or whether it'd be better to just document the option of using it with a ControlTemplate.

Describe alternatives you've considered N/A

Additional context I've tested switching to SKGLView in LiveChartsCore.SkiaSharpView.Maui on Android w/ SkiaSharp 3, and the frametime bump is pretty significant - a real-time chart that previously struggled to maintain 30fps is now much closer to 60fps.

beto-rodriguez commented 3 weeks ago

See https://github.com/beto-rodriguez/LiveCharts2/tree/hardware-accelerated

that branch works, but in my test, I get more frames on the SKCanvas than SKGLView, at least on windows, not completely sure why.

Kay-STL commented 3 weeks ago

that branch works, but in my test, I get more frames on the SKCanvas than SKGLView, at least on windows, not completely sure why.

Huh, interesting - I've never had any issues with the Canvas view on Windows or iOS for what its worth, it's usually decently fast there, it's primarily Android where switching to the GL view makes a huge difference. I'm guessing the underlying SKXamlCanvas on Windows is probably fairly quick already.