What's the most efficient way to render a XAML visual tree onto a DXGI surface?
See original GitHub issue(I originally posted this question in the Win2D repo but this might be a more appropriate place for it.)
I’m using MediaCapture
in a UWP app to get a video stream from a camera with the intent to simultaneously record it and live stream it. For sports, I’d like to overlay scoreboard information that I’ve laid out using XAML controls.
I plan to use either the D3D11 video APIs or a custom video effect (and Win2D if applicable) to do the overlay in real-time. However, both of those techniques require the overlay to be in a DXGI surface and I can’t figure out how to efficiently render the XAML tree into one. The best approach I’ve seen is to use RenderTargetBitmap
and then copy the bits to the CPU before pushing them back into DXGI. That seems horribly inefficient.
XamlUIPresenter
looks like it would be perfect but
XamlUIPresenter is not intended for general Microsoft DirectX and Windows Runtime interoperation scenarios. You cannot use this API in a UWP app that you submit to the Microsoft Store, it will not pass certification.
Is there a way to do this with supported APIs entirely in video memory without the round trip to the CPU?
Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (4 by maintainers)
Top GitHub Comments
Thanks for the update @daneuber I’ll definitely watch out for that.
I can confirm that the transparency issue is definitely fixed in Windows 10 build 19041 (aka May 2020, aka 2004). Yay!