Browse Source

Updated glslang.

Branimir Karadžić 8 years ago
parent
commit
b2fa6f8689
52 changed files with 868 additions and 233 deletions
  1. 10 6
      3rdparty/glslang/SPIRV/GlslangToSpv.cpp
  2. 1 0
      3rdparty/glslang/SPIRV/GlslangToSpv.h
  3. 1 1
      3rdparty/glslang/SPIRV/SPVRemapper.cpp
  4. 4 1
      3rdparty/glslang/SPIRV/SpvBuilder.cpp
  5. 75 40
      3rdparty/glslang/StandAlone/StandAlone.cpp
  6. 2 2
      3rdparty/glslang/Test/baseResults/310AofA.vert.out
  7. 2 2
      3rdparty/glslang/Test/baseResults/430AofA.frag.out
  8. 51 0
      3rdparty/glslang/Test/baseResults/constFoldIntMin.frag.out
  9. 1 2
      3rdparty/glslang/Test/baseResults/cppBad.vert.out
  10. 67 0
      3rdparty/glslang/Test/baseResults/cppPassMacroName.frag.out
  11. 1 3
      3rdparty/glslang/Test/baseResults/cppSimple.vert.out
  12. 7 3
      3rdparty/glslang/Test/baseResults/glspv.frag.out
  13. 225 0
      3rdparty/glslang/Test/baseResults/hlsl.shift.per-set.frag.out
  14. 0 1
      3rdparty/glslang/Test/baseResults/hlsl.subpass.frag.out
  15. 20 0
      3rdparty/glslang/Test/baseResults/implicitInnerAtomicUint.frag.out
  16. 17 13
      3rdparty/glslang/Test/baseResults/invalidSwizzle.vert.out
  17. 5 1
      3rdparty/glslang/Test/baseResults/numeral.frag.out
  18. 19 0
      3rdparty/glslang/Test/baseResults/overlongLiteral.frag.out
  19. 0 1
      3rdparty/glslang/Test/baseResults/spv.register.subpass.frag.out
  20. 0 1
      3rdparty/glslang/Test/baseResults/spv.shaderFragMaskAMD.frag.out
  21. 3 3
      3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out
  22. 0 1
      3rdparty/glslang/Test/baseResults/spv.subpass.frag.out
  23. 5 1
      3rdparty/glslang/Test/baseResults/vulkan.frag.out
  24. 12 0
      3rdparty/glslang/Test/constFoldIntMin.frag
  25. 3 0
      3rdparty/glslang/Test/cppIntMinOverNegativeOne.frag
  26. 12 0
      3rdparty/glslang/Test/cppPassMacroName.frag
  27. 8 0
      3rdparty/glslang/Test/glspv.frag
  28. 59 0
      3rdparty/glslang/Test/hlsl.shift.per-set.frag
  29. 2 0
      3rdparty/glslang/Test/implicitInnerAtomicUint.frag
  30. 2 0
      3rdparty/glslang/Test/invalidSwizzle.vert
  31. 3 0
      3rdparty/glslang/Test/numeral.frag
  32. 1 0
      3rdparty/glslang/Test/overlongLiteral.frag
  33. 7 0
      3rdparty/glslang/Test/runtests
  34. 8 0
      3rdparty/glslang/Test/vulkan.frag
  35. 3 0
      3rdparty/glslang/Test/vulkan.vert
  36. 9 0
      3rdparty/glslang/glslang/Include/arrays.h
  37. 2 0
      3rdparty/glslang/glslang/Include/intermediate.h
  38. 26 2
      3rdparty/glslang/glslang/MachineIndependent/Constant.cpp
  39. 2 2
      3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp
  40. 16 0
      3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp
  41. 10 7
      3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp
  42. 5 5
      3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h
  43. 19 9
      3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp
  44. 66 64
      3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp
  45. 37 42
      3rdparty/glslang/glslang/MachineIndependent/localintermediate.h
  46. 2 4
      3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp
  47. 6 3
      3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp
  48. 22 7
      3rdparty/glslang/glslang/Public/ShaderLang.h
  49. 4 0
      3rdparty/glslang/gtests/AST.FromFile.cpp
  50. 4 4
      3rdparty/glslang/hlsl/hlslParseHelper.cpp
  51. 1 1
      3rdparty/glslang/known_good.json
  52. 1 1
      3rdparty/glslang/update_glslang_sources.py

+ 10 - 6
3rdparty/glslang/SPIRV/GlslangToSpv.cpp

