microsoft / ShaderConductor

ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages
MIT License
1.78k stars 250 forks source link
compiler d3d10 d3d11 d3d12 d3d9 dxil glsl graphics hlsl metal opengl opengl-es shader spir-v vulkan

ShaderConductor

Build Status License

ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages.

Features

Note that this project is still in an early stage, and it is under active development.

Architecture

ShaderConductor is not a real compiler. Instead, it glues existing open source components to do the cross-compiling.

  1. DirectX Shader Compiler to compile HLSL to DXIL or SPIR-V,
  2. SPIRV-Cross to convert SPIR-V to target shading languages.

Architecture

Prerequisites

Building

ShaderConductor has been tested on Windows, Linux, and macOS.

The script way:

  BuildAll.py <BuildSystem> <Compiler> <Architecture> <Configuration>

where,

This script automatically grabs external dependencies to External folder, generates project file in Build/\<BuildSystem>-\<Compiler>-\<Platform>-\<Architecture>[-\<Configuration>], and builds it.

The manual way:

  mkdir Build
  cd Build
  cmake -G "Visual Studio 15" -T host=x64 -A x64 ../
  cmake --build .

After building, the output file ShaderConductor.dll can be located in \<YourCMakeTargetFolder>/Bin/\<Configuration>/. It depends on dxcompiler.dll in the same folder.

Artifacts

You can download the prebuilt binaries generated by CI system. Currently, artifacts for Windows, Linux, macOS are published every commit.

License

ShaderConductor is distributed under the terms of MIT License. See LICENSE for details.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.