From 0da9eaabe8b0a858949e878319113ce1c9419f0d Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 1 Aug 2015 17:10:02 -0600 Subject: [PATCH] Version reporting: Restart active use of revision.h, now based on a git tag. The new make-revision script regenerates glslang/Include/revision.h, used as it always has been, but made with a git-tag version and the the number of commits on master. I have a pre-commit hook that will automatically do this on master, likely often enough to work in practice, without needing pull requests to include it. --- StandAlone/StandAlone.cpp | 6 ++++-- glslang/Include/revision.h | 17 +++++------------ make-revision | 9 +++++++++ 3 files changed, 18 insertions(+), 14 deletions(-) create mode 100755 make-revision diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index b88d8ad..2a740ed 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -39,6 +39,7 @@ #include "Worklist.h" #include "./../glslang/Include/ShHandle.h" +#include "./../glslang/Include/revision.h" #include "./../glslang/Public/ShaderLang.h" #include "../SPIRV/GlslangToSpv.h" #include "../SPIRV/GLSL450Lib.h" @@ -782,12 +783,13 @@ int C_DECL main(int argc, char* argv[]) return ESuccess; } - if (Options & EOptionDumpVersions) { + if (Options & EOptionDumpVersions) { + printf("Glslang Version: %s %s\n", GLSLANG_REVISION, GLSLANG_DATE); printf("ESSL Version: %s\n", glslang::GetEsslVersionString()); printf("GLSL Version: %s\n", glslang::GetGlslVersionString()); std::string spirvVersion; glslang::GetSpirvVersion(spirvVersion); - printf("SPIR-V Version %s\n", spirvVersion.c_str()); // TODO: move to consume source-generated data + printf("SPIR-V Version %s\n", spirvVersion.c_str()); if (Worklist.empty()) return ESuccess; } diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 00836fc..36496ec 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -1,13 +1,6 @@ -// 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. +// This header is generated by the make-revision script. +// For the version, it uses the latest git tag followed by the number of commits. +// For the date, it uses the current date (when then script is run). -#define GLSLANG_REVISION "25512" -#define GLSLANG_DATE "2014/02/24 14:36:08" +#define GLSLANG_REVISION "2.1.686" +#define GLSLANG_DATE "02-Aug-2015" diff --git a/make-revision b/make-revision new file mode 100755 index 0000000..ab5a859 --- /dev/null +++ b/make-revision @@ -0,0 +1,9 @@ +#!/bin/sh + +echo "// This header is generated by the make-revision script." +echo "// For the version, it uses the latest git tag followed by the number of commits." +echo "// For the date, it uses the current date (when then script is run)." + +echo +echo \#define GLSLANG_REVISION \"`git describe --tags --abbrev=0`.`git log --oneline | wc -l`\" +echo \#define GLSLANG_DATE \"`date +%d-%b-%Y`\" -- 2.7.4