diff --git a/Install/Windows/glslangValidator.exe b/Install/Windows/glslangValidator.exe index 24272a3983d2c18fbde74f02f0de81d3ab33e40c..600014cd9c6291b3989a5a15f7e3316a4e576085 100644 Binary files a/Install/Windows/glslangValidator.exe and b/Install/Windows/glslangValidator.exe differ diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index a3c1fafa6cfcd2bed2ab52ac5c5af2e96c8750ca..ae0465c8c22436f1c3c734d142f7df6f611cf44a 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -62,6 +62,7 @@ enum TOptions { EOptionMultiThreaded = 0x040, EOptionDumpConfig = 0x080, EOptionDumpReflection = 0x100, + EOptionSuppressWarnings = 0x200, }; // @@ -91,7 +92,7 @@ ShBinding FixedAttributeBindings[] = { ShBindingTable FixedAttributeTable = { 3, FixedAttributeBindings }; EShLanguage FindLanguage(const std::string& name); -bool CompileFile(const char *fileName, ShHandle, int options); +bool CompileFile(const char *fileName, ShHandle); void usage(); void FreeFileData(char** data); char** ReadFileData(const char* fileName); @@ -478,9 +479,12 @@ bool ProcessArguments(int argc, char* argv[]) break; case 't': #ifdef _WIN32 - Options |= EOptionMultiThreaded; + Options |= EOptionMultiThreaded; #endif break; + case 'w': + Options |= EOptionSuppressWarnings; + break; default: return false; } @@ -496,6 +500,16 @@ bool ProcessArguments(int argc, char* argv[]) return true; } +void SetMessageOptions(EShMessages& messages) +{ + if (Options & EOptionRelaxedErrors) + messages = (EShMessages)(messages | EShMsgRelaxedErrors); + if (Options & EOptionIntermediate) + messages = (EShMessages)(messages | EShMsgAST); + if (Options & EOptionSuppressWarnings) + messages = (EShMessages)(messages | EShMsgSuppressWarnings); +} + // Thread entry point, for non-linking asynchronous mode. unsigned int #ifdef _WIN32 @@ -509,7 +523,7 @@ CompileShaders(void*) if (compiler == 0) return false; - CompileFile(workItem->name.c_str(), compiler, Options); + CompileFile(workItem->name.c_str(), compiler); if (! (Options & EOptionSuppressInfolog)) workItem->results = ShGetInfoLog(compiler); @@ -532,10 +546,7 @@ void CompileAndLinkShaders() std::list<glslang::TShader*> shaders; EShMessages messages = EShMsgDefault; - if (Options & EOptionRelaxedErrors) - messages = (EShMessages)(messages | EShMsgRelaxedErrors); - if (Options & EOptionIntermediate) - messages = (EShMessages)(messages | EShMsgAST); + SetMessageOptions(messages); // // Per-shader processing... @@ -713,7 +724,7 @@ EShLanguage FindLanguage(const std::string& name) // Read a file's data into a string, and compile it using the old interface ShCompile, // for non-linkable results. // -bool CompileFile(const char *fileName, ShHandle compiler, int Options) +bool CompileFile(const char *fileName, ShHandle compiler) { int ret; char** shaderStrings = ReadFileData(fileName); @@ -732,10 +743,7 @@ bool CompileFile(const char *fileName, ShHandle compiler, int Options) return false; EShMessages messages = EShMsgDefault; - if (Options & EOptionRelaxedErrors) - messages = (EShMessages)(messages | EShMsgRelaxedErrors); - if (Options & EOptionIntermediate) - messages = (EShMessages)(messages | EShMsgAST); + SetMessageOptions(messages); for (int i = 0; i < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++i) { for (int j = 0; j < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++j) { @@ -777,13 +785,14 @@ void usage() "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" - "-d: delay exit\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"); + "-t: multi-threaded mode\n" + "-w: suppress warnings (except as required by #extension : warn)\n" + ); } #ifndef _WIN32 diff --git a/Test/130.frag b/Test/130.frag index 3099a47bf408ea25df4713826bca743ea8c5fe46..fbc7996f9fd7e3b3133a773b265de2b894994167 100644 --- a/Test/130.frag +++ b/Test/130.frag @@ -37,3 +37,10 @@ in vec4 gl_Color; flat in vec4 gl_Color; flat in vec4 gl_Color[2]; // ERROR, array vec4 gl_Color; // ERROR, storage + +#extension GL_ARB_texture_gather : warn + +void bar() +{ + vec4 s = textureGather(sampC, vec3(0.2)); +} diff --git a/Test/baseResults/130.frag.out b/Test/baseResults/130.frag.out index 55d7e528a8504e670eb689b9d88234246dbea87b..8fca0816de86c79f44e617a3d712a386954ecbb4 100644 --- a/Test/baseResults/130.frag.out +++ b/Test/baseResults/130.frag.out @@ -3,7 +3,9 @@ ERROR: 0:25: 'texture gather function' : not supported for this version or the e ERROR: 0:35: 'redeclaration' : cannot change the type of gl_Color ERROR: 0:38: 'gl_Color' : redeclaring non-array as array ERROR: 0:39: 'redeclaration' : cannot change storage, memory, or auxiliary qualification of gl_Color -ERROR: 4 compilation errors. No code generated. +ERROR: 0:43: 'bar' : function already has a body +WARNING: 0:45: extension GL_ARB_texture_gather is being used for texture gather function +ERROR: 5 compilation errors. No code generated. ERROR: node is still EOpNull! 0:16 Function Definition: main( (void) @@ -40,6 +42,18 @@ ERROR: node is still EOpNull! 0:32 0.200000 0:32 0.200000 0:32 0.200000 +0:43 Function Definition: bar( (void) +0:43 Function Parameters: +0:45 Sequence +0:45 Sequence +0:45 move second child to first child (4-component vector of float) +0:45 's' (4-component vector of float) +0:45 Function Call: textureGather(sC1;vf3; (4-component vector of float) +0:45 'sampC' (uniform samplerCube) +0:45 Constant: +0:45 0.200000 +0:45 0.200000 +0:45 0.200000 0:? Linker Objects 0:? 'a' (3-component vector of float) 0:? 'b' (float) diff --git a/Test/baseResults/cppComplexExpr.vert.out b/Test/baseResults/cppComplexExpr.vert.out index 28e67f014077a5b2dd86611f085f79f46e6dec44..d59a55676de48dbd7e42e0abdcb160fc95e0aa07 100644 --- a/Test/baseResults/cppComplexExpr.vert.out +++ b/Test/baseResults/cppComplexExpr.vert.out @@ -1,4 +1,3 @@ -WARNING: #version: statement missing; use #version on first line of shader ERROR: 0:46: 'xyxwx' : illegal vector field selection ERROR: 0:46: 'xyxwx' : illegal vector field selection ERROR: 2 compilation errors. No code generated. diff --git a/Test/baseResults/empty.frag.out b/Test/baseResults/empty.frag.out index a17d25409aad69df5a9825976ffff16a0fc32691..683b29db9e27c775d4c5d5b9043e5ff701f36684 100644 --- a/Test/baseResults/empty.frag.out +++ b/Test/baseResults/empty.frag.out @@ -1,11 +1,9 @@ empty.frag -WARNING: #version: statement missing; use #version on first line of shader 0:? Sequence 0:? Linker Objects empty2.frag -WARNING: #version: statement missing; use #version on first line of shader 0:? Sequence 0:? Linker Objects diff --git a/Test/baseResults/errors.frag.out b/Test/baseResults/errors.frag.out index 37304d8e08e067318a874de507218d900ae2a62a..01c46038a7d03eef82d6551ee22b79d72ad27aa8 100644 --- a/Test/baseResults/errors.frag.out +++ b/Test/baseResults/errors.frag.out @@ -1,4 +1,3 @@ -WARNING: #version: statement missing; use #version on first line of shader ERROR: 0:1: 'main' : function cannot take any parameter(s) ERROR: 0:1: 'int' : main function cannot return a value ERROR: 2 compilation errors. No code generated. diff --git a/Test/baseResults/pointCoord.frag.out b/Test/baseResults/pointCoord.frag.out index ed4fe56ce88e5cb4ac8253969b009ca71e983552..688c624ea851817bf89d88b9b800724878a81fa2 100644 --- a/Test/baseResults/pointCoord.frag.out +++ b/Test/baseResults/pointCoord.frag.out @@ -1,4 +1,3 @@ -WARNING: #version: statement missing; use #version on first line of shader 0:? Sequence 0:5 Function Definition: main( (void) 0:5 Function Parameters: diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 2b22a8c7b471a24fa4be7cd863bf75b4a18f47ea..c393a851179322dc3e42f29e7a25623bf6221090 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -296,7 +296,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo // Get a good version... if (version == 0) { version = defaultVersion; - infoSink.info.message(EPrefixWarning, "#version: statement missing; use #version on first line of shader"); + // infoSink.info.message(EPrefixWarning, "#version: statement missing; use #version on first line of shader"); } // Get a good profile...