Skip to content
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

What's the most efficient way to render a XAML visual tree onto a DXGI surface? #630

Closed
AdamSzofran opened this issue Aug 9, 2018 · 3 comments

Comments

@AdamSzofran
Copy link

AdamSzofran commented Aug 9, 2018

(I reposted this question in the WindowsUIDevLabs repo, which 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.

@weltkante
Copy link

Just throwing in something else, did you consider letting Windows doing the composition by rendering the video to a SwapChainPanel?

@shawnhar
Copy link
Member

shawnhar commented Oct 2, 2018

This is not specifically a Win2D question, and it looks like you got some answers over in the WindowsUIDevLaps repo, so I'm going to close the issue here.

@shawnhar shawnhar closed this as completed Oct 2, 2018
@AdamSzofran
Copy link
Author

Agreed. Thanks Shawn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants