[vulkan] Merge commit 3ee5f2f1d3316e228916788b300d786bb574d337 as used by v1.2.148 SDK.
Bug: 60761
Change-Id: I3f388de43178ac14d672deb7e5443a3187d35200
diff --git a/BUILD.gn b/BUILD.gn
index 7242b6f..c32a0fa 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -80,6 +80,8 @@
config("glslang_hlsl") {
defines = [ "ENABLE_HLSL=1" ]
+
+ cflags = [ "-Wno-conversion" ]
}
template("glslang_sources_common") {
@@ -227,10 +229,12 @@
"-Wno-inconsistent-missing-override",
"-Wno-sign-compare",
"-Wno-unused-variable",
+ "-Wno-unknown-warning-option",
"-Wno-missing-field-initializers",
"-Wno-newline-eof",
]
}
+
if (is_win && !is_clang) {
cflags = [
"/wd4018", # signed/unsigned mismatch
diff --git a/SPIRV/SPVRemapper.cpp b/SPIRV/SPVRemapper.cpp
index fd0bb89..943b9b6 100644
--- a/SPIRV/SPVRemapper.cpp
+++ b/SPIRV/SPVRemapper.cpp
@@ -827,7 +827,15 @@
[&](spv::Id& id) {
if (thisOpCode != spv::OpNop) {
++idCounter;
- const std::uint32_t hashval = opCounter[thisOpCode] * thisOpCode * 50047 + idCounter + fnId * 117;
+ const std::uint32_t hashval =
+ // Explicitly cast operands to unsigned int to avoid integer
+ // promotion to signed int followed by integer overflow,
+ // which would result in undefined behavior.
+ static_cast<unsigned int>(opCounter[thisOpCode])
+ * thisOpCode
+ * 50047
+ + idCounter
+ + static_cast<unsigned int>(fnId) * 117;
if (isOldIdUnmapped(id))
localId(id, nextUnusedId(hashval % softTypeIdLimit + firstMappedID));
diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt
index 14249bf..552da5e 100644
--- a/glslang/CMakeLists.txt
+++ b/glslang/CMakeLists.txt
@@ -33,7 +33,7 @@
if(WIN32)
add_subdirectory(OSDependent/Windows)
-elseif(UNIX)
+elseif(UNIX OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
add_subdirectory(OSDependent/Unix)
else(WIN32)
message("unknown platform")