dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.09k stars 1.17k forks source link

Support the latest Direct3D API #3996

Open JensNordenbro opened 3 years ago

JensNordenbro commented 3 years ago

As I understand it WPF does not use the latest versions of Direct3D. This disallows GPU backed HW-acceleration for certain scenarios.

Implement support for latest Direct3D.

lindexi commented 3 years ago

@JensNordenbro See https://github.com/dotnet/wpf/issues/85

JensNordenbro commented 3 years ago

@lindexi, that would be Nice but it does not seem to be in Microsofts interest right now. I hope this change is not to big and it would create value!

JensNordenbro commented 3 years ago

I could also imagine wpf being layered on top of low level WinUI apis as a part of project Reunion. Wpf in net7, net8 does not have to be 100 procent compatible between versions...it is more important that the graphics pipeline is being cared for.

Maybe https://github.com/microsoft/Win2D/issues/707 can have additional Project Reunion synergies.

xiejiang2014 commented 3 years ago

see this https://github.com/Mikolaytis/WpfSkiaAngleSharpDxOpenTK

Use SkiaSharp, OpenTK ,complete hardware acceleration, high frame rate, no "airspace" problem. But there are still some small problems, App crash on PC Sleep and other Device Lost events.

More details: https://github.com/mono/SkiaSharp/issues/745

JensNordenbro commented 3 years ago

Hi @xiejiang2014! I tried the Demo in the repo but in only showed a white window and then crashed a couple of seconds later.

Also that repo is using OpenGL and not in line with my goal of having WPF targeting the lastest DirectX/Direct3D API so that all components can be accelerated by the native Windows approach of UI acceleration.

JensNordenbro commented 3 years ago

Maybe https://devblogs.microsoft.com/directx/open-sourcing-direct3d-9-on-12-and-the-release-of-the-dxbc-signer-nuget-package/#comments can be used as an intermediary.

lindexi commented 3 years ago

See https://github.com/microsoft/D3D9On12

gaetandezeiraud commented 3 years ago

I do not have the skills on WPF to do the integration of D3D9On12. But seems a good solution. Need a try to see if it breaks things.

Edit: I trying to implement it. I do not guarantee anything. First, I assume that all DX9 related code is inside WpfGfx (https://github.com/dotnet/wpf/tree/89d172db0b7a192de720c6cfba5e28a1e7d46123/src/Microsoft.DotNet.Wpf/src/WpfGfx)

JensNordenbro commented 2 years ago

Sounds good ; Let me know if you acheive some success and maybe I can try on my ARM64 device.

gaetandezeiraud commented 2 years ago

I got a little carried away. And I haven't had time to look into it yet.

chrisk414 commented 2 years ago

Epic just released Unreal5 and their latest tech, Ninite, only runs under DX12. I tried to host UE5(DX12) on wpf and it failed. Yeah other UE4 app runs just fine with WPF.

So, my question is, is WPF ever going to get DX update? If not, has anyone succeeded hosting DX12 app? Unable to host UE5 is a deal-breaker for me and I would appreciate if you can help.

Many thanks.

gaetandezeiraud commented 2 years ago

WPF is dead. Try Avalonia UI.

glyad commented 2 years ago

Avalonia

Dear @Brouilles, thousands of apps developed with WPF aren't dead and require to add new features. When I'll be able to run WPF based apps on Avalonia without to change a single line of the code, I'm promising you, I'll start to use Avalonia.

greatawesome commented 1 year ago

Avalonia

Dear @Brouilles, thousands of apps developed with WPF aren't dead and require to add new features. When I'll be able to run WPF based apps on Avalonia without to change a single line of the code, I'm promising you, I'll start to use Avalonia.

That day might be here: https://avaloniaui.net/XPF