diff options
author | David Neto <dneto@google.com> | 2022-04-06 12:54:37 -0400 |
---|---|---|
committer | David Neto <dneto@google.com> | 2022-04-06 12:54:37 -0400 |
commit | 7cea1fee975febe331912d905712249653aa2273 (patch) | |
tree | 2f54f00f7da67103c24d0b817cb95e5ca0dd56d3 | |
parent | 36f155040f5a4db1aa56e2cd25ac47dca9f57819 (diff) | |
parent | 1bbf43f210941ba69a2cd05cf3529063f1ff5bb9 (diff) | |
download | shaderc-7cea1fee975febe331912d905712249653aa2273.tar.gz |
Merge commit '1bbf43f210941ba69a2cd05cf3529063f1ff5bb9' into update-shaderc
Including:
1bbf43f Finalize v2022.1
131d466 Update DEPS for SPIRV-Tools fixes for SPIR-V 1.6
7ca718f Start v2022.1 development
8ec4195 Finalize v2202.0
6e54e68 Update DEPS to Glslang 11.8.0
9a5a9eb Start v2022.0 development
9d0b384 Finalize v2021.4
50c1da3 Support Vulkan 1.3
e72186b No need to cd $SOURCE_DIR again
3ffea48 Fix ndk-build libshader_combined target for newer NDK
4864297 Add SPIR-V 1.6 support
33ac6e5 Remove the core file that may be generated by death tests
988a5fa Docker build needs higher privileges for sanitizer builds
657c5ed Fix for missing copyright in glslang
dd79d05 Start v2021.4-dev
Change-Id: I702ef4b4e71fa6eeb9045638d6a560716692ed2a
-rw-r--r-- | Android.mk | 6 | ||||
-rw-r--r-- | CHANGES | 16 | ||||
-rw-r--r-- | DEPS | 6 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | glslc/README.asciidoc | 3 | ||||
-rw-r--r-- | glslc/src/main.cc | 9 | ||||
-rw-r--r-- | glslc/test/expect.py | 16 | ||||
-rw-r--r-- | glslc/test/option_target_env.py | 10 | ||||
-rw-r--r-- | glslc/test/option_target_spv.py | 7 | ||||
-rw-r--r-- | glslc/test/parameter_tests.py | 4 | ||||
-rwxr-xr-x | kokoro/linux/build-docker.sh | 3 | ||||
-rwxr-xr-x | kokoro/linux/build.sh | 3 | ||||
-rw-r--r-- | kokoro/ndk-build/build.sh | 24 | ||||
-rw-r--r-- | libshaderc/include/shaderc/env.h | 4 | ||||
-rw-r--r-- | libshaderc/src/shaderc.cc | 4 | ||||
-rw-r--r-- | libshaderc_util/include/libshaderc_util/compiler.h | 2 | ||||
-rw-r--r-- | libshaderc_util/src/compiler.cc | 6 | ||||
-rw-r--r-- | libshaderc_util/src/compiler_test.cc | 8 | ||||
-rw-r--r-- | libshaderc_util/src/spirv_tools_wrapper.cc | 2 | ||||
-rwxr-xr-x | utils/add_copyright.py | 2 |
20 files changed, 115 insertions, 21 deletions
@@ -52,8 +52,8 @@ $(1)/combine.ar: $(addprefix $(1)/, $(ALL_LIBS)) $(1)/libshaderc_combined.a: $(addprefix $(1)/, $(ALL_LIBS)) $(1)/combine.ar @echo "[$(TARGET_ARCH_ABI)] Combine: libshaderc_combined.a <= $(ALL_LIBS)" - @cd $(1) && $(2)ar -M < combine.ar && cd $(ROOT_SHADERC_PATH) - @$(2)objcopy --strip-debug $(1)/libshaderc_combined.a + @cd $(1) && $(TARGET_AR) -M < combine.ar && cd $(ROOT_SHADERC_PATH) + @$(TARGET_STRIP) --strip-debug $(1)/libshaderc_combined.a $(NDK_APP_LIBS_OUT)/$(APP_STL)/$(TARGET_ARCH_ABI)/libshaderc.a: \ $(1)/libshaderc_combined.a @@ -73,4 +73,4 @@ endef libshaderc_combined: $(SHADERC_HEADERS_IN_OUT_DIR) -$(eval $(call gen_libshaderc,$(TARGET_OUT),$(TOOLCHAIN_PREFIX))) +$(eval $(call gen_libshaderc,$(TARGET_OUT))) @@ -1,5 +1,21 @@ Revision history for Shaderc +v2022.1 2022-01-27 + - Update DEPS to include two fixes on top of SPIRV-Tools v2022.1: + - Validator handles Nontemporal image operand + - Optimizer handles RayQueryKHR type + +v2022.0 2022-01-27 + - Update to Glslang 11.8.0 + +v2021.4 2022-01-27 + - Support Vulkan 1.3 + - Support targeting SPIR-V 1.6, which is the default for Vulkan 1.3 + - Updated copyright check: Excludes Glslang generated files when + building in source tree + - Fix Android.mk rules for building libshaderc_combined, to adapt to more + recent NDKs that have removed the GNU binutils. + v2021.3 2021-11-11 - Add build switch to disable copyright check - Update DEPS: @@ -5,11 +5,11 @@ vars = { 'khronos_git': 'https://github.com/KhronosGroup', 'effcee_revision' : '2ec8f8738118cc483b67c04a759fee53496c5659', - 'glslang_revision': '600c5037baac82a80851d1fb95f3f09d34bb43e8', + 'glslang_revision': 'c34bb3b6c55f6ab084124ad964be95a699700d34', 'googletest_revision': '389cb68b87193358358ae87cc56d257fd0d80189', 're2_revision': '7107ebc4fbf7205151d8d2a57b2fc6e7853125d4', - 'spirv_headers_revision': '814e728b30ddd0f4509233099a3ad96fd4318c07', - 'spirv_tools_revision': 'ab8eb607750208066e2d57eff6a34dbaf05f5ada', + 'spirv_headers_revision': 'b42ba6d92faf6b4938e6f22ddd186dbdacc98d78', + 'spirv_tools_revision': 'b846f8f1dc2d79f2b5ce27d5ad901f885da1cf82', } deps = { @@ -96,7 +96,6 @@ See Glslang's `ENABLE_HLSL` CMake setting.) git clone https://github.com/google/shaderc $SOURCE_DIR cd $SOURCE_DIR ./utils/git-sync-deps -cd $SOURCE_DIR/ ``` **Note:** The [known-good](https://github.com/google/shaderc/tree/known-good) diff --git a/glslc/README.asciidoc b/glslc/README.asciidoc index 2d64820..ced28af 100644 --- a/glslc/README.asciidoc +++ b/glslc/README.asciidoc @@ -237,7 +237,7 @@ the following: * `opengl4.5`: create SPIR-V under OpenGL 4.5 semantics. Generated code uses SPIR-V 1.0, except for code compiled for Vulkan 1.1, which uses -SPIR-V 1.3, and code compiled for Vulkan 1.5, which uses SPIR-V 1.5. +SPIR-V 1.3, and code compiled for Vulkan 1.2, which uses SPIR-V 1.5. If this option is not specified, a default of `vulkan1.0` is used. @@ -259,6 +259,7 @@ The ``<value>`` can be one of the following: * `spv1.3` * `spv1.4` * `spv1.5` +* `spv1.6` ==== `-x` diff --git a/glslc/src/main.cc b/glslc/src/main.cc index 5ca5d61..54ae3ff 100644 --- a/glslc/src/main.cc +++ b/glslc/src/main.cc @@ -159,6 +159,7 @@ Options: vulkan1.0 # The default vulkan1.1 vulkan1.2 + vulkan1.3 vulkan # Same as vulkan1.0 opengl4.5 opengl # Same as opengl4.5 @@ -169,8 +170,9 @@ Options: For example, default for vulkan1.0 is spv1.0, and the default for vulkan1.1 is spv1.3, the default for vulkan1.2 is spv1.5. + the default for vulkan1.3 is spv1.6. Values are: - spv1.0, spv1.1, spv1.2, spv1.3, spv1.4, spv1.5 + spv1.0, spv1.1, spv1.2, spv1.3, spv1.4, spv1.5, spv1.6 --version Display compiler version information. -w Suppresses all warning messages. -Werror Treat all warnings as errors. @@ -438,6 +440,9 @@ int main(int argc, char** argv) { } else if (target_env_str == "vulkan1.2") { target_env = shaderc_target_env_vulkan; version = shaderc_env_version_vulkan_1_2; + } else if (target_env_str == "vulkan1.3") { + target_env = shaderc_target_env_vulkan; + version = shaderc_env_version_vulkan_1_3; } else if (target_env_str == "opengl") { target_env = shaderc_target_env_opengl; } else if (target_env_str == "opengl4.5") { @@ -470,6 +475,8 @@ int main(int argc, char** argv) { ver = shaderc_spirv_version_1_4; } else if (ver_str == "spv1.5") { ver = shaderc_spirv_version_1_5; + } else if (ver_str == "spv1.6") { + ver = shaderc_spirv_version_1_6; } else { std::cerr << "glslc: error: invalid value '" << ver_str << "' in '--target-spv=" << ver_str << "'" << std::endl; diff --git a/glslc/test/expect.py b/glslc/test/expect.py index 7410f73..9ac54b2 100644 --- a/glslc/test/expect.py +++ b/glslc/test/expect.py @@ -312,6 +312,22 @@ class ValidObjectFile1_5(SuccessfulReturn, CorrectObjectFilePreamble): return True, '' +class ValidObjectFile1_6(SuccessfulReturn, CorrectObjectFilePreamble): + """Mixin class for checking that every input file generates a valid SPIR-V 1.6 + object file following the object file naming rule, and there is no output on + stdout/stderr.""" + + def check_object_file_preamble(self, status): + for input_filename in status.input_filenames: + object_filename = get_object_filename(input_filename) + success, message = self.verify_object_file_preamble( + os.path.join(status.directory, object_filename), + 0x10600) + if not success: + return False, message + return True, '' + + class ValidObjectFileWithAssemblySubstr(SuccessfulReturn, CorrectObjectFilePreamble): """Mixin class for checking that every input file generates a valid object file following the object file naming rule, there is no output on diff --git a/glslc/test/option_target_env.py b/glslc/test/option_target_env.py index 4805581..91e6022 100644 --- a/glslc/test/option_target_env.py +++ b/glslc/test/option_target_env.py @@ -131,6 +131,16 @@ class TestTargetEnvEqVulkan1_2WithVulkan1_1ShaderSucceeds(expect.ValidObjectFile glslc_args = ['--target-env=vulkan1.2', '-c', shader] @inside_glslc_testsuite('OptionTargetEnv') +class TestTargetEnvEqVulkan1_2WithVulkan1_0ShaderSucceeds(expect.ValidObjectFile1_6): + shader = FileShader(vulkan_vertex_shader(), '.vert') + glslc_args = ['--target-env=vulkan1.3', '-c', shader] + +@inside_glslc_testsuite('OptionTargetEnv') +class TestTargetEnvEqVulkan1_2WithVulkan1_1ShaderSucceeds(expect.ValidObjectFile1_6): + shader = FileShader(vulkan_compute_subgroup_shader(), '.comp') + glslc_args = ['--target-env=vulkan1.3', '-c', shader] + +@inside_glslc_testsuite('OptionTargetEnv') class TestTargetEnvEqOpenGL4_5WithOpenGLShaderSucceeds(expect.ValidObjectFile): shader = FileShader(opengl_vertex_shader(), '.vert') glslc_args = ['--target-env=opengl4.5', '-c', shader] diff --git a/glslc/test/option_target_spv.py b/glslc/test/option_target_spv.py index 870025b..86ad6f1 100644 --- a/glslc/test/option_target_spv.py +++ b/glslc/test/option_target_spv.py @@ -78,6 +78,13 @@ class TestTargetSpv1p5(expect.ValidObjectFile1_5): glslc_args = ['--target-spv=spv1.5', '-c', shader] +@inside_glslc_testsuite('OptionTargetSpv') +class TestTargetSpv1p5(expect.ValidObjectFile1_6): + """Tests that compiling to spv1.6 succeeds and generates SPIR-V 1.6 binary.""" + shader = FileShader(vulkan_vertex_shader(), '.vert') + glslc_args = ['--target-spv=spv1.6', '-c', shader] + + ### Option parsing error cases @inside_glslc_testsuite('OptionTargetSpv') diff --git a/glslc/test/parameter_tests.py b/glslc/test/parameter_tests.py index be011a1..ce41d8f 100644 --- a/glslc/test/parameter_tests.py +++ b/glslc/test/parameter_tests.py @@ -163,6 +163,7 @@ Options: vulkan1.0 # The default vulkan1.1 vulkan1.2 + vulkan1.3 vulkan # Same as vulkan1.0 opengl4.5 opengl # Same as opengl4.5 @@ -173,8 +174,9 @@ Options: For example, default for vulkan1.0 is spv1.0, and the default for vulkan1.1 is spv1.3, the default for vulkan1.2 is spv1.5. + the default for vulkan1.3 is spv1.6. Values are: - spv1.0, spv1.1, spv1.2, spv1.3, spv1.4, spv1.5 + spv1.0, spv1.1, spv1.2, spv1.3, spv1.4, spv1.5, spv1.6 --version Display compiler version information. -w Suppresses all warning messages. -Werror Treat all warnings as errors. diff --git a/kokoro/linux/build-docker.sh b/kokoro/linux/build-docker.sh index fb65f81..9687d0a 100755 --- a/kokoro/linux/build-docker.sh +++ b/kokoro/linux/build-docker.sh @@ -92,6 +92,9 @@ then fi echo $(date): ctest completed. +# libshaderc_util/core is generated by the death test in shaderc_util_file_finder_test +rm -f libshaderc_util/core + # Package the build. ninja install cd $KOKORO_ARTIFACTS_DIR diff --git a/kokoro/linux/build.sh b/kokoro/linux/build.sh index 765a387..3e6375c 100755 --- a/kokoro/linux/build.sh +++ b/kokoro/linux/build.sh @@ -24,7 +24,10 @@ ROOT_DIR="$( cd "${SCRIPT_DIR}/../.." >/dev/null 2>&1 && pwd )" CONFIG=$1 COMPILER=$2 +# --privileged is required for some sanitizer builds, as they seem to require +# PTRACE privileges docker run --rm -i \ + --privileged \ --volume "${ROOT_DIR}:${ROOT_DIR}" \ --volume "${KOKORO_ARTIFACTS_DIR}:${KOKORO_ARTIFACTS_DIR}" \ --workdir "${ROOT_DIR}" \ diff --git a/kokoro/ndk-build/build.sh b/kokoro/ndk-build/build.sh index edf361c..0b9e124 100644 --- a/kokoro/ndk-build/build.sh +++ b/kokoro/ndk-build/build.sh @@ -44,13 +44,21 @@ cd $SRC/build # Invoke the build. BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} -echo $(date): Starting ndk-build ... -$ANDROID_NDK/ndk-build \ - -C $SRC/android_test \ - NDK_APP_OUT=`pwd` \ - V=1 \ - SPVTOOLS_LOCAL_PATH=$SRC/third_party/spirv-tools \ - SPVHEADERS_LOCAL_PATH=$SRC/third_party/spirv-headers \ - -j 8 + +function do_ndk_build () { + echo $(date): Starting ndk-build $@... + $ANDROID_NDK/ndk-build \ + -C $SRC/android_test \ + NDK_APP_OUT=`pwd` \ + V=1 \ + SPVTOOLS_LOCAL_PATH=$SRC/third_party/spirv-tools \ + SPVHEADERS_LOCAL_PATH=$SRC/third_party/spirv-headers \ + -j 8 $@ +} + +do_ndk_build + +# Check that libshaderc_combined builds +do_ndk_build libshaderc_combined echo $(date): ndk-build completed. diff --git a/libshaderc/include/shaderc/env.h b/libshaderc/include/shaderc/env.h index 5285b9e..14b418d 100644 --- a/libshaderc/include/shaderc/env.h +++ b/libshaderc/include/shaderc/env.h @@ -40,6 +40,7 @@ typedef enum { shaderc_env_version_vulkan_1_0 = ((1u << 22)), shaderc_env_version_vulkan_1_1 = ((1u << 22) | (1 << 12)), shaderc_env_version_vulkan_1_2 = ((1u << 22) | (2 << 12)), + shaderc_env_version_vulkan_1_3 = ((1u << 22) | (3 << 12)), // For OpenGL, use the number from #version in shaders. // TODO(dneto): Currently no difference between OpenGL 4.5 and 4.6. // See glslang/Standalone/Standalone.cpp @@ -60,7 +61,8 @@ typedef enum { shaderc_spirv_version_1_2 = 0x010200u, shaderc_spirv_version_1_3 = 0x010300u, shaderc_spirv_version_1_4 = 0x010400u, - shaderc_spirv_version_1_5 = 0x010500u + shaderc_spirv_version_1_5 = 0x010500u, + shaderc_spirv_version_1_6 = 0x010600u } shaderc_spirv_version; #ifdef __cplusplus diff --git a/libshaderc/src/shaderc.cc b/libshaderc/src/shaderc.cc index 7fdd516..712f3dc 100644 --- a/libshaderc/src/shaderc.cc +++ b/libshaderc/src/shaderc.cc @@ -305,6 +305,10 @@ shaderc_util::Compiler::TargetEnvVersion GetCompilerTargetEnvVersion( version_number) { return Compiler::TargetEnvVersion::Vulkan_1_2; } + if (static_cast<uint32_t>(Compiler::TargetEnvVersion::Vulkan_1_3) == + version_number) { + return Compiler::TargetEnvVersion::Vulkan_1_3; + } if (static_cast<uint32_t>(Compiler::TargetEnvVersion::OpenGL_4_5) == version_number) { return Compiler::TargetEnvVersion::OpenGL_4_5; diff --git a/libshaderc_util/include/libshaderc_util/compiler.h b/libshaderc_util/include/libshaderc_util/compiler.h index bad5b6a..1a46f4e 100644 --- a/libshaderc_util/include/libshaderc_util/compiler.h +++ b/libshaderc_util/include/libshaderc_util/compiler.h @@ -85,6 +85,7 @@ class Compiler { Vulkan_1_0 = ((1 << 22)), // Vulkan 1.0 Vulkan_1_1 = ((1 << 22) | (1 << 12)), // Vulkan 1.1 Vulkan_1_2 = ((1 << 22) | (2 << 12)), // Vulkan 1.2 + Vulkan_1_3 = ((1 << 22) | (3 << 12)), // Vulkan 1.2 // For OpenGL, use the numbering from #version in shaders. OpenGL_4_5 = 450, }; @@ -97,6 +98,7 @@ class Compiler { v1_3 = 0x010300u, v1_4 = 0x010400u, v1_5 = 0x010500u, + v1_6 = 0x010600u, }; enum class OutputType { diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc index 8a8d12b..7c1206c 100644 --- a/libshaderc_util/src/compiler.cc +++ b/libshaderc_util/src/compiler.cc @@ -720,6 +720,9 @@ GlslangClientInfo GetGlslangClientInfo( } else if (env_version == Compiler::TargetEnvVersion::Vulkan_1_2) { result.client_version = glslang::EShTargetVulkan_1_2; result.target_language_version = glslang::EShTargetSpv_1_5; + } else if (env_version == Compiler::TargetEnvVersion::Vulkan_1_3) { + result.client_version = glslang::EShTargetVulkan_1_3; + result.target_language_version = glslang::EShTargetSpv_1_6; } else { errs << "error:" << error_tag << ": Invalid target client version " << static_cast<uint32_t>(env_version) << " for Vulkan environment " @@ -766,6 +769,9 @@ GlslangClientInfo GetGlslangClientInfo( case Compiler::SpirvVersion::v1_5: result.target_language_version = glslang::EShTargetSpv_1_5; break; + case Compiler::SpirvVersion::v1_6: + result.target_language_version = glslang::EShTargetSpv_1_6; + break; default: errs << "error:" << error_tag << ": Unknown SPIR-V version " << std::hex << uint32_t(spv_version); diff --git a/libshaderc_util/src/compiler_test.cc b/libshaderc_util/src/compiler_test.cc index 1dfbb6d..a0a964d 100644 --- a/libshaderc_util/src/compiler_test.cc +++ b/libshaderc_util/src/compiler_test.cc @@ -165,7 +165,7 @@ void main() { o = clamp(i, vec4(0.5), vec4(1.0)); } std::string Disassemble(const std::vector<uint32_t> binary) { std::string result; shaderc_util::SpirvToolsDisassemble(Compiler::TargetEnv::Vulkan, - Compiler::TargetEnvVersion::Vulkan_1_2, + Compiler::TargetEnvVersion::Vulkan_1_3, binary, &result); return result; } @@ -389,6 +389,12 @@ TEST_F(CompilerTest, SpirvTargetVersion1_5Succeeds) { EXPECT_THAT(errors_, Eq("")); } +TEST_F(CompilerTest, SpirvTargetVersion1_6Succeeds) { + compiler_.SetTargetSpirv(Compiler::SpirvVersion::v1_6); + EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); + EXPECT_THAT(errors_, Eq("")); +} + TEST_F(CompilerTest, SpirvTargetBadVersionFails) { compiler_.SetTargetSpirv(static_cast<Compiler::SpirvVersion>(0x090900)); EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); diff --git a/libshaderc_util/src/spirv_tools_wrapper.cc b/libshaderc_util/src/spirv_tools_wrapper.cc index 8ce5253..63bff6a 100644 --- a/libshaderc_util/src/spirv_tools_wrapper.cc +++ b/libshaderc_util/src/spirv_tools_wrapper.cc @@ -37,6 +37,8 @@ spv_target_env GetSpirvToolsTargetEnv(Compiler::TargetEnv env, return SPV_ENV_VULKAN_1_1; case Compiler::TargetEnvVersion::Vulkan_1_2: return SPV_ENV_VULKAN_1_2; + case Compiler::TargetEnvVersion::Vulkan_1_3: + return SPV_ENV_VULKAN_1_3; default: break; } diff --git a/utils/add_copyright.py b/utils/add_copyright.py index 37505bc..ab3c5f1 100755 --- a/utils/add_copyright.py +++ b/utils/add_copyright.py @@ -62,7 +62,7 @@ def filtered_descendants(glob): """Returns glob-matching filenames under the current directory, but skips some irrelevant paths.""" return find('.', glob, ['third_party', 'external', 'build*', 'out*', - 'CompilerIdCXX', '.venv']) + 'CompilerIdCXX', '.venv', 'glslang']) def skip(line): |