diff --git a/CHANGES b/CHANGES index ddd5ca96f..5cc47d6ed 100644 --- a/CHANGES +++ b/CHANGES @@ -1,8 +1,92 @@ Revision history for Shaderc -v2023.8-dev 2023-10-12 +v2026.2-dev 2026-01-22 - Start development +v2026.1 2026-01-23 + - Update dependencies: + - Glslang 16.2.0 + - SPIRV-Tools v2026.1rc1. + - SPIRV-Headers top of tree + Supports VK_EXT_descriptor_heap and other extensions. + - Require the CHANGES file to have a valid date on its version lines + This avoid the problem of stale version information in the + pkg-config configuration files. + +v2025.5 2025-11-27 + - Update dependencies + +v2025.4 2025-09-25 + - Update dependencies + - Add option to set max SPIR-V ID bound. + glslc: -fmax-id-bound + - CMake: Fix some install logic: when glslc is not built, + don't try to install it. + - Remove testing of VS 2019 + +v2025.3 2025-06-24 + - Update dependencies + - CMake updates: + - Actually disable all tests when specified + - Add a way to disable building glslc + +v2025.2 2025-04-23 + - Update dependencies: Glslang, SPIRV-Tools, SPIRV-Headers + - Supports BFloat16 floating point types + +v2025.1 2025-02-27 + - Update tools and compilers tested: + - Clang 13 + - GCC 13 + - VisualStudio 2022 + - CMake 3.31.2 + - Python 3.12 + - NDK r27c + - Skip version numbers to match SPIRV-Tools, to avoid + confusion. + +v2024.4 2024-12-06 + - Support Vulkan 1.4 + +v2024.3 2024-09-23 + - Update dependencies: Glslang, SPRIV-Tools, SPIRV-Headers + - SPIRV-Tools is at v2024.4.rc1 + - This incorporates a SPIRV-Tools fix which was limiting parallelism. + Validator friendly name generation was serializing on a mutex + protecting the locale object. + - During HLSL compilation or any optimizing compile, don't tell the + validator to use "friendly names". This should save time spent in the + initial validation step of the optimization recipe. + - Adapt test golden results to Glslang changes which reorder + decorations by object enum value. + - Fix ndk-build library dependencies: libshaderc_util depends on glslang + - Use Python 3.12 on Linux CI bots + - Fix Python 3.12 warnings for string escapes + +v2024.2 2024-06-21 + - Update dependencies: + Glslang: top of tree 2024-06-21 + SPIRV-Header: top of tree 2024-06-21 + SPIRV-Tools: v2024.3.rc1 + - Build: + - Remove support for VS2017 + +v2024.1 2024-04-30 + - Update dependencies + - Propagate test/install options to Glslang + +v2024.0 2024-03-08 + - Update dependencies + - Utilities: + - Use Python3 explicitly in utility scripts + +v2023.8 2024-01-03 + - API: Expose rlaxed Vulkan rules from glslang + - Update to Glslang 14.0.0 + - CMake: + - Comply with CMP0148: Use PythonInterp + - Use TARGET_OBJECTS to simplify creating the shaderc_shared library. + v2023.7 2023-10-12 - Update dependencies - Finish converting build instructions and flags to always use C++17 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bc8f5d9e..8cd756a16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.17.2) +cmake_minimum_required(VERSION 3.22.1) project(shaderc) enable_testing() @@ -51,6 +51,16 @@ else() message(STATUS "Configuring Shaderc to avoid building examples.") endif() +option(SHADERC_SKIP_EXECUTABLES "Skip building executables." ${SHADERC_SKIP_EXECUTABLES}) +if(NOT ${SHADERC_SKIP_EXECUTABLES}) + set(SHADERC_ENABLE_EXECUTABLES ON) +endif() +if (${SHADERC_ENABLE_EXECUTABLES}) + message(STATUS "Configuring Shaderc to build executables.") +else() + message(STATUS "Configuring Shaderc to avoid building executables.") +endif() + option(SHADERC_SKIP_COPYRIGHT_CHECK "Skip copyright check" ${SHADERC_SKIP_COPYRIGHT_CHECK}) if(NOT ${SHADERC_SKIP_COPYRIGHT_CHECK}) set(SHADERC_ENABLE_COPYRIGHT_CHECK ON) @@ -99,14 +109,14 @@ endif () if (SHADERC_ENABLE_COPYRIGHT_CHECK) add_custom_target(check-copyright ALL - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py + ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py --check WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Check copyright") endif() add_custom_target(add-copyright - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py + ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Add copyright") @@ -134,7 +144,7 @@ if(${SHADERC_ENABLE_EXAMPLES}) endif() add_custom_target(build-version - ${PYTHON_EXECUTABLE} + ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).") diff --git a/DEPS b/DEPS index 76d158031..a59ae9d3d 100644 --- a/DEPS +++ b/DEPS @@ -5,13 +5,13 @@ vars = { 'google_git': 'https://github.com/google', 'khronos_git': 'https://github.com/KhronosGroup', - 'abseil_revision': '5be22f98733c674d532598454ae729253bc53e82', - 'effcee_revision' : '19b4aa87af25cb4ee779a071409732f34bfc305c', - 'glslang_revision': '6be56e45e574b375d759b89dad35f780bbd4792f', - 'googletest_revision': 'e47544ad31cb3ceecd04cc13e8fe556f8df9fe0b', - 're2_revision': 'c9cba76063cf4235c1a15dd14a24a4ef8d623761', - 'spirv_headers_revision': '4183b260f4cccae52a89efdfcdd43c4897989f42', - 'spirv_tools_revision': '360d469b9eac54d6c6e20f609f9ec35e3a5380ad', + 'abseil_revision': '1315c900e1ddbb08a23e06eeb9a06450052ccb5e', + 'effcee_revision': '08da24ec245a274fea3a128ba50068f163390565', + 'glslang_revision': '09c541ee5b22bbac307987b50d86ec2b4f683d75', + 'googletest_revision': '1d17ea141d2c11b8917d2c7d029f1c4e2b9769b2', + 're2_revision': '4a8cee3dd3c3d81b6fe8b867811e193d5819df07', + 'spirv_headers_revision': '465055f6c9128772e20082e893d974146acf7a02', + 'spirv_tools_revision': 'e4bceacf59fdfe742047e94e41ef65a48999a0dd', } deps = { diff --git a/Dockerfile b/Dockerfile index 882123908..2bbde65b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,7 @@ RUN apk add --update \ build-base \ cmake \ git \ + linux-headers \ ninja \ python3 \ py-pip \ diff --git a/README.md b/README.md index 3f54dedd0..bc10b01fa 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ to provide: Linux[![Linux Build Status](https://storage.googleapis.com/shaderc/badges/build_status_linux_clang_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_release.html) MacOS[![MacOS Build Status](https://storage.googleapis.com/shaderc/badges/build_status_macos_clang_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_release.html) -Windows[![Windows Build Status](https://storage.googleapis.com/shaderc/badges/build_status_windows_vs2017_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2017_release.html) +Windows[![Windows Build Status](https://storage.googleapis.com/shaderc/badges/build_status_windows_vs2022_amd64_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2022_release.html) [More downloads](downloads.md) @@ -176,7 +176,7 @@ On Linux, if cross compiling to Windows: On Windows, the following tools should be installed and available on your path: -- Visual Studio 2017 or later. Previous versions of Visual Studio may work but +- Visual Studio 2022 or later. Previous versions of Visual Studio may work but are untested and unsupported. - Git - including the associated tools, Bash, `diff`. diff --git a/downloads.md b/downloads.md index b61042290..a92e9c0f9 100644 --- a/downloads.md +++ b/downloads.md @@ -7,11 +7,11 @@ Download the latest builds. ## Release | Windows | Linux | MacOS | | --- | --- | --- | -| [MSVC 2019](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2019_release.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_release.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_release.html) | -| [MSVC 2017](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2017_release.html) | [gcc](https://storage.googleapis.com/shaderc/badges/build_link_linux_gcc_release.html) | | +| [VS 2022](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2022_amd64_release.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_release.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_release.html) | +| | [gcc](https://storage.googleapis.com/shaderc/badges/build_link_linux_gcc_release.html) | | ## Debug | Windows | Linux | MacOS | | --- | --- | --- | -| [MSVC 2019](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2019_debug.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_debug.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_debug.html) | -| [MSVC 2017](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2017_debug.html) | [gcc](https://storage.googleapis.com/shaderc/badges/build_link_linux_gcc_debug.html) | | +| [VS 2022](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2022_amd64_debug.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_debug.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_debug.html) | +| | [gcc](https://storage.googleapis.com/shaderc/badges/build_link_linux_gcc_debug.html) | | diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt index 1277d87e7..948307e2e 100644 --- a/glslc/CMakeLists.txt +++ b/glslc/CMakeLists.txt @@ -48,12 +48,14 @@ target_link_libraries(glslc PRIVATE shaderc_util shaderc # internal Shaderc libraries ${CMAKE_THREAD_LIBS_INIT}) -add_executable(glslc_exe src/main.cc) -shaderc_default_compile_options(glslc_exe) -target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include) -set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc) -target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc) -add_dependencies(glslc_exe build-version) +if(SHADERC_ENABLE_EXECUTABLES) + add_executable(glslc_exe src/main.cc) + shaderc_default_compile_options(glslc_exe) + target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include) + set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc) + target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc) + add_dependencies(glslc_exe build-version) +endif(SHADERC_ENABLE_EXECUTABLES) shaderc_add_tests( TEST_PREFIX glslc @@ -66,9 +68,11 @@ shaderc_add_tests( shaderc_add_asciidoc(glslc_doc_README README) if(SHADERC_ENABLE_INSTALL) - install(TARGETS glslc_exe - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}) + if(SHADERC_ENABLE_EXECUTABLES) + install(TARGETS glslc_exe + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif(SHADERC_ENABLE_EXECUTABLES) endif(SHADERC_ENABLE_INSTALL) add_subdirectory(test) diff --git a/glslc/README.asciidoc b/glslc/README.asciidoc index c9ffbdcb7..c1854333a 100644 --- a/glslc/README.asciidoc +++ b/glslc/README.asciidoc @@ -234,6 +234,8 @@ the following: * `vulkan1.0`: create SPIR-V under Vulkan 1.0 semantics. * `vulkan1.1`: create SPIR-V under Vulkan 1.1 semantics. * `vulkan1.2`: create SPIR-V under Vulkan 1.2 semantics. +* `vulkan1.3`: create SPIR-V under Vulkan 1.3 semantics. +* `vulkan1.4`: create SPIR-V under Vulkan 1.4 semantics. * `opengl`: create SPIR-V under OpenGL 4.5 semantics. * `opengl4.5`: create SPIR-V under OpenGL 4.5 semantics. diff --git a/glslc/src/main.cc b/glslc/src/main.cc index 5cc3f4385..4de210068 100644 --- a/glslc/src/main.cc +++ b/glslc/src/main.cc @@ -165,6 +165,7 @@ An input file of - represents standard input. vulkan1.1 vulkan1.2 vulkan1.3 + vulkan1.4 vulkan # Same as vulkan1.0 opengl4.5 opengl # Same as opengl4.5 @@ -174,8 +175,9 @@ An input file of - represents standard input. required to be supported for the target environment. 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. + the default for vulkan1.2 is spv1.5, + the default for vulkan1.3 is spv1.6, + the default for vulkan1.4 is spv1.6. Values are: spv1.0, spv1.1, spv1.2, spv1.3, spv1.4, spv1.5, spv1.6 --version Display compiler version information. @@ -265,8 +267,9 @@ int main(int argc, char** argv) { // Sets binding base for the given uniform kind. If stage is // shader_glsl_infer_from_source then set it for all shader stages. - auto set_binding_base = [&compiler]( - shaderc_shader_kind stage, shaderc_uniform_kind kind, uint32_t base) { + auto set_binding_base = [&compiler](shaderc_shader_kind stage, + shaderc_uniform_kind kind, + uint32_t base) { if (stage == shaderc_glsl_infer_from_source) compiler.options().SetBindingBase(kind, base); else @@ -335,6 +338,15 @@ int main(int argc, char** argv) { compiler.options().SetNanClamp(true); } else if (arg.starts_with("-fpreserve-bindings")) { compiler.options().SetPreserveBindings(true); + } else if (arg.starts_with("-fmax-id-bound=")) { + const string_piece value_str = arg.substr(std::strlen("-fmax-id-bound=")); + uint32_t bound = 0; + if (!shaderc_util::ParseUint32(value_str.str(), &bound)) { + std::cerr << "glslc: error: invalid value '" << value_str << "' in '" + << arg << "'" << std::endl; + return 1; + } + compiler.options().SetMaxIdBound(bound); } else if (((u_kind = shaderc_uniform_kind_image), (arg == "-fimage-binding-base")) || ((u_kind = shaderc_uniform_kind_texture), @@ -452,6 +464,9 @@ int main(int argc, char** argv) { } 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 == "vulkan1.4") { + target_env = shaderc_target_env_vulkan; + version = shaderc_env_version_vulkan_1_4; } else if (target_env_str == "opengl") { target_env = shaderc_target_env_opengl; } else if (target_env_str == "opengl4.5") { @@ -675,9 +690,10 @@ int main(int argc, char** argv) { // from the file name. If current_fshader_stage is specifed to one of // the forced shader kinds, use that for the following compilation. input_files.emplace_back(glslc::InputFileSpec{ - arg.str(), (current_fshader_stage == shaderc_glsl_infer_from_source - ? glslc::DeduceDefaultShaderKindFromFileName(arg) - : current_fshader_stage), + arg.str(), + (current_fshader_stage == shaderc_glsl_infer_from_source + ? glslc::DeduceDefaultShaderKindFromFileName(arg) + : current_fshader_stage), language, current_entry_point_name}); } } diff --git a/glslc/test/CMakeLists.txt b/glslc/test/CMakeLists.txt index ac001bd33..c5ec68963 100644 --- a/glslc/test/CMakeLists.txt +++ b/glslc/test/CMakeLists.txt @@ -12,17 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_test(NAME shaderc_expect_unittests - COMMAND ${PYTHON_EXECUTABLE} -m unittest expect_unittest.py - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -add_test(NAME shaderc_glslc_test_framework_unittests - COMMAND ${PYTHON_EXECUTABLE} -m unittest glslc_test_framework_unittest.py - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - if(${SHADERC_ENABLE_TESTS}) - add_test(NAME glslc_tests - COMMAND ${PYTHON_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/glslc_test_framework.py - $ $ - --test-dir ${CMAKE_CURRENT_SOURCE_DIR}) + + add_test(NAME shaderc_expect_unittests + COMMAND ${Python_EXECUTABLE} -m unittest expect_unittest.py + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + add_test(NAME shaderc_glslc_test_framework_unittests + COMMAND ${Python_EXECUTABLE} -m unittest glslc_test_framework_unittest.py + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + # These tests use the glslc executable, so they can only run if + # glslc has been built. + if(${SHADERC_ENABLE_EXECUTABLES}) + add_test(NAME glslc_tests + COMMAND ${Python_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/glslc_test_framework.py + $ $ + --test-dir ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + endif() diff --git a/glslc/test/expect.py b/glslc/test/expect.py index c58557dd8..22e9f8e38 100644 --- a/glslc/test/expect.py +++ b/glslc/test/expect.py @@ -242,7 +242,7 @@ def verify_assembly_file_preamble(self, filename): line3 = assembly_file.readline() if (line1 != '; SPIR-V\n' or - line2 != '; Version: 1.0\n' or + (not line2.startswith('; Version: 1.')) or (not line3.startswith('; Generator: Google Shaderc over Glslang;'))): return False, 'Incorrect SPV assembly' @@ -427,10 +427,13 @@ class ValidAssemblyFileWithSubstr(ValidAssemblyFile): """Mixin class for checking that every input file generates a valid assembly file following the assembly file naming rule, there is no output on stdout/stderr, and all assembly files have the given substring specified - by expected_assembly_substr. + as self.expected_assembly_substr (if present) and substrings specified + by the list strings in self.expected_assembly_substrings (if present). + At least one string must be specified. - To mix in this class, subclasses need to provde expected_assembly_substr - as the expected substring. + To mix in this class, subclasses need to provide + self.expected_assembly_substr as the expected substring, or a list of + strings in self.expected_assembly_substrings. """ def check_assembly_with_substr(self, status): @@ -441,11 +444,22 @@ def check_assembly_with_substr(self, status): if not success: return False, message with open(assembly_filename, 'r') as f: - content = f.read() - if self.expected_assembly_substr not in convert_to_unix_line_endings(content): - return False, ('Incorrect assembly output:\n{asm}\n' - 'Expected substring not found:\n{exp}'.format( - asm=content, exp=self.expected_assembly_substr)) + content = convert_to_unix_line_endings(f.read()) + expected_strs = [] + if 'expected_assembly_substrings' in dir(self): + expected_strs.extend(self.expected_assembly_substrings) + if 'expected_assembly_substr' in dir(self): + expected_strs.append(self.expected_assembly_substr) + assert(type(expected_strs) is list) + assert(len(expected_strs) > 0) + for es in expected_strs: + assert(type(es) is str) + + for es in expected_strs: + if es not in content: + return False, ('Incorrect assembly output:\n{asm}\n' + 'Expected substring not found:\n{exp}'.format( + asm=content, exp=es)) return True, '' diff --git a/glslc/test/feature_gl_ext_descriptor_heap.py b/glslc/test/feature_gl_ext_descriptor_heap.py new file mode 100644 index 000000000..29535b3d7 --- /dev/null +++ b/glslc/test/feature_gl_ext_descriptor_heap.py @@ -0,0 +1,41 @@ +# Copyright 2026 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 expect +from glslc_test_framework import inside_glslc_testsuite +from placeholder import FileShader + +# See GL_EXT_descriptor_heap +# https://github.com/KhronosGroup/GLSL/blob/main/extensions/ext/GLSL_EXT_descriptor_heap.txt +GLSL_COMPUTE_SHADER_DESCRIPTOR_HEAP_BUFFER = """#version 450 +#extension GL_EXT_descriptor_heap : require + +layout(descriptor_heap) uniform U { uint source; } ubo[]; +layout(descriptor_heap) buffer B { uint dest; } ssbo[]; + +void main() +{ + ssbo[42].dest = ubo[2026].source; +}""" + +@inside_glslc_testsuite('GL_EXT_descriptor_heap') +class BufferSampleCompiles(expect.ValidAssemblyFileWithSubstr): + shader = FileShader(GLSL_COMPUTE_SHADER_DESCRIPTOR_HEAP_BUFFER, '.comp') + glslc_args = ['-S', shader, '--target-env=vulkan1.2'] + expected_assembly_substrings = [ + "OpCapability UntypedPointersKHR", + "OpCapability DescriptorHeapEXT", + "= OpUntypedAccessChainKHR", + "= OpBufferPointerEXT", + ] diff --git a/glslc/test/option_dash_cap_O.py b/glslc/test/option_dash_cap_O.py index fa474f9a4..cf301c523 100644 --- a/glslc/test/option_dash_cap_O.py +++ b/glslc/test/option_dash_cap_O.py @@ -21,71 +21,94 @@ EMPTY_SHADER_IN_CWD = Directory('.', [File('shader.vert', MINIMAL_SHADER)]) ASSEMBLY_WITH_DEBUG_SOURCE = [ - '; SPIR-V\n', - '; Version: 1.0\n', - '; Generator: Google Shaderc over Glslang; 11\n', - '; Bound: 7\n', - '; Schema: 0\n', - ' OpCapability Shader\n', - ' %2 = OpExtInstImport "GLSL.std.450"\n', - ' OpMemoryModel Logical GLSL450\n', - ' OpEntryPoint Vertex %main "main"\n', - ' %1 = OpString "shader.vert"\n', - ' OpSource ESSL 310 %1 "// OpModuleProcessed entry-point main\n', - '// OpModuleProcessed client vulkan100\n', - '// OpModuleProcessed target-env vulkan1.0\n', - '// OpModuleProcessed entry-point main\n', - '#line 1\n', - '#version 310 es\n', - 'void main() {}"\n', - ' OpSourceExtension "GL_GOOGLE_cpp_style_line_directive"\n', - ' OpSourceExtension "GL_GOOGLE_include_directive"\n', - ' OpName %main "main"\n', - ' %void = OpTypeVoid\n', - ' %4 = OpTypeFunction %void\n', - ' OpLine %1 2 11\n', - ' %main = OpFunction %void None %4\n', - ' %6 = OpLabel\n', - ' OpReturn\n', - ' OpFunctionEnd\n'] - -ASSEMBLY_WITH_DEBUG = [ - '; SPIR-V\n', - '; Version: 1.0\n', - '; Generator: Google Shaderc over Glslang; 11\n', - '; Bound: 6\n', - '; Schema: 0\n', - ' OpCapability Shader\n', - ' %1 = OpExtInstImport "GLSL.std.450"\n', - ' OpMemoryModel Logical GLSL450\n', - ' OpEntryPoint Vertex %main "main"\n', - ' OpSource ESSL 310\n', - ' OpSourceExtension "GL_GOOGLE_cpp_style_line_directive"\n', - ' OpSourceExtension "GL_GOOGLE_include_directive"\n', - ' OpName %main "main"\n', - ' %void = OpTypeVoid\n', - ' %3 = OpTypeFunction %void\n', - ' %main = OpFunction %void None %3\n', - ' %5 = OpLabel\n', - ' OpReturn\n', - ' OpFunctionEnd\n'] - -ASSEMBLY_WITHOUT_DEBUG = [ - '; SPIR-V\n', - '; Version: 1.0\n', - '; Generator: Google Shaderc over Glslang; 11\n', - '; Bound: 6\n', - '; Schema: 0\n', - ' OpCapability Shader\n', - ' %1 = OpExtInstImport "GLSL.std.450"\n', - ' OpMemoryModel Logical GLSL450\n', - ' OpEntryPoint Vertex %4 "main"\n', - ' %void = OpTypeVoid\n', - ' %3 = OpTypeFunction %void\n', - ' %4 = OpFunction %void None %3\n', # %4 vs. %main - ' %5 = OpLabel\n', - ' OpReturn\n', - ' OpFunctionEnd\n'] + """; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 11 +; Bound: 7 +; Schema: 0 + OpCapability Shader + %2 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + %1 = OpString "shader.vert" + OpSource ESSL 310 %1 "// OpModuleProcessed entry-point main +// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed entry-point main +#line 1 +#version 310 es +void main() {}" + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + %void = OpTypeVoid + %4 = OpTypeFunction %void + OpLine %1 2 11 + %main = OpFunction %void None %4 + %6 = OpLabel + OpLine %1 2 0 + OpReturn + OpFunctionEnd +""" +] + +ASSEMBLY_O0 = [ + """; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 11 +; Bound: 6 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd +"""] + +ASSEMBLY_O = [ + """; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 11 +; Bound: 6 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %4 = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd +"""] + +ASSEMBLY_Os = [ + """; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 11 +; Bound: 6 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %4 = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd +"""] @inside_glslc_testsuite('OptionDashCapO') @@ -95,7 +118,8 @@ class TestDashCapO0(expect.ValidFileContents): environment = EMPTY_SHADER_IN_CWD glslc_args = ['-S', '-O0', 'shader.vert'] target_filename = 'shader.vert.spvasm' - expected_file_contents = ASSEMBLY_WITH_DEBUG + expected_file_contents = ASSEMBLY_O0 + @inside_glslc_testsuite('OptionDashCapO') class TestDashCapOPerformance(expect.ValidFileContents): @@ -104,7 +128,8 @@ class TestDashCapOPerformance(expect.ValidFileContents): environment = EMPTY_SHADER_IN_CWD glslc_args = ['-S', '-O', 'shader.vert'] target_filename = 'shader.vert.spvasm' - expected_file_contents = ASSEMBLY_WITHOUT_DEBUG + expected_file_contents = ASSEMBLY_O + @inside_glslc_testsuite('OptionDashCapO') class TestDashCapOs(expect.ValidFileContents): @@ -113,7 +138,7 @@ class TestDashCapOs(expect.ValidFileContents): environment = EMPTY_SHADER_IN_CWD glslc_args = ['-S', '-Os', 'shader.vert'] target_filename = 'shader.vert.spvasm' - expected_file_contents = ASSEMBLY_WITHOUT_DEBUG + expected_file_contents = ASSEMBLY_Os @inside_glslc_testsuite('OptionDashCapO') @@ -123,7 +148,7 @@ class TestDashCapOOverriding(expect.ValidFileContents): environment = EMPTY_SHADER_IN_CWD glslc_args = ['-S', '-Os', '-O0', '-Os', '-O0', 'shader.vert'] target_filename = 'shader.vert.spvasm' - expected_file_contents = ASSEMBLY_WITH_DEBUG + expected_file_contents = ASSEMBLY_O0 @inside_glslc_testsuite('OptionDashCapO') diff --git a/glslc/test/option_fauto_bind_uniforms.py b/glslc/test/option_fauto_bind_uniforms.py index 3f90a126b..d6f86d028 100644 --- a/glslc/test/option_fauto_bind_uniforms.py +++ b/glslc/test/option_fauto_bind_uniforms.py @@ -80,8 +80,10 @@ u6[2]; u7; u8; - return float4(u8.Consume() + t2.SampleCmp(s2, 1.0, 2.0)) + t1.Sample(s1, 1.0) - + t6.Load(1); + // SampleCmp disabled due to https://github.com/KhronosGroup/glslang/issues/2444. + //return float4(u8.Consume() + t2.SampleCmp(s2, 1.0, 2.0)) + t1.Sample(s1, 1.0) + // + t6.Load(1); + return float4(u8.Consume()) + t1.Sample(s1, 1.0) + t6.Load(1); } """ @@ -340,7 +342,7 @@ class HlslFSamplerBindingBaseOptionRespected(expect.ValidAssemblyFileWithSubstr) shader = FileShader(HLSL_SHADER_WITHOUT_BINDINGS, '.frag') glslc_args = ['-S', '-x', 'hlsl', '-fhlsl-iomap', shader, '-fauto-bind-uniforms', '-fsampler-binding-base', '100'] - expected_assembly_substr = "OpDecorate %s2 Binding 102" + expected_assembly_substr = "OpDecorate %s1 Binding 101" @inside_glslc_testsuite('OptionFAutoBindUniforms') @@ -351,7 +353,7 @@ class HlslFSamplerBindingBaseForFragOptionRespected(expect.ValidAssemblyFileWith shader = FileShader(HLSL_SHADER_WITHOUT_BINDINGS, '.frag') glslc_args = ['-S', '-x', 'hlsl', '-fhlsl-iomap', shader, '-fauto-bind-uniforms', '-fsampler-binding-base', 'frag', '100'] - expected_assembly_substr = "OpDecorate %s2 Binding 102" + expected_assembly_substr = "OpDecorate %s1 Binding 101" @inside_glslc_testsuite('OptionFAutoBindUniforms') @@ -362,7 +364,7 @@ class HlslFSamplerBindingBaseForComputeOptionIgnoredWhenCompilingAsFrag(expect.V shader = FileShader(HLSL_SHADER_WITHOUT_BINDINGS, '.frag') glslc_args = ['-S', '-x', 'hlsl', '-fhlsl-iomap', shader, '-fauto-bind-uniforms', '-fsampler-binding-base', 'compute', '100'] - expected_assembly_substr = "OpDecorate %s2 Binding 2" + expected_assembly_substr = "OpDecorate %s1 Binding 1" @inside_glslc_testsuite('OptionFAutoBindUniforms') diff --git a/glslc/test/option_fmax_id_bound.py b/glslc/test/option_fmax_id_bound.py new file mode 100644 index 000000000..b5548bc0b --- /dev/null +++ b/glslc/test/option_fmax_id_bound.py @@ -0,0 +1,50 @@ +# Copyright 2025 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 expect +from glslc_test_framework import inside_glslc_testsuite +from placeholder import FileShader + +COMPUTE_SHADER = """#version 450 +#extension GL_EXT_control_flow_attributes : require + +layout(local_size_x=1) in; + +layout(binding=0) buffer Out { uint x; } g_out; + +void main() { + uint x = 0; + [[unroll]] + for (int i = 0; i < 100; ++i) { + x = x + uint(i); + } + g_out.x = x; +} +""" + +@inside_glslc_testsuite('OptionFMaxIdBound') +class TestFMaxIdBoundLow(expect.ErrorMessageSubstr): + """Tests that compilation fails with a low -fmax-id-bound.""" + + shader = FileShader(COMPUTE_SHADER, ".comp") + glslc_args = ['-c', shader, '-fmax-id-bound=300', '-O'] + expected_error_substr = [" ID overflow. Try running compact-ids"] + + +@inside_glslc_testsuite('OptionFMaxIdBound') +class TestFMaxIdBoundHigh(expect.ValidObjectFile): + """Tests that compilation passes with a high -fmax-id-bound.""" + + shader = FileShader(COMPUTE_SHADER, ".comp") + glslc_args = ['-c', shader, '-fmax-id-bound=200000', '-O'] diff --git a/glslc/test/option_fresource_set_binding.py b/glslc/test/option_fresource_set_binding.py index 254004e77..03edda70e 100644 --- a/glslc/test/option_fresource_set_binding.py +++ b/glslc/test/option_fresource_set_binding.py @@ -38,10 +38,10 @@ class FRegisterSetBindingForFragRespected(expect.ValidAssemblyFileWithSubstr): '-fresource-set-binding', 'frag', 't4', '9', '16', 't5', '17', '18'] - expected_assembly_substr = """OpDecorate %t4 DescriptorSet 9 - OpDecorate %t4 Binding 16 - OpDecorate %t5 DescriptorSet 17 - OpDecorate %t5 Binding 18""" + expected_assembly_substr = """OpDecorate %t4 Binding 16 + OpDecorate %t4 DescriptorSet 9 + OpDecorate %t5 Binding 18 + OpDecorate %t5 DescriptorSet 17""" @inside_glslc_testsuite('OptionFRegisterSetBinding') @@ -52,10 +52,10 @@ class FRegisterSetBindingForFragRespectedJustOneTriple(expect.ValidAssemblyFileW glslc_args = ['-S', '-x', 'hlsl', shader, '-fresource-set-binding', 'frag', 't4', '9', '16'] - expected_assembly_substr = """OpDecorate %t4 DescriptorSet 9 - OpDecorate %t4 Binding 16 - OpDecorate %t5 DescriptorSet 0 - OpDecorate %t5 Binding 5""" + expected_assembly_substr = """OpDecorate %t4 Binding 16 + OpDecorate %t4 DescriptorSet 9 + OpDecorate %t5 Binding 5 + OpDecorate %t5 DescriptorSet 0""" @inside_glslc_testsuite('OptionFRegisterSetBinding') @@ -67,10 +67,10 @@ class FRegisterSetBindingForWrongStageIgnored(expect.ValidAssemblyFileWithSubstr '-fresource-set-binding', 'vert', 't4', '9', '16', 't5', '17', '18'] - expected_assembly_substr = """OpDecorate %t4 DescriptorSet 0 - OpDecorate %t4 Binding 4 - OpDecorate %t5 DescriptorSet 0 - OpDecorate %t5 Binding 5""" + expected_assembly_substr = """OpDecorate %t4 Binding 4 + OpDecorate %t4 DescriptorSet 0 + OpDecorate %t5 Binding 5 + OpDecorate %t5 DescriptorSet 0""" @inside_glslc_testsuite('OptionFRegisterSetBinding') @@ -82,10 +82,10 @@ class FRegisterSetBindingForAllRespected(expect.ValidAssemblyFileWithSubstr): '-fresource-set-binding', 't4', '9', '16', 't5', '17', '18'] - expected_assembly_substr = """OpDecorate %t4 DescriptorSet 9 - OpDecorate %t4 Binding 16 - OpDecorate %t5 DescriptorSet 17 - OpDecorate %t5 Binding 18""" + expected_assembly_substr = """OpDecorate %t4 Binding 16 + OpDecorate %t4 DescriptorSet 9 + OpDecorate %t5 Binding 18 + OpDecorate %t5 DescriptorSet 17""" @inside_glslc_testsuite('OptionFRegisterSetBinding') diff --git a/glslc/test/option_mfmt.py b/glslc/test/option_mfmt.py index bd5847863..f87102f4e 100644 --- a/glslc/test/option_mfmt.py +++ b/glslc/test/option_mfmt.py @@ -22,7 +22,7 @@ # match exactly, and there should not be a trailing comma at the end of the # list. When -mfmt=c is specified, curly brackets should be presented. MINIMAL_SHADER_NUM_FORMAT_PATTERN = "^0x07230203.*[0-9a-f]$" -MINIMAL_SHADER_C_FORMAT_PATTERN = "^\{0x07230203.*[0-9a-f]\}" +MINIMAL_SHADER_C_FORMAT_PATTERN = "^\\{0x07230203.*[0-9a-f]\\}" ERROR_SHADER = '#version 140\n#error\nvoid main() {}' diff --git a/glslc/test/option_target_env.py b/glslc/test/option_target_env.py index 91e6022e1..9555a77de 100644 --- a/glslc/test/option_target_env.py +++ b/glslc/test/option_target_env.py @@ -131,15 +131,26 @@ 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): +class TestTargetEnvEqVulkan1_3WithVulkan1_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): +class TestTargetEnvEqVulkan1_3WithVulkan1_1ShaderSucceeds(expect.ValidObjectFile1_6): shader = FileShader(vulkan_compute_subgroup_shader(), '.comp') glslc_args = ['--target-env=vulkan1.3', '-c', shader] +@inside_glslc_testsuite('OptionTargetEnv') +class TestTargetEnvEqVulkan1_4WithVulkan1_0ShaderSucceeds(expect.ValidObjectFile1_6): + shader = FileShader(vulkan_vertex_shader(), '.vert') + glslc_args = ['--target-env=vulkan1.4', '-c', shader] + +@inside_glslc_testsuite('OptionTargetEnv') +class TestTargetEnvEqVulkan1_4WithVulkan1_1ShaderSucceeds(expect.ValidObjectFile1_6): + shader = FileShader(vulkan_compute_subgroup_shader(), '.comp') + glslc_args = ['--target-env=vulkan1.4', '-c', shader] + + @inside_glslc_testsuite('OptionTargetEnv') class TestTargetEnvEqOpenGL4_5WithOpenGLShaderSucceeds(expect.ValidObjectFile): shader = FileShader(opengl_vertex_shader(), '.vert') diff --git a/glslc/test/parameter_tests.py b/glslc/test/parameter_tests.py index 6e3e1cdce..d49621060 100644 --- a/glslc/test/parameter_tests.py +++ b/glslc/test/parameter_tests.py @@ -169,6 +169,7 @@ class HelpParameters( vulkan1.1 vulkan1.2 vulkan1.3 + vulkan1.4 vulkan # Same as vulkan1.0 opengl4.5 opengl # Same as opengl4.5 @@ -178,8 +179,9 @@ class HelpParameters( required to be supported for the target environment. 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. + the default for vulkan1.2 is spv1.5, + the default for vulkan1.3 is spv1.6, + the default for vulkan1.4 is spv1.6. Values are: spv1.0, spv1.1, spv1.2, spv1.3, spv1.4, spv1.5, spv1.6 --version Display compiler version information. diff --git a/kokoro/android-cmake-armeabi-v7a/build.sh b/kokoro/android-cmake-armeabi-v7a/build.sh new file mode 100755 index 000000000..ce34ea842 --- /dev/null +++ b/kokoro/android-cmake-armeabi-v7a/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Copyright (C) 2017 Google Inc. +# +# 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. + +SCRIPT_DIR=$(dirname "$BASH_SOURCE") +exec $SCRIPT_DIR/../scripts/android/build.sh "armeabi-v7a with NEON" diff --git a/kokoro/linux/presubmit_clang_asan.cfg b/kokoro/android-cmake-armeabi-v7a/continuous.cfg similarity index 86% rename from kokoro/linux/presubmit_clang_asan.cfg rename to kokoro/android-cmake-armeabi-v7a/continuous.cfg index fcaaa3632..c650a5dce 100644 --- a/kokoro/linux/presubmit_clang_asan.cfg +++ b/kokoro/android-cmake-armeabi-v7a/continuous.cfg @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Presubmit build configuration. -build_file: "shaderc/kokoro/linux/build_clang_asan.sh" +build_file: "shaderc/kokoro/android-cmake-armeabi-v7a/build.sh" diff --git a/kokoro/linux/presubmit_gcc_debug.cfg b/kokoro/android-cmake-armeabi-v7a/presubmit.cfg similarity index 86% rename from kokoro/linux/presubmit_gcc_debug.cfg rename to kokoro/android-cmake-armeabi-v7a/presubmit.cfg index f0eec27ca..c650a5dce 100644 --- a/kokoro/linux/presubmit_gcc_debug.cfg +++ b/kokoro/android-cmake-armeabi-v7a/presubmit.cfg @@ -12,6 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Presubmit build configuration. -build_file: "shaderc/kokoro/linux/build_gcc_debug.sh" - +build_file: "shaderc/kokoro/android-cmake-armeabi-v7a/build.sh" diff --git a/kokoro/linux/license_check_docker.sh b/kokoro/android-cmake-x86/build.sh similarity index 80% rename from kokoro/linux/license_check_docker.sh rename to kokoro/android-cmake-x86/build.sh index f88077e87..5f2d45b2f 100755 --- a/kokoro/linux/license_check_docker.sh +++ b/kokoro/android-cmake-x86/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2020 Google Inc. +# Copyright (C) 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -e # Fail on any error. -set -x # Display commands being run. - -license-checker --dir="$ROOT_DIR" \ No newline at end of file +SCRIPT_DIR=$(dirname "$BASH_SOURCE") +exec $SCRIPT_DIR/../scripts/android/build.sh x86 diff --git a/kokoro/linux/continuous_clang_asan.cfg b/kokoro/android-cmake-x86/continuous.cfg similarity index 86% rename from kokoro/linux/continuous_clang_asan.cfg rename to kokoro/android-cmake-x86/continuous.cfg index 129115135..cdc8d7946 100644 --- a/kokoro/linux/continuous_clang_asan.cfg +++ b/kokoro/android-cmake-x86/continuous.cfg @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Continuous build configuration. -build_file: "shaderc/kokoro/linux/build_clang_asan.sh" +build_file: "shaderc/kokoro/android-cmake-x86/build.sh" diff --git a/kokoro/linux/presubmit_clang_debug.cfg b/kokoro/android-cmake-x86/presubmit.cfg similarity index 86% rename from kokoro/linux/presubmit_clang_debug.cfg rename to kokoro/android-cmake-x86/presubmit.cfg index 87abaf72d..cdc8d7946 100644 --- a/kokoro/linux/presubmit_clang_debug.cfg +++ b/kokoro/android-cmake-x86/presubmit.cfg @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Presubmit build configuration. -build_file: "shaderc/kokoro/linux/build_clang_debug.sh" +build_file: "shaderc/kokoro/android-cmake-x86/build.sh" diff --git a/kokoro/android-release/build_arm.sh b/kokoro/android-release/build_arm.sh deleted file mode 100755 index 6d43504a5..000000000 --- a/kokoro/android-release/build_arm.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2017 Google Inc. -# -# 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. -# -# Android Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x - -SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh "armeabi-v7a with NEON" diff --git a/kokoro/android-release/continuous_arm.cfg b/kokoro/android-release/continuous_arm.cfg deleted file mode 100644 index a4f931a09..000000000 --- a/kokoro/android-release/continuous_arm.cfg +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -# -build_file: "shaderc/kokoro/android-release/build_arm.sh" diff --git a/kokoro/android-release/continuous_x86.cfg b/kokoro/android-release/continuous_x86.cfg deleted file mode 100644 index a8643d5d0..000000000 --- a/kokoro/android-release/continuous_x86.cfg +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -# -build_file: "shaderc/kokoro/android-release/build_x86.sh" diff --git a/kokoro/android-release/presubmit_arm.cfg b/kokoro/android-release/presubmit_arm.cfg deleted file mode 100644 index b88294da7..000000000 --- a/kokoro/android-release/presubmit_arm.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/android-release/build_arm.sh" diff --git a/kokoro/android-release/presubmit_x86.cfg b/kokoro/android-release/presubmit_x86.cfg deleted file mode 100644 index 590753e0b..000000000 --- a/kokoro/android-release/presubmit_x86.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/android-release/build_x86.sh" diff --git a/kokoro/linux/license_check.sh b/kokoro/license-check/build.sh similarity index 83% rename from kokoro/linux/license_check.sh rename to kokoro/license-check/build.sh index a36e4ff6a..2881a8a8a 100755 --- a/kokoro/linux/license_check.sh +++ b/kokoro/license-check/build.sh @@ -22,7 +22,4 @@ ROOT_DIR="$( cd "${SCRIPT_DIR}/../.." >/dev/null 2>&1 && pwd )" docker run --rm -i \ --volume "${ROOT_DIR}:${ROOT_DIR}:ro" \ --workdir "${ROOT_DIR}" \ - --env ROOT_DIR="${ROOT_DIR}" \ - --env SCRIPT_DIR="${SCRIPT_DIR}" \ - --entrypoint "${SCRIPT_DIR}/license_check_docker.sh" \ - "gcr.io/shaderc-build/radial-build:latest" + us-east4-docker.pkg.dev/shaderc-build/radial-docker/ubuntu-24.04-amd64/license-checker diff --git a/kokoro/linux/presubmit_license_check.cfg b/kokoro/license-check/continuous.cfg similarity index 87% rename from kokoro/linux/presubmit_license_check.cfg rename to kokoro/license-check/continuous.cfg index 38db8f54e..9f786f23b 100644 --- a/kokoro/linux/presubmit_license_check.cfg +++ b/kokoro/license-check/continuous.cfg @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Presubmit build configuration. -build_file: "shaderc/kokoro/linux/license_check.sh" +build_file: "shaderc/kokoro/license-check/build.sh" diff --git a/kokoro/linux/continuous_license_check.cfg b/kokoro/license-check/presubmit.cfg similarity index 87% rename from kokoro/linux/continuous_license_check.cfg rename to kokoro/license-check/presubmit.cfg index 066a4d3b9..9f786f23b 100644 --- a/kokoro/linux/continuous_license_check.cfg +++ b/kokoro/license-check/presubmit.cfg @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Continuous build configuration. -build_file: "shaderc/kokoro/linux/license_check.sh" +build_file: "shaderc/kokoro/license-check/build.sh" diff --git a/kokoro/macos/build_clang_debug.sh b/kokoro/linux-clang-asan/build.sh old mode 100644 new mode 100755 similarity index 83% rename from kokoro/macos/build_clang_debug.sh rename to kokoro/linux-clang-asan/build.sh index ed889ff89..9d805506a --- a/kokoro/macos/build_clang_debug.sh +++ b/kokoro/linux-clang-asan/build.sh @@ -13,14 +13,7 @@ # 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. -# -# MacOS Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x +set -e -x SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh Debug - +source $SCRIPT_DIR/../scripts/linux/build.sh ASAN "clang-13.0.1" diff --git a/kokoro/linux-clang-asan/continuous.cfg b/kokoro/linux-clang-asan/continuous.cfg new file mode 100644 index 000000000..6ba986906 --- /dev/null +++ b/kokoro/linux-clang-asan/continuous.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-clang-asan/build.sh" diff --git a/kokoro/linux-clang-asan/presubmit.cfg b/kokoro/linux-clang-asan/presubmit.cfg new file mode 100644 index 000000000..6ba986906 --- /dev/null +++ b/kokoro/linux-clang-asan/presubmit.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-clang-asan/build.sh" diff --git a/kokoro/android-release/build_x86.sh b/kokoro/linux-clang-debug/build.sh similarity index 83% rename from kokoro/android-release/build_x86.sh rename to kokoro/linux-clang-debug/build.sh index c642ab1c9..ca5f1eb20 100755 --- a/kokoro/android-release/build_x86.sh +++ b/kokoro/linux-clang-debug/build.sh @@ -13,14 +13,7 @@ # 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. -# -# Android Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x +set -e -x SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh x86 - +source $SCRIPT_DIR/../scripts/linux/build.sh DEBUG "clang-13.0.1" diff --git a/kokoro/linux-clang-debug/continuous.cfg b/kokoro/linux-clang-debug/continuous.cfg new file mode 100644 index 000000000..28e44e48f --- /dev/null +++ b/kokoro/linux-clang-debug/continuous.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-clang-debug/build.sh" diff --git a/kokoro/linux-clang-debug/presubmit.cfg b/kokoro/linux-clang-debug/presubmit.cfg new file mode 100644 index 000000000..28e44e48f --- /dev/null +++ b/kokoro/linux-clang-debug/presubmit.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-clang-debug/build.sh" diff --git a/kokoro/linux/build_mingw_release.sh b/kokoro/linux-clang-release/build.sh similarity index 82% rename from kokoro/linux/build_mingw_release.sh rename to kokoro/linux-clang-release/build.sh index 0b54dc68c..7bf53fff6 100755 --- a/kokoro/linux/build_mingw_release.sh +++ b/kokoro/linux-clang-release/build.sh @@ -13,13 +13,7 @@ # 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. -# -# Linux Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x +set -e -x SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh RELEASE_MINGW +source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE "clang-13.0.1" diff --git a/kokoro/linux-clang-release/continuous.cfg b/kokoro/linux-clang-release/continuous.cfg new file mode 100644 index 000000000..27cf0e58a --- /dev/null +++ b/kokoro/linux-clang-release/continuous.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-clang-release/build.sh" diff --git a/kokoro/linux-clang-release/presubmit.cfg b/kokoro/linux-clang-release/presubmit.cfg new file mode 100644 index 000000000..27cf0e58a --- /dev/null +++ b/kokoro/linux-clang-release/presubmit.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-clang-release/build.sh" diff --git a/kokoro/linux/build_gcc_debug.sh b/kokoro/linux-gcc-debug-exception/build.sh similarity index 82% rename from kokoro/linux/build_gcc_debug.sh rename to kokoro/linux-gcc-debug-exception/build.sh index 3a96cf762..3d860cca5 100755 --- a/kokoro/linux/build_gcc_debug.sh +++ b/kokoro/linux-gcc-debug-exception/build.sh @@ -13,13 +13,7 @@ # 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. -# -# Linux Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x +set -e -x SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh DEBUG "gcc-9" +source $SCRIPT_DIR/../scripts/linux/build.sh DEBUG_EXCEPTION "gcc-13" diff --git a/kokoro/linux-gcc-debug-exception/continuous.cfg b/kokoro/linux-gcc-debug-exception/continuous.cfg new file mode 100644 index 000000000..f113e4e14 --- /dev/null +++ b/kokoro/linux-gcc-debug-exception/continuous.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-gcc-debug-exception/build.sh" diff --git a/kokoro/linux-gcc-debug-exception/presubmit.cfg b/kokoro/linux-gcc-debug-exception/presubmit.cfg new file mode 100644 index 000000000..f113e4e14 --- /dev/null +++ b/kokoro/linux-gcc-debug-exception/presubmit.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-gcc-debug-exception/build.sh" diff --git a/kokoro/linux-gcc-debug/build.sh b/kokoro/linux-gcc-debug/build.sh new file mode 100755 index 000000000..acc772397 --- /dev/null +++ b/kokoro/linux-gcc-debug/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright (C) 2017 Google Inc. +# +# 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. + +set -e -x +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/linux/build.sh DEBUG "gcc-13" diff --git a/kokoro/linux-gcc-debug/continuous.cfg b/kokoro/linux-gcc-debug/continuous.cfg new file mode 100644 index 000000000..637f2beec --- /dev/null +++ b/kokoro/linux-gcc-debug/continuous.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-gcc-debug/build.sh" diff --git a/kokoro/linux-gcc-debug/presubmit.cfg b/kokoro/linux-gcc-debug/presubmit.cfg new file mode 100644 index 000000000..637f2beec --- /dev/null +++ b/kokoro/linux-gcc-debug/presubmit.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-gcc-debug/build.sh" diff --git a/kokoro/linux-gcc-release/build.sh b/kokoro/linux-gcc-release/build.sh new file mode 100755 index 000000000..9e051f72a --- /dev/null +++ b/kokoro/linux-gcc-release/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright (C) 2017 Google Inc. +# +# 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. + +set -e -x +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE "gcc-13" diff --git a/kokoro/linux-gcc-release/continuous.cfg b/kokoro/linux-gcc-release/continuous.cfg new file mode 100644 index 000000000..e5133ece8 --- /dev/null +++ b/kokoro/linux-gcc-release/continuous.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-gcc-release/build.sh" diff --git a/kokoro/linux-gcc-release/presubmit.cfg b/kokoro/linux-gcc-release/presubmit.cfg new file mode 100644 index 000000000..e5133ece8 --- /dev/null +++ b/kokoro/linux-gcc-release/presubmit.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/linux-gcc-release/build.sh" diff --git a/kokoro/linux/build_clang_asan.sh b/kokoro/linux/build_clang_asan.sh deleted file mode 100755 index 9110bc5cd..000000000 --- a/kokoro/linux/build_clang_asan.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2017 Google Inc. -# -# 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. -# -# Linux Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x - -SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh ASAN "clang-10.0.0" diff --git a/kokoro/linux/build_clang_debug.sh b/kokoro/linux/build_clang_debug.sh deleted file mode 100755 index 227237e7b..000000000 --- a/kokoro/linux/build_clang_debug.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2017 Google Inc. -# -# 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. -# -# Linux Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x - -SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh DEBUG "clang-10.0.0" diff --git a/kokoro/linux/build_clang_release.sh b/kokoro/linux/build_clang_release.sh deleted file mode 100755 index 126f5d441..000000000 --- a/kokoro/linux/build_clang_release.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2017 Google Inc. -# -# 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. -# -# Linux Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x - -SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh RELEASE "clang-10.0.0" diff --git a/kokoro/linux/build_gcc_coverage.sh b/kokoro/linux/build_gcc_coverage.sh deleted file mode 100755 index 7270334c6..000000000 --- a/kokoro/linux/build_gcc_coverage.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2017 Google Inc. -# -# 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. -# -# Linux Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x - -SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh COVERAGE "gcc-7" # gcc-8+ has issues with lcov diff --git a/kokoro/linux/build_gcc_debug_exception.sh b/kokoro/linux/build_gcc_debug_exception.sh deleted file mode 100755 index 9849336ac..000000000 --- a/kokoro/linux/build_gcc_debug_exception.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2017 Google Inc. -# -# 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. -# -# Linux Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x - -SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh DEBUG_EXCEPTION "gcc-9" diff --git a/kokoro/linux/build_gcc_release.sh b/kokoro/linux/build_gcc_release.sh deleted file mode 100755 index 912360499..000000000 --- a/kokoro/linux/build_gcc_release.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2017 Google Inc. -# -# 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. -# -# Linux Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x - -SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh RELEASE "gcc-9" diff --git a/kokoro/linux/continuous_clang_debug.cfg b/kokoro/linux/continuous_clang_debug.cfg deleted file mode 100644 index 1021c4412..000000000 --- a/kokoro/linux/continuous_clang_debug.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -build_file: "shaderc/kokoro/linux/build_clang_debug.sh" - -action { - define_artifacts { - regex: "install.tgz" - } -} diff --git a/kokoro/linux/continuous_clang_release.cfg b/kokoro/linux/continuous_clang_release.cfg deleted file mode 100644 index cffba600a..000000000 --- a/kokoro/linux/continuous_clang_release.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -build_file: "shaderc/kokoro/linux/build_clang_release.sh" - -action { - define_artifacts { - regex: "install.tgz" - } -} diff --git a/kokoro/linux/continuous_gcc_debug.cfg b/kokoro/linux/continuous_gcc_debug.cfg deleted file mode 100644 index 526f08f78..000000000 --- a/kokoro/linux/continuous_gcc_debug.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -build_file: "shaderc/kokoro/linux/build_gcc_debug.sh" - -action { - define_artifacts { - regex: "install.tgz" - } -} diff --git a/kokoro/linux/continuous_gcc_debug_exception.cfg b/kokoro/linux/continuous_gcc_debug_exception.cfg deleted file mode 100644 index cecd1556c..000000000 --- a/kokoro/linux/continuous_gcc_debug_exception.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -build_file: "shaderc/kokoro/linux/build_gcc_debug_exception.sh" diff --git a/kokoro/linux/continuous_gcc_release.cfg b/kokoro/linux/continuous_gcc_release.cfg deleted file mode 100644 index 8e0cde8e5..000000000 --- a/kokoro/linux/continuous_gcc_release.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -build_file: "shaderc/kokoro/linux/build_gcc_release.sh" - -action { - define_artifacts { - regex: "install.tgz" - } -} diff --git a/kokoro/linux/continuous_mingw_release.cfg b/kokoro/linux/continuous_mingw_release.cfg deleted file mode 100644 index a0d4e76fe..000000000 --- a/kokoro/linux/continuous_mingw_release.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -build_file: "shaderc/kokoro/linux/build_mingw_release.sh" diff --git a/kokoro/linux/presubmit_clang_release.cfg b/kokoro/linux/presubmit_clang_release.cfg deleted file mode 100644 index 81ba77d28..000000000 --- a/kokoro/linux/presubmit_clang_release.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/linux/build_clang_release.sh" diff --git a/kokoro/linux/presubmit_gcc_release.cfg b/kokoro/linux/presubmit_gcc_release.cfg deleted file mode 100644 index fda4333f8..000000000 --- a/kokoro/linux/presubmit_gcc_release.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/linux/build_gcc_release.sh" diff --git a/kokoro/linux/presubmit_mingw_release.cfg b/kokoro/linux/presubmit_mingw_release.cfg deleted file mode 100644 index bfc53adc0..000000000 --- a/kokoro/linux/presubmit_mingw_release.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/linux/build_mingw_release.sh" diff --git a/kokoro/macos-clang-debug/build.sh b/kokoro/macos-clang-debug/build.sh new file mode 100755 index 000000000..0c5478b8b --- /dev/null +++ b/kokoro/macos-clang-debug/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright (C) 2017 Google Inc. +# +# 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. + +set -e -x +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/macos/build.sh DEBUG diff --git a/kokoro/macos-clang-debug/continuous.cfg b/kokoro/macos-clang-debug/continuous.cfg new file mode 100644 index 000000000..4e1fa454d --- /dev/null +++ b/kokoro/macos-clang-debug/continuous.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/macos-clang-debug/build.sh" diff --git a/kokoro/macos-clang-debug/presubmit.cfg b/kokoro/macos-clang-debug/presubmit.cfg new file mode 100644 index 000000000..4e1fa454d --- /dev/null +++ b/kokoro/macos-clang-debug/presubmit.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/macos-clang-debug/build.sh" diff --git a/kokoro/macos-clang-release/build.sh b/kokoro/macos-clang-release/build.sh new file mode 100755 index 000000000..4bb7df004 --- /dev/null +++ b/kokoro/macos-clang-release/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright (C) 2017 Google Inc. +# +# 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. + +set -e -x +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/macos/build.sh RelWithDebInfo diff --git a/kokoro/macos-clang-release/continuous.cfg b/kokoro/macos-clang-release/continuous.cfg new file mode 100644 index 000000000..49779db52 --- /dev/null +++ b/kokoro/macos-clang-release/continuous.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/macos-clang-release/build.sh" diff --git a/kokoro/macos-clang-release/presubmit.cfg b/kokoro/macos-clang-release/presubmit.cfg new file mode 100644 index 000000000..49779db52 --- /dev/null +++ b/kokoro/macos-clang-release/presubmit.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/macos-clang-release/build.sh" diff --git a/kokoro/macos/build_clang_release.sh b/kokoro/macos/build_clang_release.sh deleted file mode 100644 index 9599bac39..000000000 --- a/kokoro/macos/build_clang_release.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2017 Google Inc. -# -# 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. -# -# MacOS Build Script. - -# Fail on any error. -set -e -# Display commands being run. -set -x - -SCRIPT_DIR=`dirname "$BASH_SOURCE"` -source $SCRIPT_DIR/build.sh RelWithDebInfo - diff --git a/kokoro/macos/continuous_clang_debug.cfg b/kokoro/macos/continuous_clang_debug.cfg deleted file mode 100644 index d8000a924..000000000 --- a/kokoro/macos/continuous_clang_debug.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -build_file: "shaderc/kokoro/macos/build_clang_debug.sh" - -action { - define_artifacts { - regex: "install.tgz" - } -} diff --git a/kokoro/macos/continuous_clang_release.cfg b/kokoro/macos/continuous_clang_release.cfg deleted file mode 100644 index 101d06eb4..000000000 --- a/kokoro/macos/continuous_clang_release.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Continuous build configuration. -build_file: "shaderc/kokoro/macos/build_clang_release.sh" - -action { - define_artifacts { - regex: "install.tgz" - } -} diff --git a/kokoro/macos/presubmit_clang_debug.cfg b/kokoro/macos/presubmit_clang_debug.cfg deleted file mode 100644 index d2748ae7a..000000000 --- a/kokoro/macos/presubmit_clang_debug.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/macos/build_clang_debug.sh" diff --git a/kokoro/macos/presubmit_clang_release.cfg b/kokoro/macos/presubmit_clang_release.cfg deleted file mode 100644 index 3041155e2..000000000 --- a/kokoro/macos/presubmit_clang_release.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/macos/build_clang_release.sh" diff --git a/kokoro/ndk-build/build-docker.sh b/kokoro/ndk-build/build-docker.sh index 12d178be1..5e0b74f32 100755 --- a/kokoro/ndk-build/build-docker.sh +++ b/kokoro/ndk-build/build-docker.sh @@ -40,7 +40,7 @@ function clean_dir() { # Get source for dependencies, as specified in the DEPS file /usr/bin/python3 utils/git-sync-deps --treeless -using ndk-r25c +using ndk-r27c clean_dir "$ROOT_DIR/build" cd "$ROOT_DIR/build" diff --git a/kokoro/ndk-build/build.sh b/kokoro/ndk-build/build.sh index bf85b2d81..88f67ae7e 100644 --- a/kokoro/ndk-build/build.sh +++ b/kokoro/ndk-build/build.sh @@ -46,7 +46,7 @@ docker run --rm -i \ --env KOKORO_ARTIFACTS_DIR="${KOKORO_ARTIFACTS_DIR}" \ --env BUILD_SHA="${BUILD_SHA}" \ --entrypoint "${SCRIPT_DIR}/build-docker.sh" \ - "gcr.io/shaderc-build/radial-build:latest" + us-east4-docker.pkg.dev/shaderc-build/radial-docker/ubuntu-24.04-amd64/cpp-builder RESULT=$? # This is important. If the permissions are not fixed, kokoro will fail diff --git a/kokoro/ndk-build/continuous.cfg b/kokoro/ndk-build/continuous.cfg new file mode 100644 index 000000000..4e6b1fa70 --- /dev/null +++ b/kokoro/ndk-build/continuous.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/scripts/ndk-build/build.sh" diff --git a/kokoro/ndk-build/presubmit.cfg b/kokoro/ndk-build/presubmit.cfg new file mode 100644 index 000000000..4e6b1fa70 --- /dev/null +++ b/kokoro/ndk-build/presubmit.cfg @@ -0,0 +1,15 @@ +# Copyright (C) 2017 Google Inc. +# +# 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. + +build_file: "shaderc/kokoro/scripts/ndk-build/build.sh" diff --git a/kokoro/android-release/build-docker.sh b/kokoro/scripts/android/build-docker.sh similarity index 90% rename from kokoro/android-release/build-docker.sh rename to kokoro/scripts/android/build-docker.sh index a81832513..b6c73f7de 100755 --- a/kokoro/android-release/build-docker.sh +++ b/kokoro/scripts/android/build-docker.sh @@ -25,14 +25,16 @@ set -e # Display commands being run. set -x -using cmake-3.17.2 +using cmake-3.31.2 using ninja-1.10.0 -using ndk-r25c # Sets ANDROID_NDK_HOME, pointing at the NDK's root dir +using ndk-r27c # Sets ANDROID_NDK_HOME, pointing at the NDK's root dir + +git config --global --add safe.directory '*' cd $ROOT_DIR ./utils/git-sync-deps -mkdir build +[ -d build ] || mkdir build cd $ROOT_DIR/build # Invoke the build. diff --git a/kokoro/android-release/build.sh b/kokoro/scripts/android/build.sh similarity index 88% rename from kokoro/android-release/build.sh rename to kokoro/scripts/android/build.sh index 3b5f11c61..04614d982 100755 --- a/kokoro/android-release/build.sh +++ b/kokoro/scripts/android/build.sh @@ -19,7 +19,7 @@ set -e # Fail on any error. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )" -ROOT_DIR="$( cd "${SCRIPT_DIR}/../.." >/dev/null 2>&1 && pwd )" +ROOT_DIR="$( cd "${SCRIPT_DIR}/../../.." >/dev/null 2>&1 && pwd )" TARGET_ARCH="$1" @@ -35,4 +35,4 @@ docker run --rm -i \ --env TARGET_ARCH="${TARGET_ARCH}" \ --env KOKORO_ARTIFACTS_DIR="${KOKORO_ARTIFACTS_DIR}" \ --entrypoint "${SCRIPT_DIR}/build-docker.sh" \ - "gcr.io/shaderc-build/radial-build:latest" + us-east4-docker.pkg.dev/shaderc-build/radial-docker/ubuntu-24.04-amd64/cpp-builder diff --git a/kokoro/linux/build-docker.sh b/kokoro/scripts/linux/build-docker.sh similarity index 95% rename from kokoro/linux/build-docker.sh rename to kokoro/scripts/linux/build-docker.sh index 7d71b6123..31c39f6ed 100755 --- a/kokoro/linux/build-docker.sh +++ b/kokoro/scripts/linux/build-docker.sh @@ -25,8 +25,9 @@ set -x # Display commands being run. SKIP_TESTS="False" BUILD_TYPE="Debug" -using cmake-3.17.2 +using cmake-3.31.2 using ninja-1.10.0 +using python-3.12 if [ ! -z "$COMPILER" ]; then using "$COMPILER" @@ -57,10 +58,12 @@ then SKIP_TESTS="True" fi +git config --global --add safe.directory '*' + cd $ROOT_DIR ./utils/git-sync-deps -mkdir build +[ -d build ] || mkdir build cd $ROOT_DIR/build # Invoke the build. diff --git a/kokoro/linux/build.sh b/kokoro/scripts/linux/build.sh similarity index 89% rename from kokoro/linux/build.sh rename to kokoro/scripts/linux/build.sh index 3e6375c48..385a55d16 100755 --- a/kokoro/linux/build.sh +++ b/kokoro/scripts/linux/build.sh @@ -19,7 +19,7 @@ set -e # Fail on any error. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )" -ROOT_DIR="$( cd "${SCRIPT_DIR}/../.." >/dev/null 2>&1 && pwd )" +ROOT_DIR="$( cd "${SCRIPT_DIR}/../../.." >/dev/null 2>&1 && pwd )" CONFIG=$1 COMPILER=$2 @@ -37,4 +37,4 @@ docker run --rm -i \ --env COMPILER="${COMPILER}" \ --env KOKORO_ARTIFACTS_DIR="${KOKORO_ARTIFACTS_DIR}" \ --entrypoint "${SCRIPT_DIR}/build-docker.sh" \ - "gcr.io/shaderc-build/radial-build:latest" + us-east4-docker.pkg.dev/shaderc-build/radial-docker/ubuntu-24.04-amd64/cpp-builder diff --git a/kokoro/macos/build.sh b/kokoro/scripts/macos/build.sh similarity index 100% rename from kokoro/macos/build.sh rename to kokoro/scripts/macos/build.sh diff --git a/kokoro/scripts/ndk-build/build-docker.sh b/kokoro/scripts/ndk-build/build-docker.sh new file mode 100755 index 000000000..9163d7a5f --- /dev/null +++ b/kokoro/scripts/ndk-build/build-docker.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# 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. +# +# Linux Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +# This is required to run any git command in the docker since owner will +# have changed between the clone environment, and the docker container. +git config --global --add safe.directory '*' + +. /bin/using.sh # Declare the bash `using` function for configuring toolchains. + +cd $ROOT_DIR + +function clean_dir() { + dir=$1 + if [[ -d "$dir" ]]; then + rm -fr "$dir" + fi + mkdir "$dir" +} + +# Get source for dependencies, as specified in the DEPS file +/usr/bin/python3 utils/git-sync-deps --treeless + +using ndk-r27c + +clean_dir "$ROOT_DIR/build" +cd "$ROOT_DIR/build" + +function do_ndk_build () { + echo $(date): Starting ndk-build $@... + $ANDROID_NDK_HOME/ndk-build \ + -C $ROOT_DIR/android_test \ + NDK_PROJECT_PATH=. \ + NDK_LIBS_OUT=./libs \ + NDK_APP_OUT=./app \ + V=1 \ + SPVTOOLS_LOCAL_PATH=$ROOT_DIR/third_party/spirv-tools \ + SPVHEADERS_LOCAL_PATH=$ROOT_DIR/third_party/spirv-headers \ + -j8 $@ +} + +# Builds all the ABIs (see APP_ABI in jni/Application.mk) +do_ndk_build + +# Check that libshaderc_combined builds +# Explicitly set each ABI, otherwise it will only pick x86. +# It seems to be the behaviour when specifying an explicit target. +for abi in x86 x86_64 armeabi-v7a arm64-v8a; do + do_ndk_build APP_ABI=$abi libshaderc_combined +done + +echo $(date): ndk-build completed. diff --git a/kokoro/scripts/ndk-build/build.sh b/kokoro/scripts/ndk-build/build.sh new file mode 100755 index 000000000..6d5d74a3b --- /dev/null +++ b/kokoro/scripts/ndk-build/build.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Copyright (c) 2021 Google LLC. +# +# 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. +# +# Linux Build Script. + +# Fail on any error. +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )" +ROOT_DIR="$( cd "${SCRIPT_DIR}/../../.." >/dev/null 2>&1 && pwd )" + +BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} + +# chown the given directory to the current user, if it exists. +# Docker creates files with the root user - this can upset the Kokoro artifact copier. +function chown_dir() { + dir=$1 + if [[ -d "$dir" ]]; then + sudo chown -R "$(id -u):$(id -g)" "$dir" + fi +} + +set +e +# Allow build failures + +# "--privileged" is required to run ptrace in the asan builds. +docker run --rm -i \ + --privileged \ + --volume "${ROOT_DIR}:${ROOT_DIR}" \ + --volume "${KOKORO_ARTIFACTS_DIR}:${KOKORO_ARTIFACTS_DIR}" \ + --workdir "${ROOT_DIR}" \ + --env SCRIPT_DIR=${SCRIPT_DIR} \ + --env ROOT_DIR=${ROOT_DIR} \ + --env KOKORO_ARTIFACTS_DIR="${KOKORO_ARTIFACTS_DIR}" \ + --env BUILD_SHA="${BUILD_SHA}" \ + --entrypoint "${SCRIPT_DIR}/build-docker.sh" \ + us-east4-docker.pkg.dev/shaderc-build/radial-docker/ubuntu-24.04-amd64/cpp-builder +RESULT=$? + +# This is important. If the permissions are not fixed, kokoro will fail +# to pull build artifacts, and put the build in tool-failure state, which +# blocks the logs. +chown_dir "${ROOT_DIR}/build" +exit $RESULT diff --git a/kokoro/windows/build.bat b/kokoro/scripts/windows/build.bat similarity index 86% rename from kokoro/windows/build.bat rename to kokoro/scripts/windows/build.bat index a87cfea65..0db2b0437 100644 --- a/kokoro/windows/build.bat +++ b/kokoro/scripts/windows/build.bat @@ -20,9 +20,12 @@ set BUILD_ROOT=%cd% set SRC=%cd%\github\shaderc set BUILD_TYPE=%1 set VS_VERSION=%2 +set ARCH=%3 -:: Force usage of python 3.6. -set PATH=C:\python36;%PATH% +:: Force usage of python 3.12 +set PATH=C:\python312;%PATH% +:: Glslang requires cmake 3.27 or later +set PATH=C:\cmake-3.31.2\bin;%PATH% cd %SRC% python utils\git-sync-deps @@ -35,12 +38,8 @@ cd %SRC%\build :: ######################################### :: set up msvc build env :: ######################################### -if %VS_VERSION% == 2019 ( - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 - echo "Using VS 2019..." -) else if %VS_VERSION% == 2017 ( - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 - echo "Using VS 2017..." +if %VS_VERSION% == 2022 ( + call "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" %ARCH% ) :: ######################################### diff --git a/kokoro/windows/build_debug_2017.bat b/kokoro/windows-vs2022-amd64-debug/build.bat similarity index 87% rename from kokoro/windows/build_debug_2017.bat rename to kokoro/windows-vs2022-amd64-debug/build.bat index c1ecf87b6..96af528ef 100644 --- a/kokoro/windows/build_debug_2017.bat +++ b/kokoro/windows-vs2022-amd64-debug/build.bat @@ -1,4 +1,4 @@ -:: Copyright (C) 2017 Google Inc. +:: Copyright (C) 2025 Google Inc. :: :: Licensed under the Apache License, Version 2.0 (the "License"); :: you may not use this file except in compliance with the License. @@ -20,4 +20,4 @@ set SCRIPT_DIR=%~dp0 :: Call with correct parameter -call %SCRIPT_DIR%\build.bat Debug 2017 +call %SCRIPT_DIR%\..\scripts\windows\build.bat Debug 2022 amd64 diff --git a/kokoro/windows/continuous_debug_2017.cfg b/kokoro/windows-vs2022-amd64-debug/continuous.cfg similarity index 82% rename from kokoro/windows/continuous_debug_2017.cfg rename to kokoro/windows-vs2022-amd64-debug/continuous.cfg index 34c3b0671..6469e62f9 100644 --- a/kokoro/windows/continuous_debug_2017.cfg +++ b/kokoro/windows-vs2022-amd64-debug/continuous.cfg @@ -1,4 +1,4 @@ -# Copyright (C) 2017 Google Inc. +# Copyright (C) 2025 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Continuous build configuration. -build_file: "shaderc/kokoro/windows/build_debug_2017.bat" +build_file: "shaderc/kokoro/windows-vs2022-amd64-debug/build.bat" action { define_artifacts { diff --git a/kokoro/windows/continuous_debug_2019.cfg b/kokoro/windows-vs2022-amd64-debug/presubmit.cfg similarity index 82% rename from kokoro/windows/continuous_debug_2019.cfg rename to kokoro/windows-vs2022-amd64-debug/presubmit.cfg index 3600e1b5d..6469e62f9 100644 --- a/kokoro/windows/continuous_debug_2019.cfg +++ b/kokoro/windows-vs2022-amd64-debug/presubmit.cfg @@ -1,4 +1,4 @@ -# Copyright (C) 2023 Google Inc. +# Copyright (C) 2025 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Continuous build configuration. -build_file: "shaderc/kokoro/windows/build_debug_2019.bat" +build_file: "shaderc/kokoro/windows-vs2022-amd64-debug/build.bat" action { define_artifacts { diff --git a/kokoro/windows/build_debug_2019.bat b/kokoro/windows-vs2022-amd64-release/build.bat similarity index 86% rename from kokoro/windows/build_debug_2019.bat rename to kokoro/windows-vs2022-amd64-release/build.bat index ea173d984..3fe22ebb0 100644 --- a/kokoro/windows/build_debug_2019.bat +++ b/kokoro/windows-vs2022-amd64-release/build.bat @@ -1,4 +1,4 @@ -:: Copyright (C) 2023 Google Inc. +:: Copyright (C) 2025 Google Inc. :: :: Licensed under the Apache License, Version 2.0 (the "License"); :: you may not use this file except in compliance with the License. @@ -11,8 +11,6 @@ :: 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. -:: -:: Windows Build Script. @echo on @@ -20,4 +18,4 @@ set SCRIPT_DIR=%~dp0 :: Call with correct parameter -call %SCRIPT_DIR%\build.bat Debug 2019 +call %SCRIPT_DIR%\..\scripts\windows\build.bat RelWithDebInfo 2022 amd64 diff --git a/kokoro/windows/continuous_release_2019.cfg b/kokoro/windows-vs2022-amd64-release/continuous.cfg similarity index 82% rename from kokoro/windows/continuous_release_2019.cfg rename to kokoro/windows-vs2022-amd64-release/continuous.cfg index 8cbbc7e26..eb59c14ab 100644 --- a/kokoro/windows/continuous_release_2019.cfg +++ b/kokoro/windows-vs2022-amd64-release/continuous.cfg @@ -1,4 +1,4 @@ -# Copyright (C) 2023 Google Inc. +# Copyright (C) 2025 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Continuous build configuration. -build_file: "shaderc/kokoro/windows/build_release_2019.bat" +build_file: "shaderc/kokoro/windows-vs2022-amd64-release/build.bat" action { define_artifacts { diff --git a/kokoro/windows/continuous_release_2017.cfg b/kokoro/windows-vs2022-amd64-release/presubmit.cfg similarity index 82% rename from kokoro/windows/continuous_release_2017.cfg rename to kokoro/windows-vs2022-amd64-release/presubmit.cfg index b3249d445..eb59c14ab 100644 --- a/kokoro/windows/continuous_release_2017.cfg +++ b/kokoro/windows-vs2022-amd64-release/presubmit.cfg @@ -1,4 +1,4 @@ -# Copyright (C) 2017 Google Inc. +# Copyright (C) 2025 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Continuous build configuration. -build_file: "shaderc/kokoro/windows/build_release_2017.bat" +build_file: "shaderc/kokoro/windows-vs2022-amd64-release/build.bat" action { define_artifacts { diff --git a/kokoro/windows/build_release_2017.bat b/kokoro/windows/build_release_2017.bat deleted file mode 100644 index 4102eaa45..000000000 --- a/kokoro/windows/build_release_2017.bat +++ /dev/null @@ -1,24 +0,0 @@ -:: Copyright (C) 2017 Google Inc. -:: -:: 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. -:: -:: Windows Build Script. - -@echo on - -:: Find out the directory of the common build script. -set SCRIPT_DIR=%~dp0 - -:: Call with correct parameter -call %SCRIPT_DIR%\build.bat RelWithDebInfo 2017 - diff --git a/kokoro/windows/build_release_2019.bat b/kokoro/windows/build_release_2019.bat deleted file mode 100644 index f0611e3d1..000000000 --- a/kokoro/windows/build_release_2019.bat +++ /dev/null @@ -1,23 +0,0 @@ -:: Copyright (C) 2023 Google Inc. -:: -:: 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. -:: -:: Windows Build Script. - -@echo on - -:: Find out the directory of the common build script. -set SCRIPT_DIR=%~dp0 - -:: Call with correct parameter -call %SCRIPT_DIR%\build.bat RelWithDebInfo 2019 diff --git a/kokoro/windows/presubmit_debug_2017.cfg b/kokoro/windows/presubmit_debug_2017.cfg deleted file mode 100644 index 57168d397..000000000 --- a/kokoro/windows/presubmit_debug_2017.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/windows/build_debug_2017.bat" diff --git a/kokoro/windows/presubmit_debug_2019.cfg b/kokoro/windows/presubmit_debug_2019.cfg deleted file mode 100644 index 7aa76d895..000000000 --- a/kokoro/windows/presubmit_debug_2019.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2023 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/windows/build_debug_2019.bat" diff --git a/kokoro/windows/presubmit_release_2017.cfg b/kokoro/windows/presubmit_release_2017.cfg deleted file mode 100644 index 16499fc21..000000000 --- a/kokoro/windows/presubmit_release_2017.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2017 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/windows/build_release_2017.bat" diff --git a/kokoro/windows/presubmit_release_2019.cfg b/kokoro/windows/presubmit_release_2019.cfg deleted file mode 100644 index 734cff0c0..000000000 --- a/kokoro/windows/presubmit_release_2019.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2023 Google Inc. -# -# 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. - -# Presubmit build configuration. -build_file: "shaderc/kokoro/windows/build_release_2019.bat" diff --git a/libshaderc/include/shaderc/env.h b/libshaderc/include/shaderc/env.h index 14b418dcd..3d32b2a9a 100644 --- a/libshaderc/include/shaderc/env.h +++ b/libshaderc/include/shaderc/env.h @@ -41,6 +41,7 @@ typedef enum { 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)), + shaderc_env_version_vulkan_1_4 = ((1u << 22) | (4 << 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 diff --git a/libshaderc/include/shaderc/shaderc.h b/libshaderc/include/shaderc/shaderc.h index 3a3e97d6b..dd40744d0 100644 --- a/libshaderc/include/shaderc/shaderc.h +++ b/libshaderc/include/shaderc/shaderc.h @@ -463,6 +463,9 @@ SHADERC_EXPORT void shaderc_compile_options_set_binding_base_for_stage( SHADERC_EXPORT void shaderc_compile_options_set_preserve_bindings( shaderc_compile_options_t options, bool preserve_bindings); +SHADERC_EXPORT void shaderc_compile_options_set_max_id_bound( + shaderc_compile_options_t options, uint32_t max_id_bound); + // Sets whether the compiler should automatically assign locations to // uniform variables that don't have explicit locations in the shader source. SHADERC_EXPORT void shaderc_compile_options_set_auto_map_locations( diff --git a/libshaderc/include/shaderc/shaderc.hpp b/libshaderc/include/shaderc/shaderc.hpp index 3817af806..77ccd7a70 100644 --- a/libshaderc/include/shaderc/shaderc.hpp +++ b/libshaderc/include/shaderc/shaderc.hpp @@ -317,6 +317,10 @@ class CompileOptions { shaderc_compile_options_set_preserve_bindings(options_, preserve_bindings); } + void SetMaxIdBound(uint32_t max_id_bound) { + shaderc_compile_options_set_max_id_bound(options_, max_id_bound); + } + // Sets whether the compiler automatically assigns locations to // uniform variables that don't have explicit locations. void SetAutoMapLocations(bool auto_map) { @@ -365,7 +369,7 @@ class CompileOptions { shaderc_compile_options_set_invert_y(options_, enable); } - // Sets whether the compiler should generates code for max an min which, + // Sets whether the compiler should generate code for max and min which, // if given a NaN operand, will return the other operand. Similarly, the // clamp builtin will favour the non-NaN operands, as if clamp were // implemented as a composition of max and min. diff --git a/libshaderc/src/shaderc.cc b/libshaderc/src/shaderc.cc index 63f1bbc6c..4a43b292e 100644 --- a/libshaderc/src/shaderc.cc +++ b/libshaderc/src/shaderc.cc @@ -110,7 +110,7 @@ class StageDeducer { public: explicit StageDeducer( shaderc_shader_kind kind = shaderc_glsl_infer_from_source) - : kind_(kind), error_(false){} + : kind_(kind), error_(false) {} // The method that underlying glslang will call to determine the shader stage // to be used in current compilation. It is called only when there is neither // forced shader kind (or say stage, in the view of glslang), nor #pragma @@ -203,9 +203,9 @@ class InternalFileIncluder : public shaderc_util::CountingIncluder { void* user_data) : resolver_(resolver), result_releaser_(result_releaser), - user_data_(user_data){} + user_data_(user_data) {} InternalFileIncluder() - : resolver_(nullptr), result_releaser_(nullptr), user_data_(nullptr){} + : resolver_(nullptr), result_releaser_(nullptr), user_data_(nullptr) {} private: // Check the validity of the callbacks. @@ -311,6 +311,10 @@ shaderc_util::Compiler::TargetEnvVersion GetCompilerTargetEnvVersion( version_number) { return Compiler::TargetEnvVersion::Vulkan_1_3; } + if (static_cast(Compiler::TargetEnvVersion::Vulkan_1_4) == + version_number) { + return Compiler::TargetEnvVersion::Vulkan_1_4; + } if (static_cast(Compiler::TargetEnvVersion::OpenGL_4_5) == version_number) { return Compiler::TargetEnvVersion::OpenGL_4_5; @@ -536,6 +540,11 @@ void shaderc_compile_options_set_preserve_bindings( options->compiler.SetPreserveBindings(preserve_bindings); } +void shaderc_compile_options_set_max_id_bound(shaderc_compile_options_t options, + uint32_t max_id_bound) { + options->compiler.SetMaxIdBound(max_id_bound); +} + void shaderc_compile_options_set_auto_map_locations( shaderc_compile_options_t options, bool auto_map) { options->compiler.SetAutoMapLocations(auto_map); @@ -569,8 +578,8 @@ void shaderc_compile_options_set_vulkan_rules_relaxed( options->compiler.SetVulkanRulesRelaxed(enable); } -void shaderc_compile_options_set_invert_y( - shaderc_compile_options_t options, bool enable) { +void shaderc_compile_options_set_invert_y(shaderc_compile_options_t options, + bool enable) { options->compiler.EnableInvertY(enable); } @@ -587,9 +596,7 @@ shaderc_compiler_t shaderc_compiler_initialize() { return compiler; } -void shaderc_compiler_release(shaderc_compiler_t compiler) { - delete compiler; -} +void shaderc_compiler_release(shaderc_compiler_t compiler) { delete compiler; } namespace { shaderc_compilation_result_t CompileToSpecifiedOutputType( @@ -629,7 +636,8 @@ shaderc_compilation_result_t CompileToSpecifiedOutputType( std::tie(compilation_succeeded, compilation_output_data, compilation_output_data_size_in_bytes) = additional_options->compiler.Compile( - source_string, forced_stage, input_file_name_str, entry_point_name, + source_string, forced_stage, input_file_name_str, + entry_point_name, // stage_deducer has a flag: error_, which we need to check later. // We need to make this a reference wrapper, so that std::function // won't make a copy for this callable object. @@ -641,9 +649,9 @@ shaderc_compilation_result_t CompileToSpecifiedOutputType( std::tie(compilation_succeeded, compilation_output_data, compilation_output_data_size_in_bytes) = shaderc_util::Compiler().Compile( - source_string, forced_stage, input_file_name_str, entry_point_name, - std::ref(stage_deducer), includer, output_type, &errors, - &total_warnings, &total_errors); + source_string, forced_stage, input_file_name_str, + entry_point_name, std::ref(stage_deducer), includer, output_type, + &errors, &total_warnings, &total_errors); } result->messages = errors.str(); diff --git a/libshaderc/src/shaderc_cpp_test.cc b/libshaderc/src/shaderc_cpp_test.cc index 0f1f37f05..401d5b984 100644 --- a/libshaderc/src/shaderc_cpp_test.cc +++ b/libshaderc/src/shaderc_cpp_test.cc @@ -103,12 +103,12 @@ class CppInterface : public testing::Test { // Compiles a shader, asserts compilation success, and returns the warning // messages. // The input file name is set to "shader" by default. - std::string CompilationWarnings( - const std::string& shader, shaderc_shader_kind kind, - // This could default to options_, but that can - // be easily confused with a no-options-provided - // case: - const CompileOptions& options) { + std::string CompilationWarnings(const std::string& shader, + shaderc_shader_kind kind, + // This could default to options_, but that + // can be easily confused with a + // no-options-provided case: + const CompileOptions& options) { const auto compilation_result = compiler_.CompileGlslToSpv(shader, kind, "shader", options); EXPECT_TRUE(CompilationResultIsSuccess(compilation_result)) << kind << '\n' @@ -458,9 +458,8 @@ TEST_F(CppInterface, ForcedVersionProfileRedundantProfileStd) { TEST_F(CppInterface, GenerateDebugInfoBinary) { options_.SetGenerateDebugInfo(); - const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, options_); + const std::string binary_output = CompilationOutput( + kMinimalDebugInfoShader, shaderc_glsl_vertex_shader, options_); // The binary output should contain the name of the vector (debug_info_sample) // null-terminated, as well as the whole original source. std::string vector_name("debug_info_sample"); @@ -472,9 +471,8 @@ TEST_F(CppInterface, GenerateDebugInfoBinary) { TEST_F(CppInterface, GenerateDebugInfoBinaryClonedOptions) { options_.SetGenerateDebugInfo(); CompileOptions cloned_options(options_); - const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, cloned_options); + const std::string binary_output = CompilationOutput( + kMinimalDebugInfoShader, shaderc_glsl_vertex_shader, cloned_options); // The binary output should contain the name of the vector (debug_info_sample) // null-terminated, as well as the whole original source. std::string vector_name("debug_info_sample"); @@ -846,39 +844,39 @@ TEST_P(IncluderTests, SetIncluderClonedOptions) { } INSTANTIATE_TEST_SUITE_P(CppInterface, IncluderTests, - testing::ValuesIn(std::vector{ - IncluderTestCase( - // Fake file system. - { - {"root", - "#version 150\n" - "void foo() {}\n" - "#include \"path/to/file_1\"\n"}, - {"path/to/file_1", "content of file_1\n"}, - }, - // Expected output. - "#line 0 \"path/to/file_1\"\n" - " content of file_1\n" - "#line 3"), - IncluderTestCase( - // Fake file system. - {{"root", - "#version 150\n" - "void foo() {}\n" - "#include \"path/to/file_1\"\n"}, - {"path/to/file_1", - "#include \"path/to/file_2\"\n" - "content of file_1\n"}, - {"path/to/file_2", "content of file_2\n"}}, - // Expected output. - "#line 0 \"path/to/file_1\"\n" - "#line 0 \"path/to/file_2\"\n" - " content of file_2\n" - "#line 1 \"path/to/file_1\"\n" - " content of file_1\n" - "#line 3"), - - })); + testing::ValuesIn(std::vector{ + IncluderTestCase( + // Fake file system. + { + {"root", + "#version 150\n" + "void foo() {}\n" + "#include \"path/to/file_1\"\n"}, + {"path/to/file_1", "content of file_1\n"}, + }, + // Expected output. + "#line 0 \"path/to/file_1\"\n" + " content of file_1\n" + "#line 3"), + IncluderTestCase( + // Fake file system. + {{"root", + "#version 150\n" + "void foo() {}\n" + "#include \"path/to/file_1\"\n"}, + {"path/to/file_1", + "#include \"path/to/file_2\"\n" + "content of file_1\n"}, + {"path/to/file_2", "content of file_2\n"}}, + // Expected output. + "#line 0 \"path/to/file_1\"\n" + "#line 0 \"path/to/file_2\"\n" + " content of file_2\n" + "#line 1 \"path/to/file_1\"\n" + " content of file_1\n" + "#line 3"), + + })); TEST_F(CppInterface, WarningsOnLine) { // By default the compiler will emit a warning on line 2 complaining @@ -1077,6 +1075,7 @@ TEST_F(CppInterface, TargetEnvCompileOptionsVulkan1_0EnvVulkan1_1ShaderFails) { shaderc_glsl_compute_shader, options_)); } +// Simple Vulkan 1.1 tests TEST_F(CppInterface, TargetEnvCompileOptionsVulkan1_1EnvVulkan1_0ShaderSucceeds) { options_.SetTargetEnvironment(shaderc_target_env_vulkan, @@ -1093,6 +1092,59 @@ TEST_F(CppInterface, shaderc_glsl_compute_shader, options_)); } +// Simple Vulkan 1.2 tests +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_2EnvVulkan1_0ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_2); + EXPECT_TRUE(CompilationSuccess(BarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_2EnvVulkan1_1ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_2); + EXPECT_TRUE(CompilationSuccess(SubgroupBarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +// Simple Vulkan 1.3 tests +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_3EnvVulkan1_0ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_3); + EXPECT_TRUE(CompilationSuccess(BarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_3EnvVulkan1_1ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_3); + EXPECT_TRUE(CompilationSuccess(SubgroupBarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +// Simple Vulkan 1.4 tests +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_4EnvVulkan1_0ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_4); + EXPECT_TRUE(CompilationSuccess(BarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_4EnvVulkan1_1ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_4); + EXPECT_TRUE(CompilationSuccess(SubgroupBarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +// Other tests + TEST_F(CppInterface, BeginAndEndOnSpvCompilationResult) { const SpvCompilationResult compilation_result = compiler_.CompileGlslToSpv( kMinimalShader, shaderc_glsl_vertex_shader, "shader"); @@ -1432,8 +1484,9 @@ TEST_F(CppInterface, HlslFunctionality1SurvivesCloning) { // source. https://github.com/KhronosGroup/glslang/issues/1616 options.SetAutoBindUniforms(true); CompileOptions cloned_options(options); - const std::string disassembly_text = AssemblyOutput( - kHlslShaderWithCounterBuffer, shaderc_glsl_fragment_shader, cloned_options); + const std::string disassembly_text = + AssemblyOutput(kHlslShaderWithCounterBuffer, shaderc_glsl_fragment_shader, + cloned_options); EXPECT_THAT(disassembly_text, HasSubstr("OpDecorateString")); } diff --git a/libshaderc/src/shaderc_test.cc b/libshaderc/src/shaderc_test.cc index 5610b0b67..43cc3720c 100644 --- a/libshaderc/src/shaderc_test.cc +++ b/libshaderc/src/shaderc_test.cc @@ -609,9 +609,8 @@ TEST_F(CompileStringWithOptionsTest, ForcedVersionProfileRedundantProfileStd) { TEST_F(CompileStringWithOptionsTest, GenerateDebugInfoBinary) { shaderc_compile_options_set_generate_debug_info(options_.get()); ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, options_.get()); + const std::string binary_output = CompilationOutput( + kMinimalDebugInfoShader, shaderc_glsl_vertex_shader, options_.get()); // The binary output should contain the name of the vector (debug_info_sample) // null-terminated, as well as the whole original source. std::string vector_name("debug_info_sample"); @@ -626,8 +625,8 @@ TEST_F(CompileStringWithOptionsTest, GenerateDebugInfoBinaryClonedOptions) { shaderc_compile_options_clone(options_.get())); ASSERT_NE(nullptr, compiler_.get_compiler_handle()); const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, cloned_options.get()); + CompilationOutput(kMinimalDebugInfoShader, shaderc_glsl_vertex_shader, + cloned_options.get()); // The binary output should contain the name of the vector (debug_info_sample) // null-terminated, as well as the whole original source. std::string vector_name("debug_info_sample"); @@ -984,39 +983,39 @@ TEST_P(IncluderTests, SetIncluderCallbacksClonedOptions) { } INSTANTIATE_TEST_SUITE_P(CompileStringTest, IncluderTests, - testing::ValuesIn(std::vector{ - IncluderTestCase( - // Fake file system. - { - {"root", - "#version 150\n" - "void foo() {}\n" - "#include \"path/to/file_1\"\n"}, - {"path/to/file_1", "content of file_1\n"}, - }, - // Expected output. - "#line 0 \"path/to/file_1\"\n" - " content of file_1\n" - "#line 3"), - IncluderTestCase( - // Fake file system. - {{"root", - "#version 150\n" - "void foo() {}\n" - "#include \"path/to/file_1\"\n"}, - {"path/to/file_1", - "#include \"path/to/file_2\"\n" - "content of file_1\n"}, - {"path/to/file_2", "content of file_2\n"}}, - // Expected output. - "#line 0 \"path/to/file_1\"\n" - "#line 0 \"path/to/file_2\"\n" - " content of file_2\n" - "#line 1 \"path/to/file_1\"\n" - " content of file_1\n" - "#line 3"), - - })); + testing::ValuesIn(std::vector{ + IncluderTestCase( + // Fake file system. + { + {"root", + "#version 150\n" + "void foo() {}\n" + "#include \"path/to/file_1\"\n"}, + {"path/to/file_1", "content of file_1\n"}, + }, + // Expected output. + "#line 0 \"path/to/file_1\"\n" + " content of file_1\n" + "#line 3"), + IncluderTestCase( + // Fake file system. + {{"root", + "#version 150\n" + "void foo() {}\n" + "#include \"path/to/file_1\"\n"}, + {"path/to/file_1", + "#include \"path/to/file_2\"\n" + "content of file_1\n"}, + {"path/to/file_2", "content of file_2\n"}}, + // Expected output. + "#line 0 \"path/to/file_1\"\n" + "#line 0 \"path/to/file_2\"\n" + " content of file_2\n" + "#line 1 \"path/to/file_1\"\n" + " content of file_1\n" + "#line 3"), + + })); TEST_F(CompileStringWithOptionsTest, WarningsOnLine) { // Some versions of Glslang will return an error, some will return just @@ -1225,6 +1224,63 @@ TEST_F(CompileStringWithOptionsTest, shaderc_glsl_compute_shader, options_.get())); } +// Simple Vulkan 1.2 tests +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_0ShaderToVulkan1_2Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_2); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_1ShaderToVulkan1_2Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_2); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeSubgroupBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +// Simple Vulkan 1.3 tests +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_0ShaderToVulkan1_3Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_3); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_1ShaderToVulkan1_3Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_3); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeSubgroupBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +// Simple Vulkan 1.4 tests +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_0ShaderToVulkan1_4Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_4); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_1ShaderToVulkan1_4Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_4); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeSubgroupBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + // task shader TEST_F(CompileStringWithOptionsTest, TargetEnvRespectedWhenCompilingVulkan1_0TaskShaderToVulkan1_0Succeeds) { diff --git a/libshaderc_util/Android.mk b/libshaderc_util/Android.mk index 9642e254d..78a2efefd 100644 --- a/libshaderc_util/Android.mk +++ b/libshaderc_util/Android.mk @@ -27,6 +27,6 @@ LOCAL_SRC_FILES:=src/args.cc \ src/shader_stage.cc \ src/spirv_tools_wrapper.cc \ src/version_profile.cc -LOCAL_STATIC_LIBRARIES:=SPIRV SPIRV-Tools-opt +LOCAL_STATIC_LIBRARIES:=SPIRV SPIRV-Tools-opt glslang LOCAL_C_INCLUDES:=$(LOCAL_PATH)/include include $(BUILD_STATIC_LIBRARY) diff --git a/libshaderc_util/include/libshaderc_util/compiler.h b/libshaderc_util/include/libshaderc_util/compiler.h index d9d02b951..3f593d6de 100644 --- a/libshaderc_util/include/libshaderc_util/compiler.h +++ b/libshaderc_util/include/libshaderc_util/compiler.h @@ -24,10 +24,9 @@ #include #include -#include "glslang/Public/ShaderLang.h" - #include "counting_includer.h" #include "file_finder.h" +#include "glslang/Public/ShaderLang.h" #include "mutex.h" #include "resources.h" #include "string_piece.h" @@ -85,7 +84,8 @@ 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 + Vulkan_1_3 = ((1 << 22) | (3 << 12)), // Vulkan 1.3 + Vulkan_1_4 = ((1 << 22) | (4 << 12)), // Vulkan 1.4 // For OpenGL, use the numbering from #version in shaders. OpenGL_4_5 = 450, }; @@ -297,8 +297,8 @@ class Compiler { } // Sets the lowest binding number used when automatically assigning bindings - // for uniform resources of the given type, for all shader stages. The default - // base is zero. + // for uniform resources of the given type, for all shader stages. The + // default base is zero. void SetAutoBindingBase(UniformKind kind, uint32_t base) { for (auto stage : stages()) { SetAutoBindingBaseForStage(stage, kind, base); @@ -319,6 +319,8 @@ class Compiler { preserve_bindings_ = preserve_bindings; } + void SetMaxIdBound(uint32_t max_id_bound) { max_id_bound_ = max_id_bound; } + // Sets whether the compiler automatically assigns locations to // uniform variables that don't have explicit locations. void SetAutoMapLocations(bool auto_map) { auto_map_locations_ = auto_map; } @@ -343,8 +345,8 @@ class Compiler { // shader stage. For example, // SetHlslRegisterSetAndBinding(Stage::Fragment, "t1", "4", "5") // means register "t1" in a fragment shader should map to binding 5 in set 4. - // (Glslang wants this data as strings, not ints or enums.) The string data is - // copied. + // (Glslang wants this data as strings, not ints or enums.) The string data + // is copied. void SetHlslRegisterSetAndBindingForStage(Stage stage, const std::string& reg, const std::string& set, const std::string& binding) { @@ -393,7 +395,8 @@ class Compiler { const string_piece& error_tag)>& stage_callback, CountingIncluder& includer, OutputType output_type, - std::ostream* error_stream, size_t* total_warnings, size_t* total_errors) const; + std::ostream* error_stream, size_t* total_warnings, + size_t* total_errors) const; static EShMessages GetDefaultRules() { return static_cast(EShMsgSpvRules | EShMsgVulkanRules | @@ -521,9 +524,9 @@ class Compiler { // and convert image variables to combined image-sampler variables. bool auto_combined_image_sampler_; - // The base binding number per uniform type, per stage, used when automatically - // binding uniforms that don't hzve explicit bindings in the shader source. - // The default is zero. + // The base binding number per uniform type, per stage, used when + // automatically binding uniforms that don't hzve explicit bindings in the + // shader source. The default is zero. uint32_t auto_binding_base_[kNumStages][kNumUniformKinds]; // True if the compiler should automatically map uniforms that don't @@ -533,6 +536,8 @@ class Compiler { // True if the compiler should preserve all bindings, even when unused. bool preserve_bindings_; + uint32_t max_id_bound_ = 0x3FFFFF; + // True if the compiler should use HLSL IO mapping rules when compiling HLSL. bool hlsl_iomap_; @@ -544,7 +549,8 @@ class Compiler { // source language is HLSL. bool hlsl_legalization_enabled_; - // True if the compiler should support extension SPV_GOOGLE_hlsl_functionality1. + // True if the compiler should support extension + // SPV_GOOGLE_hlsl_functionality1. bool hlsl_functionality1_enabled_; // True if the compiler should support 16-bit HLSL types. diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc index e5f5d1055..f2ed3c71d 100644 --- a/libshaderc_util/src/compiler.cc +++ b/libshaderc_util/src/compiler.cc @@ -178,7 +178,8 @@ std::tuple, size_t> Compiler::Compile( const string_piece& error_tag)>& stage_callback, CountingIncluder& includer, OutputType output_type, - std::ostream* error_stream, size_t* total_warnings, size_t* total_errors) const { + std::ostream* error_stream, size_t* total_warnings, + size_t* total_errors) const { // Compilation results to be returned: // Initialize the result tuple as a failed compilation. In error cases, we // should return result_tuple directly without setting its members. @@ -192,8 +193,8 @@ std::tuple, size_t> Compiler::Compile( // Check target environment. const auto target_client_info = GetGlslangClientInfo( - error_tag, target_env_, target_env_version_, - target_spirv_version_, target_spirv_version_is_forced_); + error_tag, target_env_, target_env_version_, target_spirv_version_, + target_spirv_version_is_forced_); if (!target_client_info.error.empty()) { *error_stream << target_client_info.error; *total_warnings = 0; @@ -272,7 +273,8 @@ std::tuple, size_t> Compiler::Compile( shader.setEntryPoint(entry_point_name); shader.setAutoMapBindings(auto_bind_uniforms_); if (auto_combined_image_sampler_) { - shader.setTextureSamplerTransformMode(EShTexSampTransUpgradeTextureRemoveSampler); + shader.setTextureSamplerTransformMode( + EShTexSampTransUpgradeTextureRemoveSampler); } shader.setAutoMapLocations(auto_map_locations_); const auto& bases = auto_binding_base_[static_cast(used_shader_stage)]; @@ -296,7 +298,7 @@ std::tuple, size_t> Compiler::Compile( } if (vulkan_rules_relaxed_) { glslang::EShSource language = glslang::EShSourceNone; - switch(source_language_) { + switch (source_language_) { case SourceLanguage::GLSL: language = glslang::EShSourceGlsl; break; @@ -307,7 +309,8 @@ std::tuple, size_t> Compiler::Compile( // This option will only be used if the Vulkan client is used. // If new versions of GL_KHR_vulkan_glsl come out, it would make sense to // let callers specify which version to use. For now, just use 100. - shader.setEnvInput(language, used_shader_stage, glslang::EShClientVulkan, 100); + shader.setEnvInput(language, used_shader_stage, glslang::EShClientVulkan, + 100); shader.setEnvInputVulkanRulesRelaxed(); } shader.setInvertY(invert_y_enabled_); @@ -367,6 +370,7 @@ std::tuple, size_t> Compiler::Compile( if (!opt_passes.empty()) { spvtools::OptimizerOptions opt_options; opt_options.set_preserve_bindings(preserve_bindings_); + opt_options.set_max_id_bound(max_id_bound_); std::string opt_errors; if (!SpirvToolsOptimize(target_env_, target_env_version_, opt_passes, @@ -494,8 +498,8 @@ std::tuple Compiler::PreprocessShader( &string_names, 1); shader.setPreamble(shader_preamble.data()); auto target_client_info = GetGlslangClientInfo( - error_tag, target_env_, target_env_version_, - target_spirv_version_, target_spirv_version_is_forced_); + error_tag, target_env_, target_env_version_, target_spirv_version_, + target_spirv_version_is_forced_); if (!target_client_info.error.empty()) { return std::make_tuple(false, "", target_client_info.error); } @@ -755,6 +759,9 @@ GlslangClientInfo GetGlslangClientInfo( } 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 if (env_version == Compiler::TargetEnvVersion::Vulkan_1_4) { + result.client_version = glslang::EShTargetVulkan_1_4; + result.target_language_version = glslang::EShTargetSpv_1_6; } else { errs << "error:" << error_tag << ": Invalid target client version " << static_cast(env_version) << " for Vulkan environment " diff --git a/libshaderc_util/src/compiler_test.cc b/libshaderc_util/src/compiler_test.cc index 4ebb91324..e1e9c3272 100644 --- a/libshaderc_util/src/compiler_test.cc +++ b/libshaderc_util/src/compiler_test.cc @@ -14,10 +14,10 @@ #include "libshaderc_util/compiler.h" -#include - #include +#include + #include "death_test.h" #include "libshaderc_util/counting_includer.h" #include "libshaderc_util/spirv_tools_wrapper.h" @@ -353,16 +353,18 @@ TEST_F(CompilerTest, BadTargetEnvVulkanVersionFails) { compiler_.SetTargetEnv(Compiler::TargetEnv::Vulkan, static_cast(123)); EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, - HasSubstr("Invalid target client version 123 for Vulkan environment 0")); + EXPECT_THAT( + errors_, + HasSubstr("Invalid target client version 123 for Vulkan environment 0")); } TEST_F(CompilerTest, BadTargetEnvOpenGLVersionFails) { compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGL, static_cast(123)); EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, - HasSubstr("Invalid target client version 123 for OpenGL environment 1")); + EXPECT_THAT( + errors_, + HasSubstr("Invalid target client version 123 for OpenGL environment 1")); } TEST_F(CompilerTest, SpirvTargetVersion1_0Succeeds) { @@ -535,18 +537,17 @@ TEST_P(LimitTest, Sample) { #define CASE(LIMIT, DEFAULT, NEW) \ { Compiler::Limit::LIMIT, DEFAULT, NEW } -INSTANTIATE_TEST_SUITE_P( - CompilerTest, LimitTest, - // See resources.cc for the defaults. - testing::ValuesIn(std::vector{ - // clang-format off +INSTANTIATE_TEST_SUITE_P(CompilerTest, LimitTest, + // See resources.cc for the defaults. + testing::ValuesIn(std::vector{ + // clang-format off // This is just a sampling of the possible values. CASE(MaxLights, 8, 99), CASE(MaxClipPlanes, 6, 10929), CASE(MaxTessControlAtomicCounters, 0, 72), CASE(MaxSamples, 4, 8), - // clang-format on - })); + // clang-format on + })); #undef CASE // Returns a fragment shader accessing a texture with the given @@ -819,9 +820,20 @@ TEST_F(CompilerTest, HlslFunctionality1Enabled) { EXPECT_THAT(disassembly, HasSubstr("OpExtension \"SPV_GOOGLE_hlsl_functionality1\"")) << disassembly; + EXPECT_THAT(disassembly, HasSubstr("OpDecorateString %_entryPointOutput " + "UserSemantic \"SV_TARGET0\"")) + << disassembly; +} + +TEST_F(CompilerTest, RelaxedVulkanRulesEnabled) { + compiler_.SetSourceLanguage(Compiler::SourceLanguage::GLSL); + compiler_.SetAutoBindUniforms(true); // Uniform variable needs a binding + compiler_.SetVulkanRulesRelaxed(true); + const auto words = + SimpleCompilationBinary(kGlslFragShaderOpaqueUniforms, EShLangFragment); + const auto disassembly = Disassemble(words); EXPECT_THAT(disassembly, - HasSubstr("OpDecorateString %_entryPointOutput " - "UserSemantic \"SV_TARGET0\"")) + HasSubstr("OpMemberName %gl_DefaultUniformBlock 0 \"a\"")) << disassembly; } @@ -926,6 +938,8 @@ INSTANTIATE_TEST_SUITE_P( // Unforced SPIR-V version. Success cases. {CASE_VK(1_0, 1_4), false, GCASE_VK("", 1_0, 1_0)}, {CASE_VK(1_1, 1_4), false, GCASE_VK("", 1_1, 1_3)}, + {CASE_VK(1_3, 1_6), false, GCASE_VK("", 1_3, 1_6)}, + {CASE_VK(1_4, 1_6), false, GCASE_VK("", 1_4, 1_6)}, {CASE_GL(4_5, 1_4), false, GCASE_GL("", 450, 1_0)}, })); @@ -941,6 +955,12 @@ INSTANTIATE_TEST_SUITE_P( {CASE_VK(1_1, 1_1), true, GCASE_VK("", 1_1, 1_1)}, {CASE_VK(1_1, 1_2), true, GCASE_VK("", 1_1, 1_2)}, {CASE_VK(1_1, 1_3), true, GCASE_VK("", 1_1, 1_3)}, + {CASE_VK(1_3, 1_4), true, GCASE_VK("", 1_3, 1_4)}, + {CASE_VK(1_3, 1_5), true, GCASE_VK("", 1_3, 1_5)}, + {CASE_VK(1_3, 1_6), true, GCASE_VK("", 1_3, 1_6)}, + {CASE_VK(1_4, 1_4), true, GCASE_VK("", 1_4, 1_4)}, + {CASE_VK(1_4, 1_5), true, GCASE_VK("", 1_4, 1_5)}, + {CASE_VK(1_4, 1_6), true, GCASE_VK("", 1_4, 1_6)}, {CASE_GL(4_5, 1_0), true, GCASE_GL("", 450, 1_0)}, {CASE_GL(4_5, 1_1), true, GCASE_GL("", 450, 1_1)}, {CASE_GL(4_5, 1_2), true, GCASE_GL("", 450, 1_2)}, diff --git a/libshaderc_util/src/spirv_tools_wrapper.cc b/libshaderc_util/src/spirv_tools_wrapper.cc index b4f57f895..49426d0b6 100644 --- a/libshaderc_util/src/spirv_tools_wrapper.cc +++ b/libshaderc_util/src/spirv_tools_wrapper.cc @@ -40,6 +40,8 @@ spv_target_env GetSpirvToolsTargetEnv(Compiler::TargetEnv env, return SPV_ENV_VULKAN_1_2; case Compiler::TargetEnvVersion::Vulkan_1_3: return SPV_ENV_VULKAN_1_3; + case Compiler::TargetEnvVersion::Vulkan_1_4: + return SPV_ENV_VULKAN_1_4; default: break; } @@ -126,6 +128,11 @@ bool SpirvToolsOptimize(Compiler::TargetEnv env, val_opts.SetRelaxLogicalPointer(true); // This uses relaxed rules for pre-legalized HLSL. val_opts.SetBeforeHlslLegalization(true); + // Don't use friendly names when printing validation errors. + // It incurs a high startup cost whether or not there is an + // error. Validation failures are compiler bugs, and so they + // should be rare anyway. + val_opts.SetFriendlyNames(false); // Set additional optimizer options. optimizer_options.set_validator_options(val_opts); diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index a01f31eaf..d44f62a1e 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -83,6 +83,11 @@ endif() if (NOT TARGET glslang) if (IS_DIRECTORY ${SHADERC_GLSLANG_DIR}) + if (SHADERC_ENABLE_TESTS) + # Glslang tests are off by default. Turn them on if testing Shaderc. + set(GLSLANG_TESTS ON) + endif() + set(GLSLANG_ENABLE_INSTALL $) add_subdirectory(${SHADERC_GLSLANG_DIR} glslang) endif() if (NOT TARGET glslang) diff --git a/utils/add_copyright.py b/utils/add_copyright.py index ab3c5f196..7ea08979e 100755 --- a/utils/add_copyright.py +++ b/utils/add_copyright.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2015 The Shaderc Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/utils/remove-file-by-suffix.py b/utils/remove-file-by-suffix.py index 39af161c6..ce7c65867 100755 --- a/utils/remove-file-by-suffix.py +++ b/utils/remove-file-by-suffix.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2015 The Shaderc Authors. All rights reserved. # diff --git a/utils/update_build_version.py b/utils/update_build_version.py index 11ee53e02..7adcefcc8 100755 --- a/utils/update_build_version.py +++ b/utils/update_build_version.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 The Shaderc Authors. All rights reserved. # @@ -72,14 +72,16 @@ def deduce_software_version(directory): """ # Match the first well-formed version-and-date line. + # It must be on the third line, and it must have an ISO date. # Allow trailing whitespace in the checked-out source code has # unexpected carriage returns on a linefeed-only system such as # Linux. pattern = re.compile(r'^(v\d+\.\d+(-dev|[\.-]rc\d+)?) \d\d\d\d-\d\d-\d\d\s*$') changes_file = os.path.join(directory, 'CHANGES') with open(changes_file, errors='replace') as f: - for line in f.readlines(): - match = pattern.match(line) + lines = f.readlines()[2:] + if len(lines) > 0: + match = pattern.match(lines[0]) if match: return match.group(1) raise Exception('No version number found in {}'.format(changes_file))