-
Notifications
You must be signed in to change notification settings - Fork 538
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
Angle WPF #1521
base: main
Are you sure you want to change the base?
Angle WPF #1521
Conversation
Maybe it will be easier to just start with a new view that is just for GPU? Then there is no need for checks and fallback. If you are adding a GPU view to a window, then you probably would want it to fail if the GPU is not available? Also, what are the conditions that it would fail? Isn't WPF built on top of DX ? |
For a backend rendering thread, is it a lot of work? I think that is a feature that is worth adding to the base implementation. UWP is really a backend thread loop, and then I shuttle calls to the main thread. One downside of a background thread is that you can't access the UI, such as bounds, in that thread... But I have a property in UWP to toggle this feature on and off. |
The reasons ANGLE backend will fail to initialize:
I think that fallback to CPU rendering is an important feature that is need to exist in a default implementation. There is a lot of cases when user do not have a GPU device and do want to run an app to do the job done. For the instance - app can be launched in the server environment or in the virtual machine. About async GPU rendering - I have a code already, but it's specialized for out app. All I need is to think what is needed, what is not and mindfully transfer code chunk by chunk with some refactoring afterwards. It will take me a day I think. I will do it on the weekend. Do you want it as a single PR? Or let's just do this simple PR first and then add an async things via separate PR. |
For the async bits, how much of a change to add it? I was thinking that if it is going to be a bit of re-engineering then maybe not duplicate work? |
Something just occurred to me. The software fallback seemed a bit weird and I didn't recall even needing that for UWP. I didn't actually do all the testing, but I now recall that DX has a software rasterizer: WARP. Isn't that the fallback? Or is it not enough? https://docs.microsoft.com/en-us/windows/win32/direct3darticles/directx-warp#enabling-rendering-when-direct3d-hardware-is-not-available When I create the dives, I try a few layers, DX11, DX9, WARP: https://github.com/mono/SkiaSharp/blob/master/source/SkiaSharp.Views/SkiaSharp.Views.UWP/GlesInterop/GlesContext.cs#L195 |
Why do you need ANGLE? The 84th milestone already has support for the D3D backend, you need to add bindings. |
Do we know how far that support is? It is very recent. I'll check with them. |
@AnarchyMob WoW. Awesome news! Can't wait to use DirectX backend in our app. Is there any issue exists about D3D backend? If no - let's create one? @mattleibow About async bits - OK. I'll add them to this PR on a weekend. About fallback - I've asked my QA team to test the fallback code in our app in case I've missed something. That's why my response have a large delay. |
Hi, thanks for your work on this issue!
I think it would be immensely helpful to allow multiple instances. In my case, I define a DataTemplate like
and frequently create multiple instances using an ItemsControl. |
Update on a PR status:
|
Description of Change
I've added working ANGLE approach to the SkiaSharp.Views.WPF that enables GPU rendering with minimum performance overhead on transferring draw calls between OpenGL and DirectX.
This version of code is a minimum working example that's have minimum changes to the SKElement code. I've decided to do so to make PR as simple as I can, so it will be easy to understand the code and make some changes to it, if we will need some.
[WARNING]
ANGLE libs are attached by Avalonia nuget package, but it has an issue, somehow it do not copy angle libs to the connected projects output, like WPF sample. So to make ANGLE working you need to copy libs manually. We need to ask and make an update to Avalonia nuget package or make SkiaSharp ANGLE libs package that supports dlls copying to connected projects.
If this PR will be merged I will continue the work and add support of rendering in specific thread, and other tweaks.
Bugs Added
API Changes
Added:
GLMode SKElement.Mode { get; }
GRContext SKElement.GRContext { get; }
void SKElement.StopRenderAndDisposeAllUnmanagedResources()
Behavioral Changes
PR Checklist