Announcing Silk.NET 2.17: Cleaner Code, Smoother Experience.

Are you tired of wading through messy code to achieve the smooth performance you need for your GPU applications? If so, it's time to upgrade to Silk.NET 2.17. This latest update delivers faster, cleaner code and a smoother experience than ever before, making it the easiest way to achieve top-tier performance without sacrificing usability. With Silk.NET 2.17, you can experience the power of clean code, achieve silky-smooth performance, and write code that feels right at home with the rest of your C# code.

Reworked DirectX bindings, added new WebGPU, Direct2D, DirectComposition, DirectWrite, and D3D11-on-12 bindings, as well as better support for Android 12, Windows on ARM64, reflection-free NativeAOT, and drop-in DXVK support. This, coupled with a whole lot of other enhancements & bugfixes mean there's something for everyone in Silk.NET 2.17, the largest user experience improvement update to date. Find out what's new in 2.17!

Today, we’re releasing Silk.NET 2.17, and we're not kidding when we say it's this is the largest user experience improvement we've done so far. Silk.NET 2.17 is the culmination of just over 8 months of work by lots of people, and we're so glad to finally release it!

You can download Silk.NET 2.17 from NuGet:

Patch notes at a glance

Don't need the full scoop? No worries, here's a summary of what's been going on:

  1. Added zero-cost extension methods for ComPtrs, making our DirectX bindings easier to use and higher quality than ever before.
  2. Added WebGPU bindings for Dawn and WGPU.
  3. Added Direct2D bindings. (massive thank you to @curin)
  4. Added DirectComposition bindings. (again, massive preesh to @curin)
  5. Added DirectWrite bindings.
  6. Added d3d11on12 bindings.
  7. Added WGL bindings.
  8. Added support for Android 12.
  9. Added support for OpenAL disconnect extension. (thanks @okaniku)
  10. Added GLFW API constants for ANGLE. (thanks @cyraid)
  11. Added extension functions for OpenAL BufferData to make use of AL_EXT_float32 enums.
  12. Added ReopenDevices extension for OpenAL Soft. (thanks @LeNitrous)
  13. Added BufferCallback extension for OpenAL Soft.
  14. Added Vulkan structure chain polymorphism. (thanks @Khitiara for the proposal)
  15. Added SDL/GLFW native libraries for Windows on ARM64.
  16. Added IsScancodePressed function in Silk.NET Input.
  17. Added TopMost in Silk.NET Windowing (thanks @MarioGK)
  18. Added EGL display and surface to INativeWindow.
  19. Added an explicit check against calling Reset on a window while within the render loop of said window.
  20. Added support for multiple native binary candidate paths for a single binding.
  21. Improved support for WASM and AOT in the Silk.NET loader.
  22. Improved support for Windows on ARM64.
  23. Improved Silk.NET.Maths generic specialization codegen.
  24. Improved support for DXVK, including a new DXHandle property in INativeWindow for getting Linux HWND equivalents.
  25. Improved support for Silk.NET.Windowing under reflection-free NativeAOT
  26. Updated to SDL 2.24.
  27. Updated to Vulkan 1.3.246.
  28. Updated to DirectStorage 1.1.1.
  29. Updated to OpenXR 1.0.27.
  30. Updated to Assimp 5.2.5.
  31. Updated to latest OpenCL specifications.
  32. Updated to latest OpenGL specifications.
  33. Updated to latest ImGui.
  34. Fixed XInput GetApi not being implemented. (thanks @skyebird189)
  35. Fixed TransparentBuffer not being applied correctly without specifying a PreferredBitDepth. (thanks @MarioGK)
  36. Fixed wide string marshalling.
  37. Fixed string array marshalling on systems where the max DBCS character size is insufficient for UTF8.
  38. Fixed Span overloads not calculating the correct length value for ommitted (implicit) length parameters.
  39. Fixed copying of native libraries under .NET Framework 4.6.1. (thanks @paralaxsd)
  40. Fixed SDL crashing on Android when the screen rotates in some cases.
  41. Fixed a memory leak when using GlobalMemory to marshal string arrays instead of StringArrayToPtr. (thanks @Khitiara)

I know what you're thinking, they're longer patch notes than I was expecting too! That's in no small part due to the passionate community that has contributed a lot towards this release.

Migration Guidance

