Skip to content
A collection of tools, libraries, and tests for Vulkan shader compilation.
C++ Python C CMake Shell Batchfile Other
Branch: master
Clone or download
zoddicus Code hygiene work for spvc (#808)
Changing the include path to spvc instead of shaderc

Reformatting a couple rules to be more readable.
Latest commit 68b6857 Sep 18, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
android_test Remove app_dummy call in Android test (#756) Jul 9, 2019
build_overrides fixes for Fuchsia. (#733) Jun 25, 2019
cmake Shaderc requires Python3 (#594) Apr 11, 2019
examples Add libshaderc_spvc interface to SPIRV-Cross. (#524) Jan 15, 2019
glslc Force Glslang to support HLSL in its interface (#784) Aug 22, 2019
kokoro Fix Windows build uploads. (#597) Apr 20, 2019
libshaderc Rolling 7 dependencies and updating known_failures (#791) Aug 27, 2019
libshaderc_spvc Code hygiene work for spvc (#808) Sep 18, 2019
libshaderc_util Rolling 7 dependencies and updating known_failures (#791) Aug 27, 2019
spvc Code hygiene work for spvc (#808) Sep 18, 2019
third_party Remove unsetting compiler check variables (#801) Sep 5, 2019
utils Have new parameter (#805) Sep 10, 2019
.clang-format Remove extra .clang-format files. (#573) Mar 4, 2019
.gitignore Add libshaderc_spvc interface to SPIRV-Cross. (#524) Jan 15, 2019
AUTHORS Initial commit of shaderc. Aug 6, 2015 Add the SPIRV-Tools-opt library into Sep 21, 2016 Code hygiene work for spvc (#808) Sep 18, 2019
CHANGES Update CHANGES (#730) Jun 19, 2019
CMakeLists.txt Have new parameter (#805) Sep 10, 2019 Use monospace font and add links where appropriate. Aug 14, 2015
CONTRIBUTORS Add Adam Chainz ( into CONTRIBUTORS. Jun 20, 2016
DEPS Rolling 4 dependencies and update known_failures (#803) Sep 9, 2019 Switch GLSLang to upstream (#515) Jan 2, 2019
Dockerfile Update Dockerfile to use Python 3 (#668) Jun 7, 2019
LICENSE Initial commit of shaderc. Aug 6, 2015 Force Glslang to support HLSL in its interface (#784) Aug 22, 2019 Fix typos in the artifacts links. (#606) May 6, 2019


A collection of tools, libraries and tests for shader compilation. At the moment it includes:

  • glslc, a command line compiler for GLSL/HLSL to SPIR-V, and
  • libshaderc, a library API for accessing glslc functionality.
  • spvc, a command line wrapper around the SPIR-V to GLSL/HLSL/MSL compiler SPIRV-Cross, and
  • libshaderc_spvc, a library API for accessing spvc functionality.

Note: The fact that that libshaderc is not named libshaderc_glslc is a quirk of history, and a known inconsistency. Changing it would require a significant amount of renaming and breaking of downstream projects, so it is being left as is.

glslc wraps around core functionality in glslang and SPIRV-Tools. glslc and its library aims to to provide:

  • a command line compiler with GCC- and Clang-like usage, for better integration with build systems
  • an API where functionality can be added without breaking existing clients
  • an API supporting standard concurrency patterns across multiple operating systems
  • increased functionality such as file #include support

spvc wraps around core functionality in spirv-cross and SPIRV-Tools. spirv and its library aims to provide:

  • validation and transformation of inputs before cross-compiling
  • an API designed around integration with specific projects like Dawn

Note: spvc and its library are WIP and optional artifacts that are by default disabled in the build. How to enabled is detailed below.


LinuxLinux Build Status MacOSMacOS Build Status WindowsWindows Build Status

More downloads


Shaderc has maintained backward compatibility for quite some time, and we don't anticipate any breaking changes. Ongoing enhancements are described in the CHANGES file.

Shaderc has been shipping in the Android NDK since version r12b. (The NDK build uses sources from Those repos are downstream from GitHub.) We currently require r18b.

For licensing terms, please see the LICENSE file. If interested in contributing to this project, please see

This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google. That may change if Shaderc gains contributions from others. See the file for more information. See also the AUTHORS and CONTRIBUTORS files.

File organization

  • android_test/ : a small Android application to verify compilation
  • cmake/: CMake utility functions and configuration for Shaderc
  • examples/: Example programs
  • glslc/: an executable to compile GLSL to SPIR-V
  • libshaderc/: a library for compiling shader strings into SPIR-V
  • libshaderc_util/: a utility library used by multiple shaderc components
  • third_party/: third party open source packages; see below
  • utils/: utility scripts for Shaderc

Shaderc depends on glslang, the Khronos reference compiler for GLSL.

Shaderc depends on SPIRV-Tools for assembling, disassembling, and transforming SPIR-V binaries.

Shaderc depends on the Google Test testing framework.

In the following sections, $SOURCE_DIR is the directory you intend to clone Shaderc into.

Getting and building Shaderc

If you only want prebuilt executables or libraries, see the Downloads section.

The rest of this section describes how to build Shaderc from sources.

Note: Shaderc assumes Glslang supports HLSL compilation. The instructions below assume you're building Glslang from sources, and in a subtree of shaderc/third_party. In that scenario, Glslang's HLSL support is automatically enabled. Shaderc also can be built using a Glslang from outside the shaderc/third_party tree. In that case you must ensure that that external Glslang is built with HLSL functionality. See Glslang's ENABLE_HLSL CMake setting.)

  1. Check out the source code:
git clone $SOURCE_DIR

Note: The known-good branch of the repository contains a known_good.json file describing a set of repo URLs and specific commits that have been tested together. This information is updated periodically, and typically matches the latest update of these sources in the development branch of the Android NDK. The known-good branch also contains a script that will read the JSON file and checkout those specific commits for you.

  1. Ensure you have the requisite tools -- see the tools subsection below.

  2. Decide where to place the build output. In the following steps, we'll call it $BUILD_DIR. Any new directory should work. We recommend building outside the source tree, but it is also common to build in a (new) subdirectory of $SOURCE_DIR, such as $SOURCE_DIR/build.

4a) Build (and test) with Ninja on Linux or Windows:

cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} $SOURCE_DIR
ctest # optional

4b) Or build (and test) with MSVC on Windows:

cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo}
ctest -C {Release|Debug|MinSizeRel|RelWithDebInfo}

4c) Or build with MinGW on Linux for Windows: (Skip building threaded unit tests due to Googletest bug 606)

cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} $SOURCE_DIR \
   -DCMAKE_TOOLCHAIN_FILE=$SOURCE_DIR/cmake/linux-mingw-toolchain.cmake \

After a successful build, you should have a glslc executable somewhere under the $BUILD_DIR/glslc/ directory, as well as a libshaderc library somewhere under the $BUILD_DIR/libshaderc/ directory.

The default behavior on MSVC is to link with the static CRT. If you would like to change this behavior -DSHADERC_ENABLE_SHARED_CRT may be passed on the cmake configure line.

See the libshaderc README for more on using the library API in your project.

Tools you'll need

For building, testing, and profiling Shaderc, the following tools should be installed regardless of your OS:

  • CMake: for generating compilation targets.
  • Python 3: for utility scripts and running the test suite.

On Linux, the following tools should be installed:

  • gcov: for testing code coverage, provided by the gcc package on Ubuntu.
  • lcov: a graphical frontend for gcov, provided by the lcov package on Ubuntu.
  • genhtml: for creating reports in html format from lcov output, provided by the lcov package on Ubuntu.

On Linux, if cross compiling to Windows:

  • mingw: A GCC-based cross compiler targeting Windows so that generated executables use the Micrsoft C runtime libraries.

On Windows, the following tools should be installed and available on your path:

  • Visual Studio 2013 Update 4 or later. Previous versions of Visual Studio will likely work but are untested.
  • Git - including the associated tools, Bash, diff.

Optionally, the following tools may be installed on any OS:

Building and running Shaderc using Docker

Please make sure you have the Docker engine installed on your machine.

To create a Docker image containing Shaderc command line tools, issue the following command in ${SOURCE_DIR}: docker build -t <IMAGE-NAME> .. The created image will have all the command line tools installed at /usr/local internally, and a data volume mounted at /code.

Assume <IMAGE-NAME> is shaderc/shaderc from now on.

To invoke a tool from the above created image in a Docker container:

docker run shaderc/shaderc glslc --version

Alternatively, you can mount a host directory (e.g., example) containing the shaders you want to manipulate and run different kinds of tools via an interactive shell in the container:

$ docker run -i -t -v `pwd`/example:/code shaderc/shaderc
/code $ ls
/code $ glslc -c -o - test.vert | spirv-dis

Building spvc

The value SHADERC_ENABLE_SPVC in CMakeLists.txt must be set to ON to enable building spvc.

This can be achieved by either editing the file in your checkout, or passing -DSHADERC_ENABLE_SPVC=ON to cmake to set the value.

Bug tracking

We track bugs using GitHub -- click on the "Issues" button on the project's GitHub page.

Test coverage

On Linux, you can obtain test coverage as follows:

ninja report-coverage

Then the coverage report can be found under the $BUILD_DIR/coverage-report directory.


Bindings are maintained by third parties, may contain content offered under a different license, and may reference or contain older versions of Shaderc and its dependencies.

You can’t perform that action at this time.