aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2018-09-27 13:58:05 -0400
committerDavid Neto <dneto@google.com>2018-09-27 13:58:43 -0400
commit9e12deaa2c227850010f10fe798ba48f8c76ecb8 (patch)
treef8b08e3232b927e950b9403c7822e6b3b1a48c9e
parent01c3b1a21e9642a61aa1f6a6a80a4f26b7a964e8 (diff)
parenta84571caead1f963701fd6ff859a32c4b2d5a702 (diff)
downloadshaderc-ndk-release-r19.tar.gz
Includes: a84571c Add support for missing CallableNV shader stage e2ddeea [ci] Remove Travis and Appveyor CI dd41537 Set the CMake C++ standard to C++11 38fbaed Specify NV_EXTENSIONS for Android build 0165db5 Add BUILD.gn rules 9340ae5 Re-order glslc help (almost) alphabetically and add -O, -Os, -O0 5cd480f Add new Glslang files to Android.mk a8dcbfa [appveyor] Use the correct filename for shared library 10aee4a [appveyor] Disable testing on VS2013 3104e38 [travis] Update Android NDK toolchain 8973958 [kokoro] Skip building SPIRV-tools tests on VS 2013 e7a6a26 [kokoro] Checkout effcee and re2 repos 7aef860 Update CHANGES. (E.g. Added NV Turing extensions) b430877 Add-support-for-SPV_NVX_raytracing e8ffa06 Add-support-for-SPV_NV_mesh_shader 30af9f9 Add virtual dtor to classes with virtual functions a2c044c [kokoro] Update Windows bots. (#468) f7efa14 Update to Glslang generator version 7 be8e087 Travis: download and install pip 4f36a64 Force binary mode when writing a binary to stdout 87a8420 Adjust configuration to link SPIRV-Tools into Glslang 5fd1b25 Support -fhlsl_functionality1 8dec681 Also install shaderc_shared.dll on windows. 2a0f3a3 Use standard SPIRV-Tools transformation recipes 583fb13 Locate clang for Linux buildbots. (#446) c993158 Support setting target environment version, e.g. Vulkan 1.1 45e1621 Re-enable the Windows continuous Debug builds. (#444) fc15f0a Add build result badges to README. (#439) 371d6ef Glslang generator version 6 0d23433 Glslang generator version 5 b6d4dcb Update glslc README for -fauto-map-locations cce7bbc Add glslc tests for -fauto-map-locations 13c6d97 Fix setting of debug DLL name for AppVeyor 461cc14 Adding kokoro build configurations. (#429) e55a246 AppVeyor packaging: debug DLL name no longer has extra "d" dbb0f14 Start v2018.0-dev 7a23a01 Finalize v2017.2 10530a0 copyright check: Skip auto-generated CMakeFiles 1628033 Update CHANGES for -fauto-map-locations afb2658 Glslang now requires bindings on resources d1f763c Add -fauto-map-locations option 563bc6e Add a virtual destructor, otherwise Clang 6.0complains about delete being called on an abstract class. c7b5df4 Skip Debug builds for VS 2013 and VS 2015 66aac8c Glslang updated its generator version number to 4 5d4b3f4 Android.mk: add glslang/MachineIndependent/attribute.cpp 773ec22 Make tests resilient to better SPIR-V optimizations 22aee5d Travis CI: install pip and set clone depth to 1 ad86c6c Adapt to Glslang codegen version update 98ab88b glslc tests: Relax version word check 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 12fb656 Don't build HTML docs by default 1803679 SPIRV-Tools added source/opt/inline_opaque_pass.cpp 280b66d SPIRV-Tools: Add source/opt/pass.cpp c276932 Android.mk: Add source/id_descriptor.cpp to SPIRV-Tools 7d7725f Add SPIRV-Tools opt/inline_exhaustive_pass.cpp ab73cf3 Add SPIRV-Tools source/opt/common_uniform_elim_pass.cpp 274d102 Support GLSL 4.6 and ESSL 3.2 9752555 Add source/opt/mem_pass.cpp to SPRIV-Tools d10af57 Add Appveyor configs for VS 2015, VS 2017 aa8f376 Adapt to Glslang error changes fb33022 Add recent SPIRV-Tools source file additions 41ce8e6 Fix Glslang Android build f382c71 Update CHANGES to mention use of GNUInstallDirs e27569f Introduce new option to skip installation cd5199f Glslang requires -DENABLE_HLSL 7bd63fb Add block_merge_pass.cpp to SPIRV-Tools ef03acd Increase default maxDrawBuffers 2f68ce7 Add SPIRV-Tools file source/opt/insert_extract_elim.cpp c4b491b SPIRV-Tools added source/opt/local_single_store_elim_pass.cpp 62fd200 Avoid unnecessary lambda capture 8f79dd1 Reorganize options in glslc README 63d0f82 Add -fresource-set-binding bf60221 Add option to set HLSL register descriptor set and binding 44dff89 Add -fhlsl-offsets 6194f07 Render table of contents for glslc manual aede4fe Fix Glslang test dir path for MSVC build 760c3f5 React to new SPIRV-Tools source files 0dd731a React to removed Glslang .cpp files 1adfc98 Update tests for Glslang global warning changes 6ff1564 Add layout(location = 0) where needed in tests. b1228ba Adjust copying of Glslang test files, for include test 558dede Shorten arg checking for -f*-binding-base 7df8217 Reject negative numbers when parsing unsigned. 63313f9 Add -fuav-binding-base cdcc015 Support setting SSBO binding base 357d24b Add glslc options to set binding base for uniforms 735a541 Add shaderc_compile_options_set_binding_base_for_stage c1729a4 Add libshaderc_util::Compiler::SetAutoBindingBaseForStage 2c7db7c Add shaderc_util::Compiler::Stage da4f9b0 Add generic names for shader stages a290067 Add glslc options to set binding base numbers d8eb937 Add C, C++ API to set binding base for uniforms b54a418 Add libshaderc_util::SetAutoBindingBase b7b4892 Add -flimit-file to glslc doc summary a532710 Document some recent changes, e.g. HLSL offsets 7261ab8 Fix Travis-CI so ctest emits output on failure 3c85d26 Make git ignore android_test/libs 580d540 Support SPIR-V 1.2 in SPIRV-Tools Android build dcb3036 Avoid mem leaks in counting includer test 44823cb Add util/bit_stream.cpp in Android.mk for SPIRV-Tools a571eef Trim Appveyor notification list 659b796 Fix test to update glslang 9b3dbd1 Avoid noexcept-type in GCC 7.1 for test code 21e2016 Added compact_ids_pass.cpp to Android.mk 380e143 React to Glslang #version error message for HLSL ed5e93e Update tests for different Glslang error message 3966711 SPIRV-Tools added flatten decorations pass 6509a8b Update tests for Glslang message changes 32b0c71 Add SPIRV-Tools source file for its MR534 71b9b3b Support non-standard vendor extended instructions c698442 Add pervasive dependency to extension_enum.inc 97ab4d1 SPIRV-Tools added source/validate_capability.cpp 9a08e4a Added extension enum, mapping autogen to android fef405c Add util/string_utils.cpp to SPIRV-Tools 9faaa69 Fix include error message when no options object e29176b Start v2017.2-dev 1b4359c Finalize v2017.1 b541cc5 Update CHANGES with all recent key items 6d49dcf Mention Rust binding in README 7da4872 Describe the known-good branch 864d819 SPIRV-Tools added source/extensions.cpp 5432099 Clarify that bindings are maintained by others 0609612 Add Bindings section in Readme 1a149f6 Fix shaderc_compile_to_spv examples in shaderc.h cb4f0f6 Describe includer error convention in the struct. 48b5f88 Add comment to explain how to return an error in callback 9c3a4ee Use OpenCL extended instruction set from SPIRV-Headers 5c6247c Add validate_type_unique.cpp to SPIRV-Tools b4f0c10 Add spirv_validator_options.cpp to SPIRV-Tools 83afd96 Update CHANGES to say NVIDIA extensions enabled f6d5124 Enable NV_EXTENSIONS for Android build of glslang 849ae99 Install shaderc header files. 7ae44a1 Add -fauto-bind-uniforms to glslc ea687fd Add C, C++ API option to auto bind uniforms fc60017 Add libshader_util::Compiler::SetAutoBindUniforms 26c29e4 Test compiler option to auto bind uniforms 6ec47b0 Fix installation of libshaderc_combined.a on Windows. 0de1e58 Add CMake configuration to install shaderc libraries. 4fa3150 SPIRV-Tools added source/validate_decorations.cpp 9f7547d Allow build time to be overidden. 38777c7 Update Travis CI configuration. dd79e70 Adapt to Glslang Includer interface changes. 0675ac7 Updated CMake configuration for Android Studio. (#296) 607daae Allow trailing whitespace in version lines in CHANGES c5cfcc5 Adapt to Glslang include message changes 419214b Don't write an output file if compilation fails 138757e shaderc_util::GetOutputStream sends errors to a given stream 54fa1d7 Set the tool to Google Shaderc over Glslang 30e5bc0 Start v2016.3-dev 2fb6a3a Finalize v2016.2 e3f0d2e Add -Werror to Android build 4ff1d25 Add rule for creating SPIRV-Tools generators.inc file 01921d4 Updated maxDrawBuffers to be consistent with Vulkan/GLES3.0 (#283) Change-Id: Ib5ffc53fb129e8880350bae3fa7a98bf729e89da Testing: checkbuild.py on Linux; unit tests on Windows
-rw-r--r--.appveyor.yml83
-rw-r--r--.travis.yml125
-rw-r--r--BUILD.gn114
-rw-r--r--CHANGES7
-rw-r--r--CMakeLists.txt9
-rw-r--r--README.md6
-rw-r--r--build_overrides/shaderc.gni19
-rw-r--r--glslc/src/main.cc79
-rw-r--r--glslc/src/shader_stage.cc23
-rw-r--r--glslc/src/stage_test.cc26
-rw-r--r--glslc/test/parameter_tests.py79
-rw-r--r--kokoro/android-release/build.sh2
-rw-r--r--kokoro/linux/build.sh2
-rw-r--r--kokoro/macos/build.sh2
-rw-r--r--kokoro/ndk-build/build.sh2
-rw-r--r--kokoro/windows/build.bat11
-rw-r--r--libshaderc/Android.mk2
-rw-r--r--libshaderc/include/shaderc/shaderc.h27
-rw-r--r--libshaderc/src/common_shaders_for_test.h38
-rw-r--r--libshaderc/src/shaderc.cc57
-rw-r--r--libshaderc/src/shaderc_private.h18
-rw-r--r--libshaderc/src/shaderc_private_test.cc18
-rw-r--r--libshaderc/src/shaderc_test.cc76
-rw-r--r--libshaderc_util/Android.mk2
-rw-r--r--libshaderc_util/include/libshaderc_util/compiler.h26
-rw-r--r--libshaderc_util/src/resources.cc12
-rw-r--r--third_party/Android.mk2
27 files changed, 569 insertions, 298 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
deleted file mode 100644
index 89bb874..0000000
--- a/.appveyor.yml
+++ /dev/null
@@ -1,83 +0,0 @@
-# Windows Build Configuration for AppVeyor
-# http://www.appveyor.com/docs/appveyor-yml
-
-# version format
-version: "{build}"
-
-os:
- - Visual Studio 2015
- - Visual Studio 2013
- - Visual Studio 2017
-
-platform:
- - x64
-
-environment:
- PYTHON_PATH: "C:/Python27"
-
-configuration:
- - Debug
- - Release
-
-matrix:
- fast_finish: true
- exclude:
- - os: Visual Studio 2015
- configuration: Debug
- - os: Visual Studio 2013
- configuration: Debug
-
-branches:
- only:
- - master
-
-# scripts that are called at very beginning, before repo cloning
-init:
- - "%PYTHON_PATH%/Scripts/pip.exe install nose"
-
-# scripts that run after cloning repository
-install:
- - git clone https://github.com/google/googletest.git third_party/googletest
- - git clone https://github.com/google/glslang.git third_party/glslang
- - git clone https://github.com/KhronosGroup/SPIRV-Tools.git third_party/spirv-tools
- - git clone https://github.com/KhronosGroup/SPIRV-Headers.git third_party/spirv-headers
-
-build:
- parallel: true # enable MSBuild parallel builds
- verbosity: minimal
-
-build_script:
- - mkdir build && cd build
- - cmake .. -DCMAKE_INSTALL_PREFIX=install
- - cmake --build . --target install --config %CONFIGURATION%
-
-test_script:
- - ctest -C %CONFIGURATION% --output-on-failure
-
-after_test:
- - ps: >-
- If ($env:configuration -Match "Debug") {
- $env:ZIP_FILENAME="shaderc-tot-windows-x64-debug.zip"
- } Else {
- $env:ZIP_FILENAME="shaderc-tot-windows-x64-release.zip"
- }
- - cp libshaderc\%CONFIGURATION%\shaderc_shared.dll install\lib\
- - cd install
- - 7z a %ZIP_FILENAME% bin\glslc.exe include\shaderc\* lib\shaderc_combined.lib lib\shaderc_shared.dll
-
-artifacts:
- - path: build\install\$(ZIP_FILENAME)
- name: shaderc-artifacts
- - path: build\install\bin\glslc.exe
-
-notifications:
- - provider: Email
- to:
- - antiagainst@google.com
- - awoloszyn@google.com
- - dneto@google.com
- - qining@google.com
- subject: 'Shaderc Windows Build #{{buildVersion}}: {{status}}'
- on_build_success: false
- on_build_failure: true
- on_build_status_changed: true
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index c1aaee6..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,125 +0,0 @@
-# Linux Build Configuration for Travis
-
-language: cpp
-
-os:
- - linux
- - osx
-
-# Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment.
-sudo: required
-dist: trusty
-
-env:
- - SHADERC_BUILD_TYPE=Release
- - SHADERC_BUILD_TYPE=Debug
-
-compiler:
- - clang
- - gcc
-
-matrix:
- fast_finish: true # Show final status immediately if a test fails.
- exclude:
- # Skip GCC builds on macOS.
- - os: osx
- compiler: gcc
- include:
- # Additional GCC builds for code coverage.
- - os: linux
- compiler: gcc
- env: SHADERC_CODE_COVERAGE=ON
- # Additional build using Android NDK
- - env: BUILD_NDK=ON
-
-
-cache:
- apt: true
-
-git:
- depth: 1
-
-branches:
- only:
- - master
-
-addons:
- apt:
- packages:
- - clang-3.6
- - lcov
-
-before_install:
- - if [[ "$BUILD_NDK" == "ON" ]]; then
- git clone --depth=1 https://github.com/urho3d/android-ndk.git $HOME/android-ndk;
- export ANDROID_NDK=$HOME/android-ndk;
- git clone --depth=1 https://github.com/taka-no-me/android-cmake.git $HOME/android-cmake;
- export TOOLCHAIN_PATH=$HOME/android-cmake/android.toolchain.cmake;
- fi
- - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
- curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py;
- sudo python /tmp/get-pip.py;
- fi
-
-install:
- - pip install --user nose
- - pip install --user cpp-coveralls
-
- - export PATH=$HOME/.local/bin:$PATH # Make sure we can find the above Python packages
- # Make sure that clang-3.6 is selected.
- - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then
- export CC=clang-3.6 CXX=clang++-3.6;
- fi
-
-before_script:
- - git clone --depth=1 https://github.com/google/googletest third_party/googletest
- - git clone --depth=1 https://github.com/google/glslang third_party/glslang
- - git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Tools third_party/spirv-tools
- - git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers third_party/spirv-headers
-
-script:
- - mkdir build && cd build
- - if [[ "$BUILD_NDK" == "ON" ]]; then
- cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH}
- -DANDROID_NATIVE_API_LEVEL=android-9
- -DCMAKE_BUILD_TYPE=Release
- -DANDROID_ABI="armeabi-v7a with NEON"
- -DSHADERC_SKIP_TESTS=ON ..;
- else
- cmake -DCMAKE_BUILD_TYPE=${SHADERC_BUILD_TYPE:-Debug}
- -DENABLE_CODE_COVERAGE=${SHADERC_CODE_COVERAGE:-OFF} ..;
- fi
- - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
- export NPROC=`nproc`;
- else
- export NPROC=`sysctl -n hw.ncpu`;
- fi
- - make -j${NPROC}
- - if [[ "$BUILD_NDK" != "ON" ]]; then ctest -j${NPROC} --output-on-failure; fi
-
-after_success:
- # Collect coverage and push to coveralls.info.
- # Ignore third party source code and tests.
- - if [[ "$CC" == "gcc" && "$SHADERC_CODE_COVERAGE" == "ON" ]]; then
- coveralls
- --root ../
- --build-root ./
- --exclude-pattern '.+/third_party/'
- --exclude-pattern '.+/.+_test\.cc'
- --exclude-pattern '.+/CMakeFiles/'
- --gcov /usr/bin/gcov
- --gcov-options '\--long-file-names --preserve-paths'
- --verbose;
- fi
-
-
-notifications:
- email:
- recipients:
- - antiagainst@google.com
- - awoloszyn@google.com
- - deki@google.com
- - dneto@google.com
- - qining@google.com
- on_success: change
- on_failure: always
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..3ef029b
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,114 @@
+# Copyright 2018 The Shaderc Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/shaderc.gni")
+
+glslang_dir = shaderc_glslang_dir
+spirv_tools_dir = shaderc_spirv_tools_dir
+
+config("shaderc_util_public") {
+ include_dirs = [ "libshaderc_util/include" ]
+}
+
+source_set("shaderc_util_sources") {
+ sources = [
+ "libshaderc_util/include/libshaderc_util/counting_includer.h",
+ "libshaderc_util/include/libshaderc_util/file_finder.h",
+ "libshaderc_util/include/libshaderc_util/format.h",
+ "libshaderc_util/include/libshaderc_util/io.h",
+ "libshaderc_util/include/libshaderc_util/message.h",
+ "libshaderc_util/include/libshaderc_util/mutex.h",
+ "libshaderc_util/include/libshaderc_util/resources.h",
+ "libshaderc_util/include/libshaderc_util/spirv_tools_wrapper.h",
+ "libshaderc_util/include/libshaderc_util/string_piece.h",
+ "libshaderc_util/include/libshaderc_util/universal_unistd.h",
+ "libshaderc_util/include/libshaderc_util/version_profile.h",
+ "libshaderc_util/src/compiler.cc",
+ "libshaderc_util/src/file_finder.cc",
+ "libshaderc_util/src/io.cc",
+ "libshaderc_util/src/message.cc",
+ "libshaderc_util/src/resources.cc",
+ "libshaderc_util/src/shader_stage.cc",
+ "libshaderc_util/src/spirv_tools_wrapper.cc",
+ "libshaderc_util/src/version_profile.cc",
+ ]
+
+ public_configs = [ ":shaderc_util_public" ]
+
+ deps = [
+ "${glslang_dir}:glslang_static",
+ "${spirv_tools_dir}:spvtools",
+ ]
+}
+
+static_library("shaderc_util") {
+ public_configs = [ ":shaderc_util_public" ]
+
+ deps = [
+ ":shaderc_util_sources",
+ ]
+}
+
+config("shaderc_public") {
+ include_dirs = [ "libshaderc/include" ]
+ defines = [ "SHADERC_SHAREDLIB" ]
+
+ # Executable needs an rpath to find our shared libraries on OSX
+ if (is_mac) {
+ ldflags = [
+ "-rpath",
+ "@executable_path/",
+ ]
+ }
+}
+
+source_set("libshaderc_sources") {
+ defines = [ "SHADERC_IMPLEMENTATION" ]
+
+ sources = [
+ "libshaderc/include/shaderc/shaderc.h",
+ "libshaderc/include/shaderc/shaderc.hpp",
+ "libshaderc/src/shaderc.cc",
+ "libshaderc/src/shaderc_private.h",
+ ]
+
+ public_configs = [ ":shaderc_public" ]
+
+ deps = [
+ ":shaderc_util",
+ "${spirv_tools_dir}:spvtools",
+ "${spirv_tools_dir}:spvtools_val",
+ "${glslang_dir}:glslang_static",
+ ]
+}
+
+shared_library("libshaderc") {
+ public_configs = [ ":shaderc_public" ]
+
+ deps = [
+ ":libshaderc_sources",
+ ]
+
+ # Tell dependents where to find this shared library
+ if (is_mac) {
+ ldflags = [
+ "-install_name",
+ "@rpath/${target_name}.dylib",
+ ]
+ }
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [ "//build/config/compiler:no_chromium_code" ]
+}
+
diff --git a/CHANGES b/CHANGES
index f90eece..30783f4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,11 @@
Revision history for Shaderc
-v2018.0-dev 2018-02-27
- - Start v2018.0-dev
+v2018.0-dev 2018-09-20
- Support -fhlsl_functionality1 (also -fhlsl-functionality1)
+ - Support NVIDIA Turing extensions. Requires updated Glslang and SPIRV-Tools.
+ Fixes:
+ #469: Add virtual dtor to classes with virtual functions.
+ #457: Fix writing SPIR-V binaries to standard output on Windows.
v2017.2 2018-02-27
- Add a shared library version of libshaderc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9bd0df..b982eab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,10 +19,19 @@ else()
message(STATUS "Configuring Shaderc to avoid building tests.")
endif()
+set (CMAKE_CXX_STANDARD 11)
+
+option(SHADERC_ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
+
include(GNUInstallDirs)
include(cmake/setup_build.cmake)
include(cmake/utils.cmake)
+
+if(SHADERC_ENABLE_NV_EXTENSIONS)
+ add_definitions(-DNV_EXTENSIONS)
+endif(SHADERC_ENABLE_NV_EXTENSIONS)
+
add_custom_target(check-copyright ALL
${PYTHON_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
--check
diff --git a/README.md b/README.md
index 9a4cfef..b6d5e90 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,5 @@
# Shaderc
-[![Linux and Mac Build Status](https://travis-ci.org/google/shaderc.svg)](https://travis-ci.org/google/shaderc "Linux and Mac Build Status")
-[![Windows Build status](https://ci.appveyor.com/api/projects/status/g6c372blna7vnk1l?svg=true)](https://ci.appveyor.com/project/dneto0/shaderc "Windows Build Status")
-[![Coverage Status](https://coveralls.io/repos/google/shaderc/badge.svg?branch=master&service=github)](https://coveralls.io/github/google/shaderc?branch=master)
-
-Latest Build Status by Google:
-
<img alt="Linux" src="kokoro/img/linux.png" width="20px" height="20px" hspace="2px"/>![Linux Build Status](https://storage.googleapis.com/shaderc/badges/build_status_linux_release.svg)
<img alt="MacOS" src="kokoro/img/macos.png" width="20px" height="20px" hspace="2px"/>![MacOS Build Status](https://storage.googleapis.com/shaderc/badges/build_status_macos_release.svg)
<img alt="Windows" src="kokoro/img/windows.png" width="20px" height="20px" hspace="2px"/>![Windows Build Status](https://storage.googleapis.com/shaderc/badges/build_status_windows_release.svg)
diff --git a/build_overrides/shaderc.gni b/build_overrides/shaderc.gni
new file mode 100644
index 0000000..da03422
--- /dev/null
+++ b/build_overrides/shaderc.gni
@@ -0,0 +1,19 @@
+# Copyright 2018 The Shaderc Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# These are variables that are overridable by projects that include shaderc.
+
+# The path to shaderc dependencies.
+shaderc_glslang_dir = "//third_party/glslang"
+shaderc_spirv_tools_dir = "//third_party/spirv-tools"
diff --git a/glslc/src/main.cc b/glslc/src/main.cc
index 16f78c9..c6ceaec 100644
--- a/glslc/src/main.cc
+++ b/glslc/src/main.cc
@@ -60,58 +60,59 @@ Options:
Automatically assign locations to uniform variables that
don't have an explicit 'location' layout in the shader
source.
- -fhlsl-iomap Use HLSL IO mappings for bindings.
+ -fentry-point=<name>
+ Specify the entry point name for HLSL compilation, for
+ all subsequent source files. Default is "main".
-fhlsl_functionality1, -fhlsl-functionality1
Enable extension SPV_GOOGLE_hlsl_functionality1 for HLSL
compilation.
+ -fhlsl-iomap Use HLSL IO mappings for bindings.
+ -fhlsl-offsets Use HLSL offset rules for packing members of blocks.
+ Affects only GLSL. HLSL rules are always used for HLSL.
+ -flimit=<settings>
+ Specify resource limits. Each limit is specified by a limit
+ name followed by an integer value. Tokens should be
+ separated by whitespace. If the same limit is specified
+ several times, only the last setting takes effect.
+ -flimit-file <file>
+ Set limits as specified in the given file.
+ -fresource-set-binding [stage] <reg0> <set0> <binding0>
+ [<reg1> <set1> <binding1>...]
+ Explicitly sets the descriptor set and binding for
+ HLSL resources, by register name. Optionally restrict
+ it to a single stage.
+ -fcbuffer-binding-base [stage] <value>
+ Same as -fubo-binding-base.
-fimage-binding-base [stage] <value>
Sets the lowest automatically assigned binding number for
images. Optionally only set it for a single shader stage.
For HLSL, the resource register number is added to this
base.
- -ftexture-binding-base [stage] <value>
- Sets the lowest automatically assigned binding number for
- textures. Optionally only set it for a single shader stage.
- For HLSL, the resource register number is added to this
- base.
-fsampler-binding-base [stage] <value>
Sets the lowest automatically assigned binding number for
samplers Optionally only set it for a single shader stage.
For HLSL, the resource register number is added to this
base.
- -fubo-binding-base [stage] <value>
- Sets the lowest automatically assigned binding number for
- uniform buffer objects (UBO). Optionally only set it for
- a single shader stage.
- For HLSL, the resource register number is added to this
- base.
- -fcbuffer-binding-base [stage] <value>
- Same as -fubo-binding-base.
-fssbo-binding-base [stage] <value>
Sets the lowest automatically assigned binding number for
shader storage buffer objects (SSBO). Optionally only set
it for a single shader stage. Only affects GLSL.
+ -ftexture-binding-base [stage] <value>
+ Sets the lowest automatically assigned binding number for
+ textures. Optionally only set it for a single shader stage.
+ For HLSL, the resource register number is added to this
+ base.
-fuav-binding-base [stage] <value>
For automatically assigned bindings for unordered access
views (UAV), the register number is added to this base to
determine the binding number. Optionally only set it for
a single shader stage. Only affects HLSL.
- -fresource-set-binding [stage] <reg0> <set0> <binding0>
- [<reg1> <set1> <binding1>...]
- Explicitly sets the descriptor set and binding for
- HLSL resources, by register name. Optionally restrict
- it to a single stage.
- -fentry-point=<name>
- Specify the entry point name for HLSL compilation, for
- all subsequent source files. Default is "main".
- -flimit=<settings>
- Specify resource limits. Each limit is specified by a limit
- name followed by an integer value. Tokens should be
- separated by whitespace. If the same limit is specified
- several times, only the last setting takes effect.
- --show-limits Display available limit names and their default values.
- -flimit-file <file>
- Set limits as specified in the given file.
+ -fubo-binding-base [stage] <value>
+ Sets the lowest automatically assigned binding number for
+ uniform buffer objects (UBO). Optionally only set it for
+ a single shader stage.
+ For HLSL, the resource register number is added to this
+ base.
-fshader-stage=<stage>
Treat subsequent input files as having stage <stage>.
Valid stages are vertex, vert, fragment, frag, tesscontrol,
@@ -119,13 +120,7 @@ Options:
-g Generate source-level debug information.
Currently this option has no effect.
--help Display available options.
- --version Display compiler version information.
-I <value> Add directory to include search path.
- -o <file> Write output to <file>.
- A file name of '-' represents standard output.
- -std=<value> Version and profile for GLSL input files. Possible values
- are concatenations of version and profile, e.g. 310es,
- 450core, etc. Ignored for HLSL files.
-mfmt=<format> Output SPIR-V binary code using the selected format. This
option may be specified only when the compilation output is
in SPIR-V binary code form. Available options include bin, c
@@ -136,7 +131,16 @@ Options:
-MF <file> Write dependency output to the given file.
-MT <target> Specify the target of the rule emitted by dependency
generation.
+ -O Optimize the generated SPIR-V code for better performance.
+ -Os Optimize the generated SPIR-V code for smaller size.
+ -O0 Disable optimization.
+ -o <file> Write output to <file>.
+ A file name of '-' represents standard output.
+ -std=<value> Version and profile for GLSL input files. Possible values
+ are concatenations of version and profile, e.g. 310es,
+ 450core, etc. Ignored for HLSL files.
-S Only run preprocess and compilation steps.
+ --show-limits Display available limit names and their default values.
--target-env=<environment>
Set the target client environment, and the semantics
of warnings and errors. An optional suffix can specify
@@ -146,14 +150,13 @@ Options:
vulkan # Same as vulkan1.0
opengl4.5
opengl # Same as opengl4.5
+ --version Display compiler version information.
-w Suppresses all warning messages.
-Werror Treat all warnings as errors.
-x <language> Treat subsequent input files as having type <language>.
Valid languages are: glsl, hlsl.
For files ending in .hlsl the default is hlsl.
Otherwise the default is glsl.
- -fhlsl-offsets Use HLSL offset rules for packing members of blocks.
- Affects only GLSL. HLSL rules are always used for HLSL.
)";
}
diff --git a/glslc/src/shader_stage.cc b/glslc/src/shader_stage.cc
index 142195a..3e4716d 100644
--- a/glslc/src/shader_stage.cc
+++ b/glslc/src/shader_stage.cc
@@ -43,7 +43,18 @@ shaderc_shader_kind MapStageNameToForcedKind(const string_piece& stage_name) {
{"geometry", shaderc_glsl_geometry_shader},
{"geom", shaderc_glsl_geometry_shader},
{"compute", shaderc_glsl_compute_shader},
- {"comp", shaderc_glsl_compute_shader}};
+ {"comp", shaderc_glsl_compute_shader},
+#ifdef NV_EXTENSIONS
+ {"rgen", shaderc_glsl_raygen_shader },
+ {"rahit", shaderc_glsl_anyhit_shader },
+ {"rchit", shaderc_glsl_closesthit_shader },
+ {"rmiss", shaderc_glsl_miss_shader },
+ {"rint", shaderc_glsl_intersection_shader },
+ {"rcall", shaderc_glsl_callable_shader },
+ {"task", shaderc_glsl_task_shader },
+ {"mesh", shaderc_glsl_mesh_shader },
+#endif
+ };
for (const auto& entry : string_to_kind) {
if (stage_name == entry.id) return entry.stage;
}
@@ -68,6 +79,16 @@ shaderc_shader_kind DeduceDefaultShaderKindFromFileName(
{"geom", shaderc_glsl_default_geometry_shader},
{"comp", shaderc_glsl_default_compute_shader},
{"spvasm", shaderc_spirv_assembly},
+#ifdef NV_EXTENSIONS
+ {"rgen", shaderc_glsl_default_raygen_shader },
+ {"rahit", shaderc_glsl_default_anyhit_shader },
+ {"rchit", shaderc_glsl_default_closesthit_shader },
+ {"rmiss", shaderc_glsl_default_miss_shader },
+ {"rint", shaderc_glsl_default_intersection_shader },
+ {"rcall", shaderc_glsl_default_callable_shader },
+ {"task", shaderc_glsl_default_task_shader },
+ {"mesh", shaderc_glsl_default_mesh_shader },
+#endif
};
const string_piece extension = glslc::GetFileExtension(file_name);
diff --git a/glslc/src/stage_test.cc b/glslc/src/stage_test.cc
index 9b1c254..80eef92 100644
--- a/glslc/src/stage_test.cc
+++ b/glslc/src/stage_test.cc
@@ -48,6 +48,32 @@ TEST(DeduceDefaultShaderKindFromFileName, ValidStage) {
EXPECT_EQ(shaderc_glsl_default_compute_shader,
glslc::DeduceDefaultShaderKindFromFileName("a.comp"));
+
+#ifdef NV_EXTENSIONS
+ EXPECT_EQ(shaderc_glsl_default_raygen_shader,
+ glslc::DeduceDefaultShaderKindFromFileName("a.rgen"));
+
+ EXPECT_EQ(shaderc_glsl_default_anyhit_shader,
+ glslc::DeduceDefaultShaderKindFromFileName("a.rahit"));
+
+ EXPECT_EQ(shaderc_glsl_default_closesthit_shader,
+ glslc::DeduceDefaultShaderKindFromFileName("a.rchit"));
+
+ EXPECT_EQ(shaderc_glsl_default_miss_shader,
+ glslc::DeduceDefaultShaderKindFromFileName("a.rmiss"));
+
+ EXPECT_EQ(shaderc_glsl_default_intersection_shader,
+ glslc::DeduceDefaultShaderKindFromFileName("a.rint"));
+
+ EXPECT_EQ(shaderc_glsl_default_callable_shader,
+ glslc::DeduceDefaultShaderKindFromFileName("a.rcall"));
+
+ EXPECT_EQ(shaderc_glsl_default_task_shader,
+ glslc::DeduceDefaultShaderKindFromFileName("a.task"));
+
+ EXPECT_EQ(shaderc_glsl_default_mesh_shader,
+ glslc::DeduceDefaultShaderKindFromFileName("a.mesh"));
+#endif
}
TEST(DeduceDefaultShaderKindFromFileName, InvalidStage) {
diff --git a/glslc/test/parameter_tests.py b/glslc/test/parameter_tests.py
index 21015e9..f83d10e 100644
--- a/glslc/test/parameter_tests.py
+++ b/glslc/test/parameter_tests.py
@@ -65,58 +65,59 @@ Options:
Automatically assign locations to uniform variables that
don't have an explicit 'location' layout in the shader
source.
- -fhlsl-iomap Use HLSL IO mappings for bindings.
+ -fentry-point=<name>
+ Specify the entry point name for HLSL compilation, for
+ all subsequent source files. Default is "main".
-fhlsl_functionality1, -fhlsl-functionality1
Enable extension SPV_GOOGLE_hlsl_functionality1 for HLSL
compilation.
+ -fhlsl-iomap Use HLSL IO mappings for bindings.
+ -fhlsl-offsets Use HLSL offset rules for packing members of blocks.
+ Affects only GLSL. HLSL rules are always used for HLSL.
+ -flimit=<settings>
+ Specify resource limits. Each limit is specified by a limit
+ name followed by an integer value. Tokens should be
+ separated by whitespace. If the same limit is specified
+ several times, only the last setting takes effect.
+ -flimit-file <file>
+ Set limits as specified in the given file.
+ -fresource-set-binding [stage] <reg0> <set0> <binding0>
+ [<reg1> <set1> <binding1>...]
+ Explicitly sets the descriptor set and binding for
+ HLSL resources, by register name. Optionally restrict
+ it to a single stage.
+ -fcbuffer-binding-base [stage] <value>
+ Same as -fubo-binding-base.
-fimage-binding-base [stage] <value>
Sets the lowest automatically assigned binding number for
images. Optionally only set it for a single shader stage.
For HLSL, the resource register number is added to this
base.
- -ftexture-binding-base [stage] <value>
- Sets the lowest automatically assigned binding number for
- textures. Optionally only set it for a single shader stage.
- For HLSL, the resource register number is added to this
- base.
-fsampler-binding-base [stage] <value>
Sets the lowest automatically assigned binding number for
samplers Optionally only set it for a single shader stage.
For HLSL, the resource register number is added to this
base.
- -fubo-binding-base [stage] <value>
- Sets the lowest automatically assigned binding number for
- uniform buffer objects (UBO). Optionally only set it for
- a single shader stage.
- For HLSL, the resource register number is added to this
- base.
- -fcbuffer-binding-base [stage] <value>
- Same as -fubo-binding-base.
-fssbo-binding-base [stage] <value>
Sets the lowest automatically assigned binding number for
shader storage buffer objects (SSBO). Optionally only set
it for a single shader stage. Only affects GLSL.
+ -ftexture-binding-base [stage] <value>
+ Sets the lowest automatically assigned binding number for
+ textures. Optionally only set it for a single shader stage.
+ For HLSL, the resource register number is added to this
+ base.
-fuav-binding-base [stage] <value>
For automatically assigned bindings for unordered access
views (UAV), the register number is added to this base to
determine the binding number. Optionally only set it for
a single shader stage. Only affects HLSL.
- -fresource-set-binding [stage] <reg0> <set0> <binding0>
- [<reg1> <set1> <binding1>...]
- Explicitly sets the descriptor set and binding for
- HLSL resources, by register name. Optionally restrict
- it to a single stage.
- -fentry-point=<name>
- Specify the entry point name for HLSL compilation, for
- all subsequent source files. Default is "main".
- -flimit=<settings>
- Specify resource limits. Each limit is specified by a limit
- name followed by an integer value. Tokens should be
- separated by whitespace. If the same limit is specified
- several times, only the last setting takes effect.
- --show-limits Display available limit names and their default values.
- -flimit-file <file>
- Set limits as specified in the given file.
+ -fubo-binding-base [stage] <value>
+ Sets the lowest automatically assigned binding number for
+ uniform buffer objects (UBO). Optionally only set it for
+ a single shader stage.
+ For HLSL, the resource register number is added to this
+ base.
-fshader-stage=<stage>
Treat subsequent input files as having stage <stage>.
Valid stages are vertex, vert, fragment, frag, tesscontrol,
@@ -124,13 +125,7 @@ Options:
-g Generate source-level debug information.
Currently this option has no effect.
--help Display available options.
- --version Display compiler version information.
-I <value> Add directory to include search path.
- -o <file> Write output to <file>.
- A file name of '-' represents standard output.
- -std=<value> Version and profile for GLSL input files. Possible values
- are concatenations of version and profile, e.g. 310es,
- 450core, etc. Ignored for HLSL files.
-mfmt=<format> Output SPIR-V binary code using the selected format. This
option may be specified only when the compilation output is
in SPIR-V binary code form. Available options include bin, c
@@ -141,7 +136,16 @@ Options:
-MF <file> Write dependency output to the given file.
-MT <target> Specify the target of the rule emitted by dependency
generation.
+ -O Optimize the generated SPIR-V code for better performance.
+ -Os Optimize the generated SPIR-V code for smaller size.
+ -O0 Disable optimization.
+ -o <file> Write output to <file>.
+ A file name of '-' represents standard output.
+ -std=<value> Version and profile for GLSL input files. Possible values
+ are concatenations of version and profile, e.g. 310es,
+ 450core, etc. Ignored for HLSL files.
-S Only run preprocess and compilation steps.
+ --show-limits Display available limit names and their default values.
--target-env=<environment>
Set the target client environment, and the semantics
of warnings and errors. An optional suffix can specify
@@ -151,14 +155,13 @@ Options:
vulkan # Same as vulkan1.0
opengl4.5
opengl # Same as opengl4.5
+ --version Display compiler version information.
-w Suppresses all warning messages.
-Werror Treat all warnings as errors.
-x <language> Treat subsequent input files as having type <language>.
Valid languages are: glsl, hlsl.
For files ending in .hlsl the default is hlsl.
Otherwise the default is glsl.
- -fhlsl-offsets Use HLSL offset rules for packing members of blocks.
- Affects only GLSL. HLSL rules are always used for HLSL.
'''
expected_stderr = ''
diff --git a/kokoro/android-release/build.sh b/kokoro/android-release/build.sh
index 4a59199..b32f7fd 100644
--- a/kokoro/android-release/build.sh
+++ b/kokoro/android-release/build.sh
@@ -41,6 +41,8 @@ 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
+git clone https://github.com/google/re2 spirv-tools/external/re2
+git clone https://github.com/google/effcee spirv-tools/external/effcee
cd $SRC/
mkdir build
diff --git a/kokoro/linux/build.sh b/kokoro/linux/build.sh
index efff2b0..6765656 100644
--- a/kokoro/linux/build.sh
+++ b/kokoro/linux/build.sh
@@ -74,6 +74,8 @@ 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
+git clone https://github.com/google/re2 spirv-tools/external/re2
+git clone https://github.com/google/effcee spirv-tools/external/effcee
cd $SRC/
mkdir build
diff --git a/kokoro/macos/build.sh b/kokoro/macos/build.sh
index c379911..7ae097c 100644
--- a/kokoro/macos/build.sh
+++ b/kokoro/macos/build.sh
@@ -36,6 +36,8 @@ 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
+git clone https://github.com/google/re2 spirv-tools/external/re2
+git clone https://github.com/google/effcee spirv-tools/external/effcee
cd $SRC/
mkdir build
diff --git a/kokoro/ndk-build/build.sh b/kokoro/ndk-build/build.sh
index 4b3b97e..5e1e126 100644
--- a/kokoro/ndk-build/build.sh
+++ b/kokoro/ndk-build/build.sh
@@ -46,6 +46,8 @@ git clone $GLSLANG_REPO_URL
git clone https://github.com/google/googletest.git
git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
git clone https://github.com/KhronosGroup/SPIRV-Headers.git spirv-tools/external/spirv-headers
+git clone https://github.com/google/re2 spirv-tools/external/re2
+git clone https://github.com/google/effcee spirv-tools/external/effcee
cd $SRC/
mkdir build
diff --git a/kokoro/windows/build.bat b/kokoro/windows/build.bat
index 4f7a23e..b1c76c8 100644
--- a/kokoro/windows/build.bat
+++ b/kokoro/windows/build.bat
@@ -29,6 +29,8 @@ 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
+git clone https://github.com/google/re2 spirv-tools/external/re2
+git clone https://github.com/google/effcee spirv-tools/external/effcee
cd %SRC%
mkdir build
@@ -57,7 +59,14 @@ if "%KOKORO_GITHUB_COMMIT%." == "." (
) else (
set BUILD_SHA=%KOKORO_GITHUB_COMMIT%
)
-cmake -DRE2_BUILD_TESTING=OFF -GNinja -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe ..
+
+:: Skip building SPIRV-Tools tests for VS2013
+if %VS_VERSION% == 2013 (
+ cmake -DRE2_BUILD_TESTING=OFF -DSPIRV_SKIP_TESTS=ON -GNinja -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe ..
+) else (
+ cmake -DRE2_BUILD_TESTING=OFF -GNinja -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe ..
+)
+
if %ERRORLEVEL% GEQ 1 exit /b %ERRORLEVEL%
echo "Build glslang... %DATE% %TIME%"
diff --git a/libshaderc/Android.mk b/libshaderc/Android.mk
index 13d5057..cdccab2 100644
--- a/libshaderc/Android.mk
+++ b/libshaderc/Android.mk
@@ -7,7 +7,7 @@ LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/include
LOCAL_SRC_FILES:=src/shaderc.cc
LOCAL_C_INCLUDES:=$(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES:=shaderc_util SPIRV-Tools-opt
-LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti
+LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -DNV_EXTENSIONS
LOCAL_EXPORT_CPPFLAGS:=-std=c++11
LOCAL_EXPORT_LDFLAGS:=-latomic
include $(BUILD_STATIC_LIBRARY)
diff --git a/libshaderc/include/shaderc/shaderc.h b/libshaderc/include/shaderc/shaderc.h
index 093bb12..6addebf 100644
--- a/libshaderc/include/shaderc/shaderc.h
+++ b/libshaderc/include/shaderc/shaderc.h
@@ -64,6 +64,7 @@ typedef enum {
shaderc_glsl_geometry_shader = shaderc_geometry_shader,
shaderc_glsl_tess_control_shader = shaderc_tess_control_shader,
shaderc_glsl_tess_evaluation_shader = shaderc_tess_evaluation_shader,
+
// Deduce the shader kind from #pragma annotation in the source code. Compiler
// will emit error if #pragma annotation is not found.
shaderc_glsl_infer_from_source,
@@ -77,6 +78,32 @@ typedef enum {
shaderc_glsl_default_tess_control_shader,
shaderc_glsl_default_tess_evaluation_shader,
shaderc_spirv_assembly,
+#ifdef NV_EXTENSIONS
+ shaderc_raygen_shader,
+ shaderc_anyhit_shader,
+ shaderc_closesthit_shader,
+ shaderc_miss_shader,
+ shaderc_intersection_shader,
+ shaderc_callable_shader,
+ shaderc_glsl_raygen_shader = shaderc_raygen_shader,
+ shaderc_glsl_anyhit_shader = shaderc_anyhit_shader,
+ shaderc_glsl_closesthit_shader = shaderc_closesthit_shader,
+ shaderc_glsl_miss_shader = shaderc_miss_shader,
+ shaderc_glsl_intersection_shader = shaderc_intersection_shader,
+ shaderc_glsl_callable_shader = shaderc_callable_shader,
+ shaderc_glsl_default_raygen_shader,
+ shaderc_glsl_default_anyhit_shader,
+ shaderc_glsl_default_closesthit_shader,
+ shaderc_glsl_default_miss_shader,
+ shaderc_glsl_default_intersection_shader,
+ shaderc_glsl_default_callable_shader,
+ shaderc_task_shader,
+ shaderc_mesh_shader,
+ shaderc_glsl_task_shader = shaderc_task_shader,
+ shaderc_glsl_mesh_shader = shaderc_mesh_shader,
+ shaderc_glsl_default_task_shader,
+ shaderc_glsl_default_mesh_shader,
+#endif
} shaderc_shader_kind;
typedef enum {
diff --git a/libshaderc/src/common_shaders_for_test.h b/libshaderc/src/common_shaders_for_test.h
index 4a89efe..7cc63f9 100644
--- a/libshaderc/src/common_shaders_for_test.h
+++ b/libshaderc/src/common_shaders_for_test.h
@@ -259,6 +259,44 @@ const char kGlslShaderComputeSubgroupBarrier[] =
#extension GL_KHR_shader_subgroup_basic : enable
void main() { subgroupBarrier(); })";
+#ifdef NV_EXTENSIONS
+// A GLSL task shader using a regular barrier.
+const char kGlslShaderTaskBarrier[] =
+ R"(#version 450
+ #extension GL_NV_mesh_shader : enable
+ layout(local_size_x = 32) in;
+ void main() { barrier(); })";
+
+// A GLSL task shader using the Subgroups feature.
+const char kGlslShaderTaskSubgroupBarrier[] =
+ R"(#version 450
+ #extension GL_NV_mesh_shader : enable
+ #extension GL_KHR_shader_subgroup_basic : enable
+ layout(local_size_x = 32) in;
+ void main() { subgroupBarrier(); })";
+
+// A GLSL mesh shader using a regular barrier.
+const char kGlslShaderMeshBarrier[] =
+ R"(#version 450
+ #extension GL_NV_mesh_shader : enable
+ layout(local_size_x = 32) in;
+ layout(max_vertices=81) out;
+ layout(max_primitives=32) out;
+ layout(triangles) out;
+ void main() { barrier(); })";
+
+// A GLSL mesh shader using the Subgroups feature.
+const char kGlslShaderMeshSubgroupBarrier[] =
+ R"(#version 450
+ #extension GL_NV_mesh_shader : enable
+ #extension GL_KHR_shader_subgroup_basic : enable
+ layout(local_size_x = 32) in;
+ layout(max_vertices=81) out;
+ layout(max_primitives=32) out;
+ layout(triangles) out;
+ void main() { subgroupBarrier(); })";
+#endif
+
const char kGlslMultipleFnShader[] =
R"(#version 450
layout(location=0) flat in int inVal;
diff --git a/libshaderc/src/shaderc.cc b/libshaderc/src/shaderc.cc
index 17b4c17..8a6eeb8 100644
--- a/libshaderc/src/shaderc.cc
+++ b/libshaderc/src/shaderc.cc
@@ -56,6 +56,26 @@ EShLanguage GetForcedStage(shaderc_shader_kind kind) {
return EShLangTessControl;
case shaderc_glsl_tess_evaluation_shader:
return EShLangTessEvaluation;
+
+#ifdef NV_EXTENSIONS
+ case shaderc_glsl_raygen_shader:
+ return EShLangRayGenNV;
+ case shaderc_glsl_anyhit_shader:
+ return EShLangAnyHitNV;
+ case shaderc_glsl_closesthit_shader:
+ return EShLangClosestHitNV;
+ case shaderc_glsl_miss_shader:
+ return EShLangMissNV;
+ case shaderc_glsl_intersection_shader:
+ return EShLangIntersectNV;
+ case shaderc_glsl_callable_shader:
+ return EShLangCallableNV;
+ case shaderc_glsl_task_shader:
+ return EShLangTaskNV;
+ case shaderc_glsl_mesh_shader:
+ return EShLangMeshNV;
+#endif
+
case shaderc_glsl_infer_from_source:
case shaderc_glsl_default_vertex_shader:
case shaderc_glsl_default_fragment_shader:
@@ -63,6 +83,16 @@ EShLanguage GetForcedStage(shaderc_shader_kind kind) {
case shaderc_glsl_default_geometry_shader:
case shaderc_glsl_default_tess_control_shader:
case shaderc_glsl_default_tess_evaluation_shader:
+#ifdef NV_EXTENSIONS
+ case shaderc_glsl_default_raygen_shader:
+ case shaderc_glsl_default_anyhit_shader:
+ case shaderc_glsl_default_closesthit_shader:
+ case shaderc_glsl_default_miss_shader:
+ case shaderc_glsl_default_intersection_shader:
+ case shaderc_glsl_default_callable_shader:
+ case shaderc_glsl_default_task_shader:
+ case shaderc_glsl_default_mesh_shader:
+#endif
case shaderc_spirv_assembly:
return EShLangCount;
}
@@ -120,6 +150,16 @@ class StageDeducer {
case shaderc_glsl_tess_control_shader:
case shaderc_glsl_tess_evaluation_shader:
case shaderc_glsl_infer_from_source:
+#ifdef NV_EXTENSIONS
+ case shaderc_glsl_raygen_shader:
+ case shaderc_glsl_anyhit_shader:
+ case shaderc_glsl_closesthit_shader:
+ case shaderc_glsl_miss_shader:
+ case shaderc_glsl_intersection_shader:
+ case shaderc_glsl_callable_shader:
+ case shaderc_glsl_task_shader:
+ case shaderc_glsl_mesh_shader:
+#endif
return EShLangCount;
case shaderc_glsl_default_vertex_shader:
return EShLangVertex;
@@ -133,6 +173,23 @@ class StageDeducer {
return EShLangTessControl;
case shaderc_glsl_default_tess_evaluation_shader:
return EShLangTessEvaluation;
+#ifdef NV_EXTENSIONS
+ case shaderc_glsl_default_raygen_shader:
+ return EShLangRayGenNV;
+ case shaderc_glsl_default_anyhit_shader:
+ return EShLangAnyHitNV;
+ case shaderc_glsl_default_closesthit_shader:
+ return EShLangClosestHitNV;
+ case shaderc_glsl_default_miss_shader:
+ return EShLangMissNV;
+ case shaderc_glsl_default_intersection_shader:
+ return EShLangIntersectNV;
+ case shaderc_glsl_default_callable_shader:
+ return EShLangCallableNV;
+ case shaderc_glsl_default_task_shader:
+ return EShLangTaskNV;
+ case shaderc_glsl_default_mesh_shader:
+#endif
case shaderc_spirv_assembly:
return EShLangCount;
}
diff --git a/libshaderc/src/shaderc_private.h b/libshaderc/src/shaderc_private.h
index 47de8f5..30dc863 100644
--- a/libshaderc/src/shaderc_private.h
+++ b/libshaderc/src/shaderc_private.h
@@ -111,6 +111,24 @@ inline shaderc_util::Compiler::Stage shaderc_convert_specific_stage(
return shaderc_util::Compiler::Stage::Geometry;
case shaderc_compute_shader:
return shaderc_util::Compiler::Stage::Compute;
+#if NV_EXTENSIONS
+ case shaderc_raygen_shader:
+ return shaderc_util::Compiler::Stage::RayGenNV;
+ case shaderc_intersection_shader:
+ return shaderc_util::Compiler::Stage::IntersectNV;
+ case shaderc_anyhit_shader:
+ return shaderc_util::Compiler::Stage::AnyHitNV;
+ case shaderc_closesthit_shader:
+ return shaderc_util::Compiler::Stage::ClosestHitNV;
+ case shaderc_miss_shader:
+ return shaderc_util::Compiler::Stage::MissNV;
+ case shaderc_callable_shader:
+ return shaderc_util::Compiler::Stage::CallableNV;
+ case shaderc_task_shader:
+ return shaderc_util::Compiler::Stage::TaskNV;
+ case shaderc_mesh_shader:
+ return shaderc_util::Compiler::Stage::MeshNV;
+#endif
default:
// We don't care about the other kinds.
break;
diff --git a/libshaderc/src/shaderc_private_test.cc b/libshaderc/src/shaderc_private_test.cc
index 2d6ebf8..3b64551 100644
--- a/libshaderc/src/shaderc_private_test.cc
+++ b/libshaderc/src/shaderc_private_test.cc
@@ -30,5 +30,23 @@ TEST(ConvertSpecificStage, Exhaustive) {
shaderc_convert_specific_stage(shaderc_geometry_shader));
EXPECT_EQ(shaderc_util::Compiler::Stage::Compute,
shaderc_convert_specific_stage(shaderc_compute_shader));
+#ifdef NV_EXTENSIONS
+ EXPECT_EQ(shaderc_util::Compiler::Stage::RayGenNV,
+ shaderc_convert_specific_stage(shaderc_raygen_shader));
+ EXPECT_EQ(shaderc_util::Compiler::Stage::AnyHitNV,
+ shaderc_convert_specific_stage(shaderc_anyhit_shader));
+ EXPECT_EQ(shaderc_util::Compiler::Stage::ClosestHitNV,
+ shaderc_convert_specific_stage(shaderc_closesthit_shader));
+ EXPECT_EQ(shaderc_util::Compiler::Stage::IntersectNV,
+ shaderc_convert_specific_stage(shaderc_intersection_shader));
+ EXPECT_EQ(shaderc_util::Compiler::Stage::MissNV,
+ shaderc_convert_specific_stage(shaderc_miss_shader));
+ EXPECT_EQ(shaderc_util::Compiler::Stage::CallableNV,
+ shaderc_convert_specific_stage(shaderc_callable_shader));
+ EXPECT_EQ(shaderc_util::Compiler::Stage::TaskNV,
+ shaderc_convert_specific_stage(shaderc_task_shader));
+ EXPECT_EQ(shaderc_util::Compiler::Stage::MeshNV,
+ shaderc_convert_specific_stage(shaderc_mesh_shader));
+#endif
}
} // anonymous namespace
diff --git a/libshaderc/src/shaderc_test.cc b/libshaderc/src/shaderc_test.cc
index 762b335..2571915 100644
--- a/libshaderc/src/shaderc_test.cc
+++ b/libshaderc/src/shaderc_test.cc
@@ -1167,6 +1167,82 @@ TEST_F(CompileStringWithOptionsTest,
shaderc_glsl_compute_shader, options_.get()));
}
+#ifdef NV_EXTENSIONS
+// task shader
+TEST_F(CompileStringWithOptionsTest,
+ TargetEnvRespectedWhenCompilingVulkan1_0TaskShaderToVulkan1_0Succeeds) {
+ shaderc_compile_options_set_target_env(options_.get(),
+ shaderc_target_env_vulkan,
+ shaderc_env_version_vulkan_1_0);
+ EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderTaskBarrier,
+ shaderc_glsl_task_shader, options_.get()));
+}
+
+TEST_F(CompileStringWithOptionsTest,
+ TargetEnvRespectedWhenCompilingVulkan1_0TaskShaderToVulkan1_1Succeeds) {
+ shaderc_compile_options_set_target_env(options_.get(),
+ shaderc_target_env_vulkan,
+ shaderc_env_version_vulkan_1_1);
+ EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderTaskBarrier,
+ shaderc_glsl_task_shader, options_.get()));
+}
+
+TEST_F(CompileStringWithOptionsTest,
+ TargetEnvRespectedWhenCompilingVulkan1_1TaskShaderToVulkan1_0Fails) {
+ shaderc_compile_options_set_target_env(options_.get(),
+ shaderc_target_env_vulkan,
+ shaderc_env_version_vulkan_1_0);
+ EXPECT_FALSE(CompilesToValidSpv(compiler_, kGlslShaderTaskSubgroupBarrier,
+ shaderc_glsl_task_shader, options_.get()));
+}
+
+TEST_F(CompileStringWithOptionsTest,
+ TargetEnvRespectedWhenCompilingVulkan1_1TaskShaderToVulkan1_1Succeeds) {
+ shaderc_compile_options_set_target_env(options_.get(),
+ shaderc_target_env_vulkan,
+ shaderc_env_version_vulkan_1_1);
+ EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderTaskSubgroupBarrier,
+ shaderc_glsl_task_shader, options_.get()));
+}
+
+// mesh shader
+TEST_F(CompileStringWithOptionsTest,
+ TargetEnvRespectedWhenCompilingVulkan1_0MeshShaderToVulkan1_0Succeeds) {
+ shaderc_compile_options_set_target_env(options_.get(),
+ shaderc_target_env_vulkan,
+ shaderc_env_version_vulkan_1_0);
+ EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderMeshBarrier,
+ shaderc_glsl_mesh_shader, options_.get()));
+}
+
+TEST_F(CompileStringWithOptionsTest,
+ TargetEnvRespectedWhenCompilingVulkan1_0MeshShaderToVulkan1_1Succeeds) {
+ shaderc_compile_options_set_target_env(options_.get(),
+ shaderc_target_env_vulkan,
+ shaderc_env_version_vulkan_1_1);
+ EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderMeshBarrier,
+ shaderc_glsl_mesh_shader, options_.get()));
+}
+
+TEST_F(CompileStringWithOptionsTest,
+ TargetEnvRespectedWhenCompilingVulkan1_1MeshShaderToVulkan1_0Fails) {
+ shaderc_compile_options_set_target_env(options_.get(),
+ shaderc_target_env_vulkan,
+ shaderc_env_version_vulkan_1_0);
+ EXPECT_FALSE(CompilesToValidSpv(compiler_, kGlslShaderMeshSubgroupBarrier,
+ shaderc_glsl_mesh_shader, options_.get()));
+}
+
+TEST_F(CompileStringWithOptionsTest,
+ TargetEnvRespectedWhenCompilingVulkan1_1MeshShaderToVulkan1_1Succeeds) {
+ shaderc_compile_options_set_target_env(options_.get(),
+ shaderc_target_env_vulkan,
+ shaderc_env_version_vulkan_1_1);
+ EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderMeshSubgroupBarrier,
+ shaderc_glsl_mesh_shader, options_.get()));
+}
+#endif
+
TEST_F(CompileStringWithOptionsTest,
DISABLED_TargetEnvIgnoredWhenPreprocessing) {
// This test is disabled since some versions of glslang may refuse to compile
diff --git a/libshaderc_util/Android.mk b/libshaderc_util/Android.mk
index 13c9f0a..3ef93b3 100644
--- a/libshaderc_util/Android.mk
+++ b/libshaderc_util/Android.mk
@@ -2,7 +2,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:=shaderc_util
-LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti
+LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -DNV_EXTENSIONS
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/include
LOCAL_SRC_FILES:=src/compiler.cc \
src/file_finder.cc \
diff --git a/libshaderc_util/include/libshaderc_util/compiler.h b/libshaderc_util/include/libshaderc_util/compiler.h
index 298344e..32c7547 100644
--- a/libshaderc_util/include/libshaderc_util/compiler.h
+++ b/libshaderc_util/include/libshaderc_util/compiler.h
@@ -169,14 +169,36 @@ class Compiler {
Geometry,
Fragment,
Compute,
+#ifdef NV_EXTENSIONS
+ RayGenNV,
+ IntersectNV,
+ AnyHitNV,
+ ClosestHitNV,
+ MissNV,
+ CallableNV,
+ TaskNV,
+ MeshNV,
+#endif
+ StageEnd,
};
- enum { kNumStages = int(Stage::Compute) + 1 };
+ enum { kNumStages = int(Stage::StageEnd) };
// Returns a std::array of all the Stage values.
const std::array<Stage, kNumStages>& stages() const {
static std::array<Stage, kNumStages> values{
{Stage::Vertex, Stage::TessEval, Stage::TessControl, Stage::Geometry,
- Stage::Fragment, Stage::Compute}};
+ Stage::Fragment, Stage::Compute,
+#ifdef NV_EXTENSIONS
+ Stage::RayGenNV,
+ Stage::IntersectNV,
+ Stage::AnyHitNV,
+ Stage::ClosestHitNV,
+ Stage::MissNV,
+ Stage::CallableNV,
+ Stage::TaskNV,
+ Stage::MeshNV,
+#endif
+ }};
return values;
}
diff --git a/libshaderc_util/src/resources.cc b/libshaderc_util/src/resources.cc
index 1617b0a..3cd9a66 100644
--- a/libshaderc_util/src/resources.cc
+++ b/libshaderc_util/src/resources.cc
@@ -116,6 +116,18 @@ const TBuiltInResource kDefaultTBuiltInResource = {
/*.maxCullDistances = */ 8, // ARB_cull_distance.
/*.maxCombinedClipAndCullDistances = */ 8, // ARB_cull_distance.
/*.maxSamples = */ 4,
+#ifdef NV_EXTENSIONS
+ /* .maxMeshOutputVerticesNV = */ 256,
+ /* .maxMeshOutputPrimitivesNV = */ 512,
+ /* .maxMeshWorkGroupSizeX_NV = */ 32,
+ /* .maxMeshWorkGroupSizeY_NV = */ 1,
+ /* .maxMeshWorkGroupSizeZ_NV = */ 1,
+ /* .maxTaskWorkGroupSizeX_NV = */ 32,
+ /* .maxTaskWorkGroupSizeY_NV = */ 1,
+ /* .maxTaskWorkGroupSizeZ_NV = */ 1,
+ /* .maxMeshViewCountNV = */ 4,
+#endif
+
// This is the glslang TLimits structure.
// It defines whether or not the following features are enabled.
// We want them to all be enabled.
diff --git a/third_party/Android.mk b/third_party/Android.mk
index 9e67eb0..a6f506c 100644
--- a/third_party/Android.mk
+++ b/third_party/Android.mk
@@ -17,6 +17,8 @@ LOCAL_SRC_FILES:= \
SPIRV/Logger.cpp \
SPIRV/SPVRemapper.cpp \
SPIRV/SpvBuilder.cpp \
+ SPIRV/SpvPostProcess.cpp \
+ SPIRV/SpvTools.cpp \
SPIRV/disassemble.cpp \
SPIRV/doc.cpp