This is a minor release (albeit as major as minor releases get), so we're not going to go into too much detail here. However we'll note a few things to keep in mind when upgrading to this version:

  • We have updated the versions of some of our BCL libraries, such as System.Memory. If you explicitly import these into your projects, you will also need to upgrade to the latest versions of these libraries.
  • You may get some obsolete warnings when you upgrade from a pre-2.16 version of Silk.NET. This is because we have deprecated some enum names that were needlessly verbose, and trimmed any common elements of these. Your compiler and IDE should be good at telling you what the recommended alternative is. This isn't new for 2.17, but because we didn't write a blog post/migration guidance for 2.16 we thought it was worth calling this one out.
  • We have removed some overloads that were causing widespread confusion and/or misuse in the pre-2.17 Silk.NET versions. This is mostly pertaining to in/out/ref for opaque types, but there may be more. Chances are if you have to make any changes as a result of this update, your existing code was likely non-functional and/or sub-optimal (be that in terms of either performance or readability).

Other than that, your code should work as-is with this new verison, but we do recommend taking time to take advantage of the new user experience improvements (particularly with DirectX)! As always, please let us know in GitHub Discussions or our Discord server if you have issues migrating to this verison of Silk.NET.

DirectX usability improvements

Development Lead: Dylan Perks (@Perksey)

If you're a fan of DirectX, you'll be pleased to hear that 2.17 includes major improvements in usability for our DirectX family of bindings. With this update, you can now call methods directly off of a ComPtr<T> of your type, making it easier than ever to work with DirectX. Plus, you no longer need to deal with interface GUIDs yourself - we've done our best to abstract this away the same way IID_PPV_ARGS abstracts it away in C++ land. This massive user experience improvement for our DirectX family of bindings is sure to make your life easier and your code cleaner than ever before. Let's take a look at some samples:


// Declare our IDXGIFactory2 output pointer
void* factoryOut = null;

// Manually get GUID to get factory interface pointer.
dxgi.CreateDXGIFactory2(0, SilkMarshal.GuidPtrOf<IDXGIFactory2>(), ref factoryOut);

// Cast the output to the correct type and store the interface pointer.
_factory = (IDXGIFactory2*) factoryOut;

// Manually get the IUnknown pointer to the device for CreateSwapChainForHwnd 
void* swapChainOut = null;
fixed (IUnknown* device = &_device)
    _factory->CreateSwapChainForHwnd(device, window.Native.Win32.Value.Hwnd, ref swapChainDesc, ref fullscreenDesc, null, ref swapChainOut);
_swapchain = (IDXGISwapChain1*) swapChainOut;


// Create the factory, storing the interface pointer safely as a ComPtr<IDXGIFactory2>.
_factory = dxgi.CreateDXGIFactory2<IDXGIFactory2>();

// Create the swapchain, calling the method directly on the ComPtr and once again storing safely as a ComPtr<IDXGISwapChain1>
// DEVELOPER NOTE: We know that the Unsafe.NullRef isn't the prettiest and we are working on a fix!
_factory.CreateSwapChainForHwnd(device, window.Native.Win32.Value.Hwnd, ref swapChainDesc, ref fullscreenDesc, ref Unsafe.NullRef<IDXGIOutput>(), ref _swapchain);

Much cleaner! The goal here is to place an emphasis on properly managing your COM pointers through ComPtr. And don't worry about overhead, the codegen for these new abstractions is identical to doing all of this yourself.

Behind the Scenes

To improve the usability of our DirectX family of bindings, we took several steps in Silk.NET 2.17. First, we added extension methods to the ComPtr type for each interface struct within the bindings. While this gave users the ability to call methods directly on the ComPtr instance, it didn't do enough to improve usability on its own.

To address this, we introduced two new overloaders: the ComPtrOverloader and the NonKhrReturnTypeOverloader. The ComPtrOverloader looks for parameter signatures that match the IID_PPV_ARGS pattern, and creates a generic ref ComPtr overload coalescing those two parameters. The interface ID is implicitly retrieved from the interface struct used as the generic type argument to ComPtr.

The NonKhrReturnTypeOverloader takes things a step further by identifying functions whose last argument is a ref (which, after the ComPtrOverloader has worked its magic, will be the case for methods that return COM pointers). It changes that parameter to be the return type of that function instead. This is what gives users the nice CreateDXGIFactory2 experience seen in the example snippet earlier in this post.

We're always trying to improve the experience of using our bindings, so please let us know in this tracking issue if you have any feedback or ideas for improvements! As always, you can also reach us in Discord or GitHub Discussions.

WebGPU bindings

Development Lead: Beyley Thomas (@Beyley)

We've added bindings to the experimental webgpu-headers maintained by the various vendors of WebGPU drivers! WebGPU is an API that exposes the capabilities of GPU hardware for the Web. The API is designed from the ground up to efficiently map to modern native GPU APIs such as Vulkan and Direct3D 12, and is touted to be the modern replacement for WebGL.

