DirectX.Net

This project is simply a DirectX wrapper for the .Net environment. As .Net is managed code, in order to interface with native code it must have a special layer to properly marshal objects and calls. This wrapper is as close to a One-to-One conversion as possible, keeping as many names as possible. The largest change comes with global functions being grouped into classes which contain the name of the header they exist in, within the namespace that relates to the header files which the function is found in or related to. The other change is with namespaces as not all DirectX classes and functions have namespaces and so they are organized generally in a namespace like DirectX.{APIName}.Class. Sometimes there are subnamespaces where it makes sense for headers like dxgidebug.h which goes into DirectX.DXGI.Debug. The overall goal is to match DirectX as closely as possible.


Plans and Progress

The plan is currently to convert the DirectX Math Libraries, DXGI, Direct 3D 12, Direct Input, XInput, and XAudio. If you are curious on the progress currently, check out our Trello.


Doesn't this already exist?

The short answer is, it did. The main DirectX wrapper for .Net was SharpDX. Back in May 2019 the main contributor to SharpDX archived the project and it is no longer being maintained. Even SharpDX did have its issues, which mainly was the fact that SharpDX was not an unbiased wrapper. SharpDX often changed names and locations of files and functions to what they thought better suited a C# environment. This would often mean that any translation from C++ program to C# required a lot of work as you had to translate to SharpDX which was not always easy. SharpDX was also an automated wrapper for the most part as it would generate a mapping file which would often need to be edited to make all functions available. This sometimes led to functions being missed or incorrectly mapped. There was also the issue of not supporting non C# instrinsics, like __m128 which can be used for a large amount of vector math that games do. Not every function supplied by DirectX can be mapped in pure C# for __m128(XMVECTOR) as they don't return pointers to the object so they must be handled by a C++ function first. For these reasons, I chose to build a new wrapper rather than attempting to conginue where SharpDX left off. Similarly, while a few have attempted to pick up with wrappers based on SharpDX, but they tend to fall into the same pitfalls.