Shared textures support for the WPF control through D3DImage
This post is just a short preview for a substantial performance improvement in our WPF .NET control with Coherent UI 2.0. Until now, we used the system memory to transfer the image data from Coherent UI to the WPF application. While this works well in practice, there are some cases when you might want to display something in a very high resolution – say 8x8k. Copying that much memory inevitably lowers the performance.
One of our clients needed those very high resolutions and asked us if we can do something about it, suggesting transferring the surfaces through a D3DImage. By doing that we could use shared textures instead of the system memory to transfer the images. This way the image stays on the GPU and no copying occurs, leading to some quite substantial performance gains.
We’ve already explored that possibility previously, but haven’t implemented it since it was not going to be available for all OSes. With the recent end of support for Windows XP though (finally!), we decided to go for it and add an option for using shared textures. This feature is available on Vista SP2+ but all kinds of surveys suggest that the vast amount of users cover that requirement.
Here’s some benchmarks using the new feature (I used my 2k monitor so some of the pictures are cropped since the back buffers are larger):
For my last test I checked the FPS differently:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<Label Content="" Name="fpsText" Margin="2" Width="128"/> .... private int m_Frames = 0; DispatcherTimer m_FPSTimer = new DispatcherTimer(); .... CompositionTarget.Rendering += (s, a) => { ++m_Frames; }; m_FPSTimer.Interval = TimeSpan.FromSeconds(1); m_FPSTimer.Tick += (s, a) => { fpsText.Content = string.Format("FPS:{0}", m_Frames); m_Frames = 0; }; m_FPSTimer.Start(); |
And here’s the shocker:
Coherent UI 2.0 for .NET comes with a fully-functional free trial. Get your copy from here.