DirectX Shader Compiler
The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation. Applications that make use of DirectX for graphics, games, and computation can use it to generate shader programs.
For more information, see the Wiki.
Features and Goals
At the moment, the DirectX HLSL Compiler provides the following components:
dxc.exe, a command-line tool that can compile HLSL programs for shader model 6.0 or higher
dxcompiler.dll, a DLL providing a componentized compiler, assembler, disassembler, and validator
various other tools based on the above components
The Microsoft Windows SDK releases include a supported version of the compiler and validator.
The goal of the project is to allow the broader community of shader developers to contribute to the language and representation of shader programs, maintaining the principles of compatibility and supportability for the platform. It's currently in active development across two axes: language evolution (with no impact to DXIL representation), and surfacing hardware capabilities (with impact to DXIL, and thus requiring coordination with GPU implementations).
As an example of community contribution, this project can also target the SPIR-V intermediate representation. Please see the doc for how HLSL features are mapped to SPIR-V, and the wiki page for how to build, use, and contribute to the SPIR-V CodeGen.
Note: Instead of building manually, you can download the artifacts built by Appveyor for the latest master branch at here.
Note: If you intend to build from sources on Linux/macOS, follow these instructions.
Before you build, you will need to have some additional software installed. This is the most straightforward path - see Building Sources on the Wiki for more options, including Visual Studio 2015 and Ninja support.
- Visual Studio 2017. Select the following workloads: Universal Windows Platform Development and Desktop Development with C++.
- Python. Version 2.7.x is required, 3.x might work but it's not officially supported. You need not change your PATH variable during installation.
After cloning the project, you can set up a build environment shortcut by double-clicking the
utils\hct\hctshortcut.js file. This will create a shortcut on your desktop with a default configuration.
Tests are built using the TAEF framework. Unless you have the Windows Driver Kit installed, you should run the script at
utils\hct\hctgettaef.py from your build environment before you start building to download and unzip it as an external dependency. You should only need to do this once.
To build, run this command on the HLSL Console.
You can also clean, build and run tests with this command.
To see a list of additional commands available, run
To run tests, open the HLSL Console and run this command after a successful build.
Some tests will run shaders and verify their behavior. These tests also involve a driver that can run these execute these shaders. See the next section on how this should be currently set up.
To run shaders compiled as DXIL, you will need support from the operating system as well as from the driver for your graphics adapter. Windows 10 Creators Update is the first version to support DXIL shaders. See the Wiki for information on using experimental support or the software adapter.
Hardware GPU support for DXIL is provided by the following vendors:
NVIDIA's r396 drivers (r397.64 and later) provide release mode support for DXIL 1.1 and Shader Model 6.1 on Win10 1709 and later, and experimental mode support for DXIL 1.2 and Shader Model 6.2 on Win10 1803 and later. These drivers also support DXR in experimental mode.
Drivers can be downloaded from geforce.com.
AMD’s driver (Radeon Software Adrenalin Edition 18.4.1 or later) provides release mode support for DXIL 1.1 and Shader Model 6.1. Drivers can be downloaded from AMD's download site.
Intel's 15.60 drivers (22.214.171.12449 and later) support release mode for DXIL 1.0 and Shader Model 6.0 as well as release mode for DXIL 1.1 and Shader Model 6.1 (View Instancing support only).
Drivers can be downloaded from the following link Intel Graphics Drivers
Direct access to 15.60 driver (latest as of of this update) is provided below:
To make contributions, see the CONTRIBUTING.md file in this project.
You can find documentation for this project in the
docs directory. These contain the original LLVM documentation files, as well as two new files worth nothing:
- HLSLChanges.rst: this is the starting point for how this fork diverges from the original llvm/clang sources
- DXIL.rst: this file contains the specification for the DXIL format
- tools/clang/docs/UsingDxc.rst: this file contains a user guide for dxc.exe
DirectX Shader Compiler is distributed under the terms of the University of Illinois Open Source License.