Skip to content

Commit 7bcc567

Browse files
authored
Merge pull request #1 from CADIndie/main
Update Shaderc to latest version
2 parents c37af01 + 72381d6 commit 7bcc567

116 files changed

Lines changed: 1272 additions & 1004 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGES

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,92 @@
11
Revision history for Shaderc
22

3-
v2023.8-dev 2023-10-12
3+
v2026.2-dev 2026-01-22
44
- Start development
55

6+
v2026.1 2026-01-23
7+
- Update dependencies:
8+
- Glslang 16.2.0
9+
- SPIRV-Tools v2026.1rc1.
10+
- SPIRV-Headers top of tree
11+
Supports VK_EXT_descriptor_heap and other extensions.
12+
- Require the CHANGES file to have a valid date on its version lines
13+
This avoid the problem of stale version information in the
14+
pkg-config configuration files.
15+
16+
v2025.5 2025-11-27
17+
- Update dependencies
18+
19+
v2025.4 2025-09-25
20+
- Update dependencies
21+
- Add option to set max SPIR-V ID bound.
22+
glslc: -fmax-id-bound
23+
- CMake: Fix some install logic: when glslc is not built,
24+
don't try to install it.
25+
- Remove testing of VS 2019
26+
27+
v2025.3 2025-06-24
28+
- Update dependencies
29+
- CMake updates:
30+
- Actually disable all tests when specified
31+
- Add a way to disable building glslc
32+
33+
v2025.2 2025-04-23
34+
- Update dependencies: Glslang, SPIRV-Tools, SPIRV-Headers
35+
- Supports BFloat16 floating point types
36+
37+
v2025.1 2025-02-27
38+
- Update tools and compilers tested:
39+
- Clang 13
40+
- GCC 13
41+
- VisualStudio 2022
42+
- CMake 3.31.2
43+
- Python 3.12
44+
- NDK r27c
45+
- Skip version numbers to match SPIRV-Tools, to avoid
46+
confusion.
47+
48+
v2024.4 2024-12-06
49+
- Support Vulkan 1.4
50+
51+
v2024.3 2024-09-23
52+
- Update dependencies: Glslang, SPRIV-Tools, SPIRV-Headers
53+
- SPIRV-Tools is at v2024.4.rc1
54+
- This incorporates a SPIRV-Tools fix which was limiting parallelism.
55+
Validator friendly name generation was serializing on a mutex
56+
protecting the locale object.
57+
- During HLSL compilation or any optimizing compile, don't tell the
58+
validator to use "friendly names". This should save time spent in the
59+
initial validation step of the optimization recipe.
60+
- Adapt test golden results to Glslang changes which reorder
61+
decorations by object enum value.
62+
- Fix ndk-build library dependencies: libshaderc_util depends on glslang
63+
- Use Python 3.12 on Linux CI bots
64+
- Fix Python 3.12 warnings for string escapes
65+
66+
v2024.2 2024-06-21
67+
- Update dependencies:
68+
Glslang: top of tree 2024-06-21
69+
SPIRV-Header: top of tree 2024-06-21
70+
SPIRV-Tools: v2024.3.rc1
71+
- Build:
72+
- Remove support for VS2017
73+
74+
v2024.1 2024-04-30
75+
- Update dependencies
76+
- Propagate test/install options to Glslang
77+
78+
v2024.0 2024-03-08
79+
- Update dependencies
80+
- Utilities:
81+
- Use Python3 explicitly in utility scripts
82+
83+
v2023.8 2024-01-03
84+
- API: Expose rlaxed Vulkan rules from glslang
85+
- Update to Glslang 14.0.0
86+
- CMake:
87+
- Comply with CMP0148: Use PythonInterp
88+
- Use TARGET_OBJECTS to simplify creating the shaderc_shared library.
89+
690
v2023.7 2023-10-12
791
- Update dependencies
892
- Finish converting build instructions and flags to always use C++17

CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
cmake_minimum_required(VERSION 3.17.2)
15+
cmake_minimum_required(VERSION 3.22.1)
1616

1717
project(shaderc)
1818
enable_testing()
@@ -51,6 +51,16 @@ else()
5151
message(STATUS "Configuring Shaderc to avoid building examples.")
5252
endif()
5353