@@ -78,11 +78,6 @@ using namespace spvtools;
 
 namespace {
 
-// For low-order part of the generator's magic number. Bump up
-// when there is a change in the style (e.g., if SSA form changes,
-// or a different instruction sequence to do something gets used).
-const int GeneratorVersion = 2;
-
 namespace {
 class SpecConstantOpModeGuard {
 public:
@@ -885,7 +880,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
       options(options),
       shaderEntry(nullptr), currentFunction(nullptr),
       sequenceDepth(0), logger(buildLogger),
-      builder((glslang::GetKhronosToolId() << 16) | GeneratorVersion, logger),
+      builder((glslang::GetKhronosToolId() << 16) | glslang::GetSpirvGeneratorVersion(), logger),
       inEntryPoint(false), entryPointTerminated(false), linkageOnly(false),
       glslangIntermediate(glslangIntermediate)
 {
@@ -5959,6 +5954,14 @@ void GetSpirvVersion(std::string& version)
     version = buf;
 }
 
+// For low-order part of the generator's magic number. Bump up
+// when there is a change in the style (e.g., if SSA form changes,
+// or a different instruction sequence to do something gets used).
+int GetSpirvGeneratorVersion()
+{
+    return 2;
+}
+
 // Write SPIR-V out to a binary file
 void OutputSpvBin(const std::vector<unsigned int>& spirv, const char* baseName)
 {
@@ -6061,6 +6064,7 @@ void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsign
         optimizer.RegisterPass(CreateInsertExtractElimPass());
         optimizer.RegisterPass(CreateAggressiveDCEPass());
         optimizer.RegisterPass(CreateDeadBranchElimPass());
+        optimizer.RegisterPass(CreateCFGCleanupPass());
         optimizer.RegisterPass(CreateBlockMergePass());
         optimizer.RegisterPass(CreateLocalMultiStoreElimPass());
         optimizer.RegisterPass(CreateInsertExtractElimPass());

+ 1 - 0
3rdparty/glslang/SPIRV/GlslangToSpv.h

@@ -56,6 +56,7 @@ struct SpvOptions {
 };
 
 void GetSpirvVersion(std::string&);
+int GetSpirvGeneratorVersion();
 void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
                   SpvOptions* options = nullptr);
 void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,

+ 1 - 1
3rdparty/glslang/SPIRV/SPVRemapper.cpp

@@ -1392,7 +1392,7 @@ namespace spv {
 
         int strippedPos = 0;
         for (unsigned word = 0; word < unsigned(spv.size()); ++word) {
-            if (strip_it != stripRange.end() && word >= strip_it->second)
+            while (strip_it != stripRange.end() && word >= strip_it->second)
                 ++strip_it;
 
             if (strip_it == stripRange.end() || word < strip_it->first || word >= strip_it->second)

+ 4 - 1
3rdparty/glslang/SPIRV/SpvBuilder.cpp

@@ -469,7 +469,10 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
 
     if (ms) {
         if (sampled == 2) {
-            addCapability(CapabilityStorageImageMultisample);
+            // Images used with subpass data are not storage
+            // images, so don't require the capability for them.
+            if (dim != Dim::DimSubpassData)
+                addCapability(CapabilityStorageImageMultisample);
             if (arrayed)
                 addCapability(CapabilityImageMSArray);
         }

+ 75 - 40
3rdparty/glslang/StandAlone/StandAlone.cpp

@@ -55,6 +55,7 @@
 #include <cctype>
 #include <cmath>
 #include <array>
+#include <map>
 #include <memory>
 #include <thread>
 
@@ -157,12 +158,11 @@ int OpenGLClientVersion = 450;           // doesn't influence anything yet, but
 unsigned int TargetVersion = 0x00001000; // maps to, say, SPIR-V 1.0
 std::vector<std::string> Processes;      // what should be recorded by OpModuleProcessed, or equivalent
 
-std::array<unsigned int, EShLangCount> baseSamplerBinding;
-std::array<unsigned int, EShLangCount> baseTextureBinding;
-std::array<unsigned int, EShLangCount> baseImageBinding;
-std::array<unsigned int, EShLangCount> baseUboBinding;
-std::array<unsigned int, EShLangCount> baseSsboBinding;
-std::array<unsigned int, EShLangCount> baseUavBinding;
+// Per descriptor-set binding base data
+typedef std::map<unsigned int, unsigned int> TPerSetBaseBinding;
+
+std::array<std::array<unsigned int, EShLangCount>, glslang::EResCount> baseBinding;
+std::array<std::array<TPerSetBaseBinding, EShLangCount>, glslang::EResCount> baseBindingForSet;
 std::array<std::vector<std::string>, EShLangCount> baseResourceSetBinding;
 
 // Add things like "#define ..." to a preamble to use in the beginning of the shader.
@@ -261,36 +261,59 @@ bool SetConfigFile(const std::string& name)
 //
 void Error(const char* message)
 {
-    printf("%s: Error %s (use -h for usage)\n", ExecutableName, message);
+    fprintf(stderr, "%s: Error %s (use -h for usage)\n", ExecutableName, message);
     exit(EFailUsage);
 }
 
 //
-// Process an optional binding base of the form:
-//   --argname [stage] base
+// Process an optional binding base of one the forms:
+//   --argname [stage] base            // base for stage (if given) or all stages (if not)
+//   --argname [stage] [set base]...   // set/base pairs: set the base for given binding set.
+
 // Where stage is one of the forms accepted by FindLanguage, and base is an integer
 //
-void ProcessBindingBase(int& argc, char**& argv, std::array<unsigned int, EShLangCount>& base)
+void ProcessBindingBase(int& argc, char**& argv, glslang::TResourceType res)
 {
     if (argc < 2)
         usage();
 
-    if (!isdigit(argv[1][0])) {
+    EShLanguage lang = EShLangCount;
+    int singleBase = 0;
+    TPerSetBaseBinding perSetBase;
+    int arg = 1;
+
+    // Parse stage, if given
+    if (!isdigit(argv[arg][0])) {
         if (argc < 3) // this form needs one more argument
             usage();
 
-        // Parse form: --argname stage base
-        const EShLanguage lang = FindLanguage(argv[1], false);
-        base[lang] = atoi(argv[2]);
-        argc-= 2;
-        argv+= 2;
+        lang = FindLanguage(argv[arg++], false);
+    }
+
+    if ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
+        // Parse a per-set binding base
+        while ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
+            const int setNum = atoi(argv[arg++]);
+            const int baseNum = atoi(argv[arg++]);
+            perSetBase[setNum] = baseNum;
+        }
     } else {
-        // Parse form: --argname base
-        for (int lang=0; lang<EShLangCount; ++lang)
-            base[lang] = atoi(argv[1]);
+        // Parse single binding base
+        singleBase = atoi(argv[arg++]);
+    }
 
-        argc--;
-        argv++;
+    argc -= (arg-1);
+    argv += (arg-1);
+
+    // Set one or all languages
+    const int langMin = (lang < EShLangCount) ? lang+0 : 0;
+    const int langMax = (lang < EShLangCount) ? lang+1 : EShLangCount;
+
+    for (int lang = langMin; lang < langMax; ++lang) {
+        if (!perSetBase.empty())
+            baseBindingForSet[res][lang] = perSetBase;
+        else
+            baseBinding[res][lang] = singleBase;
     }
 }
 
@@ -339,12 +362,8 @@ void ProcessResourceSetBindingBase(int& argc, char**& argv, std::array<std::vect
 //
 void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItems, int argc, char* argv[])
 {
-    baseSamplerBinding.fill(0);
-    baseTextureBinding.fill(0);
-    baseImageBinding.fill(0);
-    baseUboBinding.fill(0);
-    baseSsboBinding.fill(0);
-    baseUavBinding.fill(0);
+    for (int res = 0; res < glslang::EResCount; ++res)
+        baseBinding[res].fill(0);
 
     ExecutableName = argv[0];
     workItems.reserve(argc);
@@ -441,30 +460,30 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
                     } else if (lowerword == "shift-image-bindings" ||  // synonyms
                                lowerword == "shift-image-binding"  ||
                                lowerword == "sib") {
-                        ProcessBindingBase(argc, argv, baseImageBinding);
+                        ProcessBindingBase(argc, argv, glslang::EResImage);
                     } else if (lowerword == "shift-sampler-bindings" || // synonyms
                         lowerword == "shift-sampler-binding"  ||
                         lowerword == "ssb") {
-                        ProcessBindingBase(argc, argv, baseSamplerBinding);
+                        ProcessBindingBase(argc, argv, glslang::EResSampler);
                     } else if (lowerword == "shift-uav-bindings" ||  // synonyms
                                lowerword == "shift-uav-binding"  ||
                                lowerword == "suavb") {
-                        ProcessBindingBase(argc, argv, baseUavBinding);
+                        ProcessBindingBase(argc, argv, glslang::EResUav);
                     } else if (lowerword == "shift-texture-bindings" ||  // synonyms
                                lowerword == "shift-texture-binding"  ||
                                lowerword == "stb") {
-                        ProcessBindingBase(argc, argv, baseTextureBinding);
+                        ProcessBindingBase(argc, argv, glslang::EResTexture);
                     } else if (lowerword == "shift-ubo-bindings" ||  // synonyms
                                lowerword == "shift-ubo-binding"  ||
                                lowerword == "shift-cbuffer-bindings" ||
                                lowerword == "shift-cbuffer-binding"  ||
                                lowerword == "sub" ||
                                lowerword == "scb") {
-                        ProcessBindingBase(argc, argv, baseUboBinding);
+                        ProcessBindingBase(argc, argv, glslang::EResUbo);
                     } else if (lowerword == "shift-ssbo-bindings" ||  // synonyms
                                lowerword == "shift-ssbo-binding"  ||
                                lowerword == "sbb") {
-                        ProcessBindingBase(argc, argv, baseSsboBinding);
+                        ProcessBindingBase(argc, argv, glslang::EResSsbo);
                     } else if (lowerword == "source-entrypoint" || // synonyms
                                lowerword == "sep") {
                         if (argc <= 1)
@@ -791,12 +810,20 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
             shader->setPreamble(UserPreamble.get());
         shader->addProcesses(Processes);
 
-        shader->setShiftSamplerBinding(baseSamplerBinding[compUnit.stage]);
-        shader->setShiftTextureBinding(baseTextureBinding[compUnit.stage]);
-        shader->setShiftImageBinding(baseImageBinding[compUnit.stage]);
-        shader->setShiftUboBinding(baseUboBinding[compUnit.stage]);
-        shader->setShiftSsboBinding(baseSsboBinding[compUnit.stage]);
-        shader->setShiftUavBinding(baseUavBinding[compUnit.stage]);
+        // Set IO mapper binding shift values
+        for (int r = 0; r < glslang::EResCount; ++r) {
+            const glslang::TResourceType res = glslang::TResourceType(r);
+
+            // Set base bindings
+            shader->setShiftBinding(res, baseBinding[res][compUnit.stage]);
+            
+            // Set bindings for particular resource sets
+            // TODO: use a range based for loop here, when available in all environments.
+            for (auto i = baseBindingForSet[res][compUnit.stage].begin();
+                 i != baseBindingForSet[res][compUnit.stage].end(); ++i)
+                shader->setShiftBindingForSet(res, i->first, i->second);
+        }
+
         shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
         shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
         shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
@@ -1022,6 +1049,7 @@ int C_DECL main(int argc, char* argv[])
         printf("SPIR-V Version %s\n", spirvVersion.c_str());
         printf("GLSL.std.450 Version %d, Revision %d\n", GLSLstd450Version, GLSLstd450Revision);
         printf("Khronos Tool ID %d\n", glslang::GetKhronosToolId());
+        printf("SPIR-V Generator Version %d\n", glslang::GetSpirvGeneratorVersion());
         printf("GL_KHR_vulkan_glsl version %d\n", 100);
         printf("ARB_GL_gl_spirv version %d\n", 100);
         if (workList.empty())
@@ -1062,7 +1090,7 @@ int C_DECL main(int argc, char* argv[])
                 threads[t] = std::thread(CompileShaders, std::ref(workList));
                 if (threads[t].get_id() == std::thread::id())
                 {
-                    printf("Failed to create thread\n");
+                    fprintf(stderr, "Failed to create thread\n");
                     return EFailThreadCreate;
                 }
             }
@@ -1274,17 +1302,24 @@ void usage()
            "              Set descriptor set for all resources\n"
            "  --rsb [stage] type set binding       synonym for --resource-set-binding\n"
            "  --shift-image-binding [stage] num    base binding number for images (uav)\n"
+           "  --shift-image-binding [stage] [set num]... per-descriptor-set shift values\n"
            "  --sib [stage] num                    synonym for --shift-image-binding\n"
            "  --shift-sampler-binding [stage] num  base binding number for samplers\n"
+           "  --shift-sampler-binding [stage] [set num]... per-descriptor-set shift values\n"
            "  --ssb [stage] num                    synonym for --shift-sampler-binding\n"
            "  --shift-ssbo-binding [stage] num     base binding number for SSBOs\n"
+           "  --shift-ssbo-binding [stage] [set num]... per-descriptor-set shift values\n"
            "  --sbb [stage] num                    synonym for --shift-ssbo-binding\n"
            "  --shift-texture-binding [stage] num  base binding number for textures\n"
+           "  --shift-texture-binding [stage] [set num]... per-descriptor-set shift values\n"
            "  --stb [stage] num                    synonym for --shift-texture-binding\n"
            "  --shift-uav-binding [stage] num      base binding number for UAVs\n"
+           "  --shift-uav-binding [stage] [set num]... per-descriptor-set shift values\n"
            "  --suavb [stage] num                  synonym for --shift-uav-binding\n"
            "  --shift-UBO-binding [stage] num      base binding number for UBOs\n"
+           "  --shift-UBO-binding [stage] [set num]... per-descriptor-set shift values\n"
            "  --shift-cbuffer-binding [stage] num  synonym for --shift-UBO-binding\n"
+           "  --shift-cbuffer-binding [stage] [set num]... per-descriptor-set shift values\n"
            "  --sub [stage] num                    synonym for --shift-UBO-binding\n"
            "  --source-entrypoint <name>           the given shader source function is\n"
            "                                       renamed to be the <name> given in -e\n"

+ 2 - 2
3rdparty/glslang/Test/baseResults/310AofA.vert.out

@@ -320,7 +320,7 @@ ERROR: node is still EOpNull!
 0:?   Linker Objects
 0:?     'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v})
 0:?     'uname' (layout( column_major shared) uniform 3-element array of block{layout( column_major shared) uniform highp float u, layout( column_major shared) uniform implicitly-sized array of highp 4-component vector of float v})
-0:?     'name2' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of implicitly-sized array of highp 4-component vector of float v})
+0:?     'name2' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 1-element array of highp 4-component vector of float v})
 0:?     'name3' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 7-element array of highp 4-component vector of float v})
 0:?     'many' ( global 1-element array of 2-element array of 3-element array of 4-element array of 5-element array of 6-element array of highp float)
 0:?     'gu' ( global implicitly-sized array of 7-element array of highp float)
@@ -361,7 +361,7 @@ ERROR: node is still EOpNull!
 0:?   Linker Objects
 0:?     'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v})
 0:?     'uname' (layout( column_major shared) uniform 3-element array of block{layout( column_major shared) uniform highp float u, layout( column_major shared) uniform 1-element array of highp 4-component vector of float v})
-0:?     'name2' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of implicitly-sized array of highp 4-component vector of float v})
+0:?     'name2' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 1-element array of highp 4-component vector of float v})
 0:?     'name3' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 7-element array of highp 4-component vector of float v})
 0:?     'many' ( global 1-element array of 2-element array of 3-element array of 4-element array of 5-element array of 6-element array of highp float)
 0:?     'gu' ( global 1-element array of 7-element array of highp float)

+ 2 - 2
3rdparty/glslang/Test/baseResults/430AofA.frag.out

@@ -405,7 +405,7 @@ ERROR: node is still EOpNull!
 0:?   Linker Objects
 0:?     'many' ( global 1-element array of 2-element array of 3-element array of 4-element array of 5-element array of 6-element array of float)
 0:?     'gu' ( global implicitly-sized array of 7-element array of float)
-0:?     'gimp' ( global implicitly-sized array of implicitly-sized array of float)
+0:?     'gimp' ( global implicitly-sized array of 1-element array of float)
 0:?     'g4' ( global 4-element array of 7-element array of float)
 0:?     'g5' ( global 5-element array of 7-element array of float)
 
@@ -768,7 +768,7 @@ ERROR: node is still EOpNull!
 0:?   Linker Objects
 0:?     'many' ( global 1-element array of 2-element array of 3-element array of 4-element array of 5-element array of 6-element array of float)
 0:?     'gu' ( global 1-element array of 7-element array of float)
-0:?     'gimp' ( global 1-element array of implicitly-sized array of float)
+0:?     'gimp' ( global 1-element array of 1-element array of float)
 0:?     'g4' ( global 4-element array of 7-element array of float)
 0:?     'g5' ( global 5-element array of 7-element array of float)
 

+ 51 - 0
3rdparty/glslang/Test/baseResults/constFoldIntMin.frag.out

