Since we first launched WorldWide Telescope almost 5 years ago I knew we would have to have a major rewrite of WWT’s graphics engine eventually to move past DX9. Managed DX had been deprecated, and XNA would not support anything beyond DX9 either, so we had to have an alternative. I considered SlimDX, but eventually Microsoft’s Windows® API Code Pack for Microsoft® .NET Framework emerged and when we spun off code for the GeoFlow project we took that route but I was never satisfied that it was the best option. With .NET your code is not processor dependent, so why would you want to tie yourself down to x86 or x64 specific code if you could have ANYCPU as an option? Then I came across the SharpDX project. Here was a project that was designed to have make .NET code have unrestricted access to the DirectX framework, with the lowest overhead, and preserving the DirectX API, but making in .NET friendly.
One of the first thing you will notice in ShardDX is that there are not nearly as many sample code projects as you might expect for an API. The reason is the mapping is so close, and you can almost line for line port samples code from the C++ DirectX SDK to C#. The wrapper is also special, it is machine generated code that makes use of some snazzy code probably designed for the C++ IJW features of .NET to create ANYCPU compatible code. That means that I compile *ONE* version of the code, one version of the setup, and it runs transparently in 32bits on a x86 O/S and 64 bits on a x64 O/S, and even ARM in the Windows 8 case.
Another very compelling feature is they got the same API to work on Windows Desktop, Windows 8 App Store apps and Windows phone 8. You can’t necessarily run the same binaries, but you can create a graphics engine with common code that will target all of these systems. Compare this to having three different graphics API’s and you can appreciate how cool that is. One set of code instead of three. I like that simplicity. While it is not entirely free, you may still need three different codebases for the UI chrome to custom fit each app to its platform, at least you can save writing on the graphics front.
So with the WorldWide Telescope Eclipse release we will be bringing much faster graphics with our new DirectX11 engine, but gracefully degrade when only DX9 or DX10 hardware is available. This also means if you have a 64bit O/S you can now bring massive amounts of data into WWT to visualize.
In the future we will be making much more extensive use of the DX11 API with more GPU compute, geometry shaders and much more. I have been very satisfied with the development ease, performance and stability of the SharpDX platform and I can’t image going back to the old ways.
There has been a trend for people to “go back to C++”, but leaving the efficiency and safety of developing on .NET, when the GPU is doing the heavy lifting just does not seem right. SharpDX lefts you have the best of both worlds, and now it is powering all 190+ worlds in WWT.