54+
option(SHADERC_SKIP_EXECUTABLES "Skip building executables." ${SHADERC_SKIP_EXECUTABLES})
55+
if(NOT ${SHADERC_SKIP_EXECUTABLES})
56+
set(SHADERC_ENABLE_EXECUTABLES ON)
57+
endif()
58+
if (${SHADERC_ENABLE_EXECUTABLES})
59+
message(STATUS "Configuring Shaderc to build executables.")
60+
else()
61+
message(STATUS "Configuring Shaderc to avoid building executables.")
62+
endif()
63+
5464
option(SHADERC_SKIP_COPYRIGHT_CHECK "Skip copyright check" ${SHADERC_SKIP_COPYRIGHT_CHECK})
5565
if(NOT ${SHADERC_SKIP_COPYRIGHT_CHECK})
5666
set(SHADERC_ENABLE_COPYRIGHT_CHECK ON)
@@ -99,14 +109,14 @@ endif ()
99109

100110
if (SHADERC_ENABLE_COPYRIGHT_CHECK)
101111
add_custom_target(check-copyright ALL
102-
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
112+
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
103113
--check
104114
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
105115
COMMENT "Check copyright")
106116
endif()
107117

108118
add_custom_target(add-copyright
109-
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
119+
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py
110120
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
111121
COMMENT "Add copyright")
112122

@@ -134,7 +144,7 @@ if(${SHADERC_ENABLE_EXAMPLES})
134144
endif()
135145