@@ -0,0 +1,51 @@
+constFoldIntMin.frag
+Shader version: 460
+Requested GL_AMD_gpu_shader_int16
+Requested GL_ARB_gpu_shader_int64
+0:? Sequence
+0:5  Function Definition: a( ( global void)
+0:5    Function Parameters: 
+0:6    Sequence
+0:6      Sequence
+0:6        move second child to first child ( temp int16_t)
+0:6          'u' ( temp int16_t)
+0:6          Constant:
+0:6            32768 (const int)
+0:7      Sequence
+0:7        move second child to first child ( temp int)
+0:7          'v' ( temp int)
+0:7          Constant:
+0:7            -2147483648 (const int)
+0:8      Sequence
+0:8        move second child to first child ( temp int64_t)
+0:8          'w' ( temp int64_t)
+0:8          Constant:
+0:8            -9223372036854775808 (const int64_t)
+0:9      Sequence
+0:9        move second child to first child ( temp int16_t)
+0:9          'x' ( temp int16_t)
+0:9          Constant:
+0:9            0 (const int)
+0:10      Sequence
+0:10        move second child to first child ( temp int)
+0:10          'y' ( temp int)
+0:10          Constant:
+0:10            0 (const int)
+0:11      Sequence
+0:11        move second child to first child ( temp int64_t)
+0:11          'z' ( temp int64_t)
+0:11          Constant:
+0:11            0 (const int64_t)
+0:?   Linker Objects
+
+
+Linked fragment stage:
+
+ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
+
+Shader version: 460
+Requested GL_AMD_gpu_shader_int16
+Requested GL_ARB_gpu_shader_int64
+0:? Sequence
+0:?   Linker Objects
+

+ 1 - 2
3rdparty/glslang/Test/baseResults/cppBad.vert.out

@@ -2,10 +2,9 @@ cppBad.vert
 ERROR: 0:2: 'preprocessor evaluation' : bad expression 
 ERROR: 0:2: '#if' : unexpected tokens following directive 
 ERROR: 0:5: 'string' : End of line in string 
-ERROR: 0:5: 'macro expansion' : expected '(' following n
 ERROR: 0:5: '""' : string literals not supported 
 ERROR: 0:5: '' :  syntax error, unexpected INT, expecting COMMA or SEMICOLON
-ERROR: 6 compilation errors.  No code generated.
+ERROR: 5 compilation errors.  No code generated.
 
 
 Shader version: 100

+ 67 - 0
3rdparty/glslang/Test/baseResults/cppPassMacroName.frag.out

@@ -0,0 +1,67 @@
+cppPassMacroName.frag
+Shader version: 100
+0:? Sequence
+0:5  Function Definition: main( ( global void)
+0:5    Function Parameters: 
+0:7    Sequence
+0:7      Sequence
+0:7        move second child to first child ( temp mediump int)
+0:7          'f1' ( temp mediump int)
+0:7          Constant:
+0:7            4 (const int)
+0:8      Sequence
+0:8        move second child to first child ( temp mediump int)
+0:8          'f2' ( temp mediump int)
+0:8          'f1' ( temp mediump int)
+0:9      Sequence
+0:9        move second child to first child ( temp mediump int)
+0:9          'f3' ( temp mediump int)
+0:9          Constant:
+0:9            9 (const int)
+0:10      Sequence
+0:10        move second child to first child ( temp mediump int)
+0:10          'f4' ( temp mediump int)
+0:10          Constant:
+0:10            1 (const int)
+0:11      Sequence
+0:11        move second child to first child ( temp mediump int)
+0:11          'f5' ( temp mediump int)
+0:11          Constant:
+0:11            5 (const int)
+0:?   Linker Objects
+
+
+Linked fragment stage:
+
+
+Shader version: 100
+0:? Sequence
+0:5  Function Definition: main( ( global void)
+0:5    Function Parameters: 
+0:7    Sequence
+0:7      Sequence
+0:7        move second child to first child ( temp mediump int)
+0:7          'f1' ( temp mediump int)
+0:7          Constant:
+0:7            4 (const int)
+0:8      Sequence
+0:8        move second child to first child ( temp mediump int)
+0:8          'f2' ( temp mediump int)
+0:8          'f1' ( temp mediump int)
+0:9      Sequence
+0:9        move second child to first child ( temp mediump int)
+0:9          'f3' ( temp mediump int)
+0:9          Constant:
+0:9            9 (const int)
+0:10      Sequence
+0:10        move second child to first child ( temp mediump int)
+0:10          'f4' ( temp mediump int)
+0:10          Constant:
+0:10            1 (const int)
+0:11      Sequence
+0:11        move second child to first child ( temp mediump int)
+0:11          'f5' ( temp mediump int)
+0:11          Constant:
+0:11            5 (const int)
+0:?   Linker Objects
+

+ 1 - 3
3rdparty/glslang/Test/baseResults/cppSimple.vert.out

@@ -75,10 +75,8 @@ ERROR: 12:20051: '#error' : good evaluation 1
 ERROR: 12:20055: '#error' : good evaluation 2  
 ERROR: 12:9000: 'preprocessor evaluation' : expected ')' 
 ERROR: 12:9002: '#if' : unexpected tokens following directive 
-ERROR: 12:9014: 'macro expansion' : expected '(' following FOOOM
 ERROR: 12:9014: 'FOOOM' : undeclared identifier 
 ERROR: 12:9014: '=' :  cannot convert from ' temp float' to ' global int'
-ERROR: 12:9015: 'macro expansion' : expected '(' following FOOOM
 ERROR: 12:9016: 'preprocessor evaluation' : can't evaluate expression 
 ERROR: 12:9016: 'preprocessor evaluation' : bad expression 
 ERROR: 12:9500: 'preprocessor evaluation' : bad expression 
@@ -93,7 +91,7 @@ ERROR: 12:9508: '#error' : \ 377
 ERROR: 12:9602: 'defined' : cannot use in preprocessor expression when expanded from macros 
 ERROR: 12:9603: '#error' : DEF_DEFINED then  
 ERROR: 12:10002: '' : missing #endif 
-ERROR: 90 compilation errors.  No code generated.
+ERROR: 88 compilation errors.  No code generated.
 
 
 Shader version: 400

+ 7 - 3
3rdparty/glslang/Test/baseResults/glspv.frag.out

@@ -1,9 +1,13 @@
 glspv.frag
 ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error )  
 ERROR: 0:6: '#error' : GL_SPIR is 100  
-ERROR: 0:19: 'input_attachment_index' : only allowed when using GLSL for Vulkan 
-ERROR: 0:19: '' :  syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
-ERROR: 4 compilation errors.  No code generated.
+ERROR: 0:21: 'noise1' : no matching overloaded function found 
+ERROR: 0:22: 'noise2' : no matching overloaded function found 
+ERROR: 0:23: 'noise3' : no matching overloaded function found 
+ERROR: 0:24: 'noise4' : no matching overloaded function found 
+ERROR: 0:27: 'input_attachment_index' : only allowed when using GLSL for Vulkan 
+ERROR: 0:27: '' :  syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
+ERROR: 8 compilation errors.  No code generated.
 
 
 SPIR-V is not generated for failed compile or link

+ 225 - 0
3rdparty/glslang/Test/baseResults/hlsl.shift.per-set.frag.out

@@ -0,0 +1,225 @@
+hlsl.shift.per-set.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:34  Function Definition: @main( ( temp 4-component vector of float)
+0:34    Function Parameters: 
+0:?     Sequence
+0:35      't1' (layout( set=1 binding=1) uniform texture1D)
+0:36      't2' (layout( set=1 binding=2) uniform texture2D)
+0:37      't3' (layout( set=2 binding=1) uniform texture3D)
+0:38      direct index (layout( row_major std430) buffer 4-component vector of float)
+0:38        @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
+0:38          't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
+0:38          Constant:
+0:38            0 (const uint)
+0:38        Constant:
+0:38          0 (const int)
+0:39      indirect index (layout( row_major std430) buffer uint)
+0:39        @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
+0:39          't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+0:39          Constant:
+0:39            0 (const uint)
+0:39        right-shift ( temp int)
+0:39          Constant:
+0:39            0 (const int)
+0:39          Constant:
+0:39            2 (const int)
+0:40      't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer)
+0:42      's1' (layout( set=1 binding=1) uniform sampler)
+0:43      's2' (layout( set=2 binding=2) uniform sampler)
+0:45      'u1' (layout( set=1 binding=1 rgba32f) uniform image1D)
+0:46      'u2' (layout( set=2 binding=2 rgba32f) uniform image2D)
+0:47      'u3' (layout( set=2 binding=3 rgba32f) uniform image3D)
+0:49      imageLoad ( temp float)
+0:49        'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer)
+0:49        Constant:
+0:49          0 (const int)
+0:50      indirect index (layout( row_major std430) buffer uint)
+0:50        @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
+0:50          'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+0:50          Constant:
+0:50            0 (const uint)
+0:50        right-shift ( temp int)
+0:50          Constant:
+0:50            0 (const int)
+0:50          Constant:
+0:50            2 (const int)
+0:51      direct index (layout( row_major std430) buffer float)
+0:51        @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float)
+0:51          'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:51          Constant:
+0:51            0 (const uint)
+0:51        Constant:
+0:51          0 (const int)
+0:52      'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:53      'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:55      cb1: direct index for structure (layout( row_major std140) uniform int)
+0:55        'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1})
+0:55        Constant:
+0:55          0 (const uint)
+0:56      tb1: direct index for structure (layout( row_major std430) buffer int)
+0:56        'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1})
+0:56        Constant:
+0:56          0 (const uint)
+0:58      Branch: Return with expression
+0:58        Constant:
+0:58          0.000000
+0:58          0.000000
+0:58          0.000000
+0:58          0.000000
+0:34  Function Definition: main( ( temp void)
+0:34    Function Parameters: 
+0:?     Sequence
+0:34      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:34        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     's1' (layout( set=1 binding=1) uniform sampler)
+0:?     's2' (layout( set=2 binding=2) uniform sampler)
+0:?     't1' (layout( set=1 binding=1) uniform texture1D)
+0:?     't2' (layout( set=1 binding=2) uniform texture2D)
+0:?     't3' (layout( set=2 binding=1) uniform texture3D)
+0:?     't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
+0:?     't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+0:?     't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer)
+0:?     'u1' (layout( set=1 binding=1 rgba32f) uniform image1D)
+0:?     'u2' (layout( set=2 binding=2 rgba32f) uniform image2D)
+0:?     'u3' (layout( set=2 binding=3 rgba32f) uniform image3D)
+0:?     'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer)
+0:?     'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+0:?     'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:?     'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:?     'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:?     'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1})
+0:?     'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1})
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:34  Function Definition: @main( ( temp 4-component vector of float)
+0:34    Function Parameters: 
+0:?     Sequence
+0:35      't1' (layout( set=1 binding=1) uniform texture1D)
+0:36      't2' (layout( set=1 binding=2) uniform texture2D)
+0:37      't3' (layout( set=2 binding=1) uniform texture3D)
+0:38      direct index (layout( row_major std430) buffer 4-component vector of float)
+0:38        @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
+0:38          't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
+0:38          Constant:
+0:38            0 (const uint)
+0:38        Constant:
+0:38          0 (const int)
+0:39      indirect index (layout( row_major std430) buffer uint)
+0:39        @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
+0:39          't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+0:39          Constant:
+0:39            0 (const uint)
+0:39        right-shift ( temp int)
+0:39          Constant:
+0:39            0 (const int)
+0:39          Constant:
+0:39            2 (const int)
+0:40      't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer)
+0:42      's1' (layout( set=1 binding=1) uniform sampler)
+0:43      's2' (layout( set=2 binding=2) uniform sampler)
+0:45      'u1' (layout( set=1 binding=1 rgba32f) uniform image1D)
+0:46      'u2' (layout( set=2 binding=2 rgba32f) uniform image2D)
+0:47      'u3' (layout( set=2 binding=3 rgba32f) uniform image3D)
+0:49      imageLoad ( temp float)
+0:49        'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer)
+0:49        Constant:
+0:49          0 (const int)
+0:50      indirect index (layout( row_major std430) buffer uint)
+0:50        @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
+0:50          'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+0:50          Constant:
+0:50            0 (const uint)
+0:50        right-shift ( temp int)
+0:50          Constant:
+0:50            0 (const int)
+0:50          Constant:
+0:50            2 (const int)
+0:51      direct index (layout( row_major std430) buffer float)
+0:51        @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float)
+0:51          'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:51          Constant:
+0:51            0 (const uint)
+0:51        Constant:
+0:51          0 (const int)
+0:52      'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:53      'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:55      cb1: direct index for structure (layout( row_major std140) uniform int)
+0:55        'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1})
+0:55        Constant:
+0:55          0 (const uint)
+0:56      tb1: direct index for structure (layout( row_major std430) buffer int)
+0:56        'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1})
+0:56        Constant:
+0:56          0 (const uint)
+0:58      Branch: Return with expression
+0:58        Constant:
+0:58          0.000000
+0:58          0.000000
+0:58          0.000000
+0:58          0.000000
+0:34  Function Definition: main( ( temp void)
+0:34    Function Parameters: 
+0:?     Sequence
+0:34      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:34        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     's1' (layout( set=1 binding=1) uniform sampler)
+0:?     's2' (layout( set=2 binding=2) uniform sampler)
+0:?     't1' (layout( set=1 binding=1) uniform texture1D)
+0:?     't2' (layout( set=1 binding=2) uniform texture2D)
+0:?     't3' (layout( set=2 binding=1) uniform texture3D)
+0:?     't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
+0:?     't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+0:?     't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer)
+0:?     'u1' (layout( set=1 binding=1 rgba32f) uniform image1D)
+0:?     'u2' (layout( set=2 binding=2 rgba32f) uniform image2D)
+0:?     'u3' (layout( set=2 binding=3 rgba32f) uniform image3D)
+0:?     'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer)
+0:?     'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+0:?     'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:?     'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:?     'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
+0:?     'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1})
+0:?     'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1})
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+Uniform reflection:
+t1: offset -1, type 8b5d, size 1, index -1, binding 21
+t2: offset -1, type 8b5e, size 1, index -1, binding 22
+t3: offset -1, type 8b5f, size 1, index -1, binding 26
+t4.@data: offset 0, type 8b52, size 1, index 0, binding -1
+t5.@data: offset 0, type 1405, size 0, index 1, binding -1
+t6: offset -1, type 8dc2, size 1, index -1, binding 23
+s1: offset -1, type 0, size 1, index -1, binding 11
+s2: offset -1, type 0, size 1, index -1, binding 17
+u1: offset -1, type 904c, size 1, index -1, binding 31
+u2: offset -1, type 904d, size 1, index -1, binding 42
+u3: offset -1, type 904e, size 1, index -1, binding 43
+u4: offset -1, type 9051, size 1, index -1, binding 34
+u5.@data: offset 0, type 1405, size 0, index 2, binding -1
+u6.@data: offset 0, type 1406, size 1, index 3, binding -1
+cb1: offset 0, type 1404, size 1, index 4, binding -1
+tb1: offset 0, type 1404, size 1, index 5, binding -1
+
+Uniform block reflection:
+t4: offset -1, type ffffffff, size 0, index -1, binding 21
+t5: offset -1, type ffffffff, size 0, index -1, binding 22
+u5: offset -1, type ffffffff, size 0, index -1, binding 44
+u6: offset -1, type ffffffff, size 0, index -1, binding 34
+cb: offset -1, type ffffffff, size 4, index -1, binding 51
+tb: offset -1, type ffffffff, size 4, index -1, binding 27
+
+Vertex attribute reflection:
+

+ 0 - 1
3rdparty/glslang/Test/baseResults/hlsl.subpass.frag.out

@@ -434,7 +434,6 @@ gl_FragCoord origin is upper left
 // Id's are bound by 204
 
                               Capability Shader
-                              Capability StorageImageMultisample
                               Capability InputAttachment
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450

+ 20 - 0
3rdparty/glslang/Test/baseResults/implicitInnerAtomicUint.frag.out

@@ -0,0 +1,20 @@
+implicitInnerAtomicUint.frag
+ERROR: 0:2: '[]' : only outermost dimension of an array of arrays can be implicitly sized 
+ERROR: 1 compilation errors.  No code generated.
+
+
+Shader version: 460
+ERROR: node is still EOpNull!
+0:?   Linker Objects
+0:?     'c' (layout( binding=0 offset=0) uniform 1-element array of 1-element array of atomic_uint)
+
+
+Linked fragment stage:
+
+ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
+
+Shader version: 460
+ERROR: node is still EOpNull!
+0:?   Linker Objects
+0:?     'c' (layout( binding=0 offset=0) uniform 1-element array of 1-element array of atomic_uint)
+

+ 17 - 13
3rdparty/glslang/Test/baseResults/invalidSwizzle.vert.out

@@ -1,17 +1,20 @@
 invalidSwizzle.vert
-ERROR: 0:6: 'xx' : does not apply to this type:  global void
-ERROR: 0:7: 'xy' : does not apply to this type:  global void
-ERROR: 2 compilation errors.  No code generated.
+ERROR: 0:7: 'rr' : does not apply to this type:  uniform sampler2D
+ERROR: 0:7: '=' :  cannot convert from ' uniform sampler2D' to ' temp 2-component vector of float'
+ERROR: 0:8: 'xx' : does not apply to this type:  global void
+ERROR: 0:9: 'xy' : does not apply to this type:  global void
+ERROR: 4 compilation errors.  No code generated.
 
 
 Shader version: 420
 ERROR: node is still EOpNull!
-0:5  Function Definition: main( ( global void)
-0:5    Function Parameters: 
-0:6    Sequence
-0:6      Function Call: f( ( global void)
-0:7      Function Call: f( ( global void)
+0:6  Function Definition: main( ( global void)
+0:6    Function Parameters: 
+0:?     Sequence
+0:8      Function Call: f( ( global void)
+0:9      Function Call: f( ( global void)
 0:?   Linker Objects
+0:?     's' ( uniform sampler2D)
 0:?     'gl_VertexID' ( gl_VertexId int VertexId)
 0:?     'gl_InstanceID' ( gl_InstanceId int InstanceId)
 
@@ -23,12 +26,13 @@ ERROR: Linking vertex stage: No function definition (body) found:
 
 Shader version: 420
 ERROR: node is still EOpNull!
-0:5  Function Definition: main( ( global void)
-0:5    Function Parameters: 
-0:6    Sequence
-0:6      Function Call: f( ( global void)
-0:7      Function Call: f( ( global void)
+0:6  Function Definition: main( ( global void)
+0:6    Function Parameters: 
+0:?     Sequence
+0:8      Function Call: f( ( global void)
+0:9      Function Call: f( ( global void)
 0:?   Linker Objects
+0:?     's' ( uniform sampler2D)
 0:?     'gl_VertexID' ( gl_VertexId int VertexId)
 0:?     'gl_InstanceID' ( gl_InstanceId int InstanceId)
 

+ 5 - 1
3rdparty/glslang/Test/baseResults/numeral.frag.out

@@ -11,7 +11,9 @@ ERROR: 0:50: '' : hexadecimal literal too big
 ERROR: 0:88: '' : float literal needs a decimal point or exponent 
 ERROR: 0:98: '' : numeric literal too big 
 ERROR: 0:101: '' : numeric literal too big 
-ERROR: 12 compilation errors.  No code generated.
+ERROR: 0:104: '#' : preprocessor directive cannot be preceded by another token 
+ERROR: 0:104: '' :  syntax error, unexpected $end, expecting COMMA or SEMICOLON
+ERROR: 14 compilation errors.  No code generated.
 
 
 Shader version: 400
@@ -417,6 +419,7 @@ ERROR: node is still EOpNull!
 0:?     'g4' ( global int)
 0:?     'g5' ( global int)
 0:?     'g6' ( global int)
+0:?     'inf1' ( global float)
 
 
 Linked fragment stage:
@@ -825,4 +828,5 @@ ERROR: node is still EOpNull!
 0:?     'g4' ( global int)
 0:?     'g5' ( global int)
 0:?     'g6' ( global int)
+0:?     'inf1' ( global float)
 

+ 19 - 0
3rdparty/glslang/Test/baseResults/overlongLiteral.frag.out

@@ -0,0 +1,19 @@
+overlongLiteral.frag
+ERROR: 0:1: '' : hexadecimal literal too long 
+ERROR: 0:1: '' :  syntax error, unexpected INTCONSTANT
+ERROR: 2 compilation errors.  No code generated.
+
+
+Shader version: 100
+ERROR: node is still EOpNull!
+0:?   Linker Objects
+
+
+Linked fragment stage:
+
+ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
+
+Shader version: 100
+ERROR: node is still EOpNull!
+0:?   Linker Objects
+

+ 0 - 1
3rdparty/glslang/Test/baseResults/spv.register.subpass.frag.out

@@ -4,7 +4,6 @@ spv.register.subpass.frag
 // Id's are bound by 40
 
                               Capability Shader
-                              Capability StorageImageMultisample
                               Capability InputAttachment
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450

+ 0 - 1
3rdparty/glslang/Test/baseResults/spv.shaderFragMaskAMD.frag.out

@@ -4,7 +4,6 @@ spv.shaderFragMaskAMD.frag
 // Id's are bound by 80
 
                               Capability Shader
-                              Capability StorageImageMultisample
                               Capability InputAttachment
                               Capability FragmentMaskAMD
                               Extension  "SPV_AMD_shader_fragment_mask"

+ 3 - 3
3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out

@@ -11,7 +11,7 @@ spv.specConstant.vert
                               Source GLSL 400
                               Name 4  "main"
                               Name 9  "arraySize"
-                              Name 14  "foo(vf4[s1522];"
+                              Name 14  "foo(vf4[s1506];"
                               Name 13  "p"
                               Name 17  "builtin_spec_constant("
                               Name 20  "color"
@@ -102,10 +102,10 @@ spv.specConstant.vert
                               Store 20(color) 46
               48:          10 Load 22(ucol)
                               Store 47(param) 48
-              49:           2 FunctionCall 14(foo(vf4[s1522];) 47(param)
+              49:           2 FunctionCall 14(foo(vf4[s1506];) 47(param)
                               Return
                               FunctionEnd
-14(foo(vf4[s1522];):           2 Function None 12
+14(foo(vf4[s1506];):           2 Function None 12
            13(p):     11(ptr) FunctionParameter
               15:             Label
               54:     24(ptr) AccessChain 53(dupUcol) 23

+ 0 - 1
3rdparty/glslang/Test/baseResults/spv.subpass.frag.out

@@ -4,7 +4,6 @@ spv.subpass.frag
 // Id's are bound by 67
 
                               Capability Shader
-                              Capability StorageImageMultisample
                               Capability InputAttachment
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450

+ 5 - 1
3rdparty/glslang/Test/baseResults/vulkan.frag.out

@@ -39,7 +39,11 @@ ERROR: 0:93: ',' : sampler constructor must appear at point of use
 ERROR: 0:94: ':' :  wrong operand types: no operation ':' exists that takes a left-hand operand of type ' temp sampler2D' and a right operand of type ' temp sampler2D' (or there is no acceptable conversion)
 ERROR: 0:94: 'call argument' : sampler constructor must appear at point of use 
 ERROR: 0:96: 'gl_NumSamples' : undeclared identifier 
-ERROR: 38 compilation errors.  No code generated.
+ERROR: 0:101: 'noise1' : no matching overloaded function found 
+ERROR: 0:102: 'noise2' : no matching overloaded function found 
+ERROR: 0:103: 'noise3' : no matching overloaded function found 
+ERROR: 0:104: 'noise4' : no matching overloaded function found 
+ERROR: 42 compilation errors.  No code generated.
 
 
 ERROR: Linking fragment stage: Only one push_constant block is allowed per stage

+ 12 - 0
3rdparty/glslang/Test/constFoldIntMin.frag

@@ -0,0 +1,12 @@
+#version 460 core
+#extension GL_AMD_gpu_shader_int16 : enable
+#extension GL_ARB_gpu_shader_int64 : enable
+
+void a(){
+    int16_t u = -32768S / -1S; // SHRT_MIN
+    int v = -2147483648 / -1; // INT_MIN
+    int64_t w = -9223372036854775808L / -1L; // LLONG_MIN
+    int16_t x = -32768S % -1S; // SHRT_MIN
+    int y = -2147483648 % -1; // INT_MIN
+    int64_t z = -9223372036854775808L % -1L; // LLONG_MIN
+}

+ 3 - 0
3rdparty/glslang/Test/cppIntMinOverNegativeOne.frag

@@ -1,3 +1,6 @@
 #if (-2147483648 / -1) != 0
 #error INT_MIN / -1 should yield 0, something went wrong.
+#endif
+#if (-2147483648 % -1) != 0
+#error INT_MIN % -1 should yield 0, something went wrong.
 #endif

+ 12 - 0
3rdparty/glslang/Test/cppPassMacroName.frag

@@ -0,0 +1,12 @@
+#define f1(i) ((i)*(i))
+#define I2(f, n) f(n) + f(n+1)
+#define I3(f, n) I2(f, n) + f(n+2)
+
+void main()
+{
+    int f1 = 4;
+    int f2 = f1;
+    int f3 = f1(3);
+    int f4 = I2(f1, 0);
+    int f5 = I3(f1, 0);
+}

+ 8 - 0
3rdparty/glslang/Test/glspv.frag

@@ -16,4 +16,12 @@ layout(location = 2) uniform float g;
 uniform sampler2D s1;
 layout(location = 3) uniform sampler2D s2;
 
+void noise()
+{
+    noise1(vec4(1));
+    noise2(4.0);
+    noise3(vec2(3));
+    noise4(1);
+}
+
 layout(input_attachment_index = 1) uniform subpassInput sub; // ERROR, no inputs

+ 59 - 0
3rdparty/glslang/Test/hlsl.shift.per-set.frag

@@ -0,0 +1,59 @@
+// Test register class offsets for different resource types
+
+SamplerState       s1 : register(s1, space1);
+SamplerComparisonState s2 : register(s2, space2);
+
+Texture1D <float4> t1 : register(t1, space1);
+Texture2D <float4> t2 : register(t2, space1);
+Texture3D <float4> t3 : register(t1, space2);
+
+StructuredBuffer<float4> t4 : register(t1, space3);
+
+ByteAddressBuffer t5 : register(t2, space3);
+Buffer<float4> t6 : register(t3, space3);
+
+RWTexture1D <float4> u1 : register(u1, space1);
+RWTexture2D <float4> u2 : register(u2, space2);
+RWTexture3D <float4> u3 : register(u3, space2);
+
+RWBuffer <float> u4 : register(u4, space1);
+RWByteAddressBuffer u5 : register(u4, space2);
+RWStructuredBuffer<float> u6 : register(u4, space3);
+AppendStructuredBuffer<float> u7 : register(u4, space4);
+ConsumeStructuredBuffer<float> u8 : register(u4, space5);
+
+cbuffer cb : register(b1, space6) {
+    int cb1;
+};
+
+tbuffer tb : register(t7) {
+    int tb1;
+};
+
+float4 main() : SV_Target0
+{
+    t1;
+    t2;
+    t3;
+    t4[0];
+    t5.Load(0);
+    t6;
+
+    s1;
+    s2;
+
+    u1;
+    u2;
+    u3;
+
+    u4[0];
+    u5.Load(0);
+    u6[0];
+    u7;
+    u8;
+
+    cb1;
+    tb1;
+
+    return 0;
+}

+ 2 - 0
3rdparty/glslang/Test/implicitInnerAtomicUint.frag

@@ -0,0 +1,2 @@
+#version 460
+layout(binding = 0) uniform atomic_uint c[1][];

+ 2 - 0
3rdparty/glslang/Test/invalidSwizzle.vert

@@ -1,8 +1,10 @@
 #version 420
 
 void f();
+uniform sampler2D s;
 
 void main() {
+    vec2 v = s.rr; // Swizzles do not apply to samplers
     f().xx; // Scalar swizzle does not apply to void
     f().xy; // Vector swizzle does not apply either
 }

+ 3 - 0
3rdparty/glslang/Test/numeral.frag

@@ -101,3 +101,6 @@ uint g3 = 4294967294u;
 int g4 = 4294967296;   // ERROR, too big
 int g5 = 4294967295;
 int g6 = 4294967294;
+float inf1 = -1.#INF;
+float inf2 =  1.#INF;
+float inf3 = +1.#INF;

+ 1 - 0
3rdparty/glslang/Test/overlongLiteral.frag

@@ -0,0 +1 @@
+0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;

+ 7 - 0
3rdparty/glslang/Test/runtests

@@ -104,6 +104,13 @@ diff -b $BASEDIR/hlsl.explicitDescriptorSet.frag.out $TARGETDIR/hlsl.explicitDes
 $EXE -V -D -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb frag 3 > $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out
 diff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out || HASERROR=1
 
+#
+# Testing per-descriptor-set IO map shift
+#
+echo 'Testing per-descriptor-set IO map shift'
+$EXE -e main --hlsl-iomap --ssb 1 10 2 15 --stb 20 --stb 2 25 --suavb 30 --suavb 2 40 --sub 6 50 -i -q -D -V hlsl.shift.per-set.frag > $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1
+diff -b $BASEDIR/hlsl.shift.per-set.frag.out $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1
+
 #
 # Testing location error
 #

+ 8 - 0
3rdparty/glslang/Test/vulkan.frag

@@ -95,3 +95,11 @@ void callUserTexture()
 
     gl_NumSamples;   // ERROR, not for Vulkan
 }
+
+void noise()
+{
+    noise1(dv4);
+    noise2(4.0);
+    noise3(vec2(3));
+    noise4(dv4);
+}

+ 3 - 0
3rdparty/glslang/Test/vulkan.vert

@@ -58,3 +58,6 @@ out ban1 {                              // ERROR, only outer dimension
 out ban2 {
     float f;
 } bai2[arraySize][2];
+
+layout(binding = 3000) uniform sampler2D s3000;
+layout(binding = 3001) uniform b3001 { int a; };

+ 9 - 0
3rdparty/glslang/glslang/Include/arrays.h

@@ -264,6 +264,15 @@ struct TArraySizes {
 
         return false;
     }
+    bool clearInnerImplicit()
+    {
+        for (int d = 1; d < sizes.size(); ++d) {
+            if (sizes.getDimSize(d) == (unsigned)UnsizedArraySize)
+                setDimSize(d, 1);
+        }
+
+        return false;
+    }
     bool isInnerSpecialization() const
     {
         for (int d = 1; d < sizes.size(); ++d) {

+ 2 - 0
3rdparty/glslang/glslang/Include/intermediate.h

@@ -875,6 +875,8 @@ public:
     virtual bool isVector() const { return type.isVector(); }
     virtual bool isScalar() const { return type.isScalar(); }
     virtual bool isStruct() const { return type.isStruct(); }
+    virtual bool isFloatingDomain() const { return type.isFloatingDomain(); }
+    virtual bool isIntegerDomain() const { return type.isIntegerDomain(); }
     TString getCompleteString() const { return type.getCompleteString(); }
 
 protected:

+ 26 - 2
3rdparty/glslang/glslang/MachineIndependent/Constant.cpp

@@ -38,6 +38,7 @@
 #include <cmath>
 #include <cfloat>
 #include <cstdlib>
+#include <climits>
 
 namespace {
 
@@ -263,8 +264,31 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
         for (int i = 0; i < newComps; i++) {
             if (rightUnionArray[i] == 0)
                 newConstArray[i] = leftUnionArray[i];
-            else
-                newConstArray[i] = leftUnionArray[i] % rightUnionArray[i];
+            else {
+                switch (getType().getBasicType()) {
+                case EbtInt:
+                    if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == INT_MIN) {
+                        newConstArray[i].setIConst(0);
+                        break;
+                    } else goto modulo_default;
+
+                case EbtInt64:
+                    if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == LLONG_MIN) {
+                        newConstArray[i].setI64Const(0);
+                        break;
+                    } else goto modulo_default;
+#ifdef AMD_EXTENSIONS
+                case EbtInt16:
+                    if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == SHRT_MIN) {
+                        newConstArray[i].setIConst(0);
+                        break;
+                    } else goto modulo_default;
+#endif
+                default:
+                modulo_default:
+                    newConstArray[i] = leftUnionArray[i] % rightUnionArray[i];
+                }
+            }
         }
         break;
 

+ 2 - 2
3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp

@@ -1,7 +1,7 @@
 //
 // Copyright (C) 2002-2005  3Dlabs Inc. Ltd.
 // Copyright (C) 2012-2016 LunarG, Inc.
-// Copyright (C) 2015-2016 Google, Inc.
+// Copyright (C) 2015-2017 Google, Inc.
 //
 // All rights reserved.
 //
@@ -1384,7 +1384,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
     //
     // Noise functions.
     //
-    if (profile != EEsProfile) {
+    if (spvVersion.spv == 0 && profile != EEsProfile) {
         commonBuiltins.append(
             "float noise1(float x);"
             "float noise1(vec2  x);"

+ 16 - 0
3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp

@@ -3222,4 +3222,20 @@ void TIntermediate::performTextureUpgradeAndSamplerRemovalTransformation(TInterm
     root->traverse(&transform);
 }
 
+const char* TIntermediate::getResourceName(TResourceType res)
+{
+    switch (res) {
+    case EResSampler: return "shift-sampler-binding";
+    case EResTexture: return "shift-texture-binding";
+    case EResImage:   return "shift-image-binding";
+    case EResUbo:     return "shift-UBO-binding";
+    case EResSsbo:    return "shift-ssbo-binding";
+    case EResUav:     return "shift-uav-binding";
+    default:
+        assert(0); // internal error: should only be called with valid resource types.
+        return nullptr;
+    }
+}
+
+
 } // end namespace glslang

+ 10 - 7
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp

@@ -665,7 +665,8 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
     // leaving swizzles and struct/block dereferences.
 
     TIntermTyped* result = base;
-    if (base->getBasicType() != EbtVoid && (base->isVector() || base->isScalar())) {
+    if ((base->isVector() || base->isScalar()) &&
+        (base->isFloatingDomain() || base->isIntegerDomain() || base->getBasicType() == EbtBool)) {
         if (base->isScalar()) {
             const char* dotFeature = "scalar swizzle";
             requireProfile(loc, ~EEsProfile, dotFeature);
@@ -3001,7 +3002,7 @@ void TParseContext::structArrayCheck(const TSourceLoc& /*loc*/, const TType& typ
     }
 }
 
-void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qualifier, const TArraySizes* arraySizes, bool initializer, bool lastMember)
+void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qualifier, TArraySizes* arraySizes, bool initializer, bool lastMember)
 {
     assert(arraySizes);
 
@@ -3014,8 +3015,10 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
         return;
 
     // No environment allows any non-outer-dimension to be implicitly sized
-    if (arraySizes->isInnerImplicit())
+    if (arraySizes->isInnerImplicit()) {
         error(loc, "only outermost dimension of an array of arrays can be implicitly sized", "[]", "");
+        arraySizes->clearInnerImplicit();
+    }
 
     if (arraySizes->isInnerSpecialization())
         error(loc, "only outermost dimension of an array of arrays can be a specialization constant", "[]", "");
@@ -4460,8 +4463,8 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb
         switch (qualifier.storage) {
         case EvqVaryingIn:
         case EvqVaryingOut:
-            if (type.getBasicType() != EbtBlock || 
-                (!(*type.getStruct())[0].type->getQualifier().hasLocation() && 
+            if (type.getBasicType() != EbtBlock ||
+                (!(*type.getStruct())[0].type->getQualifier().hasLocation() &&
                   (*type.getStruct())[0].type->getQualifier().builtIn == EbvNone))
                 error(loc, "SPIR-V requires location for user input/output", "location", "");
             break;
@@ -4613,7 +4616,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
                 } else
                     lastBinding += type.getCumulativeArraySize();
             }
-            if (lastBinding >= resources.maxCombinedTextureImageUnits)
+            if (spvVersion.vulkan == 0 && lastBinding >= resources.maxCombinedTextureImageUnits)
                 error(loc, "sampler binding not less than gl_MaxCombinedTextureImageUnits", "binding", type.isArray() ? "(using array)" : "");
         }
         if (type.getBasicType() == EbtAtomicUint) {
@@ -4862,7 +4865,7 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol)
             // Check for overlap
             int numOffsets = 4;
             if (symbol.getType().isArray()) {
-                if (symbol.getType().isExplicitlySizedArray())
+                if (symbol.getType().isExplicitlySizedArray() && ! symbol.getType().getArraySizes()->isInnerImplicit())
                     numOffsets *= symbol.getType().getCumulativeArraySize();
                 else {
                     // "It is a compile-time error to declare an unsized array of atomic_uint."

+ 5 - 5
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h

@@ -210,10 +210,10 @@ protected:
                                       TSwizzleSelectors<TVectorSelector>&);
 
     // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
-    TVariable* globalUniformBlock;   // the actual block, inserted into the symbol table
-    unsigned int globalUniformBinding;
-    unsigned int globalUniformSet;
-    int firstNewMember;              // the index of the first member not yet inserted into the symbol table
+    TVariable* globalUniformBlock;     // the actual block, inserted into the symbol table
+    unsigned int globalUniformBinding; // the block's binding number
+    unsigned int globalUniformSet;     // the block's set number
+    int firstNewMember;                // the index of the first member not yet inserted into the symbol table
     // override this to set the language-specific name
     virtual const char* getGlobalUniformBlockName() const { return ""; }
     virtual void setUniformBlockDefaults(TType&) const { }
@@ -338,7 +338,7 @@ public:
     bool arrayError(const TSourceLoc&, const TType&);
     void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&);
     void structArrayCheck(const TSourceLoc&, const TType& structure);
-    void arraySizesCheck(const TSourceLoc&, const TQualifier&, const TArraySizes*, bool initializer, bool lastMember);
+    void arraySizesCheck(const TSourceLoc&, const TQualifier&, TArraySizes*, bool initializer, bool lastMember);
     void arrayOfArrayVersionCheck(const TSourceLoc&);
     void arrayDimCheck(const TSourceLoc&, const TArraySizes* sizes1, const TArraySizes* sizes2);
     void arrayDimCheck(const TSourceLoc&, const TType*, const TArraySizes*);

+ 19 - 9
3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp

@@ -1572,12 +1572,12 @@ namespace glslang {
 
 const char* GetEsslVersionString()
 {
-    return "OpenGL ES GLSL 3.00 glslang LunarG Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
+    return "OpenGL ES GLSL 3.20 glslang Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
 }
 
 const char* GetGlslVersionString()
 {
-    return "4.20 glslang LunarG Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
+    return "4.60 glslang Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
 }
 
 int GetKhronosToolId()
@@ -1661,20 +1661,30 @@ void TShader::addProcesses(const std::vector<std::string>& p)
     intermediate->addProcesses(p);
 }
 
+// Set binding base for given resource type
+void TShader::setShiftBinding(TResourceType res, unsigned int base) {
+    intermediate->setShiftBinding(res, base);
+}
+
+// Set binding base for given resource type for a given binding set.
+void TShader::setShiftBindingForSet(TResourceType res, unsigned int set, unsigned int base) {
+    intermediate->setShiftBindingForSet(res, set, base); 
+}
+
 // Set binding base for sampler types
-void TShader::setShiftSamplerBinding(unsigned int base) { intermediate->setShiftSamplerBinding(base); }
+void TShader::setShiftSamplerBinding(unsigned int base) { setShiftBinding(EResSampler, base); }
 // Set binding base for texture types (SRV)
-void TShader::setShiftTextureBinding(unsigned int base) { intermediate->setShiftTextureBinding(base); }
+void TShader::setShiftTextureBinding(unsigned int base) { setShiftBinding(EResTexture, base); }
 // Set binding base for image types
-void TShader::setShiftImageBinding(unsigned int base)   { intermediate->setShiftImageBinding(base); }
+void TShader::setShiftImageBinding(unsigned int base)   { setShiftBinding(EResImage, base); }
 // Set binding base for uniform buffer objects (CBV)
-void TShader::setShiftUboBinding(unsigned int base)     { intermediate->setShiftUboBinding(base); }
+void TShader::setShiftUboBinding(unsigned int base)     { setShiftBinding(EResUbo, base); }
 // Synonym for setShiftUboBinding, to match HLSL language.
-void TShader::setShiftCbufferBinding(unsigned int base) { intermediate->setShiftUboBinding(base); }
+void TShader::setShiftCbufferBinding(unsigned int base) { setShiftBinding(EResUbo, base); }
 // Set binding base for UAV (unordered access view)
-void TShader::setShiftUavBinding(unsigned int base)     { intermediate->setShiftUavBinding(base); }
+void TShader::setShiftUavBinding(unsigned int base)     { setShiftBinding(EResUav, base); }
 // Set binding base for SSBOs
-void TShader::setShiftSsboBinding(unsigned int base)    { intermediate->setShiftSsboBinding(base); }
+void TShader::setShiftSsboBinding(unsigned int base)    { setShiftBinding(EResSsbo, base); }
 // Enables binding automapping using TIoMapper
 void TShader::setAutoMapBindings(bool map)              { intermediate->setAutoMapBindings(map); }
 // Fragile: currently within one stage: simple auto-assignment of location

+ 66 - 64
3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp

@@ -351,16 +351,21 @@ private:
 // Base class for shared TIoMapResolver services, used by several derivations.
 struct TDefaultIoResolverBase : public glslang::TIoMapResolver
 {
-    int baseSamplerBinding;
-    int baseTextureBinding;
-    int baseImageBinding;
-    int baseUboBinding;
-    int baseSsboBinding;
-    int baseUavBinding;
-    std::vector<std::string> baseResourceSetBinding;
-    bool doAutoBindingMapping;
-    bool doAutoLocationMapping;
-    int nextUniformLocation;
+    TDefaultIoResolverBase(const TIntermediate &intermediate) :
+        intermediate(intermediate),
+        nextUniformLocation(0)
+    { }
+
+    int getBaseBinding(TResourceType res, unsigned int set) const {
+        return selectBaseBinding(intermediate.getShiftBinding(res), 
+                                 intermediate.getShiftBindingForSet(res, set));
+    }
+
+    const std::vector<std::string>& getResourceSetBinding() const { return intermediate.getResourceSetBinding(); }
+
+    bool doAutoBindingMapping() const { return intermediate.getAutoMapBindings(); }
+    bool doAutoLocationMapping() const { return intermediate.getAutoMapLocations(); }
+
     typedef std::vector<int> TSlotSet;
     typedef std::unordered_map<int, TSlotSet> TSlotSetMap;
     TSlotSetMap slots;
@@ -411,15 +416,15 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
             return type.getQualifier().layoutSet;
 
         // If a command line or API option requested a single descriptor set, use that (if not overrided by spaceN)
-        if (baseResourceSetBinding.size() == 1)
-            return atoi(baseResourceSetBinding[0].c_str());
+        if (getResourceSetBinding().size() == 1)
+            return atoi(getResourceSetBinding()[0].c_str());
 
         return 0;
     }
     int resolveUniformLocation(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
     {
         // kick out of not doing this
-        if (!doAutoLocationMapping)
+        if (!doAutoLocationMapping())
             return -1;
 
         // no locations added if already present, a built-in variable, a block, or an opaque
@@ -444,7 +449,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
     int resolveInOutLocation(EShLanguage /*stage*/, const char* /*name*/, const TType& type, bool /*is_live*/) override
     {
         // kick out of not doing this
-        if (!doAutoLocationMapping)
+        if (!doAutoLocationMapping())
             return -1;
 
         // no locations added if already present, or a built-in variable
@@ -485,6 +490,14 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
     void endResolve(EShLanguage) override {}
 
 protected:
+    const TIntermediate &intermediate;
+    int nextUniformLocation;
+
+    // Return descriptor set specific base if there is one, and the generic base otherwise.
+    int selectBaseBinding(int base, int descriptorSetBase) const {
+        return descriptorSetBase != -1 ? descriptorSetBase : base;
+    }
+
     static int getLayoutSet(const glslang::TType& type) {
         if (type.getQualifier().hasSet())
             return type.getQualifier().layoutSet;
@@ -518,6 +531,8 @@ protected:
  */
 struct TDefaultIoResolver : public TDefaultIoResolverBase
 {
+    TDefaultIoResolver(const TIntermediate &intermediate) : TDefaultIoResolverBase(intermediate) { }
+
     bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& /*type*/, bool /*is_live*/) override
     {
         return true;
@@ -529,37 +544,37 @@ struct TDefaultIoResolver : public TDefaultIoResolverBase
 
         if (type.getQualifier().hasBinding()) {
             if (isImageType(type))
-                return reserveSlot(set, baseImageBinding + type.getQualifier().layoutBinding);
+                return reserveSlot(set, getBaseBinding(EResImage, set) + type.getQualifier().layoutBinding);
 
             if (isTextureType(type))
-                return reserveSlot(set, baseTextureBinding + type.getQualifier().layoutBinding);
+                return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding);
 
             if (isSsboType(type))
-                return reserveSlot(set, baseSsboBinding + type.getQualifier().layoutBinding);
+                return reserveSlot(set, getBaseBinding(EResSsbo, set) + type.getQualifier().layoutBinding);
 
             if (isSamplerType(type))
-                return reserveSlot(set, baseSamplerBinding + type.getQualifier().layoutBinding);
+                return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding);
 
             if (isUboType(type))
-                return reserveSlot(set, baseUboBinding + type.getQualifier().layoutBinding);
-        } else if (is_live && doAutoBindingMapping) {
+                return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding);
+        } else if (is_live && doAutoBindingMapping()) {
             // find free slot, the caller did make sure it passes all vars with binding
             // first and now all are passed that do not have a binding and needs one
 
             if (isImageType(type))
-                return getFreeSlot(set, baseImageBinding);
+                return getFreeSlot(set, getBaseBinding(EResImage, set));
 
             if (isTextureType(type))
-                return getFreeSlot(set, baseTextureBinding);
+                return getFreeSlot(set, getBaseBinding(EResTexture, set));
 
             if (isSsboType(type))
-                return getFreeSlot(set, baseSsboBinding);
+                return getFreeSlot(set, getBaseBinding(EResSsbo, set));
 
             if (isSamplerType(type))
-                return getFreeSlot(set, baseSamplerBinding);
+                return getFreeSlot(set, getBaseBinding(EResSampler, set));
 
             if (isUboType(type))
-                return getFreeSlot(set, baseUboBinding);
+                return getFreeSlot(set, getBaseBinding(EResUbo, set));
         }
 
         return -1;
@@ -620,6 +635,8 @@ b – for constant buffer views (CBV)
  ********************************************************************************/
 struct TDefaultHlslIoResolver : public TDefaultIoResolverBase
 {
+    TDefaultHlslIoResolver(const TIntermediate &intermediate) : TDefaultIoResolverBase(intermediate) { }
+
     bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& /*type*/, bool /*is_live*/) override
     {
         return true;
@@ -631,31 +648,31 @@ struct TDefaultHlslIoResolver : public TDefaultIoResolverBase
 
         if (type.getQualifier().hasBinding()) {
             if (isUavType(type))
-                return reserveSlot(set, baseUavBinding + type.getQualifier().layoutBinding);
+                return reserveSlot(set, getBaseBinding(EResUav, set) + type.getQualifier().layoutBinding);
 
             if (isSrvType(type))
-                return reserveSlot(set, baseTextureBinding + type.getQualifier().layoutBinding);
+                return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding);
 
             if (isSamplerType(type))
-                return reserveSlot(set, baseSamplerBinding + type.getQualifier().layoutBinding);
+                return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding);
 
             if (isUboType(type))
-                return reserveSlot(set, baseUboBinding + type.getQualifier().layoutBinding);
-        } else if (is_live && doAutoBindingMapping) {
+                return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding);
+        } else if (is_live && doAutoBindingMapping()) {
             // find free slot, the caller did make sure it passes all vars with binding
             // first and now all are passed that do not have a binding and needs one
 
             if (isUavType(type))
-                return getFreeSlot(set, baseUavBinding);
+                return getFreeSlot(set, getBaseBinding(EResUav, set));
 
             if (isSrvType(type))
-                return getFreeSlot(set, baseTextureBinding);
+                return getFreeSlot(set, getBaseBinding(EResTexture, set));
 
             if (isSamplerType(type))
-                return getFreeSlot(set, baseSamplerBinding);
+                return getFreeSlot(set, getBaseBinding(EResSampler, set));
 
             if (isUboType(type))
-                return getFreeSlot(set, baseUboBinding);
+                return getFreeSlot(set, getBaseBinding(EResUbo, set));
         }
 
         return -1;
@@ -684,17 +701,17 @@ protected:
 // Returns false if the input is too malformed to do this.
 bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSink &infoSink, TIoMapResolver *resolver)
 {
-    // Trivial return if there is nothing to do.
-    if (intermediate.getShiftSamplerBinding() == 0 &&
-        intermediate.getShiftTextureBinding() == 0 &&
-        intermediate.getShiftImageBinding() == 0 &&
-        intermediate.getShiftUboBinding() == 0 &&
-        intermediate.getShiftSsboBinding() == 0 &&
-        intermediate.getShiftUavBinding() == 0 &&
-        intermediate.getResourceSetBinding().empty() &&
-        intermediate.getAutoMapBindings() == false &&
-        intermediate.getAutoMapLocations() == false &&
-        resolver == nullptr)
+    bool somethingToDo = !intermediate.getResourceSetBinding().empty() ||
+        intermediate.getAutoMapBindings() ||
+        intermediate.getAutoMapLocations();
+
+    for (int res = 0; res < EResCount; ++res) {
+        somethingToDo = somethingToDo ||
+            (intermediate.getShiftBinding(TResourceType(res)) != 0) ||
+            intermediate.hasShiftBindingForSet(TResourceType(res));
+    }
+
+    if (!somethingToDo && resolver == nullptr)
         return true;
 
     if (intermediate.getNumEntryPoints() != 1 || intermediate.isRecursive())
@@ -705,30 +722,15 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
         return false;
 
     // if no resolver is provided, use the default resolver with the given shifts and auto map settings
-    TDefaultIoResolver defaultResolver;
-    TDefaultHlslIoResolver defaultHlslResolver;
+    TDefaultIoResolver defaultResolver(intermediate);
+    TDefaultHlslIoResolver defaultHlslResolver(intermediate);
 
     if (resolver == nullptr) {
-        TDefaultIoResolverBase* resolverBase;
-
         // TODO: use a passed in IO mapper for this
         if (intermediate.usingHlslIoMapping())
-            resolverBase = &defaultHlslResolver;
+            resolver = &defaultHlslResolver;
         else
-            resolverBase = &defaultResolver;
-
-        resolverBase->baseSamplerBinding = intermediate.getShiftSamplerBinding();
-        resolverBase->baseTextureBinding = intermediate.getShiftTextureBinding();
-        resolverBase->baseImageBinding = intermediate.getShiftImageBinding();
-        resolverBase->baseUboBinding = intermediate.getShiftUboBinding();
-        resolverBase->baseSsboBinding = intermediate.getShiftSsboBinding();
-        resolverBase->baseUavBinding = intermediate.getShiftUavBinding();
-        resolverBase->baseResourceSetBinding = intermediate.getResourceSetBinding();
-        resolverBase->doAutoBindingMapping = intermediate.getAutoMapBindings();
-        resolverBase->doAutoLocationMapping = intermediate.getAutoMapLocations();
-        resolverBase->nextUniformLocation = 0;
-
-        resolver = resolverBase;
+            resolver = &defaultResolver;
     }
 
     TVarLiveMap inVarMap, outVarMap, uniformVarMap;

+ 37 - 42
3rdparty/glslang/glslang/MachineIndependent/localintermediate.h

@@ -42,6 +42,7 @@
 
 #include <algorithm>
 #include <set>
+#include <array>
 
 class TInfoSink;
 
@@ -221,12 +222,6 @@ public:
         layoutOverrideCoverage(false),
         geoPassthroughEXT(false),
 #endif
-        shiftSamplerBinding(0),
-        shiftTextureBinding(0),
-        shiftImageBinding(0),
-        shiftUboBinding(0),
-        shiftSsboBinding(0),
-        shiftUavBinding(0),
         autoMapBindings(false),
         autoMapLocations(false),
         flattenUniformArrays(false),
@@ -244,6 +239,8 @@ public:
         localSizeSpecId[1] = TQualifier::layoutNotSet;
         localSizeSpecId[2] = TQualifier::layoutNotSet;
         xfbBuffers.resize(TQualifier::layoutXfbBufferEnd);
+
+        shiftBinding.fill(0);
     }
     void setLimits(const TBuiltInResource& r) { resources = r; }
 
@@ -263,42 +260,39 @@ public:
     const std::string& getEntryPointName() const { return entryPointName; }
     const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
 
-    void setShiftSamplerBinding(unsigned int shift)
-    {
-        shiftSamplerBinding = shift;
-        processes.addIfNonZero("shift-sampler-binding", shift);
-    }
-    unsigned int getShiftSamplerBinding() const { return shiftSamplerBinding; }
-    void setShiftTextureBinding(unsigned int shift)
-    {
-        shiftTextureBinding = shift;
-        processes.addIfNonZero("shift-texture-binding", shift);
-    }
-    unsigned int getShiftTextureBinding() const { return shiftTextureBinding; }
-    void setShiftImageBinding(unsigned int shift)
+    void setShiftBinding(TResourceType res, unsigned int shift)
     {
-        shiftImageBinding = shift;
-        processes.addIfNonZero("shift-image-binding", shift);
-    }
-    unsigned int getShiftImageBinding() const { return shiftImageBinding; }
-    void setShiftUboBinding(unsigned int shift)
-    {
-        shiftUboBinding = shift;
-        processes.addIfNonZero("shift-UBO-binding", shift);
+        shiftBinding[res] = shift;
+
+        const char* name = getResourceName(res);
+        if (name != nullptr)
+            processes.addIfNonZero(name, shift);
     }
-    unsigned int getShiftUboBinding() const { return shiftUboBinding; }
-    void setShiftSsboBinding(unsigned int shift)
+
+    unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; }
+
+    void setShiftBindingForSet(TResourceType res, unsigned int set, unsigned int shift)
     {
-        shiftSsboBinding = shift;
-        processes.addIfNonZero("shift-ssbo-binding", shift);
+        if (shift == 0) // ignore if there's no shift: it's a no-op.
+            return;
+
+        shiftBindingForSet[res][set] = shift;
+
+        const char* name = getResourceName(res);
+        if (name != nullptr) {
+            processes.addProcess(name);
+            processes.addArgument(set);
+            processes.addArgument(shift);
+        }
     }
-    unsigned int getShiftSsboBinding() const { return shiftSsboBinding; }
-    void setShiftUavBinding(unsigned int shift)
+
+    int getShiftBindingForSet(TResourceType res, unsigned int set) const
     {
-        shiftUavBinding = shift;
-        processes.addIfNonZero("shift-uav-binding", shift);
+        const auto shift = shiftBindingForSet[res].find(set);
+        return shift == shiftBindingForSet[res].end() ? -1 : shift->second;
     }
-    unsigned int getShiftUavBinding() const { return shiftUavBinding; }
+    bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); }
+
     void setResourceSetBinding(const std::vector<std::string>& shift)
     {
         resourceSetBinding = shift;
@@ -638,6 +632,7 @@ protected:
     void pushSelector(TIntermSequence&, const TMatrixSelector&, const TSourceLoc&);
     bool specConstantPropagates(const TIntermTyped&, const TIntermTyped&);
     void performTextureUpgradeAndSamplerRemovalTransformation(TIntermNode* root);
+    static const char* getResourceName(TResourceType);
 
     const EShLanguage language;  // stage, known at construction time
     EShSource source;            // source language, known a bit later
@@ -678,12 +673,12 @@ protected:
     bool geoPassthroughEXT;
 #endif
 
-    unsigned int shiftSamplerBinding;
-    unsigned int shiftTextureBinding;
-    unsigned int shiftImageBinding;
-    unsigned int shiftUboBinding;
-    unsigned int shiftSsboBinding;
-    unsigned int shiftUavBinding;
+    // Base shift values
+    std::array<unsigned int, EResCount> shiftBinding;
+
+    // Per-descriptor-set shift values
+    std::array<std::map<int, int>, EResCount>  shiftBindingForSet;
+
     std::vector<std::string> resourceSetBinding;
     bool autoMapBindings;
     bool autoMapLocations;

+ 2 - 4
3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp

@@ -352,7 +352,7 @@ namespace {
     int op_sub(int a, int b) { return a - b; }
     int op_mul(int a, int b) { return a * b; }
     int op_div(int a, int b) { return a == INT_MIN && b == -1 ? 0 : a / b; }
-    int op_mod(int a, int b) { return a % b; }
+    int op_mod(int a, int b) { return a == INT_MIN && b == -1 ? 0 : a % b; }
     int op_pos(int a) { return a; }
     int op_neg(int a) { return -a; }
     int op_cmpl(int a) { return ~a; }
@@ -1157,7 +1157,6 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
     }
 
     MacroSymbol* macro = macroAtom == 0 ? nullptr : lookupMacroDef(macroAtom);
-    int token;
     int depth = 0;
 
     // no recursive expansions
@@ -1179,13 +1178,12 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
     TSourceLoc loc = ppToken->loc;  // in case we go to the next line before discovering the error
     in->mac = macro;
     if (macro->args.size() > 0 || macro->emptyArgs) {
-        token = scanToken(ppToken);
+        int token = scanToken(ppToken);
         if (newLineOkay) {
             while (token == '\n')
                 token = scanToken(ppToken);
         }
         if (token != '(') {
-            parseContext.ppError(loc, "expected '(' following", "macro expansion", atomStrings.getString(macroAtom));
             UngetToken(token, ppToken);
             delete in;
             return 0;

+ 6 - 3
3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp

@@ -128,7 +128,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
         ch = getChar();
 
         // 1.#INF or -1.#INF
-        if (ch == '#') {
+        if (parseContext.intermediate.getSource() == EShSourceHlsl && ch == '#') {
             if ((len <  2) ||
                 (len == 2 && ppToken->name[0] != '1') ||
                 (len == 3 && ppToken->name[1] != '1' && !(ppToken->name[0] == '-' || ppToken->name[0] == '+')) ||
@@ -420,7 +420,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
 
                     ival = 0;
                     do {
-                        if (ival <= 0x0fffffffu || (enableInt64 && ival <= 0x0fffffffffffffffull)) {
+                        if (len < MaxTokenLength && (ival <= 0x0fffffffu || (enableInt64 && ival <= 0x0fffffffffffffffull))) {
                             ppToken->name[len++] = (char)ch;
                             if (ch >= '0' && ch <= '9') {
                                 ii = ch - '0';
@@ -433,7 +433,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                             ival = (ival << 4) | ii;
                         } else {
                             if (! AlreadyComplained) {
-                                pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too big", "", "");
+                                if(len < MaxTokenLength)
+                                    pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too big", "", "");
+                                else
+                                    pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too long", "", "");
                                 AlreadyComplained = 1;
                             }
                             ival = 0xffffffffffffffffull;

+ 22 - 7
3rdparty/glslang/glslang/Public/ShaderLang.h

@@ -324,6 +324,17 @@ bool InitializeProcess();
 // Call once per process to tear down everything
 void FinalizeProcess();
 
+// Resource type for IO resolver
+enum TResourceType {
+    EResSampler,
+    EResTexture,
+    EResImage,
+    EResUbo,
+    EResSsbo,
+    EResUav,
+    EResCount
+};
+
 // Make one TShader per shader that you will link into a program.  Then provide
 // the shader through setStrings() or setStringsWithLengths(), then call parse(),
 // then query the info logs.
@@ -347,13 +358,17 @@ public:
     void setEntryPoint(const char* entryPoint);
     void setSourceEntryPoint(const char* sourceEntryPointName);
     void addProcesses(const std::vector<std::string>&);
-    void setShiftSamplerBinding(unsigned int base);
-    void setShiftTextureBinding(unsigned int base);
-    void setShiftImageBinding(unsigned int base);
-    void setShiftUboBinding(unsigned int base);
-    void setShiftUavBinding(unsigned int base);
-    void setShiftCbufferBinding(unsigned int base); // synonym for setShiftUboBinding
-    void setShiftSsboBinding(unsigned int base);
+
+    // IO resolver binding data: see comments in ShaderLang.cpp
+    void setShiftBinding(TResourceType res, unsigned int base);
+    void setShiftSamplerBinding(unsigned int base);  // DEPRECATED: use setShiftBinding
+    void setShiftTextureBinding(unsigned int base);  // DEPRECATED: use setShiftBinding
+    void setShiftImageBinding(unsigned int base);    // DEPRECATED: use setShiftBinding
+    void setShiftUboBinding(unsigned int base);      // DEPRECATED: use setShiftBinding
+    void setShiftUavBinding(unsigned int base);      // DEPRECATED: use setShiftBinding
+    void setShiftCbufferBinding(unsigned int base);  // synonym for setShiftUboBinding
+    void setShiftSsboBinding(unsigned int base);     // DEPRECATED: use setShiftBinding
+    void setShiftBindingForSet(TResourceType res, unsigned int set, unsigned int base);
     void setResourceSetBinding(const std::vector<std::string>& base);
     void setAutoMapBindings(bool map);
     void setAutoMapLocations(bool map);

+ 4 - 0
3rdparty/glslang/gtests/AST.FromFile.cpp

@@ -84,6 +84,7 @@ INSTANTIATE_TEST_CASE_P(
         "cppBad2.vert",
         "cppComplexExpr.vert",
         "cppDeepNest.frag",
+        "cppPassMacroName.frag",
         "badChars.frag",
         "pointCoord.frag",
         "array.frag",
@@ -115,6 +116,7 @@ INSTANTIATE_TEST_CASE_P(
         "330comp.frag",
         "constErrors.frag",
         "constFold.frag",
+        "constFoldIntMin.frag",
         "errors.frag",
         "forwardRef.frag",
         "uint.frag",
@@ -159,6 +161,7 @@ INSTANTIATE_TEST_CASE_P(
         "460.vert",
         "dce.frag",
         "atomic_uint.frag",
+        "implicitInnerAtomicUint.frag",
         "aggOps.frag",
         "always-discard.frag",
         "always-discard2.frag",
@@ -183,6 +186,7 @@ INSTANTIATE_TEST_CASE_P(
         "matrix2.frag",
         "newTexture.frag",
         "Operations.frag",
+        "overlongLiteral.frag",
         "prepost.frag",
         "simpleFunctionCall.frag",
         "structAssignment.frag",

+ 4 - 4
3rdparty/glslang/hlsl/hlslParseHelper.cpp

@@ -1,6 +1,6 @@
 //
-// Copyright (C) 2016 Google, Inc.
-// Copyright (C) 2016 LunarG, Inc.
+// Copyright (C) 2017 Google, Inc.
+// Copyright (C) 2017 LunarG, Inc.
 //
 // All rights reserved.
 //
@@ -1157,8 +1157,8 @@ bool HlslParseContext::shouldFlatten(const TType& type, TStorageQualifier qualif
     case EvqVaryingOut:
         return type.isStruct() || type.isArray();
     case EvqUniform:
-        return type.isArray() && intermediate.getFlattenUniformArrays() && topLevel ||
-               type.isStruct() && type.containsOpaque();
+        return (type.isArray() && intermediate.getFlattenUniformArrays() && topLevel) ||
+               (type.isStruct() && type.containsOpaque());
     default:
         return type.isStruct() && type.containsOpaque();
     };

+ 1 - 1
3rdparty/glslang/known_good.json

@@ -5,7 +5,7 @@
       "site" : "github",
       "subrepo" : "KhronosGroup/SPIRV-Tools",
       "subdir" : "External/spirv-tools",
-      "commit" : "1a9061a2be884eed0e518ac19866246a5c9babc0"
+      "commit" : "5834719fc17d4735fce0102738b87b70255cfd5f"
     },
     {
       "name" : "spirv-tools/external/spirv-headers",

+ 1 - 1
3rdparty/glslang/update_glslang_sources.py

@@ -141,7 +141,7 @@ def main():
 
     # Create the subdirectories in sorted order so that parent git repositories
     # are created first.
-    for c in sorted(commits, cmp=lambda x,y: cmp(x.subdir, y.subdir)):
+    for c in sorted(commits, key=lambda x: x.subdir):
         print('Get {n}\n'.format(n=c.name))
         c.Checkout()
     sys.exit(0)