Add a versioning system and tie it to the -v command-line option. System is described in glslang/Include/revision.template.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24314 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-12-04 04:43:40 +00:00
parent 44222f90af
commit 319de233dc
5 changed files with 65 additions and 18 deletions

View File

@ -63,6 +63,7 @@ enum TOptions {
EOptionDumpConfig = 0x080, EOptionDumpConfig = 0x080,
EOptionDumpReflection = 0x100, EOptionDumpReflection = 0x100,
EOptionSuppressWarnings = 0x200, EOptionSuppressWarnings = 0x200,
EOptionDumpVersions = 0x400,
}; };
// //
@ -486,6 +487,9 @@ bool ProcessArguments(int argc, char* argv[])
Options |= EOptionMultiThreaded; Options |= EOptionMultiThreaded;
#endif #endif
break; break;
case 'v':
Options |= EOptionDumpVersions;
break;
case 'w': case 'w':
Options |= EOptionSuppressWarnings; Options |= EOptionSuppressWarnings;
break; break;
@ -552,9 +556,6 @@ void CompileAndLinkShaders()
// keep track of what to free // keep track of what to free
std::list<glslang::TShader*> shaders; std::list<glslang::TShader*> shaders;
//printf("%s\n", glslang::GetEsslVersionString());
//printf("%s\n", glslang::GetGlslVersionString());
EShMessages messages = EShMsgDefault; EShMessages messages = EShMsgDefault;
SetMessageOptions(messages); SetMessageOptions(messages);
@ -632,6 +633,13 @@ int C_DECL main(int argc, char* argv[])
return ESuccess; return ESuccess;
} }
if (Options & EOptionDumpVersions) {
printf("ESSL Version: %s\n", glslang::GetEsslVersionString());
printf("GLSL Version: %s\n", glslang::GetGlslVersionString());
if (Worklist.empty())
return ESuccess;
}
if (Worklist.empty()) { if (Worklist.empty()) {
usage(); usage();
return EFailUsage; return EFailUsage;
@ -783,27 +791,32 @@ void CompileFile(const char *fileName, ShHandle compiler)
// //
void usage() void usage()
{ {
printf("Usage: glslangValidator [ options ] filename\n" printf("Usage: glslangValidator [option]... [file]...\n"
"Where: filename is a name ending in\n" "\n"
" .conf provides an optional config file that replaces the default configuration\n" "Where: each 'file' ends in\n"
" .conf to provide an optional config file that replaces the default configuration\n"
" (see -c option below for generating a template)\n" " (see -c option below for generating a template)\n"
" .vert for a vertex shader\n" " .vert for a vertex shader\n"
" .tesc for a tessellation control shader\n" " .tesc for a tessellation control shader\n"
" .tese for a tessellation evaluation shader\n" " .tese for a tessellation evaluation shader\n"
" .geom for a geometry shader\n" " .geom for a geometry shader\n"
" .frag for a fragment shader\n" " .frag for a fragment shader\n"
" .comp for a compute shader\n\n" " .comp for a compute shader\n"
"\n"
"Compilation warnings and errors will be printed to stdout.\n" "Compilation warnings and errors will be printed to stdout.\n"
"\n"
"To get other information, use one of the following options:\n" "To get other information, use one of the following options:\n"
"-c: configuration dump; use to create default configuration file (redirect to a .conf file)\n" "(Each option must be specified separately, but can go anywhere in the command line.)\n"
"-i: intermediate tree (glslang AST) is printed out\n" " -c configuration dump; use to create default configuration file (redirect to a .conf file)\n"
"-l: link validation of all input files\n" " -i intermediate tree (glslang AST) is printed out\n"
"-m: memory leak mode\n" " -l link validation of all input files\n"
"-q: dump reflection query database\n" " -m memory leak mode\n"
"-r: relaxed semantic error-checking mode\n" " -q dump reflection query database\n"
"-s: silent mode\n" " -r relaxed semantic error-checking mode\n"
"-t: multi-threaded mode\n" " -s silent mode\n"
"-w: suppress warnings (except as required by #extension : warn)\n" " -t multi-threaded mode\n"
" -v print version strings\n"
" -w suppress warnings (except as required by #extension : warn)\n"
); );
} }

View File

@ -94,6 +94,9 @@ xcopy /y $(IntDir)$(TargetName)$(TargetExt) Test</Command>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0809</Culture> <Culture>0x0809</Culture>
</ResourceCompile> </ResourceCompile>
<PreBuildEvent>
<Command>SubWCRev . glslang/Include/revision.template glslang/Include/revision.h -q</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
@ -147,6 +150,9 @@ xcopy /y $(IntDir)$(TargetName)$(TargetExt) Test</Command>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0809</Culture> <Culture>0x0809</Culture>
</ResourceCompile> </ResourceCompile>
<PreBuildEvent>
<Command>SubWCRev . glslang/Include/revision.template glslang/Include/revision.h -q</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="glslang\MachineIndependent\Constant.cpp" /> <ClCompile Include="glslang\MachineIndependent\Constant.cpp" />

View File

@ -0,0 +1,13 @@
// 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 "24303"
#define GLSLANG_DATE "2013/12/03 14:05:07"

View File

@ -0,0 +1,13 @@
// 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$"

View File

@ -912,14 +912,16 @@ int ShGetUniformLocation(const ShHandle handle, const char* name)
namespace glslang { namespace glslang {
#include "../Include/revision.h"
const char* GetEsslVersionString() const char* GetEsslVersionString()
{ {
return "OpenGL ES GLSL 3.00 glslang"; return "OpenGL ES GLSL 3.00 glslang LunarG Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
} }
const char* GetGlslVersionString() const char* GetGlslVersionString()
{ {
return "4.20 glslang"; return "4.20 glslang LunarG Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
} }
bool InitializeProcess() bool InitializeProcess()