136146
add_custom_target(build-version
137-
${PYTHON_EXECUTABLE}
147+
${Python_EXECUTABLE}
138148
${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
139149
${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc
140150
COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")

DEPS

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ vars = {
55
'google_git': 'https://github.com/google',
66
'khronos_git': 'https://github.com/KhronosGroup',
77

8-
'abseil_revision': '5be22f98733c674d532598454ae729253bc53e82',
9-
'effcee_revision' : '19b4aa87af25cb4ee779a071409732f34bfc305c',
10-
'glslang_revision': '6be56e45e574b375d759b89dad35f780bbd4792f',
11-
'googletest_revision': 'e47544ad31cb3ceecd04cc13e8fe556f8df9fe0b',
12-
're2_revision': 'c9cba76063cf4235c1a15dd14a24a4ef8d623761',
13-
'spirv_headers_revision': '4183b260f4cccae52a89efdfcdd43c4897989f42',
14-
'spirv_tools_revision': '360d469b9eac54d6c6e20f609f9ec35e3a5380ad',
8+
'abseil_revision': '1315c900e1ddbb08a23e06eeb9a06450052ccb5e',
9+
'effcee_revision': '08da24ec245a274fea3a128ba50068f163390565',
10+
'glslang_revision': '09c541ee5b22bbac307987b50d86ec2b4f683d75',
11+
'googletest_revision': '1d17ea141d2c11b8917d2c7d029f1c4e2b9769b2',
12+
're2_revision': '4a8cee3dd3c3d81b6fe8b867811e193d5819df07',
13+
'spirv_headers_revision': '465055f6c9128772e20082e893d974146acf7a02',
14+
'spirv_tools_revision': 'e4bceacf59fdfe742047e94e41ef65a48999a0dd',
1515
}
1616

1717
deps = {

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RUN apk add --update \
2020
build-base \
2121
cmake \
2222
git \
23+
linux-headers \
2324
ninja \
2425
python3 \
2526
py-pip \

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ to provide:
2828

2929
<img alt="Linux" src="kokoro/img/linux.png" width="20px" height="20px" hspace="2px"/>[![Linux Build Status](https://storage.googleapis.com/shaderc/badges/build_status_linux_clang_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_release.html)
3030
<img alt="MacOS" src="kokoro/img/macos.png" width="20px" height="20px" hspace="2px"/>[![MacOS Build Status](https://storage.googleapis.com/shaderc/badges/build_status_macos_clang_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_release.html)
31-
<img alt="Windows" src="kokoro/img/windows.png" width="20px" height="20px" hspace="2px"/>[![Windows Build Status](https://storage.googleapis.com/shaderc/badges/build_status_windows_vs2017_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2017_release.html)
31+
<img alt="Windows" src="kokoro/img/windows.png" width="20px" height="20px" hspace="2px"/>[![Windows Build Status](https://storage.googleapis.com/shaderc/badges/build_status_windows_vs2022_amd64_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2022_release.html)
3232

3333
[More downloads](downloads.md)
3434

@@ -176,7 +176,7 @@ On Linux, if cross compiling to Windows:
176176

177177
On Windows, the following tools should be installed and available on your path:
178178

179-
- Visual Studio 2017 or later. Previous versions of Visual Studio may work but
179+
- Visual Studio 2022 or later. Previous versions of Visual Studio may work but
180180
are untested and unsupported.
181181
- Git - including the associated tools, Bash, `diff`.
182182

downloads.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ Download the latest builds.
77
## Release
88
| Windows | Linux | MacOS |
99
| --- | --- | --- |
10-
| [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) |
11-
| [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) | |
10+
| [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) |
11+
| | [gcc](https://storage.googleapis.com/shaderc/badges/build_link_linux_gcc_release.html) | |
1212

1313
## Debug
1414
| Windows | Linux | MacOS |
1515
| --- | --- | --- |
16-
| [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) |
17-
| [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) | |
16+
| [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) |
17+
| | [gcc](https://storage.googleapis.com/shaderc/badges/build_link_linux_gcc_debug.html) | |

glslc/CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ target_link_libraries(glslc PRIVATE
4848
shaderc_util shaderc # internal Shaderc libraries
4949
${CMAKE_THREAD_LIBS_INIT})
5050

51-
add_executable(glslc_exe src/main.cc)
52-
shaderc_default_compile_options(glslc_exe)
53-
target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include)
54-
set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc)
55-
target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc)
56-
add_dependencies(glslc_exe build-version)
51+
if(SHADERC_ENABLE_EXECUTABLES)
52+
add_executable(glslc_exe src/main.cc)
53+
shaderc_default_compile_options(glslc_exe)
54+
target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include)
55+
set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc)
56+
target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc)
57+
add_dependencies(glslc_exe build-version)
58+
endif(SHADERC_ENABLE_EXECUTABLES)
5759

5860
shaderc_add_tests(
5961
TEST_PREFIX glslc
@@ -66,9 +68,11 @@ shaderc_add_tests(
6668
shaderc_add_asciidoc(glslc_doc_README README)
6769

6870
if(SHADERC_ENABLE_INSTALL)
69-
install(TARGETS glslc_exe
70-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
71-
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
71+
if(SHADERC_ENABLE_EXECUTABLES)
72+
install(TARGETS glslc_exe
73+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
74+
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
75+
endif(SHADERC_ENABLE_EXECUTABLES)
7276
endif(SHADERC_ENABLE_INSTALL)
7377

7478
add_subdirectory(test)

glslc/README.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ the following:
234234
* `vulkan1.0`: create SPIR-V under Vulkan 1.0 semantics.
235235
* `vulkan1.1`: create SPIR-V under Vulkan 1.1 semantics.
236236
* `vulkan1.2`: create SPIR-V under Vulkan 1.2 semantics.
237+
* `vulkan1.3`: create SPIR-V under Vulkan 1.3 semantics.
238+
* `vulkan1.4`: create SPIR-V under Vulkan 1.4 semantics.
237239
* `opengl`: create SPIR-V under OpenGL 4.5 semantics.
238240
* `opengl4.5`: create SPIR-V under OpenGL 4.5 semantics.
239241

glslc/src/main.cc

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ An input file of - represents standard input.
165165
vulkan1.1
166166
vulkan1.2
167167
vulkan1.3
168+
vulkan1.4
168169
vulkan # Same as vulkan1.0
169170
opengl4.5
170171
opengl # Same as opengl4.5
@@ -174,8 +175,9 @@ An input file of - represents standard input.
174175
required to be supported for the target environment.
175176
For example, default for vulkan1.0 is spv1.0, and
176177
the default for vulkan1.1 is spv1.3,
177-
the default for vulkan1.2 is spv1.5.
178-
the default for vulkan1.3 is spv1.6.
178+
the default for vulkan1.2 is spv1.5,
179+
the default for vulkan1.3 is spv1.6,
180+
the default for vulkan1.4 is spv1.6.
179181
Values are:
180182
spv1.0, spv1.1, spv1.2, spv1.3, spv1.4, spv1.5, spv1.6
181183
--version Display compiler version information.
@@ -265,8 +267,9 @@ int main(int argc, char** argv) {
265267

266268
// Sets binding base for the given uniform kind. If stage is
267269
// shader_glsl_infer_from_source then set it for all shader stages.
268-
auto set_binding_base = [&compiler](
269-
shaderc_shader_kind stage, shaderc_uniform_kind kind, uint32_t base) {
270+
auto set_binding_base = [&compiler](shaderc_shader_kind stage,
271+
shaderc_uniform_kind kind,
272+
uint32_t base) {
270273
if (stage == shaderc_glsl_infer_from_source)
271274
compiler.options().SetBindingBase(kind, base);
272275
else
@@ -335,6 +338,15 @@ int main(int argc, char** argv) {
335338
compiler.options().SetNanClamp(true);
336339
} else if (arg.starts_with("-fpreserve-bindings")) {
337340
compiler.options().SetPreserveBindings(true);
341+
} else if (arg.starts_with("-fmax-id-bound=")) {
342+
const string_piece value_str = arg.substr(std::strlen("-fmax-id-bound="));
343+
uint32_t bound = 0;
344+
if (!shaderc_util::ParseUint32(value_str.str(), &bound)) {
345+
std::cerr << "glslc: error: invalid value '" << value_str << "' in '"
346+
<< arg << "'" << std::endl;
347+
return 1;
348+
}
349+
compiler.options().SetMaxIdBound(bound);
338350
} else if (((u_kind = shaderc_uniform_kind_image),
339351
(arg == "-fimage-binding-base")) ||
340352
((u_kind = shaderc_uniform_kind_texture),
@@ -452,6 +464,9 @@ int main(int argc, char** argv) {
452464
} else if (target_env_str == "vulkan1.3") {
453465
target_env = shaderc_target_env_vulkan;
454466
version = shaderc_env_version_vulkan_1_3;
467+
} else if (target_env_str == "vulkan1.4") {
468+
target_env = shaderc_target_env_vulkan;
469+
version = shaderc_env_version_vulkan_1_4;
455470
} else if (target_env_str == "opengl") {
456471
target_env = shaderc_target_env_opengl;
457472
} else if (target_env_str == "opengl4.5") {
@@ -675,9 +690,10 @@ int main(int argc, char** argv) {
675690
// from the file name. If current_fshader_stage is specifed to one of
676691
// the forced shader kinds, use that for the following compilation.
677692
input_files.emplace_back(glslc::InputFileSpec{
678-
arg.str(), (current_fshader_stage == shaderc_glsl_infer_from_source
679-
? glslc::DeduceDefaultShaderKindFromFileName(arg)
680-
: current_fshader_stage),
693+
arg.str(),
694+
(current_fshader_stage == shaderc_glsl_infer_from_source
695+
? glslc::DeduceDefaultShaderKindFromFileName(arg)
696+
: current_fshader_stage),
681697
language, current_entry_point_name});
682698
}
683699
}

glslc/test/CMakeLists.txt

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,23 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
add_test(NAME shaderc_expect_unittests
16-
COMMAND ${PYTHON_EXECUTABLE} -m unittest expect_unittest.py
17-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
18-
add_test(NAME shaderc_glslc_test_framework_unittests
19-
COMMAND ${PYTHON_EXECUTABLE} -m unittest glslc_test_framework_unittest.py
20-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
21-
2215
if(${SHADERC_ENABLE_TESTS})
23-
add_test(NAME glslc_tests
24-
COMMAND ${PYTHON_EXECUTABLE}
25-
${CMAKE_CURRENT_SOURCE_DIR}/glslc_test_framework.py
26-
$<TARGET_FILE:glslc_exe> $<TARGET_FILE:spirv-dis>
27-
--test-dir ${CMAKE_CURRENT_SOURCE_DIR})
16+
17+
add_test(NAME shaderc_expect_unittests
18+
COMMAND ${Python_EXECUTABLE} -m unittest expect_unittest.py
19+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
20+
add_test(NAME shaderc_glslc_test_framework_unittests
21+
COMMAND ${Python_EXECUTABLE} -m unittest glslc_test_framework_unittest.py
22+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
23+
24+
# These tests use the glslc executable, so they can only run if
25+
# glslc has been built.
26+
if(${SHADERC_ENABLE_EXECUTABLES})
27+
add_test(NAME glslc_tests
28+
COMMAND ${Python_EXECUTABLE}
29+
${CMAKE_CURRENT_SOURCE_DIR}/glslc_test_framework.py
30+
$<TARGET_FILE:glslc_exe> $<TARGET_FILE:spirv-dis>
31+
--test-dir ${CMAKE_CURRENT_SOURCE_DIR})
32+
endif()
33+
2834
endif()

0 commit comments

Comments
 (0)