Sinkers.Veldrid.SPIRV 2.0.6

dotnet add package Sinkers.Veldrid.SPIRV --version 2.0.6
                    
NuGet\Install-Package Sinkers.Veldrid.SPIRV -Version 2.0.6
                    
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="Sinkers.Veldrid.SPIRV" Version="2.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sinkers.Veldrid.SPIRV" Version="2.0.6" />
                    
Directory.Packages.props
<PackageReference Include="Sinkers.Veldrid.SPIRV" />
                    
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 Sinkers.Veldrid.SPIRV --version 2.0.6
                    
#r "nuget: Sinkers.Veldrid.SPIRV, 2.0.6"
                    
#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 Sinkers.Veldrid.SPIRV@2.0.6
                    
#: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=Sinkers.Veldrid.SPIRV&version=2.0.6
                    
Install as a Cake Addin
#tool nuget:?package=Sinkers.Veldrid.SPIRV&version=2.0.6
                    
Install as a Cake Tool

Veldrid.SPIRV

NuGet

Veldrid.SPIRV is an extension library for Veldrid that provides support for loading SPIR-V bytecode for all Veldrid backends.

Usage

The easiest way to use Veldrid.SPIRV is through the extension methods it provides for the ResourceFactory type.

byte[] vertexShaderSpirvBytes = File.ReadAllBytes("myshader.vert.spv");
byte[] fragmentShaderSpirvBytes = File.ReadAllBytes("myshader.vert.spv");
Shader[] shaders = factory.CreateFromSpirv(
    new ShaderDescription(ShaderStages.Vertex, vertexShaderSpirvBytes, "main"),
    new ShaderDescription(ShaderStages.Fragment, vertexShaderSpirvBytes, "main"));
// Use "shaders" array to construct a Pipeline

You can also directly load GLSL source code and do the same as above. Behind the scenes, Veldrid.SPIRV will compile the GLSL to SPIR-V and then perform the cross-compile to the target language.

Specialization Constants

Although HLSL and OpenGL-style GLSL do not support SPIR-V Specialization Constants, you can use Veldrid.SPIRV to "specialize" the shader before the target source code is actually emitted. Set CrossCompileOptions.Specializations with an array of SpecializationConstant values to accomplish this.

libveldrid-spirv

Veldrid.SPIRV is implemented primarily as a native library, interfacing with SPIRV-Cross and shaderc. There are build scripts in the root of the repository which can be used to automatically build the native library for your platform.

Native build requirements:

  • CMake
  • Python

Pre-built binaries are bundled in the NuGet package for the following operating systems:

  • Windows x64
  • Windows x86
  • macOS x64
  • Linux x64
  • iOS arm64
  • Android arm64-v8a
  • Android armeabi-v7a
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
MonoAndroid monoandroid10 is compatible. 
Xamarin.iOS xamarinios10 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Sinkers.Veldrid.SPIRV:

Package Downloads
Sinkers.Veldrid

A low-level, hardware-accelerated graphics and compute library for .NET, with backends for Vulkan, Metal, Direct3D 11, OpenGL, and OpenGL ES. Veldrid can be used to create high-performance 2D and 3D games, simulations, tools, and other graphical applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.6 139 6/22/2025
2.0.5 264 3/29/2025