From 9215cc8199e89bd748f72cdead7271335003b8ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 10 Jul 2020 17:17:00 -0700 Subject: [PATCH] Updated glslang. --- 3rdparty/glslang/CHANGES.md | 24 ++ 3rdparty/glslang/SPIRV/CMakeLists.txt | 10 +- 3rdparty/glslang/SPIRV/GlslangToSpv.cpp | 11 +- 3rdparty/glslang/StandAlone/StandAlone.cpp | 20 +- .../{glslang/HLSL/pch.cpp => build_info.h} | 35 ++- .../pch.cpp => build_info.h.tmpl} | 35 ++- 3rdparty/glslang/build_info.py | 223 ++++++++++++++++++ 3rdparty/glslang/glslang/CMakeLists.txt | 21 +- 3rdparty/glslang/glslang/Include/revision.h | 3 - .../glslang/glslang/Include/revision.template | 13 - .../glslang/MachineIndependent/ShaderLang.cpp | 19 +- 3rdparty/glslang/glslang/Public/ShaderLang.h | 13 +- scripts/shaderc.lua | 1 + 13 files changed, 378 insertions(+), 50 deletions(-) create mode 100644 3rdparty/glslang/CHANGES.md rename 3rdparty/glslang/{glslang/HLSL/pch.cpp => build_info.h} (51%) rename 3rdparty/glslang/{glslang/MachineIndependent/pch.cpp => build_info.h.tmpl} (51%) create mode 100644 3rdparty/glslang/build_info.py delete mode 100644 3rdparty/glslang/glslang/Include/revision.h delete mode 100644 3rdparty/glslang/glslang/Include/revision.template diff --git a/3rdparty/glslang/CHANGES.md b/3rdparty/glslang/CHANGES.md new file mode 100644 index 000000000..1a7cbf5ab --- /dev/null +++ b/3rdparty/glslang/CHANGES.md @@ -0,0 +1,24 @@ +# Revision history for `glslang` + +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](https://semver.org/). + +## 10.15.3847-dev 2020-06-16 + +### Breaking changes + +* The following files have been removed: + * `glslang/include/revision.h` + * `glslang/include/revision.template` + +The `GLSLANG_MINOR_VERSION` and `GLSLANG_PATCH_LEVEL` defines have been removed +from the public headers. \ +Instead each build script now uses the new `build_info.py` +script along with the `build_info.h.tmpl` and this `CHANGES.md` file to generate +the glslang build-time generated header `glslang/build_info.h`. + +The new public API to obtain the `glslang` version is `glslang::GetVersion()`. + +### Other changes +* `glslang` shared objects produced by CMake are now `SONAME` versioned using + [Semantic Versioning 2.0.0](https://semver.org/). diff --git a/3rdparty/glslang/SPIRV/CMakeLists.txt b/3rdparty/glslang/SPIRV/CMakeLists.txt index 0f26bcca2..d699daddb 100644 --- a/3rdparty/glslang/SPIRV/CMakeLists.txt +++ b/3rdparty/glslang/SPIRV/CMakeLists.txt @@ -72,8 +72,10 @@ add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS}) set_property(TARGET SPIRV PROPERTY FOLDER glslang) set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON) target_include_directories(SPIRV PUBLIC - $ - $) + $ + $) + +glslang_add_build_info_dependency(SPIRV) if (ENABLE_SPVREMAPPER) add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) @@ -95,8 +97,8 @@ if(ENABLE_OPT) ) target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt) target_include_directories(SPIRV PUBLIC - $ - $) + $ + $) else() target_link_libraries(SPIRV PRIVATE MachineIndependent) endif(ENABLE_OPT) diff --git a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp index 96a24af8e..18d64f9ce 100644 --- a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -56,7 +56,9 @@ namespace spv { #include "../glslang/MachineIndependent/localintermediate.h" #include "../glslang/MachineIndependent/SymbolTable.h" #include "../glslang/Include/Common.h" -#include "../glslang/Include/revision.h" + +// Build-time generated includes +#include "glslang/build_info.h" #include #include @@ -8689,9 +8691,10 @@ void OutputSpvHex(const std::vector& spirv, const char* baseName, out.open(baseName, std::ios::binary | std::ios::out); if (out.fail()) printf("ERROR: Failed to open file: %s\n", baseName); - out << "\t// " << - GetSpirvGeneratorVersion() << "." << GLSLANG_MINOR_VERSION << "." << GLSLANG_PATCH_LEVEL << - std::endl; + out << "\t// " << + GetSpirvGeneratorVersion() << + GLSLANG_VERSION_MAJOR << "." << GLSLANG_VERSION_MINOR << "." << GLSLANG_VERSION_PATCH << + GLSLANG_VERSION_FLAVOR << std::endl; if (varName != nullptr) { out << "\t #pragma once" << std::endl; out << "const uint32_t " << varName << "[] = {" << std::endl; diff --git a/3rdparty/glslang/StandAlone/StandAlone.cpp b/3rdparty/glslang/StandAlone/StandAlone.cpp index 662b68d19..883681274 100644 --- a/3rdparty/glslang/StandAlone/StandAlone.cpp +++ b/3rdparty/glslang/StandAlone/StandAlone.cpp @@ -44,7 +44,6 @@ #include "Worklist.h" #include "DirStackFileIncluder.h" #include "./../glslang/Include/ShHandle.h" -#include "./../glslang/Include/revision.h" #include "./../glslang/Public/ShaderLang.h" #include "../SPIRV/GlslangToSpv.h" #include "../SPIRV/GLSL.std.450.h" @@ -62,6 +61,9 @@ #include "../glslang/OSDependent/osinclude.h" +// Build-time generated includes +#include "glslang/build_info.h" + extern "C" { GLSLANG_EXPORT void ShOutputHtml(); } @@ -107,6 +109,7 @@ bool SpvToolsDisassembler = false; bool SpvToolsValidate = false; bool NaNClamp = false; bool stripDebugInfo = false; +bool beQuiet = false; // // Return codes from main/exit(). @@ -661,6 +664,8 @@ void ProcessArguments(std::vector>& workItem variableName = argv[1]; bumpArg(); break; + } else if (lowerword == "quiet") { + beQuiet = true; } else if (lowerword == "version") { Options |= EOptionDumpVersions; } else if (lowerword == "help") { @@ -1108,7 +1113,8 @@ void CompileAndLinkShaderUnits(std::vector compUnits) if (! (Options & EOptionSuppressInfolog) && ! (Options & EOptionMemoryLeakMode)) { - PutsIfNonEmpty(compUnit.fileName[0].c_str()); + if (!beQuiet) + PutsIfNonEmpty(compUnit.fileName[0].c_str()); PutsIfNonEmpty(shader->getInfoLog()); PutsIfNonEmpty(shader->getInfoDebugLog()); } @@ -1274,13 +1280,13 @@ int singleMain() #endif if (Options & EOptionDumpBareVersion) { - printf("%d.%d.%d\n", - glslang::GetSpirvGeneratorVersion(), GLSLANG_MINOR_VERSION, GLSLANG_PATCH_LEVEL); + printf("%d:%d.%d.%d%s\n", glslang::GetSpirvGeneratorVersion(), GLSLANG_VERSION_MAJOR, GLSLANG_VERSION_MINOR, + GLSLANG_VERSION_PATCH, GLSLANG_VERSION_FLAVOR); if (workList.empty()) return ESuccess; } else if (Options & EOptionDumpVersions) { - printf("Glslang Version: %d.%d.%d\n", - glslang::GetSpirvGeneratorVersion(), GLSLANG_MINOR_VERSION, GLSLANG_PATCH_LEVEL); + printf("Glslang Version: %d:%d.%d.%d%s\n", glslang::GetSpirvGeneratorVersion(), GLSLANG_VERSION_MAJOR, + GLSLANG_VERSION_MINOR, GLSLANG_VERSION_PATCH, GLSLANG_VERSION_FLAVOR); printf("ESSL Version: %s\n", glslang::GetEsslVersionString()); printf("GLSL Version: %s\n", glslang::GetGlslVersionString()); std::string spirvVersion; @@ -1615,6 +1621,8 @@ void usage() " --keep-uncalled | --ku don't eliminate uncalled functions\n" " --nan-clamp favor non-NaN operand in min, max, and clamp\n" " --no-storage-format | --nsf use Unknown image format\n" + " --quiet do not print anything to stdout, unless\n" + " requested by another option\n" " --reflect-strict-array-suffix use strict array suffix rules when\n" " reflecting\n" " --reflect-basic-array-suffix arrays of basic types will have trailing [0]\n" diff --git a/3rdparty/glslang/glslang/HLSL/pch.cpp b/3rdparty/glslang/build_info.h similarity index 51% rename from 3rdparty/glslang/glslang/HLSL/pch.cpp rename to 3rdparty/glslang/build_info.h index b7a08654a..eef6f7d07 100644 --- a/3rdparty/glslang/glslang/HLSL/pch.cpp +++ b/3rdparty/glslang/build_info.h @@ -1,5 +1,5 @@ +// Copyright (C) 2020 The Khronos Group Inc. // -// Copyright (C) 2018 The Khronos Group Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ // disclaimer in the documentation and/or other materials provided // with the distribution. // -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// Neither the name of The Khronos Group Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // @@ -30,6 +30,33 @@ // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -// -#include "pch.h" +#ifndef GLSLANG_BUILD_INFO +#define GLSLANG_BUILD_INFO + +#define GLSLANG_VERSION_MAJOR 10 +#define GLSLANG_VERSION_MINOR 15 +#define GLSLANG_VERSION_PATCH 3847 +#define GLSLANG_VERSION_FLAVOR "dev" + +#define GLSLANG_VERSION_GREATER_THAN(major, minor, patch) \ + (((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ + (((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ + ((patch) > GLSLANG_VERSION_PATCH))))) + +#define GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch) \ + (((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ + (((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ + ((patch) >= GLSLANG_VERSION_PATCH))))) + +#define GLSLANG_VERSION_LESS_THAN(major, minor, patch) \ + (((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ + (((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ + ((patch) < GLSLANG_VERSION_PATCH))))) + +#define GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch) \ + (((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ + (((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ + ((patch) <= GLSLANG_VERSION_PATCH))))) + +#endif // GLSLANG_BUILD_INFO diff --git a/3rdparty/glslang/glslang/MachineIndependent/pch.cpp b/3rdparty/glslang/build_info.h.tmpl similarity index 51% rename from 3rdparty/glslang/glslang/MachineIndependent/pch.cpp rename to 3rdparty/glslang/build_info.h.tmpl index b7a08654a..eacecb09a 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/pch.cpp +++ b/3rdparty/glslang/build_info.h.tmpl @@ -1,5 +1,5 @@ +// Copyright (C) 2020 The Khronos Group Inc. // -// Copyright (C) 2018 The Khronos Group Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ // disclaimer in the documentation and/or other materials provided // with the distribution. // -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// Neither the name of The Khronos Group Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // @@ -30,6 +30,33 @@ // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -// -#include "pch.h" +#ifndef GLSLANG_BUILD_INFO +#define GLSLANG_BUILD_INFO + +#define GLSLANG_VERSION_MAJOR +#define GLSLANG_VERSION_MINOR +#define GLSLANG_VERSION_PATCH +#define GLSLANG_VERSION_FLAVOR "" + +#define GLSLANG_VERSION_GREATER_THAN(major, minor, patch) \ + (((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ + (((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ + ((patch) > GLSLANG_VERSION_PATCH))))) + +#define GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch) \ + (((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ + (((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ + ((patch) >= GLSLANG_VERSION_PATCH))))) + +#define GLSLANG_VERSION_LESS_THAN(major, minor, patch) \ + (((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ + (((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ + ((patch) < GLSLANG_VERSION_PATCH))))) + +#define GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch) \ + (((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \ + (((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \ + ((patch) <= GLSLANG_VERSION_PATCH))))) + +#endif // GLSLANG_BUILD_INFO diff --git a/3rdparty/glslang/build_info.py b/3rdparty/glslang/build_info.py new file mode 100644 index 000000000..b8d39fd8c --- /dev/null +++ b/3rdparty/glslang/build_info.py @@ -0,0 +1,223 @@ +#!/usr/bin/env python + +# Copyright (c) 2020 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. + +import datetime +import errno +import os +import os.path +import re +import subprocess +import sys +import time + +usage = """{} emits a string to stdout or file with project version information. + +args: [] [-i ] [-o ] + +Either or -i needs to be provided. + +The tool will output the provided string or file content with the following +tokens substituted: + + - The major version point parsed from the CHANGES.md file. + - The minor version point parsed from the CHANGES.md file. + - The point version point parsed from the CHANGES.md file. + - The optional dash suffix parsed from the CHANGES.md file (excluding + dash prefix). + <-flavor> - The optional dash suffix parsed from the CHANGES.md file (including + dash prefix). + - The optional date of the release in the form YYYY-MM-DD + - The git commit information for the directory taken from + "git describe" if that succeeds, or "git rev-parse HEAD" + if that succeeds, or otherwise a message containing the phrase + "unknown hash". + +-o is an optional flag for writing the output string to the given file. If + ommitted then the string is printed to stdout. +""" + +def mkdir_p(directory): + """Make the directory, and all its ancestors as required. Any of the + directories are allowed to already exist.""" + + if directory == "": + # We're being asked to make the current directory. + return + + try: + os.makedirs(directory) + except OSError as e: + if e.errno == errno.EEXIST and os.path.isdir(directory): + pass + else: + raise + + +def command_output(cmd, directory): + """Runs a command in a directory and returns its standard output stream. + + Captures the standard error stream. + + Raises a RuntimeError if the command fails to launch or otherwise fails. + """ + p = subprocess.Popen(cmd, + cwd=directory, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + (stdout, _) = p.communicate() + if p.returncode != 0: + raise RuntimeError('Failed to run %s in %s' % (cmd, directory)) + return stdout + + +def deduce_software_version(directory): + """Returns a software version number parsed from the CHANGES.md file + in the given directory. + + The CHANGES.md file describes most recent versions first. + """ + + # Match the first well-formed version-and-date line. + # 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'^#* +(\d+)\.(\d+)\.(\d+)(-\w+)? (\d\d\d\d-\d\d-\d\d)? *$') + changes_file = os.path.join(directory, 'CHANGES.md') + with open(changes_file, mode='r') as f: + for line in f.readlines(): + match = pattern.match(line) + if match: + return { + "major": match.group(1), + "minor": match.group(2), + "patch": match.group(3), + "flavor": match.group(4).lstrip("-"), + "-flavor": match.group(4), + "date": match.group(5), + } + raise Exception('No version number found in {}'.format(changes_file)) + + +def describe(directory): + """Returns a string describing the current Git HEAD version as descriptively + as possible. + + Runs 'git describe', or alternately 'git rev-parse HEAD', in directory. If + successful, returns the output; otherwise returns 'unknown hash, '.""" + try: + # decode() is needed here for Python3 compatibility. In Python2, + # str and bytes are the same type, but not in Python3. + # Popen.communicate() returns a bytes instance, which needs to be + # decoded into text data first in Python3. And this decode() won't + # hurt Python2. + return command_output(['git', 'describe'], directory).rstrip().decode() + except: + try: + return command_output( + ['git', 'rev-parse', 'HEAD'], directory).rstrip().decode() + except: + # This is the fallback case where git gives us no information, + # e.g. because the source tree might not be in a git tree. + # In this case, usually use a timestamp. However, to ensure + # reproducible builds, allow the builder to override the wall + # clock time with environment variable SOURCE_DATE_EPOCH + # containing a (presumably) fixed timestamp. + timestamp = int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) + formatted = datetime.datetime.utcfromtimestamp(timestamp).isoformat() + return 'unknown hash, {}'.format(formatted) + +def parse_args(): + directory = None + input_string = None + input_file = None + output_file = None + + if len(sys.argv) < 2: + raise Exception("Invalid number of arguments") + + directory = sys.argv[1] + i = 2 + + if not sys.argv[i].startswith("-"): + input_string = sys.argv[i] + i = i + 1 + + while i < len(sys.argv): + opt = sys.argv[i] + i = i + 1 + + if opt == "-i" or opt == "-o": + if i == len(sys.argv): + raise Exception("Expected path after {}".format(opt)) + val = sys.argv[i] + i = i + 1 + if (opt == "-i"): + input_file = val + elif (opt == "-o"): + output_file = val + else: + raise Exception("Unknown flag {}".format(opt)) + + return { + "directory": directory, + "input_string": input_string, + "input_file": input_file, + "output_file": output_file, + } + +def main(): + args = None + try: + args = parse_args() + except Exception as e: + print(e) + print("\nUsage:\n") + print(usage.format(sys.argv[0])) + sys.exit(1) + + directory = args["directory"] + template = args["input_string"] + if template == None: + with open(args["input_file"], 'r') as f: + template = f.read() + output_file = args["output_file"] + + software_version = deduce_software_version(directory) + commit = describe(directory) + output = template \ + .replace("", software_version["major"]) \ + .replace("", software_version["minor"]) \ + .replace("", software_version["patch"]) \ + .replace("", software_version["flavor"]) \ + .replace("<-flavor>", software_version["-flavor"]) \ + .replace("", software_version["date"]) \ + .replace("", commit) + + if output_file is None: + print(output) + else: + mkdir_p(os.path.dirname(output_file)) + + if os.path.isfile(output_file): + with open(output_file, 'r') as f: + if output == f.read(): + return + + with open(output_file, 'w') as f: + f.write(output) + +if __name__ == '__main__': + main() diff --git a/3rdparty/glslang/glslang/CMakeLists.txt b/3rdparty/glslang/glslang/CMakeLists.txt index 98c814575..1c7d22a2a 100644 --- a/3rdparty/glslang/glslang/CMakeLists.txt +++ b/3rdparty/glslang/glslang/CMakeLists.txt @@ -50,6 +50,8 @@ endif(EMSCRIPTEN OR ENABLE_GLSLANG_JS) add_library(GenericCodeGen STATIC GenericCodeGen/CodeGen.cpp GenericCodeGen/Link.cpp) +set_property(TARGET GenericCodeGen PROPERTY POSITION_INDEPENDENT_CODE ON) +set_property(TARGET GenericCodeGen PROPERTY FOLDER glslang) ################################################################################ # MachineIndependent @@ -129,8 +131,12 @@ if(ENABLE_HLSL) endif(ENABLE_HLSL) add_library(MachineIndependent STATIC ${MACHINEINDEPENDENT_SOURCES} ${MACHINEINDEPENDENT_HEADERS}) +set_property(TARGET MachineIndependent PROPERTY POSITION_INDEPENDENT_CODE ON) +set_property(TARGET MachineIndependent PROPERTY FOLDER glslang) -glslang_pch(SOURCES MachineIndependent/pch.cpp) +glslang_add_build_info_dependency(MachineIndependent) + +glslang_pch(MachineIndependent MachineIndependent/pch.h) target_link_libraries(MachineIndependent PRIVATE OGLCompiler OSDependent GenericCodeGen) @@ -153,18 +159,22 @@ set(GLSLANG_HEADERS Include/intermediate.h Include/PoolAlloc.h Include/ResourceLimits.h - Include/revision.h Include/ShHandle.h Include/Types.h) add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${GLSLANG_SOURCES} ${GLSLANG_HEADERS}) -set_property(TARGET glslang PROPERTY FOLDER glslang) -set_property(TARGET glslang PROPERTY POSITION_INDEPENDENT_CODE ON) +set_target_properties(glslang PROPERTIES + FOLDER glslang + POSITION_INDEPENDENT_CODE ON + VERSION "${GLSLANG_VERSION}" + SOVERSION "${GLSLANG_VERSION_MAJOR}") target_link_libraries(glslang PRIVATE OGLCompiler OSDependent MachineIndependent) target_include_directories(glslang PUBLIC $ $) +glslang_add_build_info_dependency(glslang) + glslang_only_export_explicit_symbols(glslang) if(WIN32 AND BUILD_SHARED_LIBS) @@ -210,4 +220,7 @@ if(ENABLE_GLSLANG_INSTALL) get_filename_component(dir ${file} DIRECTORY) install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/${dir}) endforeach() + + install(FILES ${GLSLANG_BUILD_INFO_H} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang) + endif(ENABLE_GLSLANG_INSTALL) diff --git a/3rdparty/glslang/glslang/Include/revision.h b/3rdparty/glslang/glslang/Include/revision.h deleted file mode 100644 index 2012f12f4..000000000 --- a/3rdparty/glslang/glslang/Include/revision.h +++ /dev/null @@ -1,3 +0,0 @@ -// This header is generated by the make-revision script. - -#define GLSLANG_PATCH_LEVEL 3847 diff --git a/3rdparty/glslang/glslang/Include/revision.template b/3rdparty/glslang/glslang/Include/revision.template deleted file mode 100644 index 4a16beeb0..000000000 --- a/3rdparty/glslang/glslang/Include/revision.template +++ /dev/null @@ -1,13 +0,0 @@ -// The file revision.h should be updated to the latest version, somehow, on -// check-in, if glslang has changed. -// -// revision.template is the source for revision.h when using SubWCRev as the -// method of updating revision.h. You don't have to do it this way, the -// requirement is only that revision.h gets updated. -// -// revision.h is under source control so that not all consumers of glslang -// source have to figure out how to create revision.h just to get a build -// going. However, if it is not updated, it can be a version behind. - -#define GLSLANG_REVISION "$WCREV$" -#define GLSLANG_DATE "$WCDATE$" diff --git a/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp b/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp index 476d17984..9c8610c92 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -72,6 +72,9 @@ // token to print ", but none of that seems appropriate for this file. #include "preprocessor/PpTokens.h" +// Build-time generated includes +#include "glslang/build_info.h" + namespace { // anonymous namespace for file-local functions and symbols // Total number of successful initializers of glslang: a refcount @@ -1684,19 +1687,29 @@ int ShGetUniformLocation(const ShHandle handle, const char* name) namespace glslang { -#include "../Include/revision.h" +Version GetVersion() +{ + Version version; + version.major = GLSLANG_VERSION_MAJOR; + version.minor = GLSLANG_VERSION_MINOR; + version.patch = GLSLANG_VERSION_PATCH; + version.flavor = GLSLANG_VERSION_FLAVOR; + return version; +} #define QUOTE(s) #s #define STR(n) QUOTE(n) const char* GetEsslVersionString() { - return "OpenGL ES GLSL 3.20 glslang Khronos. " STR(GLSLANG_MINOR_VERSION) "." STR(GLSLANG_PATCH_LEVEL); + return "OpenGL ES GLSL 3.20 glslang Khronos. " STR(GLSLANG_VERSION_MAJOR) "." STR(GLSLANG_VERSION_MINOR) "." STR( + GLSLANG_VERSION_PATCH) GLSLANG_VERSION_FLAVOR; } const char* GetGlslVersionString() { - return "4.60 glslang Khronos. " STR(GLSLANG_MINOR_VERSION) "." STR(GLSLANG_PATCH_LEVEL); + return "4.60 glslang Khronos. " STR(GLSLANG_VERSION_MAJOR) "." STR(GLSLANG_VERSION_MINOR) "." STR( + GLSLANG_VERSION_PATCH) GLSLANG_VERSION_FLAVOR; } int GetKhronosToolId() diff --git a/3rdparty/glslang/glslang/Public/ShaderLang.h b/3rdparty/glslang/glslang/Public/ShaderLang.h index 4322e18e9..e3909f637 100644 --- a/3rdparty/glslang/glslang/Public/ShaderLang.h +++ b/3rdparty/glslang/glslang/Public/ShaderLang.h @@ -74,11 +74,6 @@ extern "C" { #endif -// This should always increase, as some paths to do not consume -// a more major number. -// It should increment by one when new functionality is added. -#define GLSLANG_MINOR_VERSION 15 - // // Call before doing any other compiler/linker operations. // @@ -399,6 +394,14 @@ class TInfoSink; namespace glslang { +struct Version { + int major; + int minor; + int patch; + const char* flavor; +}; + +GLSLANG_EXPORT Version GetVersion(); GLSLANG_EXPORT const char* GetEsslVersionString(); GLSLANG_EXPORT const char* GetGlslVersionString(); GLSLANG_EXPORT int GetKhronosToolId(); diff --git a/scripts/shaderc.lua b/scripts/shaderc.lua index 3005c81b1..30ac3d4e3 100644 --- a/scripts/shaderc.lua +++ b/scripts/shaderc.lua @@ -214,6 +214,7 @@ project "glslang" includedirs { GLSLANG, + path.join(GLSLANG, ".."), path.join(SPIRV_TOOLS, "include"), path.join(SPIRV_TOOLS, "source"), }