commit | 8bd1f96a7d317b89b6754172701d7f5abfd46489 | [log] [tgz] |
---|---|---|
author | David Neto <dneto@google.com> | Tue Jul 16 15:12:26 2019 -0400 |
committer | David Neto <dneto@google.com> | Tue Jul 16 15:13:33 2019 -0400 |
tree | 03e4efed3cce3240461686c37a5ad97ca07e17f1 | |
parent | afff7dc7bc4169501c18e5f2ff366d71cb279b6c [diff] | |
parent | ef2b7a6d5aedd2dec30e77d8c97499ce5ab0564c [diff] |
Merge remote-tracking branch 'aosp/upstream-master' into update-shaderc Including: ef2b7a6 Avoid C-style cast for constants definitions (#760) c1af9a7 SetBeforeHlslLegalization to use more relaxed validation rules (#676) 72988e4 Explicitly use python3 for git-sync-deps (#759) 1f2dec1 Remove app_dummy call in Android test (#756) e9bb8f2 Add verbose flag to run_spirv_cross_tests.py (#753) f396afa Rolling 4 dependencies and update known_failures (#755) 77d7b65 Rolling 4 dependencies and updating known_failures (#754) 23bbb32 Add --target-spv option to set target SPIR-V version (#750) 8de4816 Remove old logging infra from run_spirv_cross_tests.py (#749) 30d8262 Enable implicit fallthrough warning and fix examples of (#747) 7781794 Rolling 2 dependencies (#748) 48e07b5 Rolling 4 dependencies and update known_failures (#745) cff2a56 Catch low level exceptions instead of crash (#744) 11cf0a3 Add jobs flag to spirv cross tests script (#743) 0ce3725 Extract common test environment bits out into a class (#738) c4ba097 Fix BUILD.gn for Chromium build. (#741) ab08017 BUILD.gn fixes for Fuchsia. (#733) b9a1021 Remove Appveyor artifacts link. (#739) 16f6e6a Remove SetShaderModel from API (#734) b3523d5 Move script fixes from other SPIRV related repos (#732) a731ee3 Import improvements to DEPS roll script (#729) 213a2a8 Update CHANGES (#730) 2cbf790 Add -fnan-clamp (#725) 6c4c6ed Add script to generate manual roll patch (#727) 4714ba1 Rolling 4 dependencies (#728) 2a888de Roll third_party/glslang def9662348b0..9db72785beb3 (1 commits) (#721) daf804a Roll third_party/spirv-cross 4104e363005a..146dc453bcec (2 commits) (#722) 9164aea Manually roll DEPS to get past test failure (#717) 8b2600f Roll third_party/googletest fd20d1eccef6..176eccfb8f42 (1 commits) (#718) f40bcf8 Roll third_party/googletest e110929a7b49..fd20d1eccef6 (5 commits) (#715) 8fbd7e0 Roll third_party/re2 0c95bcce2f1f..848dfb7e1d7b (2 commits) (#712) a0bfa18 Roll third_party/googletest f7c178ecb33c..e110929a7b49 (2 commits) (#709) 7b84ab7 Roll third_party/googletest 26afdba792e5..f7c178ecb33c (2 commits) (#707) 828e3a5 Roll third_party/spirv-cross 00a8539d1ddf..4104e363005a (3 commits) (#698) 9745f0e Roll third_party/googletest af4c2cb098a3..26afdba792e5 (1 commits) (#703) c21dd10 Update glslc tests for -finvert-y option (#704) ceff3dd Pass InvertY to glslang (#695) b988e6b Roll third_party/googletest 89656ddbe62f..af4c2cb098a3 (2 commits) (#702) c6cb20d Roll third_party/spirv-headers 9cf7c3a7d2d2..de99d4d834ae (1 commits) (#697) bd60de4 Roll third_party/googletest 076b7f778883..89656ddbe62f (1 commits) (#694) dcfa9d0 Roll third_party/spirv-cross fccf1d046204..00a8539d1ddf (1 commits) (#691) ef6b960 Roll third_party/spirv-cross 5e9e8918f9a2..fccf1d046204 (1 commits) (#690) 206a069 Roll third_party/spirv-headers 9242862c84fe..9cf7c3a7d2d2 (1 commits) (#689) 2f42850 Roll all DEPS to HEAD (#685) facd092 Roll third_party/effcee 8f0a61dc95e0..b83b58d177b7 (2 commits) (#677) 3c76b8a Re-introduce SetShaderModel for backwards compatibility (#675) 8738101 Refactor dup'd arg handling functions into a single location (#660) f21bd30 Update Dockerfile to use Python 3 (#668) d0298a3 Add details of spvc to README.md (#661) 78c188d Change TODO(name) to TODO(bug issue#) for spvc files (#658) dc67137 Fixing duplicate absolute install paths when using Visual Studio generators (#639) 568cf20 Add in missing flags to pass more of the spirv-cross tests (#664) acf7d24 Convert vars['foo'] to Var('foo') (#663) Testing: checkbuild.py on Linux; unit tests on Windows Change-Id: Ic91997e8266c6f53239373657fb1f566a0223bf9
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, andlibshaderc
, a library API for accessing glslc
functionality.spvc
, a command line wrapper around the SPIR-V to GLSL/HLSL/MSL compiler SPIRV-Cross, andlibshaderc_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 inconsistancy. 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:
#include
supportspvc
wraps around core functionality in spirv-cross and SPIRV-Tools. spirv
and its library aims to provide:
Note: spvc
and its library are WIP and optional artifacts that are by default disabled in the build. How to enabled is detailed below.
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.
android_test/
: a small Android application to verify compilationcmake/
: CMake utility functions and configuration for Shadercexamples/
: Example programsglslc/
: an executable to compile GLSL to SPIR-Vlibshaderc/
: a library for compiling shader strings into SPIR-Vlibshaderc_util/
: a utility library used by multiple shaderc componentsthird_party/
: third party open source packages; see belowutils/
: utility scripts for ShadercShaderc 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.
If you only want prebuilt executables or libraries, see the Downloads section.
The rest of this section describes how to build Shaderc from sources.
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.
Ensure you have the requisite tools -- see the tools subsection below.
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.
For building, testing, and profiling Shaderc, the following tools should be installed regardless of your OS:
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:
diff
.Optionally, the following tools may be installed on any OS:
asciidoctor
: for generating documentation.pygments.rb
required by asciidoctor
for syntax highlighting.nosetests
: for testing the Python code.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
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.
We track bugs using GitHub -- click on the “Issues” button on the project's GitHub page.
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 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.