Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.
/ slimshader-cpp Public archive

SlimShader is a Direct3D shader bytecode parser for .NET and C++

Notifications You must be signed in to change notification settings

tgjones/slimshader-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

SlimShader

SlimShader is a Direct3D shader bytecode parser for .NET and C++. This is the repository for the C++ version; the .NET version can be found at tgjones/slimshader.

Usage

auto fileBytes = ReadFileBytes("CompiledShader.o");
auto bytecodeContainer = DxbcContainer::Parse(fileBytes);

cout << bytecodeContainer.GetInputSignature()->GetParameters().size() << endl;
cout << bytecodeContainer.GetStatistics()->GetInstructionCount() << endl;
cout << bytecodeContainer.GetStatistics()->GetStaticFlowControlCount() << endl;
cout << bytecodeContainer.GetShader()->GetTokens().size() << endl;

Acknowledgements

  • 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.

License

SlimShader is released under the MIT License.

About

SlimShader is a Direct3D shader bytecode parser for .NET and C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages