Ahjo.Vulkan.Slang.Native 0.12.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ahjo.Vulkan.Slang.Native --version 0.12.0
                    
NuGet\Install-Package Ahjo.Vulkan.Slang.Native -Version 0.12.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ahjo.Vulkan.Slang.Native" Version="0.12.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ahjo.Vulkan.Slang.Native" Version="0.12.0" />
                    
Directory.Packages.props
<PackageReference Include="Ahjo.Vulkan.Slang.Native" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ahjo.Vulkan.Slang.Native --version 0.12.0
                    
#r "nuget: Ahjo.Vulkan.Slang.Native, 0.12.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ahjo.Vulkan.Slang.Native@0.12.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ahjo.Vulkan.Slang.Native&version=0.12.0
                    
Install as a Cake Addin
#tool nuget:?package=Ahjo.Vulkan.Slang.Native&version=0.12.0
                    
Install as a Cake Tool

Ahjo.Vulkan.Slang.Native

Raw P/Invoke bindings for the Slang shader compiler — compile Slang/HLSL to SPIR-V, plus the full shader reflection surface — with native runtime binaries included for win-x64 and linux-x64.

The managed surface is generated with ClangSharpPInvokeGenerator from slang.h at a pinned upstream release tag. Nothing is hand-written, so the bindings are a mechanical function of that tag.

Standalone. This package has no Vulkan dependency and does not reference Ahjo.Vulkan.Native or Ahjo.Vulkan — Slang takes shader text and produces bytes. Reference it directly if you need it.

using Ahjo.Vulkan.Slang.Native;

unsafe
{
    IGlobalSession* global;
    if (SlangApi.slang_createGlobalSession(0, &global) < 0) { /* handle */ }

    // Describe a SPIR-V target, create a session, load a module, find its entry
    // points, composite + link them, then getEntryPointCode() for the blob.
    // Every call that takes an ISlangBlob** outDiagnostics should be given one:
    // loadModuleFromSourceString signals failure by returning null, so a
    // result-code-only check will miss a broken compile.

    global->release();
}

Interface methods dispatch through delegate* unmanaged[MemberFunction] vtable slots — no ComWrappers, no [ComImport], no Marshal, no reflection — so the binding is Native AOT clean.

For an idiomatic wrapper over this (session objects, diagnostics as exceptions, reflection mapped onto DescriptorBinding / PushConstantRange / VertexAttributeDescription), see Ahjo.Vulkan.Slang.

What is and is not in the package

The shipped binaries are extracted from the official release archive for the pinned tag, after its SHA-256 is verified against a value pinned in this repository. Only the compiler and its SPIR-V optimizer ship:

RID Files Compressed
win-x64 slang.dll + slang-compiler.dll (the first is a small forwarder that loads the second; both are required) + slang-glslang.dll ~14 MB
linux-x64 libslang.so + libslang-glslang-<version>.so ~17 MB

slang-glslang provides the spirv-opt downstream compiler. Without it the compiler still emits valid SPIR-V — SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY is Slang's own default — but every optimization level above "none" quietly reports error[E00100]: failed to load downstream compiler 'spirv-opt' and produces identical output, so the setting does nothing. It ships for that reason. The Linux file name embeds the version and is loaded by that exact name, so it is not renamed.

Left out deliberately: slang-llvm (152 MB, for CPU and host-callable targets), slang-glsl-module (GLSL input only), libgfx and libslang-rt (Slang's own graphics layer and CPU runtime — for running shaders, not emitting them), the slang-standard-module-* tree (the core module is embedded in the compiler binary), and the slangc / slangd command-line tools. The compile-to-SPIR-V path was verified end to end with only the files above present.

Platform support

RID Shipped Notes
win-x64 yes x86-64
linux-x64 yes glibc; staged and executed on ubuntu-latest
*-arm64, osx-* no no lane — see below

Upstream publishes windows-aarch64, linux-aarch64, macos-x86_64 and macos-aarch64 assets, and this package ships none of them. That is not an oversight: a RID only ships once a CI lane has loaded its binary and compiled a shader with it. Add the lane first, then the RID.

Licensing

Slang is Apache-2.0 WITH LLVM-exception (the Khronos Group / NVIDIA); its license text ships in this package as SLANG-LICENSE.txt. This package's own binding code is MIT, like the rest of the Ahjo.Vulkan repository.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Ahjo.Vulkan.Slang.Native:

Package Downloads
Ahjo.Vulkan.Slang

Compile Slang/HLSL shader source to SPIR-V at runtime with the pinned Slang compiler (v2026.14.1), with the compiler's own diagnostics surfaced as exceptions. Feeds Ahjo.Vulkan's Device.CreateShaderModule directly.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.13.1-alpha.0.1 56 8/23/2026
0.13.0 95 8/23/2026
0.12.1-alpha.0.6 60 8/23/2026
0.12.1-alpha.0.5 57 8/23/2026
0.12.1-alpha.0.4 50 8/23/2026
0.12.1-alpha.0.3 60 8/23/2026
0.12.1-alpha.0.2 53 8/22/2026
0.12.1-alpha.0.1 65 8/20/2026
0.12.0 129 8/16/2026
0.11.1-alpha.0.1 69 8/3/2026
0.11.0 404 8/3/2026
0.10.1-alpha.0.13 67 8/3/2026
0.10.1-alpha.0.12 63 8/3/2026
0.10.1-alpha.0.11 59 8/3/2026
0.10.1-alpha.0.10 69 8/3/2026
0.10.1-alpha.0.8 63 8/3/2026
0.10.1-alpha.0.7 58 8/3/2026
0.10.1-alpha.0.6 51 8/3/2026
0.10.1-alpha.0.5 64 8/3/2026
0.10.1-alpha.0.1 69 8/2/2026
Loading failed