microsoft / WPFDXInterop

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

D3DImage possible issues #2

Closed QuantumDeveloper closed 8 years ago

QuantumDeveloper commented 8 years ago

Hi, 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? Also, I see that on size changed IntPtr of the surface is changed, which will lead to recreation of the whole swapchain instead of simple swapchain.Resize(). I think this is caused by the fact that WPF internally is still working on DirectX 9 and DirectX 9 has no way to resize swapchain, but DirectX 10 and higher - does.

From the sample I see that you recreate rendertarget each DoRender() call, which is extremely not efficient in highe performance rendering scenarios. Rendertargets should be recreated only when one of the swapchain parameters changed. Other time DX should reuse existing one.

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

Also in addition to my previous post: after resizing your D3D11Image few times, it just stops rendering to it and thats all

rrelyea commented 8 years ago

I'm going to break this out into ~4 new issues and link to them from here. Then I'll close this issue. If I missed anything, please bring it back up.