microsoft / WPFDXInterop

Repo for WPF DX Interop support
MIT License
307 stars 98 forks source link

WPF improvement: Want DirectX hosted in WPF to support higher than 60fps #3

Open rrelyea opened 8 years ago

rrelyea commented 8 years ago

[Originally filed by QuantumDeveloper as part of "D3DImage possible issues" https://github.com/Microsoft/WPFDXInterop/issues/2]

As far as I understand, in d3dImage rendering occurs only when OnRender arrives, but what if I have rendering in another thread in while loop and I want to keep rendering without UI thread, but I just need IntPtr to tell swapchain where to render? Could I render to D3DImage independent from OnRender?

Now I can render in the separate thread to the WinForm surface without any problems with any FPS my PC can reach, but I have only one issue - well known airspace problem. D3DImage could relieve me from it, but it creates a lot of other issues.

All this issues, obviously not that I expect when creating request on visualstudio.uservoice.com for Native DX 11 support for WPF. The goal was high performance immediate mode rendering, but here we still have the same 60 fps.

And my question is: could this be fixed or this will leave forever?

QuantumDeveloper commented 8 years ago

BTW, keep hosting D3D11Image in WPF loop will also make application stuck while processing of DX content. The same thing here is with original D3DImage control. Performance of the whole application is decreasing while rendering heavy content inside D3DImage.

weltkante commented 8 years ago

Is it even possible to render more than 60 fps with applications not covering the full screen? Isn't dwm just dropping frames in this case? (I.e. you deliver >60fps but dwm - which is responsible for composing multiple windowed applications - still composes at the display refresh rate, because anything else would cause tearing?)

Maybe the requirements should be clarified. Are you talking about a windowed WPF application, or one covering the full screen? For the latter it is a reasonable request, I believe dwm will autodetect if a single application covers the screen and stop composing, so >60 fps are possible.

PS: sorry if anything I said is technically wrong, I'm just asking for clarification.

QuantumDeveloper commented 8 years ago

Now I am rendering in Winforms control hosted inside WPF and it renderes af fast as it can and it much more hiher that 60 fps. For 60 Hz displays it could drop frames, but what if I have 120Hz display? WPF still could not render more than 60 frame per second just because of internal loop implementation.

MaulingMonkey commented 8 years ago

If the 60fps limit is just from vsync lock, a 120Hz display would vsync at 120fps automatically.

dotMorten commented 6 years ago

I'd be happy if I can at least get 60fps and not be completely UI bound like this thing is. For any sufficiently advanced rendering, rendering on the UI thread is really bad. I mean it works great if you have 1-2ms render times. Not so much when you start going towards 4-6ms, leaving too little for WPF, lock/unlock etc, or if you're also trying to process touch inputs.