Home

Awesome

DirectN AOT

This is an AOT-friendly version of DirectN. Aimed at x64 targets (doesn't mean it won't work for x86 targets, but it may not work for ambiguous types) . Only for .NET Core 8 and beyond, it won't work for version below 8 or with .NET Framework.

This is a work in progress although it's been stabilizing lately. If you want to discuss how, where, why, just create an issue.

So, DirectN has now been split into two projects: the interop code in one project, and the utilities, add-ons and extensions code in another project.

You don't have to use the extensions, but it's easier to use it.

The reason Extensions is separated from DirectN is more an engineering reason. The new COM Roslyn/.NET source generator at work here is very slow on ~8000 source-generated classes (since COM interop is not builtin in CLR anymore), so the DirectN project is just very difficult to work directly with in Visual Studio.

Nuget packages will be provided when the project is a bit more stable.

The key points that drive how code is generated and built:

Direct3D11 minimal sample.

The DirectN.Samples.MinimalD3D11 sample here https://github.com/smourier/DirectN/tree/master/DirectN/DirectN.WinUI3.MinimalD3D11 has been ported to C# from here: https://gist.github.com/d7samurai/abab8a580d0298cb2f34a44eec41d39d which features a minimal Direct3D11 "'API familiarizer' - an uncluttered Direct3D 11 setup & basic rendering reference implementation, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion" sample.

It's dependent on DirectN AOT, .NET 8 and ... that's it. Once built, the fully standalone .exe with zero dependency is only 4M bytes!

Here is the output (believe me, it rotates):

Sample

Full credits go to d7Samurai: https://gist.github.com/d7samurai