This repository has been archived by the owner. It is now read-only.
SlimShader is a Direct3D shader bytecode parser for .NET and C++
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Added screenshot Nov 13, 2012
src Fix text property binding Sep 2, 2015
.gitattributes Add gitattributes file Apr 27, 2013
.gitignore Remove NuGet packages from repo, and enable package restore Aug 9, 2013 Add virtual machine and HlslUnit to readme Sep 11, 2015


SlimShader is a Direct3D shader bytecode parser for .NET and C++. It is a Portable Class Library (PCL), compatible with .NET Framework 4.0+ and .NET for Windows Store apps. This is the repository for the .NET version; the C++ version can be found at tgjones/slimshader-cpp.


var fileBytes = File.ReadAllBytes("CompiledShader.o");
var bytecodeContainer = BytecodeContainer.Parse(fileBytes);


Virtual Machine

SlimShader also includes a virtual machine, which can execute HLSL shaders on the CPU. See the source code here. SlimShader.VirtualMachine includes both an interpreter and a just-in-time (JIT) compiler.


HlslUnit is a .NET library that allows you to unit test your HLSL shaders. It is built on top of SlimShader and SlimShader.VirtualMachine. I blogged about it here.


I've written a simple GUI to showcase SlimShader. You can open a compiled (binary) shader file, view the disassembled version, and view various properties (from the STAT chunk).



  • SlimShader uses several test shaders from the HLSLCrossCompiler project, by kind permission of James Jones.
  • The Nuclex Framework, in particular the HlslShaderReflector class, was very helpful when figuring out the RDEF, ISGN and OSGN chunks.
  • The Wine project, in particular Wine's shader reflection code, had some good tips for decoding the STAT chunk.
  • FXDIS was useful to look at when getting started, but the techniques used in that project (casting raw bytes to struct types) don't translate well from C++ to C#.
  • For the SHDR chunk, I mostly just used D3D11TokenizedProgramFormat.hpp, a header file that comes with the Windows DDK.


SlimShader is released under the MIT License.