Add a versioning system and tie it to the -v command-line option. System is describe...
authorJohn Kessenich <cepheus@frii.com>
Wed, 4 Dec 2013 04:43:40 +0000 (04:43 +0000)
committerJohn Kessenich <cepheus@frii.com>
Wed, 4 Dec 2013 04:43:40 +0000 (04:43 +0000)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24314 e7fa87d3-cd2b-0410-9028-fcbf551c1848

StandAlone/StandAlone.cpp
glslang.vcxproj
glslang/Include/revision.h [new file with mode: 0644]
glslang/Include/revision.template [new file with mode: 0644]
glslang/MachineIndependent/ShaderLang.cpp

index 8e240c6..ba910f8 100644 (file)
@@ -63,6 +63,7 @@ enum TOptions {
     EOptionDumpConfig         = 0x080,
     EOptionDumpReflection     = 0x100,
     EOptionSuppressWarnings   = 0x200,
+    EOptionDumpVersions       = 0x400,
 };
 
 //
@@ -486,6 +487,9 @@ bool ProcessArguments(int argc, char* argv[])
                     Options |= EOptionMultiThreaded;
                 #endif
                 break;
+            case 'v':
+                Options |= EOptionDumpVersions;
+                break;
             case 'w':
                 Options |= EOptionSuppressWarnings;
                 break;
@@ -552,9 +556,6 @@ void CompileAndLinkShaders()
     // keep track of what to free
     std::list<glslang::TShader*> shaders;
     
-    //printf("%s\n", glslang::GetEsslVersionString());
-    //printf("%s\n", glslang::GetGlslVersionString());
-
     EShMessages messages = EShMsgDefault;
     SetMessageOptions(messages);
 
@@ -632,6 +633,13 @@ int C_DECL main(int argc, char* argv[])
             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()) {
         usage();
         return EFailUsage;
@@ -783,27 +791,32 @@ void CompileFile(const char *fileName, ShHandle compiler)
 //
 void usage()
 {
-    printf("Usage: glslangValidator [ options ] filename\n"
-           "Where: filename is a name ending in\n"
-           "    .conf provides an optional config file that replaces the default configuration\n"
+    printf("Usage: glslangValidator [option]... [file]...\n"
+           "\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"
            "    .vert for a vertex shader\n"
            "    .tesc for a tessellation control shader\n"
            "    .tese for a tessellation evaluation shader\n"
            "    .geom for a geometry 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"
+           "\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"
-           "-i: intermediate tree (glslang AST) is printed out\n"
-           "-l: link validation of all input files\n"
-           "-m: memory leak mode\n"
-           "-q: dump reflection query database\n"
-           "-r: relaxed semantic error-checking mode\n"
-           "-s: silent mode\n"
-           "-t: multi-threaded mode\n"
-           "-w: suppress warnings (except as required by #extension : warn)\n"
+           "(Each option must be specified separately, but can go anywhere in the command line.)\n"
+           "  -c  configuration dump; use to create default configuration file (redirect to a .conf file)\n"
+           "  -i  intermediate tree (glslang AST) is printed out\n"
+           "  -l  link validation of all input files\n"
+           "  -m  memory leak mode\n"
+           "  -q  dump reflection query database\n"
+           "  -r  relaxed semantic error-checking mode\n"
+           "  -s  silent mode\n"
+           "  -t  multi-threaded mode\n"
+           "  -v  print version strings\n"
+           "  -w  suppress warnings (except as required by #extension : warn)\n"
            );
 }
 
index 7685882..dc7b773 100644 (file)
@@ -94,6 +94,9 @@ xcopy /y $(IntDir)$(TargetName)$(TargetExt) Test</Command>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <Culture>0x0809</Culture>\r
     </ResourceCompile>\r
+    <PreBuildEvent>\r
+      <Command>SubWCRev . glslang/Include/revision.template glslang/Include/revision.h -q</Command>\r
+    </PreBuildEvent>\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
     <ClCompile>\r
@@ -147,6 +150,9 @@ xcopy /y $(IntDir)$(TargetName)$(TargetExt) Test</Command>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <Culture>0x0809</Culture>\r
     </ResourceCompile>\r
+    <PreBuildEvent>\r
+      <Command>SubWCRev . glslang/Include/revision.template glslang/Include/revision.h -q</Command>\r
+    </PreBuildEvent>\r
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
     <ClCompile Include="glslang\MachineIndependent\Constant.cpp" />\r
diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h
new file mode 100644 (file)
index 0000000..e18be76
--- /dev/null
@@ -0,0 +1,13 @@
+// The file revision.h should be updated to the latest version, somehow, on \r
+// check-in, if glslang has changed.\r
+//\r
+// revision.template is the source for revision.h when using SubWCRev as the\r
+// method of updating revision.h.  You don't have to do it this way, the\r
+// requirement is only that revision.h gets updated.\r
+//\r
+// revision.h is under source control so that not all consumers of glslang\r
+// source have to figure out how to create revision.h just to get a build\r
+// going.  However, if it is not updated, it can be a version behind.\r
+\r
+#define GLSLANG_REVISION "24303"\r
+#define GLSLANG_DATE     "2013/12/03 14:05:07"\r
diff --git a/glslang/Include/revision.template b/glslang/Include/revision.template
new file mode 100644 (file)
index 0000000..1dc3392
--- /dev/null
@@ -0,0 +1,13 @@
+// The file revision.h should be updated to the latest version, somehow, on \r
+// check-in, if glslang has changed.\r
+//\r
+// revision.template is the source for revision.h when using SubWCRev as the\r
+// method of updating revision.h.  You don't have to do it this way, the\r
+// requirement is only that revision.h gets updated.\r
+//\r
+// revision.h is under source control so that not all consumers of glslang\r
+// source have to figure out how to create revision.h just to get a build\r
+// going.  However, if it is not updated, it can be a version behind.\r
+\r
+#define GLSLANG_REVISION "$WCREV$"\r
+#define GLSLANG_DATE     "$WCDATE$"\r
index 8fcf581..730ffe9 100644 (file)
@@ -912,14 +912,16 @@ int ShGetUniformLocation(const ShHandle handle, const char* name)
 
 namespace glslang {
 
+#include "../Include/revision.h"
+
 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()
 {
-    return "4.20 glslang";
+    return "4.20 glslang LunarG Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
 }
 
 bool InitializeProcess()