All Projects → google → Shaderc

google / Shaderc

Licence: other
A collection of tools, libraries, and tests for Vulkan shader compilation.

Projects that are alternatives of or similar to Shaderc

Shaderc Rs
Rust bindings for the shaderc library.
Stars: ✭ 143 (-85.93%)
Mutual labels:  compiler, graphics, glsl, vulkan, hlsl
Shaderconductor
ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages
Stars: ✭ 1,146 (+12.8%)
Mutual labels:  compiler, graphics, glsl, vulkan, hlsl
3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (+1051.38%)
Mutual labels:  graphics, glsl, vulkan, hlsl
Crossshader
⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.
Stars: ✭ 113 (-88.88%)
Mutual labels:  compiler, glsl, vulkan, hlsl
Shadergen
Proof-of-concept library for generating HLSL, GLSL, and Metal shader code from C#,
Stars: ✭ 395 (-61.12%)
Mutual labels:  graphics, glsl, vulkan, hlsl
Reshade
A generic post-processing injector for games and video software.
Stars: ✭ 2,285 (+124.9%)
Mutual labels:  compiler, glsl, vulkan, hlsl
Gpu Gems Book Source Code
💿 CD Content ( Source Code ) Collection of Book <GPU Gems > 1~ 3 | 《GPU精粹》 1~ 3 随书CD(源代码)珍藏
Stars: ✭ 567 (-44.19%)
Mutual labels:  graphics, glsl, hlsl
Slang
Making it easier to work with shaders
Stars: ✭ 627 (-38.29%)
Mutual labels:  glsl, vulkan, hlsl
CPP-Programming
Various C/C++ examples. DirectX, OpenGL, CUDA, Vulkan, OpenCL.
Stars: ✭ 30 (-97.05%)
Mutual labels:  vulkan, glsl, hlsl
Shaderdebugger
[DEPRECATED] C++ library for debugging HLSL & GLSL shaders
Stars: ✭ 323 (-68.21%)
Mutual labels:  compiler, glsl, hlsl
Glslang
Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Stars: ✭ 2,034 (+100.2%)
Mutual labels:  compiler, glsl, hlsl
Bonzomatic
Live shader coding tool and Shader Showdown workhorse
Stars: ✭ 829 (-18.41%)
Mutual labels:  graphics, glsl, hlsl
Pmtech
Lightweight, multi-platform, data-oriented game engine.
Stars: ✭ 478 (-52.95%)
Mutual labels:  glsl, vulkan, hlsl
Silk.net
The high-speed OpenAL, OpenGL, Vulkan, and GLFW bindings library your mother warned you about.
Stars: ✭ 534 (-47.44%)
Mutual labels:  graphics, vulkan
Vulkan
Vulkan API bindings for Go programming language
Stars: ✭ 559 (-44.98%)
Mutual labels:  graphics, vulkan
Vulkan minimal compute
Minimal Example of Using Vulkan for Compute Operations. Only ~400LOC.
Stars: ✭ 603 (-40.65%)
Mutual labels:  glsl, vulkan
Vkbasalt
a vulkan post processing layer for linux
Stars: ✭ 517 (-49.11%)
Mutual labels:  glsl, vulkan
Renderdoc
RenderDoc is a stand-alone graphics debugging tool.
Stars: ✭ 5,969 (+487.5%)
Mutual labels:  graphics, vulkan
Ouzel
C++ game engine for Windows, macOS, Linux, iOS, tvOS, Android, and web browsers
Stars: ✭ 607 (-40.26%)
Mutual labels:  glsl, hlsl
Nova Renderer
Nova Renderer, a custom cross platform render engine written in C++
Stars: ✭ 619 (-39.07%)
Mutual labels:  graphics, vulkan

Shaderc

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.

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

Downloads

Note: These binaries are just the artifacts of the builders and have not undergone any QA, thus they should be considered unsupported.

LinuxLinux Build Status MacOSMacOS Build Status WindowsWindows Build Status

More downloads

Status

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 https://android.googlesource.com/platform/external/shaderc/. 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 CONTRIBUTING.md.

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 CONTRIBUTING.md 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 https://github.com/google/shaderc $SOURCE_DIR
cd $SOURCE_DIR
./utils/git-sync-deps
cd $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 update_shaderc.py 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:

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

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

cd $BUILD_DIR
cmake $SOURCE_DIR
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)

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

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 2015 or later. Previous versions of Visual Studio may work but are untested and unsupported.
  • 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
test.vert
/code $ glslc -c -o - test.vert | spirv-dis

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:

cd $BUILD_DIR
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DENABLE_CODE_COVERAGE=ON $SOURCE_DIR
ninja
ninja report-coverage

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

Bindings

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].