While these bindings have "web" in the name, using either the Dawn or WGPU implementations of WebGPU (for which we ship native binaries) you can use this as a single API to target all of the various platforms that would otherwise have platform-specific APIs! This allows you to write truly write-once-run-everywhere code.

The Silk.NET logo rendered using WebGPU.
The Silk.NET logo rendered using WebGPU.

Please note these bindings do not work in browsers yet due to issues with the .NET WebAssembly runtime.

More DirectX Bindings

Development Lead: Andrew Davis (@curin) [Silk.NET Community]

In addition to the major improvements in usability for our DirectX family of bindings, we're excited to announce that Silk.NET 2.17 also includes bindings for Direct2D, DirectComposition, and DirectWrite. Direct2D has been among the most requested features from our users, and we're thrilled to be able to deliver on them with this release.

Direct2D is a 2D vector graphics application programming interface (API) that allows for the creation of visually rich 2D graphics. This marks our first binding to a native library dedicated solely to vector graphics. On the other hand, DirectComposition provides advanced compositing and visual effects capabilities to enable high-performance bitmap composition with transforms, effects, and animations. You can use our DirectComposition bindings to create visually engaging user interfaces that feature rich and fluid animated transitions from one visual to another. Finally, DirectWrite is a text layout and rendering API that supports high-quality text rendering for both display and print, quite 5closely integrated with Direct2D.

We're especially proud to note that much of the work on these new bindings was done by a community member, @curin, who took the initiative to drive these additions. The Silk.NET team only had to do minor rework to integrate them into the library. This is a great example of how Silk.NET is a true community-driven project, with users and contributors working together to create a better development experience for everyone.

Platform Expansion

Development Lead: Dylan Perks (@Perksey) / Beyley Thomas (@Beyley)

In Silk.NET 2.17, we focused heavily on expanding platform support and increasing the portability of Silk.NET code. To achieve this, we made Silk.NET compatible with reflection-free NativeAOT, previously known as CoreRT, which enables developers to create minimal distributions of their games and applications. Additionally, we added support for Android 12, which was previously incompatible with Silk.NET 2.16 due to recent changes in the Android permissions API.

In addition to expanding platform support and portability, we have also been doing increased testing on Windows on ARM using the Volterra development kit. As a result, we're excited to announce that Silk.NET is now fully compatible with Windows on ARM. While your mileage with the Volterra graphics drivers may vary, we have added D3D11-on-12 bindings in 2.17 to allow developers to wield the Direct3D 11 API you all know and love using the Direct3D 12 drivers, which tend to be in better shape on newer devices.

But perhaps the biggest news is the newfound portability of Silk.NET across different operating systems. For developers who prefer DirectX over other graphics APIs, they can now use the Direct3D bindings they love almost out-of-the-box on Linux using the DXVK and VKD3D native libraries, which Silk.NET now has full support for. In fact, we've made one of our examples DXVK compatible, and it only took just a few lines of code changes to make it fully portable across Windows and Linux using Silk.NET.Windowing. We also support DXVK to be used manually with our GLFW or SDL bindings, for those who are inclined to do so!

Note: While we do use VKD3D's shader compiler to replace D3DCompiler on Windows, D3D12 through VKD3D is not supported at the moment, only D3D9 and D3D11 code will work natively on Linux. (community contributions welcome!)


Silk.NET 2.17 is here, and it brings a lot of improvements to the table. With faster, cleaner code and a smoother experience, Silk.NET 2.17 is the best way to achieve top-tier performance while also writing code that feels right at home with the rest of your C# codebase. This latest update delivers reworked DirectX bindings, WebGPU bindings, Direct2D, DirectComposition, DirectWrite, D3D11-on-12, Android 12, Windows on ARM64 support, better AOT support, drop-in DXVK support, and a host of enhancements and bug fixes. In short, Silk.NET 2.17 is the largest user experience improvement we've done so far, and we've barely even scratched the surface in this blog post! (Did you see those patch notes?!)

You can download Silk.NET 2.17, as you always have, from NuGet.

Khronos®, Vulkan® are registered trademarks, and OpenXR™ is a trademark of The Khronos Group Inc. and is registered as a trademark in China, the European Union, Japan and the United Kingdom. OpenCL™, OpenGL®, and the OpenGL ES™ logos are registered trademarks or trademarks used under license by Khronos. Microsoft® and DirectX® are registered trademarks of Microsoft Corporation, used solely for identification. All other product names, trademarks, and/or company names are also used solely for identification and belong to their respective owners. Use of external images, trademarks, and/or resources are not endorsements, and no information in or regarding any of these external resources has been endorsed or approved by Silk.NET or the .NET Foundation.

Powered by Statiq Framework