tag | 9b8b764b7937f340db8b17c5afcf3f4a248f3e9f | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Mon Apr 16 14:08:13 2018 -0700 |
object | 6cd7a08592cf568d595069552d3bb6cf21addb66 |
ndk-r17-beta1
commit | 6cd7a08592cf568d595069552d3bb6cf21addb66 | [log] [tgz] |
---|---|---|
author | David Neto <dneto@google.com> | Wed Oct 25 18:14:54 2017 -0400 |
committer | David Neto <dneto@google.com> | Wed Oct 25 18:15:36 2017 -0400 |
tree | b3be9f6bdbc8230f2980ec82945915815d0ceb35 | |
parent | 48feee09e007b52120cfbbcf968ead1e5152c262 [diff] | |
parent | c60725343fd6c0822bb7f580661d2ec6460391c0 [diff] |
Merge remote-tracking branch 'aosp/upstream-master' into update-shaderc Includes: c607253 Avoid -fPIC for MinGW builds 1927f30 Allow override of SPVTOOLS_LOCAL_PATH bcadbc1 Move spirv-tools build from third_party/Android.mk 3fde660 Update CHANGES c815335 Adapt to Glslang generator version number change 259ca18 Travis CI: use make to build 16f8253 Add HLSL legalization passes to compiler.cc e089609 Add SPIRV-Tools optimizer files for linker 84c9dd9 Added more opt passes to PassId enum b58a21a Fix typos in README.md 5c4fd69 Allow SPIRV-Headers to be checked out at third_party/ c677f26 Include SPIRV-Tools before glslang 8aa64c6 Appveyor: stop downloading pip c8ba3e4 Check _WIN32 instead of WIN32 for building shared library 00c9fe4 Appveyor: Stop deploying to BinTray 97e0e13 Appveyor: deploy to BinTray instead of GitHub Release page 0b99bfa Serialize inclusions by the CountingIncluder 4cdf49e Fix the build by changing deploy repo 6db3870 Deploy Appveyor build artifacts to GitHub Releases 7ad5b69 SPIRV-Tools added source/validate_bitwise.cpp 4138101 SPIRV-Tools added source/opt/eliminate_dead_functions_pass.cpp 61eb9ff Android: Fix generation of 1.2 grammar tables c77e1e9 SPIRV-Tools added source/validate_logicals.cpp eadd549 SPIRV-Tools added source/opt/strength_reduction_pass.cpp c56b7dc Add shared library variant for libshaderc 777c9ff SPIRV-Tools added validate_arithmetics.cpp Test: checkbuild.py on Linux; unit tests on Windows Change-Id: Iea56c8d560ce09a38f03a89067629e47b40e1def
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 doing the same.Shaderc wraps around core functionality in glslang and SPIRV-Tools. Shaderc aims to to provide:
#include
supportShaderc 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.)
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. Sometimes a change updates both Shaderc and glslang. In that case the glslang change will appear in google/glslang before it appears upstream in KhronosGroup/glslang We intend to upstream all changes to glslang. We maintain the separate copy only to stage those changes for review, and to provide something for Shaderc to build against in the meantime. Please see DEVELOPMENT.howto.md for more details.
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.
Experimental: On Windows, instead of building from source, you can get the artifacts built by Appveyor for the top of the tree of the master branch under the “Artifacts” tab of a certain job.
git clone https://github.com/google/shaderc $SOURCE_DIR cd $SOURCE_DIR/third_party git clone https://github.com/google/googletest.git git clone https://github.com/google/glslang.git git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools git clone https://github.com/KhronosGroup/SPIRV-Headers.git spirv-headers 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
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.