Versioning: Address #1255: Move to semantic versioning.

Still missing is automation and final decisions on mechanisms in general.
This commit is contained in:
John Kessenich 2018-03-05 22:23:17 -07:00
parent 41e24fdb83
commit c6c80a6e48
6 changed files with 38 additions and 19 deletions

View File

@ -6159,7 +6159,9 @@ void OutputSpvHex(const std::vector<unsigned int>& 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// " GLSLANG_REVISION " " GLSLANG_DATE << std::endl;
out << "\t// " <<
glslang::GetSpirvGeneratorVersion() << "." << GLSLANG_MINOR_VERSION << "." << GLSLANG_PATCH_LEVEL <<
std::endl;
if (varName != nullptr) {
out << "\t #pragma once" << std::endl;
out << "const uint32_t " << varName << "[] = {" << std::endl;

View File

@ -99,6 +99,7 @@ enum TOptions {
EOptionOptimizeDisable = (1 << 28),
EOptionOptimizeSize = (1 << 29),
EOptionInvertY = (1 << 30),
EOptionDumpBareVersion = (1 << 31),
};
//
@ -449,6 +450,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
lowerword == "hlsl-iomapper" ||
lowerword == "hlsl-iomapping") {
Options |= EOptionHlslIoMapping;
} else if (lowerword == "invert-y" || // synonyms
lowerword == "iy") {
Options |= EOptionInvertY;
} else if (lowerword == "keep-uncalled" || // synonyms
lowerword == "ku") {
Options |= EOptionKeepUncalled;
@ -520,9 +524,8 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
variableName = argv[1];
bumpArg();
break;
} else if (lowerword == "invert-y" || // synonyms
lowerword == "iy") {
Options |= EOptionInvertY;
} else if (lowerword == "version") {
Options |= EOptionDumpVersions;
} else {
usage();
}
@ -586,7 +589,11 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Options |= EOptionDumpConfig;
break;
case 'd':
Options |= EOptionDefaultDesktop;
if (strncmp(&argv[0][1], "dumpversion", strlen(&argv[0][1]) + 1) == 0 ||
strncmp(&argv[0][1], "dumpfullversion", strlen(&argv[0][1]) + 1) == 0)
Options |= EOptionDumpBareVersion;
else
Options |= EOptionDefaultDesktop;
break;
case 'e':
// HLSL todo: entry point handle needs much more sophistication.
@ -1046,8 +1053,14 @@ int singleMain()
return ESuccess;
}
if (Options & EOptionDumpVersions) {
printf("Glslang Version: %s %s\n", GLSLANG_REVISION, GLSLANG_DATE);
if (Options & EOptionDumpBareVersion) {
printf("%d.%d.%d\n",
glslang::GetSpirvGeneratorVersion(), GLSLANG_MINOR_VERSION, GLSLANG_PATCH_LEVEL);
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("ESSL Version: %s\n", glslang::GetEsslVersionString());
printf("GLSL Version: %s\n", glslang::GetGlslVersionString());
std::string spirvVersion;
@ -1313,12 +1326,15 @@ void usage()
" 'location' (fragile, not cross stage)\n"
" --aml synonym for --auto-map-locations\n"
" --client {vulkan<ver>|opengl<ver>} see -V and -G\n"
" -dumpfullversion print bare major.minor.patchlevel\n"
" -dumpversion same as -dumpfullversion\n"
" --flatten-uniform-arrays flatten uniform texture/sampler arrays to\n"
" scalars\n"
" --fua synonym for --flatten-uniform-arrays\n"
" --hlsl-offsets Allow block offsets to follow HLSL rules\n"
" Works independently of source language\n"
" --hlsl-iomap Perform IO mapping in HLSL register space\n"
" --invert-y | --iy invert position.Y output in vertex shader\n"
" --keep-uncalled don't eliminate uncalled functions\n"
" --ku synonym for --keep-uncalled\n"
" --no-storage-format use Unknown image format\n"
@ -1365,8 +1381,8 @@ void usage()
" --variable-name <name> Creates a C header file that contains a\n"
" uint32_t array named <name>\n"
" initialized with the shader binary code.\n"
" --version synonym for -v\n"
" --vn <name> synonym for --variable-name <name>\n"
" --invert-y | --iy invert position.Y output in vertex shader\n"
);
exit(EFailUsage);

View File

@ -1,6 +1,3 @@
// 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 "Overload400-PrecQual.2000"
#define GLSLANG_DATE "12-Apr-2017"
#define GLSLANG_PATCH_LEVEL 2583

View File

@ -1577,14 +1577,17 @@ namespace glslang {
#include "../Include/revision.h"
#define QUOTE(s) #s
#define STR(n) QUOTE(n)
const char* GetEsslVersionString()
{
return "OpenGL ES GLSL 3.20 glslang Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
return "OpenGL ES GLSL 3.20 glslang Khronos. " STR(GLSLANG_MINOR_VERSION) "." STR(GLSLANG_PATCH_LEVEL);
}
const char* GetGlslVersionString()
{
return "4.60 glslang Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
return "4.60 glslang Khronos. " STR(GLSLANG_MINOR_VERSION) "." STR(GLSLANG_PATCH_LEVEL);
}
int GetKhronosToolId()

View File

@ -67,6 +67,11 @@
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 0
//
// Call before doing any other compiler/linker operations.
//

View File

@ -1,10 +1,6 @@
#!/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`\"
echo \#define GLSLANG_PATCH_LEVEL `git log --oneline | wc -l`
) > glslang/Include/revision.h