OVRSharp
OVRSharp copied to clipboard
Explore ways to improve performance of `GetMirrorImage` DirectX implementation
DirectXCompositor.GetMirrorImage is really slow right now (~15ms per call on average), mostly because there's lots of copying and manipulation going on. We should explore different ways of improving performance, such as:
- Minimize copying from GPU to RAM (at least once is necessary, though)
- See if we can execute this on a different thread and make the method
async(would OpenVR be happy with that? If not, we could call the OpenVR API on the main thread, then do the rest of the work on a different thread) - Instead of using
FlipChannelsafter the image is copied over, can we do this while copying the memory initially? - Can we make the
Texture2D->Bitmapcopying more efficient?
I don't work with DirectX much (or graphics APIs in general) so there could be something I'm missing. Any input is appreciated :)
For reference, here's the method:
https://github.com/OVRTools/OVRSharp/blob/f75f35656111f57fcafc227bab3e5a9c719e0939/OVRSharp.Graphics.DirectX/DirectXCompositor.cs#L52-L103