Бранимир Караџић пре 6 година
родитељ
комит
cf5bf3c0e5
100 измењених фајлова са 10314 додато и 3790 уклоњено
  1. 44 11
      3rdparty/glslang/CMakeLists.txt
  2. 25 2
      3rdparty/glslang/README.md
  3. 3 13
      3rdparty/glslang/SPIRV/CMakeLists.txt
  4. 245 186
      3rdparty/glslang/SPIRV/GlslangToSpv.cpp
  5. 4 0
      3rdparty/glslang/SPIRV/Logger.cpp
  6. 9 0
      3rdparty/glslang/SPIRV/Logger.h
  7. 58 22
      3rdparty/glslang/SPIRV/SpvBuilder.cpp
  8. 13 1
      3rdparty/glslang/SPIRV/SpvBuilder.h
  9. 0 8
      3rdparty/glslang/SPIRV/SpvPostProcess.cpp
  10. 3 1
      3rdparty/glslang/SPIRV/SpvTools.h
  11. 1 30
      3rdparty/glslang/SPIRV/disassemble.cpp
  12. 0 38
      3rdparty/glslang/SPIRV/doc.cpp
  13. 0 4
      3rdparty/glslang/StandAlone/ResourceLimits.cpp
  14. 27 15
      3rdparty/glslang/StandAlone/StandAlone.cpp
  15. 43 0
      3rdparty/glslang/Test/310.inheritMemory.frag
  16. 57 57
      3rdparty/glslang/Test/baseResults/310.comp.out
  17. 229 0
      3rdparty/glslang/Test/baseResults/310.inheritMemory.frag.out
  18. 7 7
      3rdparty/glslang/Test/baseResults/430.comp.out
  19. 3 1
      3rdparty/glslang/Test/baseResults/glspv.vert.out
  20. 1 1
      3rdparty/glslang/Test/baseResults/hlsl.depthGreater.frag.out
  21. 1 1
      3rdparty/glslang/Test/baseResults/hlsl.depthLess.frag.out
  22. 1 1
      3rdparty/glslang/Test/baseResults/hlsl.structIoFourWay.frag.out
  23. 7 7
      3rdparty/glslang/Test/baseResults/link1.vk.frag.out
  24. 1 0
      3rdparty/glslang/Test/baseResults/size
  25. 2 2
      3rdparty/glslang/Test/baseResults/specExamples.vert.out
  26. 2 2
      3rdparty/glslang/Test/baseResults/specExamplesConf.vert.out
  27. 2 2
      3rdparty/glslang/Test/baseResults/spv.coopmat.comp.out
  28. 2 1
      3rdparty/glslang/Test/baseResults/spv.debugInfo.1.1.frag.out
  29. 1 1
      3rdparty/glslang/Test/baseResults/spv.depthOut.frag.out
  30. 2 2
      3rdparty/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out
  31. 2 2
      3rdparty/glslang/Test/baseResults/spv.hlslOffsets.vert.out
  32. 102 0
      3rdparty/glslang/Test/baseResults/web.array.frag.out
  33. 65 0
      3rdparty/glslang/Test/baseResults/web.basic.vert.out
  34. 149 0
      3rdparty/glslang/Test/baseResults/web.builtins.frag.out
  35. 62 0
      3rdparty/glslang/Test/baseResults/web.builtins.vert.out
  36. 347 0
      3rdparty/glslang/Test/baseResults/web.controlFlow.frag.out
  37. 321 0
      3rdparty/glslang/Test/baseResults/web.operations.frag.out
  38. 396 0
      3rdparty/glslang/Test/baseResults/web.texture.frag.out
  39. 2 2
      3rdparty/glslang/Test/link1.vk.frag
  40. 2 2
      3rdparty/glslang/Test/link2.vk.frag
  41. 3 3
      3rdparty/glslang/Test/runtests
  42. 1 1
      3rdparty/glslang/Test/spv.hlslOffsets.vert
  43. 2 2
      3rdparty/glslang/Test/vulkan.vert
  44. 26 0
      3rdparty/glslang/Test/web.array.frag
  45. 15 0
      3rdparty/glslang/Test/web.basic.vert
  46. 58 0
      3rdparty/glslang/Test/web.builtins.frag
  47. 14 0
      3rdparty/glslang/Test/web.builtins.vert
  48. 91 0
      3rdparty/glslang/Test/web.controlFlow.frag
  49. 73 0
      3rdparty/glslang/Test/web.operations.frag
  50. 38 0
      3rdparty/glslang/Test/web.runtests
  51. 7 0
      3rdparty/glslang/Test/web.testlist
  52. 77 0
      3rdparty/glslang/Test/web.texture.frag
  53. 1 0
      3rdparty/glslang/_config.yml
  54. 14 9
      3rdparty/glslang/glslang/CMakeLists.txt
  55. 16 26
      3rdparty/glslang/glslang/Include/BaseTypes.h
  56. 132 96
      3rdparty/glslang/glslang/Include/ConstantUnion.h
  57. 277 180
      3rdparty/glslang/glslang/Include/Types.h
  58. 27 47
      3rdparty/glslang/glslang/Include/intermediate.h
  59. 1 1
      3rdparty/glslang/glslang/Include/revision.h
  60. 89 78
      3rdparty/glslang/glslang/MachineIndependent/Constant.cpp
  61. 380 520
      3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp
  62. 2 0
      3rdparty/glslang/glslang/MachineIndependent/Initialize.h
  63. 265 228
      3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp
  64. 14 10
      3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp
  65. 145 137
      3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp
  66. 16 4
      3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h
  67. 216 238
      3rdparty/glslang/glslang/MachineIndependent/Scan.cpp
  68. 57 17
      3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp
  69. 22 16
      3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp
  70. 13 0
      3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h
  71. 68 82
      3rdparty/glslang/glslang/MachineIndependent/Versions.cpp
  72. 0 5
      3rdparty/glslang/glslang/MachineIndependent/Versions.h
  73. 4 1
      3rdparty/glslang/glslang/MachineIndependent/attribute.cpp
  74. 0 4
      3rdparty/glslang/glslang/MachineIndependent/gl_types.h
  75. 3787 0
      3rdparty/glslang/glslang/MachineIndependent/glslang.m4
  76. 331 293
      3rdparty/glslang/glslang/MachineIndependent/glslang.y
  77. 519 517
      3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp
  78. 407 407
      3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h
  79. 5 25
      3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp
  80. 15 4
      3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp
  81. 5 1
      3rdparty/glslang/glslang/MachineIndependent/iomapper.h
  82. 2 0
      3rdparty/glslang/glslang/MachineIndependent/limits.cpp
  83. 45 80
      3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp
  84. 305 253
      3rdparty/glslang/glslang/MachineIndependent/localintermediate.h
  85. 97 21
      3rdparty/glslang/glslang/MachineIndependent/parseVersions.h
  86. 10 7
      3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp
  87. 11 12
      3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp
  88. 2 0
      3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp
  89. 5 1
      3rdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp
  90. 7 11
      3rdparty/glslang/glslang/MachineIndependent/reflection.cpp
  91. 4 0
      3rdparty/glslang/glslang/MachineIndependent/reflection.h
  92. 16 4
      3rdparty/glslang/glslang/Public/ShaderLang.h
  93. 270 0
      3rdparty/glslang/glslang/glslang.js.cpp
  94. 45 0
      3rdparty/glslang/glslang/glslang.pre.js
  95. 14 1
      3rdparty/glslang/glslang/updateGrammar
  96. 1 6
      3rdparty/glslang/gtests/AST.FromFile.cpp
  97. 0 12
      3rdparty/glslang/gtests/Spv.FromFile.cpp
  98. 0 2
      3rdparty/glslang/gtests/TestFixture.cpp
  99. 6 0
      3rdparty/glslang/gtests/TestFixture.h
  100. 0 6
      3rdparty/glslang/hlsl/hlslParseHelper.cpp

+ 44 - 11
3rdparty/glslang/CMakeLists.txt

@@ -9,6 +9,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 # Adhere to GNU filesystem layout conventions
 include(GNUInstallDirs)
 
+# Needed for CMAKE_DEPENDENT_OPTION macro
+include(CMakeDependentOption)
+
 option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
 
 set(LIB_TYPE STATIC)
@@ -23,12 +26,13 @@ if(NOT ${SKIP_GLSLANG_INSTALL})
 endif()
 option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON)
 
-option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" ON)
 option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON)
 
-option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
+option(ENABLE_GLSLANG_WEB "Reduces glslang to minumum needed for web use" OFF)
+option(ENABLE_EMSCRIPTEN_SINGLE_FILE "If using emscripten, enables SINGLE_FILE build" OFF)
+option(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE "If using emscripten, builds to run on Node instead of Web" OFF)
 
-option(ENABLE_HLSL "Enables HLSL input support" ON)
+CMAKE_DEPENDENT_OPTION(ENABLE_HLSL "Enables HLSL input support" ON "NOT ENABLE_GLSLANG_WEB" OFF)
 
 option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
 
@@ -60,18 +64,14 @@ project(glslang)
 # make testing optional
 include(CTest)
 
-if(ENABLE_AMD_EXTENSIONS)
-    add_definitions(-DAMD_EXTENSIONS)
-endif(ENABLE_AMD_EXTENSIONS)
-
-if(ENABLE_NV_EXTENSIONS)
-    add_definitions(-DNV_EXTENSIONS)
-endif(ENABLE_NV_EXTENSIONS)
-
 if(ENABLE_HLSL)
     add_definitions(-DENABLE_HLSL)
 endif(ENABLE_HLSL)
 
+if(ENABLE_GLSLANG_WEB)
+    add_definitions(-DGLSLANG_WEB)
+endif(ENABLE_GLSLANG_WEB)
+
 if(WIN32)
     set(CMAKE_DEBUG_POSTFIX "d")
     if(MSVC)
@@ -98,6 +98,39 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
     add_compile_options(/GR-) # Disable RTTI
 endif()
 
+if(ENABLE_GLSLANG_WEB)
+    if(EMSCRIPTEN)
+        add_compile_options(-Os -fno-exceptions)
+        add_compile_options("SHELL: -s WASM=1")
+        add_compile_options("SHELL: -s WASM_OBJECT_FILES=0")
+        add_link_options(-Os)
+        add_link_options("SHELL: -s FILESYSTEM=0")
+        add_link_options("SHELL: --llvm-lto 1")
+        add_link_options("SHELL: --closure 1")
+        add_link_options("SHELL: -s ALLOW_MEMORY_GROWTH=1")
+
+        add_link_options("SHELL: -s MODULARIZE=1")
+        if(ENABLE_EMSCRIPTEN_SINGLE_FILE)
+            add_link_options("SHELL: -s SINGLE_FILE=1")
+        endif(ENABLE_EMSCRIPTEN_SINGLE_FILE)
+
+        if(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE)
+            add_link_options("SHELL: -s ENVIRONMENT=node")
+            add_link_options("SHELL: -s BINARYEN_ASYNC_COMPILATION=0")
+        else()
+            add_link_options("SHELL: -s ENVIRONMENT=web,worker")
+            add_link_options("SHELL: -s EXPORT_ES6=1")
+        endif()
+    else()
+      if(MSVC)
+        add_compile_options(/Os /GR-)
+      else()
+        add_compile_options(-Os -fno-exceptions)
+        add_link_options(-Os)
+      endif()
+    endif(EMSCRIPTEN)
+endif(ENABLE_GLSLANG_WEB)
+
 # Request C++11
 if(${CMAKE_VERSION} VERSION_LESS 3.1)
     # CMake versions before 3.1 do not understand CMAKE_CXX_STANDARD

+ 25 - 2
3rdparty/glslang/README.md

@@ -155,13 +155,36 @@ changes are quite infrequent. For windows you can get binaries from
 The command to rebuild is:
 
 ```bash
+m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y
 bison --defines=MachineIndependent/glslang_tab.cpp.h
       -t MachineIndependent/glslang.y
       -o MachineIndependent/glslang_tab.cpp
 ```
 
-The above command is also available in the bash script at
-`glslang/updateGrammar`.
+The above commands are also available in the bash script in `updateGrammar`,
+when executed from the glslang subdirectory of the glslang repository.
+With no arguments it builds the full grammar, and with a "web" argument,
+the web grammar subset (see more about the web subset in the next section).
+
+### WASM for the the Web
+
+Use the steps in [Build Steps](#build-steps), which following notes/exceptions:
+* For building the web subset of core glslang:
+  + `m4` also needs a `-DGLSLANG_WEB` argument, or simply execute `updateGrammar web` from the glslang subdirectory
+  + turn off the CMAKE options for `BUILD_TESTING`, `ENABLE_OPT`, and `INSTALL_GTEST`,
+    while turning on `ENABLE_GLSLANG_WEB`
+* `emsdk` needs to be present in your executable search path, *PATH* for
+  Bash-like enivironments
+  + Instructions located
+    [here](https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install)
+* Do not checkout SPIRV-Tools into `External`
+  + Does not work correctly with emscripten out of the box and we don't want it
+    in the build anyway. *TBD* Have build ignore SPIRV-Tools for web build
+* Wrap call to `cmake` using `emconfigure` with ENABLE_GLSLANG_WEB=ON:
+  + e.g. For Linux, `emconfigure cmake -DCMAKE_BUILD_TYPE=Release
+    -DENABLE_GLSLANG_WEB=ON -DCMAKE_INSTALL_PREFIX="$(pwd)/install" ..`
+* To get a 'true' minimized build, make sure to use `brotli` to compress the .js
+  and .wasm files
 
 Testing
 -------

+ 3 - 13
3rdparty/glslang/SPIRV/CMakeLists.txt

@@ -25,24 +25,14 @@ set(HEADERS
     spvIR.h
     doc.h
     SpvTools.h
-    disassemble.h)
+    disassemble.h
+    GLSL.ext.AMD.h
+    GLSL.ext.NV.h)
 
 set(SPVREMAP_HEADERS
     SPVRemapper.h
     doc.h)
 
-if(ENABLE_AMD_EXTENSIONS)
-    list(APPEND
-         HEADERS
-         GLSL.ext.AMD.h)
-endif(ENABLE_AMD_EXTENSIONS)
-
-if(ENABLE_NV_EXTENSIONS)
-    list(APPEND
-         HEADERS
-         GLSL.ext.NV.h)
-endif(ENABLE_NV_EXTENSIONS)
-
 add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
 set_property(TARGET SPIRV PROPERTY FOLDER glslang)
 set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)

Разлика између датотеке није приказан због своје велике величине
+ 245 - 186
3rdparty/glslang/SPIRV/GlslangToSpv.cpp


+ 4 - 0
3rdparty/glslang/SPIRV/Logger.cpp

@@ -32,6 +32,8 @@
 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 // POSSIBILITY OF SUCH DAMAGE.
 
+#ifndef GLSLANG_WEB
+
 #include "Logger.h"
 
 #include <algorithm>
@@ -66,3 +68,5 @@ std::string SpvBuildLogger::getAllMessages() const {
 }
 
 } // end spv namespace
+
+#endif

+ 9 - 0
3rdparty/glslang/SPIRV/Logger.h

@@ -46,6 +46,14 @@ class SpvBuildLogger {
 public:
     SpvBuildLogger() {}
 
+#ifdef GLSLANG_WEB
+    void tbdFunctionality(const std::string& f) { }
+    void missingFunctionality(const std::string& f) { }
+    void warning(const std::string& w) { }
+    void error(const std::string& e) { errors.push_back(e); }
+    std::string getAllMessages() { return ""; }
+#else
+
     // Registers a TBD functionality.
     void tbdFunctionality(const std::string& f);
     // Registers a missing functionality.
@@ -59,6 +67,7 @@ public:
     // Returns all messages accumulated in the order of:
     // TBD functionalities, missing functionalities, warnings, errors.
     std::string getAllMessages() const;
+#endif
 
 private:
     SpvBuildLogger(const SpvBuildLogger&);

+ 58 - 22
3rdparty/glslang/SPIRV/SpvBuilder.cpp

@@ -46,7 +46,9 @@
 
 #include "SpvBuilder.h"
 
+#ifndef GLSLANG_WEB
 #include "hex_float.h"
+#endif
 
 #ifndef _WIN32
     #include <cstdio>
@@ -230,6 +232,11 @@ Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardP
 
 Id Builder::makeIntegerType(int width, bool hasSign)
 {
+#ifdef GLSLANG_WEB
+    assert(width == 32);
+    width = 32;
+#endif
+
     // try to find it
     Instruction* type;
     for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) {
@@ -265,6 +272,11 @@ Id Builder::makeIntegerType(int width, bool hasSign)
 
 Id Builder::makeFloatType(int width)
 {
+#ifdef GLSLANG_WEB
+    assert(width == 32);
+    width = 32;
+#endif
+
     // try to find it
     Instruction* type;
     for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) {
@@ -516,6 +528,7 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
     constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
     module.mapInstruction(type);
 
+#ifndef GLSLANG_WEB
     // deal with capabilities
     switch (dim) {
     case DimBuffer:
@@ -561,6 +574,7 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
                 addCapability(CapabilityImageMSArray);
         }
     }
+#endif
 
     return type->getResultId();
 }
@@ -586,7 +600,7 @@ Id Builder::makeSampledImageType(Id imageType)
     return type->getResultId();
 }
 
-#ifdef NV_EXTENSIONS
+#ifndef GLSLANG_WEB
 Id Builder::makeAccelerationStructureNVType()
 {
     Instruction *type;
@@ -602,6 +616,7 @@ Id Builder::makeAccelerationStructureNVType()
     return type->getResultId();
 }
 #endif
+
 Id Builder::getDerefTypeId(Id resultId) const
 {
     Id typeId = getTypeId(resultId);
@@ -939,6 +954,10 @@ Id Builder::makeFloatConstant(float f, bool specConstant)
 
 Id Builder::makeDoubleConstant(double d, bool specConstant)
 {
+#ifdef GLSLANG_WEB
+    assert(0);
+    return NoResult;
+#else
     Op opcode = specConstant ? OpSpecConstant : OpConstant;
     Id typeId = makeFloatType(64);
     union { double db; unsigned long long ull; } u;
@@ -963,10 +982,15 @@ Id Builder::makeDoubleConstant(double d, bool specConstant)
     module.mapInstruction(c);
 
     return c->getResultId();
+#endif
 }
 
 Id Builder::makeFloat16Constant(float f16, bool specConstant)
 {
+#ifdef GLSLANG_WEB
+    assert(0);
+    return NoResult;
+#else
     Op opcode = specConstant ? OpSpecConstant : OpConstant;
     Id typeId = makeFloatType(16);
 
@@ -991,25 +1015,33 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant)
     module.mapInstruction(c);
 
     return c->getResultId();
+#endif
 }
 
 Id Builder::makeFpConstant(Id type, double d, bool specConstant)
 {
-        assert(isFloatType(type));
+#ifdef GLSLANG_WEB
+    const int width = 32;
+    assert(width == getScalarTypeWidth(type));
+#else
+    const int width = getScalarTypeWidth(type);
+#endif
 
-        switch (getScalarTypeWidth(type)) {
-        case 16:
-                return makeFloat16Constant((float)d, specConstant);
-        case 32:
-                return makeFloatConstant((float)d, specConstant);
-        case 64:
-                return makeDoubleConstant(d, specConstant);
-        default:
-                break;
-        }
+    assert(isFloatType(type));
 
-        assert(false);
-        return NoResult;
+    switch (width) {
+    case 16:
+            return makeFloat16Constant((float)d, specConstant);
+    case 32:
+            return makeFloatConstant((float)d, specConstant);
+    case 64:
+            return makeDoubleConstant(d, specConstant);
+    default:
+            break;
+    }
+
+    assert(false);
+    return NoResult;
 }
 
 Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps)
@@ -1825,7 +1857,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
     if (parameters.component != NoResult)
         texArgs[numArgs++] = parameters.component;
 
-#ifdef NV_EXTENSIONS
+#ifndef GLSLANG_WEB
     if (parameters.granularity != NoResult)
         texArgs[numArgs++] = parameters.granularity;
     if (parameters.coarse != NoResult)
@@ -1872,6 +1904,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
         mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask);
         texArgs[numArgs++] = parameters.offsets;
     }
+#ifndef GLSLANG_WEB
     if (parameters.sample) {
         mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask);
         texArgs[numArgs++] = parameters.sample;
@@ -1889,6 +1922,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
     if (parameters.volatil) {
         mask = mask | ImageOperandsVolatileTexelKHRMask;
     }
+#endif
     mask = mask | signExtensionMask;
     if (mask == ImageOperandsMaskNone)
         --numArgs;  // undo speculative reservation for the mask argument
@@ -1904,10 +1938,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
             opCode = OpImageSparseFetch;
         else
             opCode = OpImageFetch;
-#ifdef NV_EXTENSIONS
+#ifndef GLSLANG_WEB
     } else if (parameters.granularity && parameters.coarse) {
         opCode = OpImageSampleFootprintNV;
-#endif
     } else if (gather) {
         if (parameters.Dref)
             if (sparse)
@@ -1919,6 +1952,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
                 opCode = OpImageSparseGather;
             else
                 opCode = OpImageGather;
+#endif
     } else if (explicitLod) {
         if (parameters.Dref) {
             if (proj)
@@ -2067,11 +2101,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
         break;
     }
     case OpImageQueryLod:
-#ifdef AMD_EXTENSIONS
         resultType = makeVectorType(getScalarTypeId(getTypeId(parameters.coords)), 2);
-#else
-        resultType = makeVectorType(makeFloatType(32), 2);
-#endif
         break;
     case OpImageQueryLevels:
     case OpImageQuerySamples:
@@ -2089,6 +2119,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
     if (parameters.lod)
         query->addIdOperand(parameters.lod);
     buildPoint->addInstruction(std::unique_ptr<Instruction>(query));
+    addCapability(CapabilityImageQuery);
 
     return query->getResultId();
 }
@@ -2282,7 +2313,12 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
     int numRows = getTypeNumRows(resultTypeId);
 
     Instruction* instr = module.getInstruction(componentTypeId);
-    unsigned bitCount = instr->getImmediateOperand(0);
+#ifdef GLSLANG_WEB
+    const unsigned bitCount = 32;
+    assert(bitCount == instr->getImmediateOperand(0));
+#else
+    const unsigned bitCount = instr->getImmediateOperand(0);
+#endif
 
     // Optimize matrix constructed from a bigger matrix
     if (isMatrix(sources[0]) && getNumColumns(sources[0]) >= numCols && getNumRows(sources[0]) >= numRows) {

+ 13 - 1
3rdparty/glslang/SPIRV/SpvBuilder.h

@@ -201,7 +201,11 @@ public:
     bool isMatrixType(Id typeId)       const { return getTypeClass(typeId) == OpTypeMatrix; }
     bool isStructType(Id typeId)       const { return getTypeClass(typeId) == OpTypeStruct; }
     bool isArrayType(Id typeId)        const { return getTypeClass(typeId) == OpTypeArray; }
+#ifdef GLSLANG_WEB
+    bool isCooperativeMatrixType(Id typeId)const { return false; }
+#else
     bool isCooperativeMatrixType(Id typeId)const { return getTypeClass(typeId) == OpTypeCooperativeMatrixNV; }
+#endif
     bool isAggregateType(Id typeId)    const { return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); }
     bool isImageType(Id typeId)        const { return getTypeClass(typeId) == OpTypeImage; }
     bool isSamplerType(Id typeId)      const { return getTypeClass(typeId) == OpTypeSampler; }
@@ -557,6 +561,14 @@ public:
 
         // Accumulate whether anything in the chain of structures has coherent decorations.
         struct CoherentFlags {
+            CoherentFlags() { clear(); }
+#ifdef GLSLANG_WEB
+            void clear() { }
+            bool isVolatile() const { return false; }
+            CoherentFlags operator |=(const CoherentFlags &other) { return *this; }
+#else
+            bool isVolatile() const { return volatil; }
+
             unsigned coherent : 1;
             unsigned devicecoherent : 1;
             unsigned queuefamilycoherent : 1;
@@ -577,7 +589,6 @@ public:
                 isImage = 0;
             }
 
-            CoherentFlags() { clear(); }
             CoherentFlags operator |=(const CoherentFlags &other) {
                 coherent |= other.coherent;
                 devicecoherent |= other.devicecoherent;
@@ -589,6 +600,7 @@ public:
                 isImage |= other.isImage;
                 return *this;
             }
+#endif
         };
         CoherentFlags coherentFlags;
     };

+ 0 - 8
3rdparty/glslang/SPIRV/SpvPostProcess.cpp

@@ -51,12 +51,8 @@ namespace spv {
     #include "GLSL.std.450.h"
     #include "GLSL.ext.KHR.h"
     #include "GLSL.ext.EXT.h"
-#ifdef AMD_EXTENSIONS
     #include "GLSL.ext.AMD.h"
-#endif
-#ifdef NV_EXTENSIONS
     #include "GLSL.ext.NV.h"
-#endif
 }
 
 namespace spv {
@@ -160,7 +156,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
         }
         break;
     case OpExtInst:
-#if AMD_EXTENSIONS
         switch (inst.getImmediateOperand(1)) {
         case GLSLstd450Frexp:
         case GLSLstd450FrexpStruct:
@@ -176,7 +171,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId)
         default:
             break;
         }
-#endif
         break;
     default:
         if (basicTypeOp == OpTypeFloat && width == 16)
@@ -222,12 +216,10 @@ void Builder::postProcess(Instruction& inst)
         addCapability(CapabilityImageQuery);
         break;
 
-#ifdef NV_EXTENSIONS
     case OpGroupNonUniformPartitionNV:
         addExtension(E_SPV_NV_shader_subgroup_partitioned);
         addCapability(CapabilityGroupNonUniformPartitionedNV);
         break;
-#endif
 
     case OpLoad:
     case OpStore:

+ 3 - 1
3rdparty/glslang/SPIRV/SpvTools.h

@@ -41,8 +41,10 @@
 #ifndef GLSLANG_SPV_TOOLS_H
 #define GLSLANG_SPV_TOOLS_H
 
+#ifdef ENABLE_OPT
 #include <vector>
 #include <ostream>
+#endif
 
 #include "../glslang/MachineIndependent/localintermediate.h"
 #include "Logger.h"
@@ -59,7 +61,7 @@ struct SpvOptions {
     bool validate;
 };
 
-#if ENABLE_OPT
+#ifdef ENABLE_OPT
 
 // Use the SPIRV-Tools disassembler to print SPIR-V.
 void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);

+ 1 - 30
3rdparty/glslang/SPIRV/disassemble.cpp

@@ -52,26 +52,16 @@ namespace spv {
     extern "C" {
         // Include C-based headers that don't have a namespace
         #include "GLSL.std.450.h"
-#ifdef AMD_EXTENSIONS
         #include "GLSL.ext.AMD.h"
-#endif
-
-#ifdef NV_EXTENSIONS
         #include "GLSL.ext.NV.h"
-#endif
     }
 }
 const char* GlslStd450DebugNames[spv::GLSLstd450Count];
 
 namespace spv {
 
-#ifdef AMD_EXTENSIONS
 static const char* GLSLextAMDGetDebugNames(const char*, unsigned);
-#endif
-
-#ifdef NV_EXTENSIONS
 static const char* GLSLextNVGetDebugNames(const char*, unsigned);
-#endif
 
 static void Kill(std::ostream& out, const char* message)
 {
@@ -82,15 +72,8 @@ static void Kill(std::ostream& out, const char* message)
 // used to identify the extended instruction library imported when printing
 enum ExtInstSet {
     GLSL450Inst,
-
-#ifdef AMD_EXTENSIONS
     GLSLextAMDInst,
-#endif
-
-#ifdef NV_EXTENSIONS
     GLSLextNVInst,
-#endif
-
     OpenCLExtInst,
 };
 
@@ -499,37 +482,29 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
                 const char* name = idDescriptor[stream[word - 2]].c_str();
                 if (0 == memcmp("OpenCL", name, 6)) {
                     extInstSet = OpenCLExtInst;
-#ifdef AMD_EXTENSIONS
                 } else if (strcmp(spv::E_SPV_AMD_shader_ballot, name) == 0 ||
                            strcmp(spv::E_SPV_AMD_shader_trinary_minmax, name) == 0 ||
                            strcmp(spv::E_SPV_AMD_shader_explicit_vertex_parameter, name) == 0 ||
                            strcmp(spv::E_SPV_AMD_gcn_shader, name) == 0) {
                     extInstSet = GLSLextAMDInst;
-#endif
-#ifdef NV_EXTENSIONS
-                }else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 ||
+                } else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 ||
                           strcmp(spv::E_SPV_NV_geometry_shader_passthrough, name) == 0 ||
                           strcmp(spv::E_SPV_NV_viewport_array2, name) == 0 ||
                           strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 || 
                           strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 ||
                           strcmp(spv::E_SPV_NV_mesh_shader, name) == 0) {
                     extInstSet = GLSLextNVInst;
-#endif
                 }
                 unsigned entrypoint = stream[word - 1];
                 if (extInstSet == GLSL450Inst) {
                     if (entrypoint < GLSLstd450Count) {
                         out << "(" << GlslStd450DebugNames[entrypoint] << ")";
                     }
-#ifdef AMD_EXTENSIONS
                 } else if (extInstSet == GLSLextAMDInst) {
                     out << "(" << GLSLextAMDGetDebugNames(name, entrypoint) << ")";
-#endif
-#ifdef NV_EXTENSIONS
                 }
                 else if (extInstSet == GLSLextNVInst) {
                     out << "(" << GLSLextNVGetDebugNames(name, entrypoint) << ")";
-#endif
                 }
             }
             break;
@@ -653,7 +628,6 @@ static void GLSLstd450GetDebugNames(const char** names)
     names[GLSLstd450NClamp]                  = "NClamp";
 }
 
-#ifdef AMD_EXTENSIONS
 static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint)
 {
     if (strcmp(name, spv::E_SPV_AMD_shader_ballot) == 0) {
@@ -695,9 +669,7 @@ static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint
 
     return "Bad";
 }
-#endif
 
-#ifdef NV_EXTENSIONS
 static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
 {
     if (strcmp(name, spv::E_SPV_NV_sample_mask_override_coverage) == 0 ||
@@ -751,7 +723,6 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
     }
     return "Bad";
 }
-#endif
 
 void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream)
 {

+ 0 - 38
3rdparty/glslang/SPIRV/doc.cpp

@@ -50,12 +50,8 @@ namespace spv {
         // Include C-based headers that don't have a namespace
         #include "GLSL.ext.KHR.h"
         #include "GLSL.ext.EXT.h"
-#ifdef AMD_EXTENSIONS
         #include "GLSL.ext.AMD.h"
-#endif
-#ifdef NV_EXTENSIONS
         #include "GLSL.ext.NV.h"
-#endif
     }
 }
 
@@ -98,22 +94,17 @@ const char* ExecutionModelString(int model)
     case 4:  return "Fragment";
     case 5:  return "GLCompute";
     case 6:  return "Kernel";
-#ifdef NV_EXTENSIONS
     case ExecutionModelTaskNV: return "TaskNV";
     case ExecutionModelMeshNV: return "MeshNV";
-#endif
 
     default: return "Bad";
 
-#ifdef NV_EXTENSIONS
     case ExecutionModelRayGenerationNV: return "RayGenerationNV";
     case ExecutionModelIntersectionNV:  return "IntersectionNV";
     case ExecutionModelAnyHitNV:        return "AnyHitNV";
     case ExecutionModelClosestHitNV:    return "ClosestHitNV";
     case ExecutionModelMissNV:          return "MissNV";
     case ExecutionModelCallableNV:      return "CallableNV";
-#endif
-
     }
 }
 
@@ -183,13 +174,11 @@ const char* ExecutionModeString(int mode)
 
     case 4446:  return "PostDepthCoverage";
 
-#ifdef NV_EXTENSIONS
     case ExecutionModeOutputLinesNV:            return "OutputLinesNV";
     case ExecutionModeOutputPrimitivesNV:       return "OutputPrimitivesNV";
     case ExecutionModeOutputTrianglesNV:        return "OutputTrianglesNV";
     case ExecutionModeDerivativeGroupQuadsNV:   return "DerivativeGroupQuadsNV";
     case ExecutionModeDerivativeGroupLinearNV:  return "DerivativeGroupLinearNV";
-#endif
 
     case ExecutionModePixelInterlockOrderedEXT:         return "PixelInterlockOrderedEXT";
     case ExecutionModePixelInterlockUnorderedEXT:       return "PixelInterlockUnorderedEXT";
@@ -220,14 +209,12 @@ const char* StorageClassString(int StorageClass)
     case 11: return "Image";
     case 12: return "StorageBuffer";
 
-#ifdef NV_EXTENSIONS
     case StorageClassRayPayloadNV:            return "RayPayloadNV";
     case StorageClassHitAttributeNV:          return "HitAttributeNV";
     case StorageClassIncomingRayPayloadNV:    return "IncomingRayPayloadNV";
     case StorageClassShaderRecordBufferNV:    return "ShaderRecordBufferNV";
     case StorageClassCallableDataNV:          return "CallableDataNV";
     case StorageClassIncomingCallableDataNV:  return "IncomingCallableDataNV";
-#endif
 
     case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
 
@@ -289,10 +276,7 @@ const char* DecorationString(int decoration)
     case DecorationCeiling:
     default:  return "Bad";
 
-#ifdef AMD_EXTENSIONS
     case DecorationExplicitInterpAMD: return "ExplicitInterpAMD";
-#endif
-#ifdef NV_EXTENSIONS
     case DecorationOverrideCoverageNV:          return "OverrideCoverageNV";
     case DecorationPassthroughNV:               return "PassthroughNV";
     case DecorationViewportRelativeNV:          return "ViewportRelativeNV";
@@ -301,7 +285,6 @@ const char* DecorationString(int decoration)
     case DecorationPerViewNV:                   return "PerViewNV";
     case DecorationPerTaskNV:                   return "PerTaskNV";
     case DecorationPerVertexNV:                 return "PerVertexNV";
-#endif
 
     case DecorationNonUniformEXT:           return "DecorationNonUniformEXT";
     case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
@@ -371,7 +354,6 @@ const char* BuiltInString(int builtIn)
     case 4426: return "DrawIndex";
     case 5014: return "FragStencilRefEXT";
 
-#ifdef AMD_EXTENSIONS
     case 4992: return "BaryCoordNoPerspAMD";
     case 4993: return "BaryCoordNoPerspCentroidAMD";
     case 4994: return "BaryCoordNoPerspSampleAMD";
@@ -379,9 +361,6 @@ const char* BuiltInString(int builtIn)
     case 4996: return "BaryCoordSmoothCentroidAMD";
     case 4997: return "BaryCoordSmoothSampleAMD";
     case 4998: return "BaryCoordPullModelAMD";
-#endif
-
-#ifdef NV_EXTENSIONS
     case BuiltInLaunchIdNV:                 return "LaunchIdNV";
     case BuiltInLaunchSizeNV:               return "LaunchSizeNV";
     case BuiltInWorldRayOriginNV:           return "WorldRayOriginNV";
@@ -405,14 +384,12 @@ const char* BuiltInString(int builtIn)
 //    case BuiltInInvocationsPerPixelNV:      return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
     case BuiltInBaryCoordNV:                return "BaryCoordNV";
     case BuiltInBaryCoordNoPerspNV:         return "BaryCoordNoPerspNV";
-#endif
 
     case BuiltInFragSizeEXT:                return "FragSizeEXT";
     case BuiltInFragInvocationCountEXT:     return "FragInvocationCountEXT";
 
     case 5264: return "FullyCoveredEXT";
 
-#ifdef NV_EXTENSIONS
     case BuiltInTaskCountNV:           return "TaskCountNV";
     case BuiltInPrimitiveCountNV:      return "PrimitiveCountNV";
     case BuiltInPrimitiveIndicesNV:    return "PrimitiveIndicesNV";
@@ -421,7 +398,6 @@ const char* BuiltInString(int builtIn)
     case BuiltInLayerPerViewNV:        return "LayerPerViewNV";
     case BuiltInMeshViewCountNV:       return "MeshViewCountNV";
     case BuiltInMeshViewIndicesNV:     return "MeshViewIndicesNV";
-#endif
     case BuiltInWarpsPerSMNV:           return "WarpsPerSMNV";
     case BuiltInSMCountNV:              return "SMCountNV";
     case BuiltInWarpIDNV:               return "WarpIDNV";
@@ -780,11 +756,9 @@ const char* GroupOperationString(int gop)
     case GroupOperationInclusiveScan:  return "InclusiveScan";
     case GroupOperationExclusiveScan:  return "ExclusiveScan";
     case GroupOperationClusteredReduce:  return "ClusteredReduce";
-#ifdef NV_EXTENSIONS
     case GroupOperationPartitionedReduceNV:  return "PartitionedReduceNV";
     case GroupOperationPartitionedInclusiveScanNV:  return "PartitionedInclusiveScanNV";
     case GroupOperationPartitionedExclusiveScanNV:  return "PartitionedExclusiveScanNV";
-#endif
 
     default: return "Bad";
     }
@@ -901,17 +875,14 @@ const char* CapabilityString(int info)
 
     case CapabilityStencilExportEXT: return "StencilExportEXT";
 
-#ifdef AMD_EXTENSIONS
     case CapabilityFloat16ImageAMD:       return "Float16ImageAMD";
     case CapabilityImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD";
     case CapabilityFragmentMaskAMD:       return "FragmentMaskAMD";
     case CapabilityImageReadWriteLodAMD:  return "ImageReadWriteLodAMD";
-#endif
 
     case CapabilityAtomicStorageOps:             return "AtomicStorageOps";
 
     case CapabilitySampleMaskPostDepthCoverage:  return "SampleMaskPostDepthCoverage";
-#ifdef NV_EXTENSIONS
     case CapabilityGeometryShaderPassthroughNV:     return "GeometryShaderPassthroughNV";
     case CapabilityShaderViewportIndexLayerNV:      return "ShaderViewportIndexLayerNV";
     case CapabilityShaderViewportMaskNV:            return "ShaderViewportMaskNV";
@@ -926,7 +897,6 @@ const char* CapabilityString(int info)
     case CapabilityImageFootprintNV:                return "ImageFootprintNV";
 //    case CapabilityShadingRateNV:                   return "ShadingRateNV";  // superseded by FragmentDensityEXT
     case CapabilitySampleMaskOverrideCoverageNV:    return "SampleMaskOverrideCoverageNV";
-#endif
     case CapabilityFragmentDensityEXT:              return "FragmentDensityEXT";
 
     case CapabilityFragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT";
@@ -1336,7 +1306,6 @@ const char* OpcodeString(int op)
     case 4430: return "OpSubgroupAllEqualKHR";
     case 4432: return "OpSubgroupReadInvocationKHR";
 
-#ifdef AMD_EXTENSIONS
     case 5000: return "OpGroupIAddNonUniformAMD";
     case 5001: return "OpGroupFAddNonUniformAMD";
     case 5002: return "OpGroupFMinNonUniformAMD";
@@ -1348,14 +1317,12 @@ const char* OpcodeString(int op)
 
     case 5011: return "OpFragmentMaskFetchAMD";
     case 5012: return "OpFragmentFetchAMD";
-#endif
 
     case OpReadClockKHR:               return "OpReadClockKHR";
 
     case OpDecorateStringGOOGLE:       return "OpDecorateStringGOOGLE";
     case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE";
 
-#ifdef NV_EXTENSIONS
     case OpGroupNonUniformPartitionNV:       return "OpGroupNonUniformPartitionNV";
     case OpReportIntersectionNV:             return "OpReportIntersectionNV";
     case OpIgnoreIntersectionNV:             return "OpIgnoreIntersectionNV";
@@ -1365,7 +1332,6 @@ const char* OpcodeString(int op)
     case OpExecuteCallableNV:                return "OpExecuteCallableNV";
     case OpImageSampleFootprintNV:           return "OpImageSampleFootprintNV";
     case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV";
-#endif
 
     case OpTypeCooperativeMatrixNV:         return "OpTypeCooperativeMatrixNV";
     case OpCooperativeMatrixLoadNV:         return "OpCooperativeMatrixLoadNV";
@@ -2685,7 +2651,6 @@ void Parameterize()
 
     InstructionDesc[OpModuleProcessed].operands.push(OperandLiteralString, "'process'");
 
-#ifdef AMD_EXTENSIONS
     InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'");
     InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'");
     InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'");
@@ -2724,9 +2689,7 @@ void Parameterize()
     InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Image'");
     InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Coordinate'");
     InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Fragment Index'");
-#endif
 
-#ifdef NV_EXTENSIONS
     InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X");
 
     InstructionDesc[OpTypeAccelerationStructureNV].setResultAndType(true, false);
@@ -2764,7 +2727,6 @@ void Parameterize()
     
     InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'");
     InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'");
-#endif
 
     InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Component Type'");
     InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Scope'");

+ 0 - 4
3rdparty/glslang/StandAlone/ResourceLimits.cpp

@@ -234,7 +234,6 @@ std::string GetDefaultTBuiltInResourceString()
             << "MaxCullDistances "                          << DefaultTBuiltInResource.maxCullDistances << "\n"
             << "MaxCombinedClipAndCullDistances "           << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n"
             << "MaxSamples "                                << DefaultTBuiltInResource.maxSamples << "\n"
-#ifdef NV_EXTENSIONS
             << "MaxMeshOutputVerticesNV "                   << DefaultTBuiltInResource.maxMeshOutputVerticesNV << "\n"
             << "MaxMeshOutputPrimitivesNV "                 << DefaultTBuiltInResource.maxMeshOutputPrimitivesNV << "\n"
             << "MaxMeshWorkGroupSizeX_NV "                  << DefaultTBuiltInResource.maxMeshWorkGroupSizeX_NV << "\n"
@@ -244,7 +243,6 @@ std::string GetDefaultTBuiltInResourceString()
             << "MaxTaskWorkGroupSizeY_NV "                  << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n"
             << "MaxTaskWorkGroupSizeZ_NV "                  << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n"
             << "MaxMeshViewCountNV "                        << DefaultTBuiltInResource.maxMeshViewCountNV << "\n"
-#endif
             << "nonInductiveForLoops "                      << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n"
             << "whileLoops "                                << DefaultTBuiltInResource.limits.whileLoops << "\n"
             << "doWhileLoops "                              << DefaultTBuiltInResource.limits.doWhileLoops << "\n"
@@ -451,7 +449,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
             resources->maxCombinedClipAndCullDistances = value;
         else if (tokenStr == "MaxSamples")
             resources->maxSamples = value;
-#ifdef NV_EXTENSIONS
         else if (tokenStr == "MaxMeshOutputVerticesNV")
             resources->maxMeshOutputVerticesNV = value;
         else if (tokenStr == "MaxMeshOutputPrimitivesNV")
@@ -470,7 +467,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config)
             resources->maxTaskWorkGroupSizeZ_NV = value;
         else if (tokenStr == "MaxMeshViewCountNV")
             resources->maxMeshViewCountNV = value;
-#endif
         else if (tokenStr == "nonInductiveForLoops")
             resources->limits.nonInductiveForLoops = (value != 0);
         else if (tokenStr == "whileLoops")

+ 27 - 15
3rdparty/glslang/StandAlone/StandAlone.cpp

@@ -146,11 +146,13 @@ void ProcessConfigFile()
 {
     if (ConfigFile.size() == 0)
         Resources = glslang::DefaultTBuiltInResource;
+#ifndef GLSLANG_WEB
     else {
         char* configString = ReadFileData(ConfigFile.c_str());
         glslang::DecodeResourceLimits(&Resources,  configString);
         FreeFileData(configString);
     }
+#endif
 }
 
 int ReflectOptions = EShReflectionDefault;
@@ -255,7 +257,6 @@ const char* GetBinaryName(EShLanguage stage)
         case EShLangGeometry:        name = "geom.spv";    break;
         case EShLangFragment:        name = "frag.spv";    break;
         case EShLangCompute:         name = "comp.spv";    break;
-#ifdef NV_EXTENSIONS
         case EShLangRayGenNV:        name = "rgen.spv";    break;
         case EShLangIntersectNV:     name = "rint.spv";    break;
         case EShLangAnyHitNV:        name = "rahit.spv";   break;
@@ -264,7 +265,6 @@ const char* GetBinaryName(EShLanguage stage)
         case EShLangCallableNV:      name = "rcall.spv";   break;
         case EShLangMeshNV:          name = "mesh.spv";    break;
         case EShLangTaskNV:          name = "task.spv";    break;
-#endif
         default:                     name = "unknown";     break;
         }
     } else
@@ -977,6 +977,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
             shader->setPreamble(UserPreamble.get());
         shader->addProcesses(Processes);
 
+#ifndef GLSLANG_WEB
         // Set IO mapper binding shift values
         for (int r = 0; r < glslang::EResCount; ++r) {
             const glslang::TResourceType res = glslang::TResourceType(r);
@@ -990,30 +991,33 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
                  i != baseBindingForSet[res][compUnit.stage].end(); ++i)
                 shader->setShiftBindingForSet(res, i->second, i->first);
         }
-
-        shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
         shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
-        shader->setNanMinMaxClamp(NaNClamp);
         shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
 
-        if (Options & EOptionHlslIoMapping)
-            shader->setHlslIoMapping(true);
-
         if (Options & EOptionAutoMapBindings)
             shader->setAutoMapBindings(true);
 
         if (Options & EOptionAutoMapLocations)
             shader->setAutoMapLocations(true);
 
-        if (Options & EOptionInvertY)
-            shader->setInvertY(true);
-
         for (auto& uniOverride : uniformLocationOverrides) {
             shader->addUniformLocationOverride(uniOverride.first.c_str(),
                                                uniOverride.second);
         }
 
         shader->setUniformLocationBase(uniformBase);
+#endif
+
+        shader->setNanMinMaxClamp(NaNClamp);
+
+#ifdef ENABLE_HLSL
+        shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
+        if (Options & EOptionHlslIoMapping)
+            shader->setHlslIoMapping(true);
+#endif
+
+        if (Options & EOptionInvertY)
+            shader->setInvertY(true);
 
         // Set up the environment, some subsettings take precedence over earlier
         // ways of setting things.
@@ -1023,8 +1027,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
                                 compUnit.stage, Client, ClientInputSemanticsVersion);
             shader->setEnvClient(Client, ClientVersion);
             shader->setEnvTarget(TargetLanguage, TargetVersion);
+#ifdef ENABLE_HLSL
             if (targetHlslFunctionality1)
                 shader->setEnvTargetHlslFunctionality1();
+#endif
         }
 
         shaders.push_back(shader);
@@ -1034,6 +1040,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
         DirStackFileIncluder includer;
         std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
             includer.pushExternalLocalDirectory(dir); });
+#ifndef GLSLANG_WEB
         if (Options & EOptionOutputPreprocessed) {
             std::string str;
             if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false, messages, &str, includer)) {
@@ -1045,6 +1052,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
             StderrIfNonEmpty(shader->getInfoDebugLog());
             continue;
         }
+#endif
 
         if (! shader->parse(&Resources, defaultVersion, false, messages, includer))
             CompileFailed = true;
@@ -1067,11 +1075,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
     if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages))
         LinkFailed = true;
 
+#ifndef GLSLANG_WEB
     // Map IO
     if (Options & EOptionSpv) {
         if (!program.mapIO())
             LinkFailed = true;
     }
+#endif
 
     // Report
     if (! (Options & EOptionSuppressInfolog) &&
@@ -1080,11 +1090,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
         PutsIfNonEmpty(program.getInfoDebugLog());
     }
 
+#ifndef GLSLANG_WEB
     // Reflect
     if (Options & EOptionDumpReflection) {
         program.buildReflection(ReflectOptions);
         program.dumpReflection();
     }
+#endif
 
     // Dump SPIR-V
     if (Options & EOptionSpv) {
@@ -1114,8 +1126,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
                         } else {
                             glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage));
                         }
+#ifndef GLSLANG_WEB
                         if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv))
                             spv::Disassemble(std::cout, spirv);
+#endif
                     }
                 }
             }
@@ -1203,11 +1217,13 @@ int singleMain()
         workList.add(item.get());
     });
 
+#ifndef GLSLANG_WEB
     if (Options & EOptionDumpConfig) {
         printf("%s", glslang::GetDefaultTBuiltInResourceString().c_str());
         if (workList.empty())
             return ESuccess;
     }
+#endif
 
     if (Options & EOptionDumpBareVersion) {
         printf("%d.%d.%d\n",
@@ -1379,7 +1395,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
         return EShLangFragment;
     else if (stageName == "comp")
         return EShLangCompute;
-#ifdef NV_EXTENSIONS
     else if (stageName == "rgen")
         return EShLangRayGenNV;
     else if (stageName == "rint")
@@ -1396,7 +1411,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName)
         return EShLangMeshNV;
     else if (stageName == "task")
         return EShLangTaskNV;
-#endif
 
     usage();
     return EShLangVertex;
@@ -1466,7 +1480,6 @@ void usage()
            "    .geom   for a geometry shader\n"
            "    .frag   for a fragment shader\n"
            "    .comp   for a compute shader\n"
-#ifdef NV_EXTENSIONS
            "    .mesh   for a mesh shader\n"
            "    .task   for a task shader\n"
            "    .rgen    for a ray generation shader\n"
@@ -1475,7 +1488,6 @@ void usage()
            "    .rchit   for a ray closest hit shader\n"
            "    .rmiss   for a ray miss shader\n"
            "    .rcall   for a ray callable shader\n"
-#endif
            "    .glsl   for .vert.glsl, .tesc.glsl, ..., .comp.glsl compound suffixes\n"
            "    .hlsl   for .vert.hlsl, .tesc.hlsl, ..., .comp.hlsl compound suffixes\n"
            "\n"

+ 43 - 0
3rdparty/glslang/Test/310.inheritMemory.frag

@@ -0,0 +1,43 @@
+#version 310 es
+precision mediump float;
+
+struct S {
+    float buff[10];
+};
+
+layout(std430, binding=2) readonly buffer RoBuff {
+    float buff_ro[10];
+    S s_ro;
+} ro_buffer;
+
+layout(std430, binding=2) buffer Buff {
+    float buff[10];
+    S s;
+} non_ro_buffer;
+
+void non_ro_fun(float[10] buff) { }
+void non_ro_funf(float el) { }
+void non_ro_funS(S s) { }
+
+out vec4 fragColor;
+
+void main()
+{
+    S s;
+
+    non_ro_fun(s.buff);
+    non_ro_funf(s.buff[3]);
+    non_ro_funS(s);
+
+    non_ro_fun(non_ro_buffer.buff);
+    non_ro_fun(non_ro_buffer.s.buff);
+    non_ro_funf(non_ro_buffer.buff[3]);
+    non_ro_funf(non_ro_buffer.s.buff[3]);
+    non_ro_funS(non_ro_buffer.s);
+
+    non_ro_fun(ro_buffer.buff_ro);
+    non_ro_fun(ro_buffer.s_ro.buff);
+    non_ro_funf(ro_buffer.buff_ro[3]);
+    non_ro_funf(ro_buffer.s_ro.buff[3]);
+    non_ro_funS(ro_buffer.s_ro);
+}

+ 57 - 57
3rdparty/glslang/Test/baseResults/310.comp.out

@@ -119,9 +119,9 @@ ERROR: node is still EOpNull!
 0:59    Function Parameters: 
 0:61    Sequence
 0:61      move second child to first child ( temp highp float)
-0:61        direct index (layout( column_major shared) temp highp float)
-0:61          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:61            'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:61        direct index (layout( column_major shared) readonly temp highp float)
+0:61          values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of highp float)
+0:61            'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values})
 0:61            Constant:
 0:61              1 (const int)
 0:61          Constant:
@@ -129,8 +129,8 @@ ERROR: node is still EOpNull!
 0:61        Constant:
 0:61          4.700000
 0:62      array length ( temp int)
-0:62        values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:62          'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:62        values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of highp float)
+0:62          'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values})
 0:62          Constant:
 0:62            1 (const int)
 0:63      Pre-Increment ( temp highp 4-component vector of float)
@@ -282,9 +282,9 @@ ERROR: node is still EOpNull!
 0:?     Sequence
 0:194      move second child to first child ( temp highp float)
 0:194        'g' ( temp highp float)
-0:194        direct index (layout( column_major shared) temp highp float)
-0:194          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:194            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:194        direct index (layout( column_major shared) writeonly temp highp float)
+0:194          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:194            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:194            Constant:
 0:194              1 (const int)
 0:194          Constant:
@@ -292,42 +292,42 @@ ERROR: node is still EOpNull!
 0:195      Sequence
 0:195        move second child to first child ( temp highp float)
 0:195          'f' ( temp highp float)
-0:195          direct index (layout( column_major shared) temp highp float)
-0:195            values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:195              'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:195          direct index (layout( column_major shared) writeonly temp highp float)
+0:195            values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:195              'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:195              Constant:
 0:195                1 (const int)
 0:195            Constant:
 0:195              2 (const int)
 0:196      Pre-Increment ( temp highp float)
-0:196        direct index (layout( column_major shared) temp highp float)
-0:196          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:196            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:196        direct index (layout( column_major shared) writeonly temp highp float)
+0:196          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:196            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:196            Constant:
 0:196              1 (const int)
 0:196          Constant:
 0:196            2 (const int)
 0:197      Post-Decrement ( temp highp float)
-0:197        direct index (layout( column_major shared) temp highp float)
-0:197          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:197            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:197        direct index (layout( column_major shared) writeonly temp highp float)
+0:197          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:197            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:197            Constant:
 0:197              1 (const int)
 0:197          Constant:
 0:197            2 (const int)
 0:198      add ( temp highp float)
 0:198        'f' ( temp highp float)
-0:198        direct index (layout( column_major shared) temp highp float)
-0:198          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:198            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:198        direct index (layout( column_major shared) writeonly temp highp float)
+0:198          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:198            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:198            Constant:
 0:198              1 (const int)
 0:198          Constant:
 0:198            2 (const int)
 0:199      subtract ( temp highp float)
-0:199        direct index (layout( column_major shared) temp highp float)
-0:199          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:199            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:199        direct index (layout( column_major shared) writeonly temp highp float)
+0:199          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:199            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:199            Constant:
 0:199              1 (const int)
 0:199          Constant:
@@ -339,9 +339,9 @@ ERROR: node is still EOpNull!
 0:201        true case
 0:201        'f' ( temp highp float)
 0:201        false case
-0:201        direct index (layout( column_major shared) temp highp float)
-0:201          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:201            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:201        direct index (layout( column_major shared) writeonly temp highp float)
+0:201          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:201            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:201            Constant:
 0:201              1 (const int)
 0:201          Constant:
@@ -350,9 +350,9 @@ ERROR: node is still EOpNull!
 0:202        Condition
 0:202        'b' ( temp bool)
 0:202        true case
-0:202        direct index (layout( column_major shared) temp highp float)
-0:202          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:202            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:202        direct index (layout( column_major shared) writeonly temp highp float)
+0:202          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:202            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:202            Constant:
 0:202              1 (const int)
 0:202          Constant:
@@ -363,9 +363,9 @@ ERROR: node is still EOpNull!
 0:203        Condition
 0:203        Compare Equal ( temp bool)
 0:203          'f' ( temp highp float)
-0:203          direct index (layout( column_major shared) temp highp float)
-0:203            values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:203              'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:203          direct index (layout( column_major shared) writeonly temp highp float)
+0:203            values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:203              'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:203              Constant:
 0:203                1 (const int)
 0:203            Constant:
@@ -377,9 +377,9 @@ ERROR: node is still EOpNull!
 0:205        Condition
 0:205        Compare Greater Than or Equal ( temp bool)
 0:205          'f' ( temp highp float)
-0:205          direct index (layout( column_major shared) temp highp float)
-0:205            values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:205              'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:205          direct index (layout( column_major shared) writeonly temp highp float)
+0:205            values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:205              'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:205              Constant:
 0:205                1 (const int)
 0:205            Constant:
@@ -391,9 +391,9 @@ ERROR: node is still EOpNull!
 0:207        'f' ( temp highp float)
 0:207        direct index ( temp highp float)
 0:207          Construct vec3 ( temp highp 3-component vector of float)
-0:207            direct index (layout( column_major shared) temp highp float)
-0:207              values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:207                'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:207            direct index (layout( column_major shared) writeonly temp highp float)
+0:207              values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:207                'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:207                Constant:
 0:207                  1 (const int)
 0:207              Constant:
@@ -401,14 +401,14 @@ ERROR: node is still EOpNull!
 0:207          Constant:
 0:207            0 (const int)
 0:208      Bitwise not ( temp highp int)
-0:208        value: direct index for structure (layout( column_major shared) buffer highp int)
-0:208          'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:208        value: direct index for structure (layout( column_major shared) writeonly buffer highp int)
+0:208          'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:208          Constant:
 0:208            0 (const int)
 0:209      move second child to first child ( temp highp float)
-0:209        direct index (layout( column_major shared) temp highp float)
-0:209          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:209            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:209        direct index (layout( column_major shared) writeonly temp highp float)
+0:209          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:209            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:209            Constant:
 0:209              1 (const int)
 0:209          Constant:
@@ -420,22 +420,22 @@ ERROR: node is still EOpNull!
 0:?     Sequence
 0:221      move second child to first child ( temp highp float)
 0:221        'g' ( temp highp float)
-0:221        direct index (layout( column_major shared) temp highp float)
-0:221          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:221            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:221        direct index (layout( column_major shared) writeonly temp highp float)
+0:221          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:221            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:221            Constant:
 0:221              1 (const int)
 0:221          Constant:
 0:221            2 (const int)
 0:222      Bitwise not ( temp highp int)
-0:222        value: direct index for structure (layout( column_major shared) buffer highp int)
-0:222          'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:222        value: direct index for structure (layout( column_major shared) writeonly buffer highp int)
+0:222          'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:222          Constant:
 0:222            0 (const int)
 0:223      move second child to first child ( temp highp float)
-0:223        direct index (layout( column_major shared) temp highp float)
-0:223          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float)
-0:223            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:223        direct index (layout( column_major shared) writeonly temp highp float)
+0:223          values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float)
+0:223            'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:223            Constant:
 0:223              1 (const int)
 0:223          Constant:
@@ -443,8 +443,8 @@ ERROR: node is still EOpNull!
 0:223        Constant:
 0:223          3.400000
 0:224      move second child to first child ( temp highp int)
-0:224        value: direct index for structure (layout( column_major shared) buffer highp int)
-0:224          'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:224        value: direct index for structure (layout( column_major shared) writeonly buffer highp int)
+0:224          'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:224          Constant:
 0:224            0 (const int)
 0:224        Constant:
@@ -477,7 +477,7 @@ ERROR: node is still EOpNull!
 0:?     'arrX' ( global 2-element array of highp int)
 0:?     'arrY' ( global 1-element array of highp int)
 0:?     'arrZ' ( global 4096-element array of highp int)
-0:?     'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:?     'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values})
 0:?     'v' ( buffer highp 4-component vector of float)
 0:?     'us2dbad' ( uniform mediump usampler2D)
 0:?     'us2d' ( uniform highp usampler2D)
@@ -516,7 +516,7 @@ ERROR: node is still EOpNull!
 0:?     'badQ1' (layout( rgba32f) coherent volatile restrict uniform highp image2D)
 0:?     'badQ2' (layout( rgba8i) coherent volatile restrict uniform highp iimage2D)
 0:?     'badQ3' (layout( rgba16ui) coherent volatile restrict uniform highp uimage2D)
-0:?     'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:?     'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:?     'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 1-element array of highp float values})
 0:?     'inbi' ( in block{ in highp int a})
 0:?     'outbi' ( out block{ out highp int a})
@@ -571,7 +571,7 @@ ERROR: node is still EOpNull!
 0:?     'arrX' ( global 2-element array of highp int)
 0:?     'arrY' ( global 1-element array of highp int)
 0:?     'arrZ' ( global 4096-element array of highp int)
-0:?     'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:?     'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values})
 0:?     'v' ( buffer highp 4-component vector of float)
 0:?     'us2dbad' ( uniform mediump usampler2D)
 0:?     'us2d' ( uniform highp usampler2D)
@@ -610,7 +610,7 @@ ERROR: node is still EOpNull!
 0:?     'badQ1' (layout( rgba32f) coherent volatile restrict uniform highp image2D)
 0:?     'badQ2' (layout( rgba8i) coherent volatile restrict uniform highp iimage2D)
 0:?     'badQ3' (layout( rgba16ui) coherent volatile restrict uniform highp uimage2D)
-0:?     'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values})
+0:?     'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values})
 0:?     'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 1-element array of highp float values})
 0:?     'inbi' ( in block{ in highp int a})
 0:?     'outbi' ( out block{ out highp int a})

+ 229 - 0
3rdparty/glslang/Test/baseResults/310.inheritMemory.frag.out

@@ -0,0 +1,229 @@
+310.inheritMemory.frag
+ERROR: 0:38: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
+ERROR: 0:39: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
+ERROR: 0:40: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
+ERROR: 0:41: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
+ERROR: 0:42: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter 
+ERROR: 5 compilation errors.  No code generated.
+
+
+Shader version: 310
+ERROR: node is still EOpNull!
+0:18  Function Definition: non_ro_fun(f1[10]; ( global void)
+0:18    Function Parameters: 
+0:18      'buff' ( in 10-element array of mediump float)
+0:19  Function Definition: non_ro_funf(f1; ( global void)
+0:19    Function Parameters: 
+0:19      'el' ( in mediump float)
+0:20  Function Definition: non_ro_funS(struct-S-f1[10]1; ( global void)
+0:20    Function Parameters: 
+0:20      's' ( in structure{ global 10-element array of mediump float buff})
+0:24  Function Definition: main( ( global void)
+0:24    Function Parameters: 
+0:?     Sequence
+0:28      Function Call: non_ro_fun(f1[10]; ( global void)
+0:28        buff: direct index for structure ( global 10-element array of mediump float)
+0:28          's' ( temp structure{ global 10-element array of mediump float buff})
+0:28          Constant:
+0:28            0 (const int)
+0:29      Function Call: non_ro_funf(f1; ( global void)
+0:29        direct index ( temp mediump float)
+0:29          buff: direct index for structure ( global 10-element array of mediump float)
+0:29            's' ( temp structure{ global 10-element array of mediump float buff})
+0:29            Constant:
+0:29              0 (const int)
+0:29          Constant:
+0:29            3 (const int)
+0:30      Function Call: non_ro_funS(struct-S-f1[10]1; ( global void)
+0:30        's' ( temp structure{ global 10-element array of mediump float buff})
+0:32      Function Call: non_ro_fun(f1[10]; ( global void)
+0:32        buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float)
+0:32          'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:32          Constant:
+0:32            0 (const int)
+0:33      Function Call: non_ro_fun(f1[10]; ( global void)
+0:33        buff: direct index for structure ( global 10-element array of mediump float)
+0:33          s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff})
+0:33            'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:33            Constant:
+0:33              1 (const int)
+0:33          Constant:
+0:33            0 (const int)
+0:34      Function Call: non_ro_funf(f1; ( global void)
+0:34        direct index (layout( column_major std430 offset=0) temp mediump float)
+0:34          buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float)
+0:34            'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:34            Constant:
+0:34              0 (const int)
+0:34          Constant:
+0:34            3 (const int)
+0:35      Function Call: non_ro_funf(f1; ( global void)
+0:35        direct index ( temp mediump float)
+0:35          buff: direct index for structure ( global 10-element array of mediump float)
+0:35            s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff})
+0:35              'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:35              Constant:
+0:35                1 (const int)
+0:35            Constant:
+0:35              0 (const int)
+0:35          Constant:
+0:35            3 (const int)
+0:36      Function Call: non_ro_funS(struct-S-f1[10]1; ( global void)
+0:36        s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff})
+0:36          'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:36          Constant:
+0:36            1 (const int)
+0:38      Function Call: non_ro_fun(f1[10]; ( global void)
+0:38        buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float)
+0:38          'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:38          Constant:
+0:38            0 (const int)
+0:39      Function Call: non_ro_fun(f1[10]; ( global void)
+0:39        buff: direct index for structure ( readonly global 10-element array of mediump float)
+0:39          s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff})
+0:39            'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:39            Constant:
+0:39              1 (const int)
+0:39          Constant:
+0:39            0 (const int)
+0:40      Function Call: non_ro_funf(f1; ( global void)
+0:40        direct index (layout( column_major std430 offset=0) readonly temp mediump float)
+0:40          buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float)
+0:40            'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:40            Constant:
+0:40              0 (const int)
+0:40          Constant:
+0:40            3 (const int)
+0:41      Function Call: non_ro_funf(f1; ( global void)
+0:41        direct index ( readonly temp mediump float)
+0:41          buff: direct index for structure ( readonly global 10-element array of mediump float)
+0:41            s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff})
+0:41              'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:41              Constant:
+0:41                1 (const int)
+0:41            Constant:
+0:41              0 (const int)
+0:41          Constant:
+0:41            3 (const int)
+0:42      Function Call: non_ro_funS(struct-S-f1[10]1; ( global void)
+0:42        s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff})
+0:42          'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:42          Constant:
+0:42            1 (const int)
+0:?   Linker Objects
+0:?     'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:?     'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:?     'fragColor' ( out mediump 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 310
+ERROR: node is still EOpNull!
+0:18  Function Definition: non_ro_fun(f1[10]; ( global void)
+0:18    Function Parameters: 
+0:18      'buff' ( in 10-element array of mediump float)
+0:19  Function Definition: non_ro_funf(f1; ( global void)
+0:19    Function Parameters: 
+0:19      'el' ( in mediump float)
+0:20  Function Definition: non_ro_funS(struct-S-f1[10]1; ( global void)
+0:20    Function Parameters: 
+0:20      's' ( in structure{ global 10-element array of mediump float buff})
+0:24  Function Definition: main( ( global void)
+0:24    Function Parameters: 
+0:?     Sequence
+0:28      Function Call: non_ro_fun(f1[10]; ( global void)
+0:28        buff: direct index for structure ( global 10-element array of mediump float)
+0:28          's' ( temp structure{ global 10-element array of mediump float buff})
+0:28          Constant:
+0:28            0 (const int)
+0:29      Function Call: non_ro_funf(f1; ( global void)
+0:29        direct index ( temp mediump float)
+0:29          buff: direct index for structure ( global 10-element array of mediump float)
+0:29            's' ( temp structure{ global 10-element array of mediump float buff})
+0:29            Constant:
+0:29              0 (const int)
+0:29          Constant:
+0:29            3 (const int)
+0:30      Function Call: non_ro_funS(struct-S-f1[10]1; ( global void)
+0:30        's' ( temp structure{ global 10-element array of mediump float buff})
+0:32      Function Call: non_ro_fun(f1[10]; ( global void)
+0:32        buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float)
+0:32          'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:32          Constant:
+0:32            0 (const int)
+0:33      Function Call: non_ro_fun(f1[10]; ( global void)
+0:33        buff: direct index for structure ( global 10-element array of mediump float)
+0:33          s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff})
+0:33            'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:33            Constant:
+0:33              1 (const int)
+0:33          Constant:
+0:33            0 (const int)
+0:34      Function Call: non_ro_funf(f1; ( global void)
+0:34        direct index (layout( column_major std430 offset=0) temp mediump float)
+0:34          buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float)
+0:34            'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:34            Constant:
+0:34              0 (const int)
+0:34          Constant:
+0:34            3 (const int)
+0:35      Function Call: non_ro_funf(f1; ( global void)
+0:35        direct index ( temp mediump float)
+0:35          buff: direct index for structure ( global 10-element array of mediump float)
+0:35            s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff})
+0:35              'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:35              Constant:
+0:35                1 (const int)
+0:35            Constant:
+0:35              0 (const int)
+0:35          Constant:
+0:35            3 (const int)
+0:36      Function Call: non_ro_funS(struct-S-f1[10]1; ( global void)
+0:36        s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff})
+0:36          'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:36          Constant:
+0:36            1 (const int)
+0:38      Function Call: non_ro_fun(f1[10]; ( global void)
+0:38        buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float)
+0:38          'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:38          Constant:
+0:38            0 (const int)
+0:39      Function Call: non_ro_fun(f1[10]; ( global void)
+0:39        buff: direct index for structure ( readonly global 10-element array of mediump float)
+0:39          s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff})
+0:39            'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:39            Constant:
+0:39              1 (const int)
+0:39          Constant:
+0:39            0 (const int)
+0:40      Function Call: non_ro_funf(f1; ( global void)
+0:40        direct index (layout( column_major std430 offset=0) readonly temp mediump float)
+0:40          buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float)
+0:40            'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:40            Constant:
+0:40              0 (const int)
+0:40          Constant:
+0:40            3 (const int)
+0:41      Function Call: non_ro_funf(f1; ( global void)
+0:41        direct index ( readonly temp mediump float)
+0:41          buff: direct index for structure ( readonly global 10-element array of mediump float)
+0:41            s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff})
+0:41              'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:41              Constant:
+0:41                1 (const int)
+0:41            Constant:
+0:41              0 (const int)
+0:41          Constant:
+0:41            3 (const int)
+0:42      Function Call: non_ro_funS(struct-S-f1[10]1; ( global void)
+0:42        s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff})
+0:42          'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:42          Constant:
+0:42            1 (const int)
+0:?   Linker Objects
+0:?     'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro})
+0:?     'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s})
+0:?     'fragColor' ( out mediump 4-component vector of float)
+

+ 7 - 7
3rdparty/glslang/Test/baseResults/430.comp.out

@@ -55,9 +55,9 @@ ERROR: node is still EOpNull!
 0:63    Function Parameters: 
 0:65    Sequence
 0:65      move second child to first child ( temp float)
-0:65        direct index (layout( column_major shared) temp float)
-0:65          values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of float)
-0:65            'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values})
+0:65        direct index (layout( column_major shared) readonly temp float)
+0:65          values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of float)
+0:65            'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values})
 0:65            Constant:
 0:65              1 (const int)
 0:65          Constant:
@@ -65,8 +65,8 @@ ERROR: node is still EOpNull!
 0:65        Constant:
 0:65          4.700000
 0:66      array length ( temp int)
-0:66        values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of float)
-0:66          'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values})
+0:66        values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of float)
+0:66          'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values})
 0:66          Constant:
 0:66            1 (const int)
 0:67      Barrier ( global void)
@@ -140,7 +140,7 @@ ERROR: node is still EOpNull!
 0:?     'arrX' ( global 2-element array of int)
 0:?     'arrY' ( global 1-element array of int)
 0:?     'arrZ' ( global 4096-element array of int)
-0:?     'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values})
+0:?     'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values})
 0:?     'roll' ( uniform double)
 0:?     'destTex' ( writeonly uniform image2D)
 0:?     'inbi' ( in block{ in int a})
@@ -201,7 +201,7 @@ ERROR: node is still EOpNull!
 0:?     'arrX' ( global 2-element array of int)
 0:?     'arrY' ( global 1-element array of int)
 0:?     'arrZ' ( global 4096-element array of int)
-0:?     'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values})
+0:?     'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values})
 0:?     'roll' ( uniform double)
 0:?     'destTex' ( writeonly uniform image2D)
 0:?     'inbi' ( in block{ in int a})

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

@@ -2,12 +2,14 @@ glspv.vert
 ERROR: 0:3: 'push_constant' : only allowed when using GLSL for Vulkan 
 ERROR: 0:6: 'descriptor set' : only allowed when using GLSL for Vulkan 
 ERROR: 0:8: 'shared' : not allowed when generating SPIR-V 
+ERROR: 0:8: 'binding' : uniform/buffer blocks require layout(binding=X) 
 ERROR: 0:9: 'packed' : not allowed when generating SPIR-V 
+ERROR: 0:9: 'binding' : uniform/buffer blocks require layout(binding=X) 
 ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier 
 ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier 
 ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier 
 ERROR: 0:20: '' :  syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
-ERROR: 8 compilation errors.  No code generated.
+ERROR: 10 compilation errors.  No code generated.
 
 
 SPIR-V is not generated for failed compile or link

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

@@ -58,8 +58,8 @@ using depth_greater
                               MemoryModel Logical GLSL450
                               EntryPoint Fragment 4  "PixelShaderFunction" 18
                               ExecutionMode 4 OriginUpperLeft
-                              ExecutionMode 4 DepthGreater
                               ExecutionMode 4 DepthReplacing
+                              ExecutionMode 4 DepthGreater
                               Source HLSL 500
                               Name 4  "PixelShaderFunction"
                               Name 10  "@PixelShaderFunction(f1;"

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

@@ -50,8 +50,8 @@ using depth_less
                               MemoryModel Logical GLSL450
                               EntryPoint Fragment 4  "PixelShaderFunction" 14
                               ExecutionMode 4 OriginUpperLeft
-                              ExecutionMode 4 DepthLess
                               ExecutionMode 4 DepthReplacing
+                              ExecutionMode 4 DepthLess
                               Source HLSL 500
                               Name 4  "PixelShaderFunction"
                               Name 8  "@PixelShaderFunction("

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

@@ -170,8 +170,8 @@ using depth_greater
                               MemoryModel Logical GLSL450
                               EntryPoint Fragment 4  "main" 22 27 31 36 45 48 51 55
                               ExecutionMode 4 OriginUpperLeft
-                              ExecutionMode 4 DepthGreater
                               ExecutionMode 4 DepthReplacing
+                              ExecutionMode 4 DepthGreater
                               Source HLSL 500
                               Name 4  "main"
                               Name 8  "T"

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

@@ -42,8 +42,8 @@ gl_FragCoord origin is upper left
 0:?     'b' ( global 5-element array of highp int)
 0:?     'c' ( global unsized 4-element array of highp int)
 0:?     'i' ( global highp int)
-0:?     'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
-0:?     'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m})
+0:?     'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
+0:?     'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m})
 
 link2.vk.frag
 Shader version: 450
@@ -99,8 +99,8 @@ gl_FragCoord origin is upper left
 0:?     'b' ( global unsized 3-element array of highp int)
 0:?     'c' ( global 7-element array of highp int)
 0:?     'i' ( global highp int)
-0:?     'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
-0:?     'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
+0:?     'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
+0:?     'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
 
 
 Linked fragment stage:
@@ -192,8 +192,8 @@ gl_FragCoord origin is upper left
 0:?     'b' ( global 5-element array of highp int)
 0:?     'c' ( global 7-element array of highp int)
 0:?     'i' ( global highp int)
-0:?     'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
-0:?     'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
+0:?     'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r})
+0:?     'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m})
 0:?     's2D' (layout( binding=1) uniform highp sampler2D)
 
 // Module Version 10000
@@ -233,7 +233,7 @@ gl_FragCoord origin is upper left
                               MemberDecorate 67(bnameImplicit) 0 Offset 0
                               Decorate 67(bnameImplicit) BufferBlock
                               Decorate 69 DescriptorSet 0
-                              Decorate 69 Binding 0
+                              Decorate 69 Binding 1
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/size

@@ -0,0 +1 @@
+388096 ../build/install/bin/glslangValidator.exe

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

@@ -307,7 +307,7 @@ ERROR: node is still EOpNull!
 0:?     'c' ( in 4-component vector of float)
 0:?     'd' ( in 4-component vector of float)
 0:?     'v' ( noContraction smooth out 4-component vector of float)
-0:?     'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2})
+0:?     'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2})
 0:?     'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A})
 0:?     'shv' ( shared 4-component vector of float)
 0:?     'img1' (layout( rgba32f) uniform image2D)
@@ -590,7 +590,7 @@ ERROR: node is still EOpNull!
 0:?     'c' ( in 4-component vector of float)
 0:?     'd' ( in 4-component vector of float)
 0:?     'v' ( noContraction smooth out 4-component vector of float)
-0:?     'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2})
+0:?     'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2})
 0:?     'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A})
 0:?     'shv' ( shared 4-component vector of float)
 0:?     'img1' (layout( rgba32f) uniform image2D)

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

@@ -308,7 +308,7 @@ ERROR: node is still EOpNull!
 0:?     'c' ( in 4-component vector of float)
 0:?     'd' ( in 4-component vector of float)
 0:?     'v' ( noContraction smooth out 4-component vector of float)
-0:?     'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2})
+0:?     'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2})
 0:?     'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A})
 0:?     'shv' ( shared 4-component vector of float)
 0:?     'img1' (layout( rgba32f) uniform image2D)
@@ -591,7 +591,7 @@ ERROR: node is still EOpNull!
 0:?     'c' ( in 4-component vector of float)
 0:?     'd' ( in 4-component vector of float)
 0:?     'v' ( noContraction smooth out 4-component vector of float)
-0:?     'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2})
+0:?     'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2})
 0:?     'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A})
 0:?     'shv' ( shared 4-component vector of float)
 0:?     'img1' (layout( rgba32f) uniform image2D)

+ 2 - 2
3rdparty/glslang/Test/baseResults/spv.coopmat.comp.out

@@ -282,7 +282,7 @@ spv.coopmat.comp
              101:    100(ptr) AccessChain 91(block16) 99
              102:     85(ptr) Load 101 MakePointerVisibleKHR NonPrivatePointerKHR 71
              104:    103(ptr) AccessChain 102 58 31
-             105:          32 CooperativeMatrixLoadNV 104 74 76 Aligned 16
+             105:          32 CooperativeMatrixLoadNV 104 74 76 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 71
                               Store 98(tempArg) 105
              106:          32 Load 98(tempArg)
                               Store 34(m) 106
@@ -290,7 +290,7 @@ spv.coopmat.comp
              108:    100(ptr) AccessChain 91(block16) 99
              109:     85(ptr) Load 108 MakePointerVisibleKHR NonPrivatePointerKHR 71
              110:    103(ptr) AccessChain 109 58 31
-                              CooperativeMatrixStoreNV 110 107 74 76 Aligned 16
+                              CooperativeMatrixStoreNV 110 107 74 76 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 71
              113:          50 Load 112(A)
              115:          10 Load 114(B)
              117:          32 Load 116(C)

+ 2 - 1
3rdparty/glslang/Test/baseResults/spv.debugInfo.1.1.frag.out

@@ -81,6 +81,7 @@ void main()
                               Name 97  "i"
                               ModuleProcessed  "no-storage-format"
                               ModuleProcessed  "resource-set-binding 3"
+                              ModuleProcessed  "auto-map-bindings"
                               ModuleProcessed  "auto-map-locations"
                               ModuleProcessed  "client opengl100"
                               ModuleProcessed  "target-env spirv1.3"
@@ -99,7 +100,7 @@ void main()
                               Decorate 56 Binding 0
                               Decorate 67(s2d) Location 0
                               Decorate 67(s2d) DescriptorSet 3
-                              Decorate 67(s2d) Binding 0
+                              Decorate 67(s2d) Binding 1
                3:             TypeVoid
                4:             TypeFunction 3
                7:             TypeInt 32 1

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

@@ -8,8 +8,8 @@ spv.depthOut.frag
                               MemoryModel Logical GLSL450
                               EntryPoint Fragment 4  "main" 8 10 14
                               ExecutionMode 4 OriginUpperLeft
-                              ExecutionMode 4 DepthGreater
                               ExecutionMode 4 DepthReplacing
+                              ExecutionMode 4 DepthGreater
                               Source GLSL 450
                               Name 4  "main"
                               Name 8  "gl_FragDepth"

+ 2 - 2
3rdparty/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out

@@ -15,12 +15,12 @@ spv.hlslDebugInfo.vert
 // OpModuleProcessed shift-UBO-binding 6
 // OpModuleProcessed shift-ssbo-binding 3
 // OpModuleProcessed shift-uav-binding 5
-// OpModuleProcessed flatten-uniform-arrays
 // OpModuleProcessed no-storage-format
 // OpModuleProcessed resource-set-binding t0 0 0
-// OpModuleProcessed hlsl-iomap
 // OpModuleProcessed auto-map-bindings
 // OpModuleProcessed auto-map-locations
+// OpModuleProcessed flatten-uniform-arrays
+// OpModuleProcessed hlsl-iomap
 // OpModuleProcessed client vulkan100
 // OpModuleProcessed target-env vulkan1.0
 // OpModuleProcessed source-entrypoint origMain

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

@@ -4,7 +4,7 @@ Shader version: 450
 0:27  Function Definition: main( ( global void)
 0:27    Function Parameters: 
 0:?   Linker Objects
-0:?     'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
+0:?     'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
 
 
 Linked vertex stage:
@@ -15,7 +15,7 @@ Shader version: 450
 0:27  Function Definition: main( ( global void)
 0:27    Function Parameters: 
 0:?   Linker Objects
-0:?     'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
+0:?     'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112})
 
 // Module Version 10000
 // Generated by (magic number): 80007

+ 102 - 0
3rdparty/glslang/Test/baseResults/web.array.frag.out

@@ -0,0 +1,102 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 74
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %colorOut
+               OpExecutionMode %main OriginUpperLeft
+               OpSource ESSL 310
+               OpName %main "main"
+               OpName %foo_f1_5__ "foo(f1[5];"
+               OpName %a "a"
+               OpName %g4 "g4"
+               OpName %g5 "g5"
+               OpName %param "param"
+               OpName %u "u"
+               OpName %param_0 "param"
+               OpName %colorOut "colorOut"
+               OpDecorate %colorOut Location 0
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+       %uint = OpTypeInt 32 0
+     %uint_5 = OpConstant %uint 5
+%_arr_float_uint_5 = OpTypeArray %float %uint_5
+%_ptr_Function__arr_float_uint_5 = OpTypePointer Function %_arr_float_uint_5
+     %uint_4 = OpConstant %uint 4
+%_arr_float_uint_4 = OpTypeArray %float %uint_4
+         %13 = OpTypeFunction %_arr_float_uint_4 %_ptr_Function__arr_float_uint_5
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+%_ptr_Function_float = OpTypePointer Function %float
+      %int_1 = OpConstant %int 1
+      %int_2 = OpConstant %int 2
+      %int_3 = OpConstant %int 3
+%_ptr_Private__arr_float_uint_4 = OpTypePointer Private %_arr_float_uint_4
+         %g4 = OpVariable %_ptr_Private__arr_float_uint_4 Private
+%_ptr_Private__arr_float_uint_5 = OpTypePointer Private %_arr_float_uint_5
+         %g5 = OpVariable %_ptr_Private__arr_float_uint_5 Private
+    %float_1 = OpConstant %float 1
+    %float_2 = OpConstant %float 2
+    %float_3 = OpConstant %float 3
+    %float_4 = OpConstant %float 4
+         %45 = OpConstantComposite %_arr_float_uint_4 %float_1 %float_2 %float_3 %float_4
+       %bool = OpTypeBool
+    %v2float = OpTypeVector %float 2
+%_ptr_Output_v2float = OpTypePointer Output %v2float
+   %colorOut = OpVariable %_ptr_Output_v2float Output
+    %float_5 = OpConstant %float 5
+         %73 = OpConstantComposite %v2float %float_4 %float_5
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+      %param = OpVariable %_ptr_Function__arr_float_uint_5 Function
+          %u = OpVariable %_ptr_Function__arr_float_uint_5 Function
+    %param_0 = OpVariable %_ptr_Function__arr_float_uint_5 Function
+         %39 = OpLoad %_arr_float_uint_5 %g5
+               OpStore %param %39
+         %40 = OpFunctionCall %_arr_float_uint_4 %foo_f1_5__ %param
+               OpStore %g4 %40
+         %46 = OpLoad %_arr_float_uint_4 %g4
+         %48 = OpCompositeExtract %float %45 0
+         %49 = OpCompositeExtract %float %46 0
+         %50 = OpFOrdEqual %bool %48 %49
+         %51 = OpCompositeExtract %float %45 1
+         %52 = OpCompositeExtract %float %46 1
+         %53 = OpFOrdEqual %bool %51 %52
+         %54 = OpLogicalAnd %bool %50 %53
+         %55 = OpCompositeExtract %float %45 2
+         %56 = OpCompositeExtract %float %46 2
+         %57 = OpFOrdEqual %bool %55 %56
+         %58 = OpLogicalAnd %bool %54 %57
+         %59 = OpCompositeExtract %float %45 3
+         %60 = OpCompositeExtract %float %46 3
+         %61 = OpFOrdEqual %bool %59 %60
+         %62 = OpLogicalAnd %bool %58 %61
+               OpSelectionMerge %64 None
+               OpBranchConditional %62 %63 %64
+         %63 = OpLabel
+               OpBranch %64
+         %64 = OpLabel
+         %67 = OpLoad %_arr_float_uint_5 %u
+               OpStore %param_0 %67
+         %68 = OpFunctionCall %_arr_float_uint_4 %foo_f1_5__ %param_0
+               OpStore %colorOut %73
+               OpReturn
+               OpFunctionEnd
+ %foo_f1_5__ = OpFunction %_arr_float_uint_4 None %13
+          %a = OpFunctionParameter %_ptr_Function__arr_float_uint_5
+         %16 = OpLabel
+         %20 = OpAccessChain %_ptr_Function_float %a %int_0
+         %21 = OpLoad %float %20
+         %23 = OpAccessChain %_ptr_Function_float %a %int_1
+         %24 = OpLoad %float %23
+         %26 = OpAccessChain %_ptr_Function_float %a %int_2
+         %27 = OpLoad %float %26
+         %29 = OpAccessChain %_ptr_Function_float %a %int_3
+         %30 = OpLoad %float %29
+         %31 = OpCompositeConstruct %_arr_float_uint_4 %21 %24 %27 %30
+               OpReturnValue %31
+               OpFunctionEnd

+ 65 - 0
3rdparty/glslang/Test/baseResults/web.basic.vert.out

@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 38
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %main "main" %outv4 %inv4
+               OpSource ESSL 310
+               OpName %main "main"
+               OpName %outv4 "outv4"
+               OpName %inv4 "inv4"
+               OpName %uBlock "uBlock"
+               OpMemberName %uBlock 0 "a"
+               OpMemberName %uBlock 1 "b"
+               OpMemberName %uBlock 2 "c"
+               OpName %uInst "uInst"
+               OpDecorate %outv4 Location 1
+               OpDecorate %inv4 Location 2
+               OpMemberDecorate %uBlock 0 Offset 0
+               OpMemberDecorate %uBlock 1 Offset 16
+               OpMemberDecorate %uBlock 2 Offset 32
+               OpDecorate %uBlock Block
+               OpDecorate %uInst DescriptorSet 0
+               OpDecorate %uInst Binding 3
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+      %outv4 = OpVariable %_ptr_Output_v4float Output
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+       %inv4 = OpVariable %_ptr_Input_v4float Input
+        %int = OpTypeInt 32 1
+      %v4int = OpTypeVector %int 4
+       %uint = OpTypeInt 32 0
+     %v4uint = OpTypeVector %uint 4
+     %uBlock = OpTypeStruct %v4float %v4int %v4uint
+%_ptr_Uniform_uBlock = OpTypePointer Uniform %uBlock
+      %uInst = OpVariable %_ptr_Uniform_uBlock Uniform
+      %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+      %int_1 = OpConstant %int 1
+%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int
+      %int_2 = OpConstant %int 2
+%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+         %12 = OpLoad %v4float %inv4
+         %13 = OpExtInst %v4float %1 Normalize %12
+         %23 = OpAccessChain %_ptr_Uniform_v4float %uInst %int_0
+         %24 = OpLoad %v4float %23
+         %25 = OpFMul %v4float %13 %24
+         %28 = OpAccessChain %_ptr_Uniform_v4int %uInst %int_1
+         %29 = OpLoad %v4int %28
+         %30 = OpConvertSToF %v4float %29
+         %31 = OpFMul %v4float %25 %30
+         %34 = OpAccessChain %_ptr_Uniform_v4uint %uInst %int_2
+         %35 = OpLoad %v4uint %34
+         %36 = OpConvertUToF %v4float %35
+         %37 = OpFMul %v4float %31 %36
+               OpStore %outv4 %37
+               OpReturn
+               OpFunctionEnd

+ 149 - 0
3rdparty/glslang/Test/baseResults/web.builtins.frag.out

@@ -0,0 +1,149 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 69
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %gl_FragCoord %gl_FragDepth %sc %s2 %sf %c1D %c2D %c4D %c3D %ic1D %ic3D %ic4D
+               OpExecutionMode %main OriginUpperLeft
+               OpExecutionMode %main DepthReplacing
+               OpSource ESSL 310
+               OpName %main "main"
+               OpName %f "f"
+               OpName %gl_FragCoord "gl_FragCoord"
+               OpName %gl_FragDepth "gl_FragDepth"
+               OpName %sc "sc"
+               OpName %S2 "S2"
+               OpMemberName %S2 0 "c"
+               OpMemberName %S2 1 "f"
+               OpName %s2 "s2"
+               OpName %sf "sf"
+               OpName %c1D "c1D"
+               OpName %c2D "c2D"
+               OpName %c4D "c4D"
+               OpName %c3D "c3D"
+               OpName %ic1D "ic1D"
+               OpName %ic3D "ic3D"
+               OpName %ic4D "ic4D"
+               OpDecorate %f RelaxedPrecision
+               OpDecorate %gl_FragCoord BuiltIn FragCoord
+               OpDecorate %gl_FragDepth BuiltIn FragDepth
+               OpDecorate %19 RelaxedPrecision
+               OpDecorate %sc RelaxedPrecision
+               OpDecorate %sc Location 0
+               OpMemberDecorate %S2 0 RelaxedPrecision
+               OpMemberDecorate %S2 1 RelaxedPrecision
+               OpDecorate %s2 Location 8
+               OpDecorate %30 RelaxedPrecision
+               OpDecorate %sf RelaxedPrecision
+               OpDecorate %sf Location 1
+               OpDecorate %34 RelaxedPrecision
+               OpDecorate %c1D RelaxedPrecision
+               OpDecorate %c1D Location 4
+               OpDecorate %36 RelaxedPrecision
+               OpDecorate %37 RelaxedPrecision
+               OpDecorate %38 RelaxedPrecision
+               OpDecorate %39 RelaxedPrecision
+               OpDecorate %c2D RelaxedPrecision
+               OpDecorate %c2D Location 5
+               OpDecorate %43 RelaxedPrecision
+               OpDecorate %44 RelaxedPrecision
+               OpDecorate %45 RelaxedPrecision
+               OpDecorate %46 RelaxedPrecision
+               OpDecorate %47 RelaxedPrecision
+               OpDecorate %c4D RelaxedPrecision
+               OpDecorate %c4D Location 7
+               OpDecorate %49 RelaxedPrecision
+               OpDecorate %50 RelaxedPrecision
+               OpDecorate %51 RelaxedPrecision
+               OpDecorate %52 RelaxedPrecision
+               OpDecorate %53 RelaxedPrecision
+               OpDecorate %c3D RelaxedPrecision
+               OpDecorate %c3D Location 6
+               OpDecorate %55 RelaxedPrecision
+               OpDecorate %56 RelaxedPrecision
+               OpDecorate %ic1D RelaxedPrecision
+               OpDecorate %ic1D Flat
+               OpDecorate %ic1D Location 1
+               OpDecorate %ic3D RelaxedPrecision
+               OpDecorate %ic3D Flat
+               OpDecorate %ic3D Location 2
+               OpDecorate %ic4D RelaxedPrecision
+               OpDecorate %ic4D Flat
+               OpDecorate %ic4D Location 3
+               OpDecorate %68 RelaxedPrecision
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+    %v4float = OpTypeVector %float 4
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
+       %uint = OpTypeInt 32 0
+     %uint_1 = OpConstant %uint 1
+%_ptr_Input_float = OpTypePointer Input %float
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output
+    %v3float = OpTypeVector %float 3
+%_ptr_Output_v3float = OpTypePointer Output %v3float
+         %sc = OpVariable %_ptr_Output_v3float Output
+         %S2 = OpTypeStruct %v3float %float
+%_ptr_Input_S2 = OpTypePointer Input %S2
+         %s2 = OpVariable %_ptr_Input_S2 Input
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+%_ptr_Input_v3float = OpTypePointer Input %v3float
+         %sf = OpVariable %_ptr_Output_float Output
+      %int_1 = OpConstant %int 1
+        %c1D = OpVariable %_ptr_Input_float Input
+    %v2float = OpTypeVector %float 2
+%_ptr_Input_v2float = OpTypePointer Input %v2float
+        %c2D = OpVariable %_ptr_Input_v2float Input
+        %c4D = OpVariable %_ptr_Input_v4float Input
+        %c3D = OpVariable %_ptr_Input_v3float Input
+%_ptr_Input_int = OpTypePointer Input %int
+       %ic1D = OpVariable %_ptr_Input_int Input
+      %v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+       %ic3D = OpVariable %_ptr_Input_v3int Input
+      %v4int = OpTypeVector %int 4
+%_ptr_Input_v4int = OpTypePointer Input %v4int
+       %ic4D = OpVariable %_ptr_Input_v4int Input
+      %v2int = OpTypeVector %int 2
+      %int_2 = OpConstant %int 2
+      %int_3 = OpConstant %int 3
+         %68 = OpConstantComposite %v2int %int_2 %int_3
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+          %f = OpVariable %_ptr_Function_float Function
+         %15 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1
+         %16 = OpLoad %float %15
+               OpStore %f %16
+         %19 = OpLoad %float %f
+               OpStore %gl_FragDepth %19
+         %29 = OpAccessChain %_ptr_Input_v3float %s2 %int_0
+         %30 = OpLoad %v3float %29
+               OpStore %sc %30
+         %33 = OpAccessChain %_ptr_Input_float %s2 %int_1
+         %34 = OpLoad %float %33
+               OpStore %sf %34
+         %36 = OpLoad %float %c1D
+         %37 = OpExtInst %float %1 Sinh %36
+         %38 = OpLoad %float %c1D
+         %39 = OpExtInst %float %1 Cosh %38
+         %43 = OpLoad %v2float %c2D
+         %44 = OpExtInst %v2float %1 Tanh %43
+         %45 = OpVectorTimesScalar %v2float %44 %39
+         %46 = OpCompositeConstruct %v2float %37 %37
+         %47 = OpFAdd %v2float %46 %45
+         %49 = OpLoad %v4float %c4D
+         %50 = OpExtInst %v4float %1 Asinh %49
+         %51 = OpLoad %v4float %c4D
+         %52 = OpExtInst %v4float %1 Acosh %51
+         %53 = OpFAdd %v4float %50 %52
+         %55 = OpLoad %v3float %c3D
+         %56 = OpExtInst %v3float %1 Atanh %55
+               OpReturn
+               OpFunctionEnd

+ 62 - 0
3rdparty/glslang/Test/baseResults/web.builtins.vert.out

@@ -0,0 +1,62 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 33
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %main "main" %gl_Position %ps %gl_VertexIndex %gl_PointSize %gl_InstanceIndex
+               OpSource ESSL 310
+               OpName %main "main"
+               OpName %gl_Position "gl_Position"
+               OpName %ps "ps"
+               OpName %gl_VertexIndex "gl_VertexIndex"
+               OpName %gl_PointSize "gl_PointSize"
+               OpName %gl_InstanceIndex "gl_InstanceIndex"
+               OpDecorate %gl_Position Invariant
+               OpDecorate %gl_Position BuiltIn Position
+               OpDecorate %ps RelaxedPrecision
+               OpDecorate %ps Location 0
+               OpDecorate %12 RelaxedPrecision
+               OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+               OpDecorate %gl_PointSize BuiltIn PointSize
+               OpDecorate %25 RelaxedPrecision
+               OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%_ptr_Input_float = OpTypePointer Input %float
+         %ps = OpVariable %_ptr_Input_float Input
+        %int = OpTypeInt 32 1
+      %int_4 = OpConstant %int 4
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexIndex = OpVariable %_ptr_Input_int Input
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_PointSize = OpVariable %_ptr_Output_float Output
+      %int_5 = OpConstant %int 5
+%gl_InstanceIndex = OpVariable %_ptr_Input_int Input
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+         %12 = OpLoad %float %ps
+         %13 = OpCompositeConstruct %v4float %12 %12 %12 %12
+               OpStore %gl_Position %13
+         %18 = OpLoad %int %gl_VertexIndex
+         %19 = OpISub %int %int_4 %18
+         %20 = OpConvertSToF %float %19
+         %21 = OpLoad %v4float %gl_Position
+         %22 = OpVectorTimesScalar %v4float %21 %20
+               OpStore %gl_Position %22
+         %25 = OpLoad %float %ps
+               OpStore %gl_PointSize %25
+         %28 = OpLoad %int %gl_InstanceIndex
+         %29 = OpISub %int %int_5 %28
+         %30 = OpConvertSToF %float %29
+         %31 = OpLoad %float %gl_PointSize
+         %32 = OpFMul %float %31 %30
+               OpStore %gl_PointSize %32
+               OpReturn
+               OpFunctionEnd

+ 347 - 0
3rdparty/glslang/Test/baseResults/web.controlFlow.frag.out

@@ -0,0 +1,347 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 193
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %x %BaseColor %Count %bigColor %outColor %v4 %f_0
+               OpExecutionMode %main OriginUpperLeft
+               OpSource ESSL 310
+               OpName %main "main"
+               OpName %c "c"
+               OpName %f "f"
+               OpName %x "x"
+               OpName %d "d"
+               OpName %color "color"
+               OpName %BaseColor "BaseColor"
+               OpName %i "i"
+               OpName %Count "Count"
+               OpName %bigColor "bigColor"
+               OpName %outColor "outColor"
+               OpName %sum "sum"
+               OpName %i_0 "i"
+               OpName %v4 "v4"
+               OpName %i_1 "i"
+               OpName %tv4 "tv4"
+               OpName %r "r"
+               OpName %i_2 "i"
+               OpName %i_3 "i"
+               OpName %i_4 "i"
+               OpName %A "A"
+               OpName %B "B"
+               OpName %C "C"
+               OpName %D "D"
+               OpName %f_0 "f"
+               OpDecorate %f RelaxedPrecision
+               OpDecorate %x Location 0
+               OpDecorate %color RelaxedPrecision
+               OpDecorate %BaseColor RelaxedPrecision
+               OpDecorate %BaseColor Location 2
+               OpDecorate %47 RelaxedPrecision
+               OpDecorate %Count Flat
+               OpDecorate %Count Location 4
+               OpDecorate %bigColor RelaxedPrecision
+               OpDecorate %bigColor Location 1
+               OpDecorate %63 RelaxedPrecision
+               OpDecorate %64 RelaxedPrecision
+               OpDecorate %65 RelaxedPrecision
+               OpDecorate %outColor RelaxedPrecision
+               OpDecorate %outColor Location 0
+               OpDecorate %71 RelaxedPrecision
+               OpDecorate %sum RelaxedPrecision
+               OpDecorate %v4 Flat
+               OpDecorate %v4 Location 5
+               OpDecorate %91 RelaxedPrecision
+               OpDecorate %92 RelaxedPrecision
+               OpDecorate %93 RelaxedPrecision
+               OpDecorate %tv4 RelaxedPrecision
+               OpDecorate %111 RelaxedPrecision
+               OpDecorate %115 RelaxedPrecision
+               OpDecorate %116 RelaxedPrecision
+               OpDecorate %117 RelaxedPrecision
+               OpDecorate %118 RelaxedPrecision
+               OpDecorate %119 RelaxedPrecision
+               OpDecorate %120 RelaxedPrecision
+               OpDecorate %r RelaxedPrecision
+               OpDecorate %123 RelaxedPrecision
+               OpDecorate %124 RelaxedPrecision
+               OpDecorate %136 RelaxedPrecision
+               OpDecorate %141 RelaxedPrecision
+               OpDecorate %142 RelaxedPrecision
+               OpDecorate %143 RelaxedPrecision
+               OpDecorate %144 RelaxedPrecision
+               OpDecorate %145 RelaxedPrecision
+               OpDecorate %157 RelaxedPrecision
+               OpDecorate %158 RelaxedPrecision
+               OpDecorate %159 RelaxedPrecision
+               OpDecorate %f_0 RelaxedPrecision
+               OpDecorate %f_0 Location 3
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+          %c = OpVariable %_ptr_Private_int Private
+      %float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Input_float = OpTypePointer Input %float
+          %x = OpVariable %_ptr_Input_float Input
+          %d = OpVariable %_ptr_Private_int Private
+    %v4float = OpTypeVector %float 4
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+  %BaseColor = OpVariable %_ptr_Input_v4float Input
+%_ptr_Function_int = OpTypePointer Function %int
+      %int_0 = OpConstant %int 0
+%_ptr_Input_int = OpTypePointer Input %int
+      %Count = OpVariable %_ptr_Input_int Input
+       %bool = OpTypeBool
+   %bigColor = OpVariable %_ptr_Input_v4float Input
+      %int_1 = OpConstant %int 1
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+   %outColor = OpVariable %_ptr_Output_v4float Output
+    %float_0 = OpConstant %float 0
+      %int_4 = OpConstant %int 4
+       %uint = OpTypeInt 32 0
+     %v4uint = OpTypeVector %uint 4
+%_ptr_Input_v4uint = OpTypePointer Input %v4uint
+         %v4 = OpVariable %_ptr_Input_v4uint Input
+%_ptr_Input_uint = OpTypePointer Input %uint
+     %uint_4 = OpConstant %uint 4
+    %v3float = OpTypeVector %float 3
+     %uint_3 = OpConstant %uint 3
+     %int_16 = OpConstant %int 16
+     %int_10 = OpConstant %int 10
+      %int_2 = OpConstant %int 2
+      %int_5 = OpConstant %int 5
+      %int_3 = OpConstant %int 3
+        %f_0 = OpVariable %_ptr_Input_float Input
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+          %f = OpVariable %_ptr_Function_float Function
+      %color = OpVariable %_ptr_Function_v4float Function
+          %i = OpVariable %_ptr_Function_int Function
+        %sum = OpVariable %_ptr_Function_float Function
+        %i_0 = OpVariable %_ptr_Function_int Function
+        %i_1 = OpVariable %_ptr_Function_int Function
+        %tv4 = OpVariable %_ptr_Function_v4float Function
+          %r = OpVariable %_ptr_Function_v4float Function
+        %i_2 = OpVariable %_ptr_Function_int Function
+        %i_3 = OpVariable %_ptr_Function_int Function
+        %i_4 = OpVariable %_ptr_Function_int Function
+          %A = OpVariable %_ptr_Function_int Function
+          %B = OpVariable %_ptr_Function_int Function
+          %C = OpVariable %_ptr_Function_int Function
+          %D = OpVariable %_ptr_Function_int Function
+          %9 = OpLoad %int %c
+               OpSelectionMerge %13 None
+               OpSwitch %9 %12 1 %10 2 %11
+         %12 = OpLabel
+         %39 = OpLoad %float %x
+         %40 = OpExtInst %float %1 Tan %39
+               OpStore %f %40
+               OpBranch %13
+         %10 = OpLabel
+         %19 = OpLoad %float %x
+         %20 = OpExtInst %float %1 Sin %19
+               OpStore %f %20
+               OpBranch %13
+         %11 = OpLabel
+         %23 = OpLoad %int %d
+               OpSelectionMerge %26 None
+               OpSwitch %23 %26 1 %24 2 %25
+         %24 = OpLabel
+         %27 = OpLoad %float %x
+         %28 = OpLoad %float %x
+         %29 = OpFMul %float %27 %28
+         %30 = OpLoad %float %x
+         %31 = OpFMul %float %29 %30
+               OpStore %f %31
+               OpBranch %26
+         %25 = OpLabel
+         %33 = OpLoad %float %x
+         %34 = OpLoad %float %x
+         %35 = OpFMul %float %33 %34
+               OpStore %f %35
+               OpBranch %26
+         %26 = OpLabel
+               OpBranch %13
+         %13 = OpLabel
+         %47 = OpLoad %v4float %BaseColor
+               OpStore %color %47
+               OpStore %i %int_0
+               OpBranch %51
+         %51 = OpLabel
+               OpLoopMerge %53 %54 None
+               OpBranch %55
+         %55 = OpLabel
+         %56 = OpLoad %int %i
+         %59 = OpLoad %int %Count
+         %61 = OpSLessThan %bool %56 %59
+               OpBranchConditional %61 %52 %53
+         %52 = OpLabel
+         %63 = OpLoad %v4float %bigColor
+         %64 = OpLoad %v4float %color
+         %65 = OpFAdd %v4float %64 %63
+               OpStore %color %65
+               OpBranch %54
+         %54 = OpLabel
+         %66 = OpLoad %int %i
+         %68 = OpIAdd %int %66 %int_1
+               OpStore %i %68
+               OpBranch %51
+         %53 = OpLabel
+         %71 = OpLoad %v4float %color
+               OpStore %outColor %71
+               OpStore %sum %float_0
+               OpStore %i_0 %int_0
+               OpBranch %75
+         %75 = OpLabel
+               OpLoopMerge %77 %78 None
+               OpBranch %79
+         %79 = OpLabel
+         %80 = OpLoad %int %i_0
+         %82 = OpSLessThan %bool %80 %int_4
+               OpBranchConditional %82 %76 %77
+         %76 = OpLabel
+         %87 = OpLoad %int %i_0
+         %89 = OpAccessChain %_ptr_Input_uint %v4 %87
+         %90 = OpLoad %uint %89
+         %91 = OpConvertUToF %float %90
+         %92 = OpLoad %float %sum
+         %93 = OpFAdd %float %92 %91
+               OpStore %sum %93
+               OpBranch %78
+         %78 = OpLabel
+         %94 = OpLoad %int %i_0
+         %95 = OpIAdd %int %94 %int_1
+               OpStore %i_0 %95
+               OpBranch %75
+         %77 = OpLabel
+               OpStore %i_1 %int_0
+               OpBranch %97
+         %97 = OpLabel
+               OpLoopMerge %99 %100 None
+               OpBranch %101
+        %101 = OpLabel
+        %102 = OpLoad %int %i_1
+        %103 = OpSLessThan %bool %102 %int_4
+               OpBranchConditional %103 %98 %99
+         %98 = OpLabel
+        %105 = OpLoad %int %i_1
+        %106 = OpLoad %int %i_1
+        %107 = OpAccessChain %_ptr_Input_uint %v4 %106
+        %108 = OpLoad %uint %107
+        %110 = OpIMul %uint %108 %uint_4
+        %111 = OpConvertUToF %float %110
+        %112 = OpAccessChain %_ptr_Function_float %tv4 %105
+               OpStore %112 %111
+               OpBranch %100
+        %100 = OpLabel
+        %113 = OpLoad %int %i_1
+        %114 = OpIAdd %int %113 %int_1
+               OpStore %i_1 %114
+               OpBranch %97
+         %99 = OpLabel
+        %115 = OpLoad %float %sum
+        %116 = OpCompositeConstruct %v4float %115 %115 %115 %115
+        %117 = OpLoad %v4float %tv4
+        %118 = OpFAdd %v4float %116 %117
+        %119 = OpLoad %v4float %outColor
+        %120 = OpFAdd %v4float %119 %118
+               OpStore %outColor %120
+        %123 = OpLoad %v4float %BaseColor
+        %124 = OpVectorShuffle %v3float %123 %123 0 1 2
+        %125 = OpLoad %v4float %r
+        %126 = OpVectorShuffle %v4float %125 %124 4 5 6 3
+               OpStore %r %126
+               OpStore %i_2 %int_0
+               OpBranch %128
+        %128 = OpLabel
+               OpLoopMerge %130 %131 None
+               OpBranch %132
+        %132 = OpLabel
+        %133 = OpLoad %int %i_2
+        %134 = OpLoad %int %Count
+        %135 = OpSLessThan %bool %133 %134
+               OpBranchConditional %135 %129 %130
+        %129 = OpLabel
+        %136 = OpLoad %float %f
+        %138 = OpAccessChain %_ptr_Function_float %r %uint_3
+               OpStore %138 %136
+               OpBranch %131
+        %131 = OpLabel
+        %139 = OpLoad %int %i_2
+        %140 = OpIAdd %int %139 %int_1
+               OpStore %i_2 %140
+               OpBranch %128
+        %130 = OpLabel
+        %141 = OpLoad %v4float %r
+        %142 = OpVectorShuffle %v3float %141 %141 0 1 2
+        %143 = OpLoad %v4float %outColor
+        %144 = OpVectorShuffle %v3float %143 %143 0 1 2
+        %145 = OpFAdd %v3float %144 %142
+        %146 = OpLoad %v4float %outColor
+        %147 = OpVectorShuffle %v4float %146 %145 4 5 6 3
+               OpStore %outColor %147
+               OpStore %i_3 %int_0
+               OpBranch %149
+        %149 = OpLabel
+               OpLoopMerge %151 %152 None
+               OpBranch %153
+        %153 = OpLabel
+        %154 = OpLoad %int %i_3
+        %156 = OpSLessThan %bool %154 %int_16
+               OpBranchConditional %156 %150 %151
+        %150 = OpLabel
+        %157 = OpLoad %float %f
+        %158 = OpLoad %v4float %outColor
+        %159 = OpVectorTimesScalar %v4float %158 %157
+               OpStore %outColor %159
+               OpBranch %152
+        %152 = OpLabel
+        %160 = OpLoad %int %i_3
+        %161 = OpIAdd %int %160 %int_4
+               OpStore %i_3 %161
+               OpBranch %149
+        %151 = OpLabel
+               OpStore %i_4 %int_0
+               OpBranch %163
+        %163 = OpLabel
+               OpLoopMerge %165 %166 None
+               OpBranch %167
+        %167 = OpLabel
+        %168 = OpLoad %int %i_4
+        %170 = OpSLessThan %bool %168 %int_10
+               OpBranchConditional %170 %164 %165
+        %164 = OpLabel
+               OpStore %A %int_1
+        %172 = OpLoad %int %i_4
+        %174 = OpSMod %int %172 %int_2
+        %175 = OpIEqual %bool %174 %int_0
+               OpSelectionMerge %177 None
+               OpBranchConditional %175 %176 %177
+        %176 = OpLabel
+               OpStore %B %int_2
+               OpBranch %166
+        %177 = OpLabel
+        %181 = OpLoad %int %i_4
+        %183 = OpSMod %int %181 %int_5
+        %184 = OpIEqual %bool %183 %int_0
+               OpSelectionMerge %186 None
+               OpBranchConditional %184 %185 %186
+        %185 = OpLabel
+               OpStore %B %int_2
+               OpBranch %165
+        %186 = OpLabel
+        %188 = OpLoad %int %i_4
+        %189 = OpIAdd %int %188 %int_1
+               OpStore %i_4 %189
+               OpBranch %166
+        %166 = OpLabel
+               OpBranch %163
+        %165 = OpLabel
+               OpStore %D %int_3
+               OpReturn
+               OpFunctionEnd

+ 321 - 0
3rdparty/glslang/Test/baseResults/web.operations.frag.out

@@ -0,0 +1,321 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 207
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main"
+               OpExecutionMode %main OriginUpperLeft
+               OpSource ESSL 310
+               OpName %main "main"
+               OpName %f "f"
+               OpName %v4 "v4"
+               OpName %u "u"
+               OpName %uv4 "uv4"
+               OpName %iv3 "iv3"
+               OpName %i "i"
+               OpName %uv3 "uv3"
+               OpName %m2 "m2"
+               OpName %iv4 "iv4"
+               OpName %m4 "m4"
+               OpName %a "a"
+               OpName %S "S"
+               OpMemberName %S 0 "i"
+               OpName %s "s"
+               OpName %b "b"
+               OpName %arr "arr"
+               OpName %arr2 "arr2"
+               OpName %block "block"
+               OpMemberName %block 0 "f"
+               OpName %instanceName "instanceName"
+               OpDecorate %u RelaxedPrecision
+               OpDecorate %18 RelaxedPrecision
+               OpDecorate %19 RelaxedPrecision
+               OpDecorate %20 RelaxedPrecision
+               OpDecorate %uv4 RelaxedPrecision
+               OpDecorate %24 RelaxedPrecision
+               OpDecorate %25 RelaxedPrecision
+               OpDecorate %26 RelaxedPrecision
+               OpDecorate %27 RelaxedPrecision
+               OpDecorate %iv3 RelaxedPrecision
+               OpDecorate %32 RelaxedPrecision
+               OpDecorate %33 RelaxedPrecision
+               OpDecorate %34 RelaxedPrecision
+               OpDecorate %i RelaxedPrecision
+               OpDecorate %38 RelaxedPrecision
+               OpDecorate %39 RelaxedPrecision
+               OpDecorate %uv3 RelaxedPrecision
+               OpDecorate %43 RelaxedPrecision
+               OpDecorate %45 RelaxedPrecision
+               OpDecorate %46 RelaxedPrecision
+               OpDecorate %iv4 RelaxedPrecision
+               OpDecorate %62 RelaxedPrecision
+               OpDecorate %64 RelaxedPrecision
+               OpDecorate %65 RelaxedPrecision
+               OpDecorate %104 RelaxedPrecision
+               OpDecorate %105 RelaxedPrecision
+               OpMemberDecorate %S 0 RelaxedPrecision
+               OpDecorate %153 RelaxedPrecision
+               OpDecorate %154 RelaxedPrecision
+               OpDecorate %155 RelaxedPrecision
+               OpDecorate %156 RelaxedPrecision
+               OpDecorate %157 RelaxedPrecision
+               OpDecorate %158 RelaxedPrecision
+               OpDecorate %159 RelaxedPrecision
+               OpDecorate %160 RelaxedPrecision
+               OpDecorate %161 RelaxedPrecision
+               OpDecorate %162 RelaxedPrecision
+               OpDecorate %163 RelaxedPrecision
+               OpDecorate %164 RelaxedPrecision
+               OpDecorate %165 RelaxedPrecision
+               OpDecorate %166 RelaxedPrecision
+               OpDecorate %167 RelaxedPrecision
+               OpDecorate %168 RelaxedPrecision
+               OpDecorate %169 RelaxedPrecision
+               OpDecorate %170 RelaxedPrecision
+               OpDecorate %171 RelaxedPrecision
+               OpDecorate %172 RelaxedPrecision
+               OpDecorate %173 RelaxedPrecision
+               OpDecorate %174 RelaxedPrecision
+               OpDecorate %175 RelaxedPrecision
+               OpDecorate %176 RelaxedPrecision
+               OpDecorate %177 RelaxedPrecision
+               OpDecorate %178 RelaxedPrecision
+               OpDecorate %179 RelaxedPrecision
+               OpDecorate %180 RelaxedPrecision
+               OpDecorate %181 RelaxedPrecision
+               OpDecorate %182 RelaxedPrecision
+               OpDecorate %183 RelaxedPrecision
+               OpDecorate %184 RelaxedPrecision
+               OpDecorate %185 RelaxedPrecision
+               OpDecorate %186 RelaxedPrecision
+               OpDecorate %187 RelaxedPrecision
+               OpDecorate %188 RelaxedPrecision
+               OpDecorate %189 RelaxedPrecision
+               OpDecorate %190 RelaxedPrecision
+               OpDecorate %191 RelaxedPrecision
+               OpDecorate %192 RelaxedPrecision
+               OpDecorate %193 RelaxedPrecision
+               OpDecorate %194 RelaxedPrecision
+               OpDecorate %arr RelaxedPrecision
+               OpDecorate %arr2 RelaxedPrecision
+               OpMemberDecorate %block 0 RelaxedPrecision
+               OpMemberDecorate %block 0 Offset 0
+               OpDecorate %block Block
+               OpDecorate %instanceName DescriptorSet 0
+               OpDecorate %instanceName Binding 0
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+    %v4float = OpTypeVector %float 4
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+       %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+     %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+        %int = OpTypeInt 32 1
+      %v3int = OpTypeVector %int 3
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+%_ptr_Function_int = OpTypePointer Function %int
+      %int_3 = OpConstant %int 3
+     %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+     %uint_4 = OpConstant %uint 4
+    %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
+    %float_1 = OpConstant %float 1
+      %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+      %int_1 = OpConstant %int 1
+%mat4v4float = OpTypeMatrix %v4float 4
+%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
+       %bool = OpTypeBool
+     %v4bool = OpTypeVector %bool 4
+     %v2bool = OpTypeVector %bool 2
+     %uint_5 = OpConstant %uint 5
+%_arr_float_uint_5 = OpTypeArray %float %uint_5
+%_ptr_Private__arr_float_uint_5 = OpTypePointer Private %_arr_float_uint_5
+          %a = OpVariable %_ptr_Private__arr_float_uint_5 Private
+          %S = OpTypeStruct %int
+%_ptr_Private_S = OpTypePointer Private %S
+          %s = OpVariable %_ptr_Private_S Private
+%_ptr_Function_bool = OpTypePointer Function %bool
+     %uint_2 = OpConstant %uint 2
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
+     %uint_3 = OpConstant %uint 3
+%_arr_int_uint_3 = OpTypeArray %int %uint_3
+%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3
+      %int_2 = OpConstant %int 2
+      %block = OpTypeStruct %float
+%_ptr_Uniform_block = OpTypePointer Uniform %block
+%instanceName = OpVariable %_ptr_Uniform_block Uniform
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+          %f = OpVariable %_ptr_Function_float Function
+         %v4 = OpVariable %_ptr_Function_v4float Function
+          %u = OpVariable %_ptr_Function_uint Function
+        %uv4 = OpVariable %_ptr_Function_v4uint Function
+        %iv3 = OpVariable %_ptr_Function_v3int Function
+          %i = OpVariable %_ptr_Function_int Function
+        %uv3 = OpVariable %_ptr_Function_v3uint Function
+         %m2 = OpVariable %_ptr_Function_mat2v2float Function
+        %iv4 = OpVariable %_ptr_Function_v4int Function
+         %m4 = OpVariable %_ptr_Function_mat4v4float Function
+          %b = OpVariable %_ptr_Function_bool Function
+        %arr = OpVariable %_ptr_Function__arr_int_uint_2 Function
+       %arr2 = OpVariable %_ptr_Function__arr_int_uint_3 Function
+          %9 = OpLoad %float %f
+         %13 = OpLoad %v4float %v4
+         %14 = OpVectorTimesScalar %v4float %13 %9
+         %18 = OpLoad %uint %u
+         %19 = OpLoad %uint %u
+         %20 = OpIAdd %uint %18 %19
+         %24 = OpLoad %v4uint %uv4
+         %25 = OpLoad %uint %u
+         %26 = OpCompositeConstruct %v4uint %25 %25 %25 %25
+         %27 = OpUDiv %v4uint %24 %26
+         %32 = OpLoad %v3int %iv3
+         %33 = OpLoad %v3int %iv3
+         %34 = OpISub %v3int %33 %32
+               OpStore %iv3 %34
+         %38 = OpLoad %int %i
+         %39 = OpSMod %int %38 %int_3
+               OpStore %i %39
+         %43 = OpLoad %v3uint %uv3
+         %45 = OpCompositeConstruct %v3uint %uint_4 %uint_4 %uint_4
+         %46 = OpUMod %v3uint %43 %45
+         %51 = OpLoad %mat2v2float %m2
+         %53 = OpCompositeConstruct %v2float %float_1 %float_1
+         %54 = OpCompositeExtract %v2float %51 0
+         %55 = OpFSub %v2float %54 %53
+         %56 = OpCompositeExtract %v2float %51 1
+         %57 = OpFSub %v2float %56 %53
+         %58 = OpCompositeConstruct %mat2v2float %55 %57
+               OpStore %m2 %58
+         %62 = OpLoad %v4int %iv4
+         %64 = OpCompositeConstruct %v4int %int_1 %int_1 %int_1 %int_1
+         %65 = OpIAdd %v4int %62 %64
+               OpStore %iv4 %65
+         %69 = OpLoad %mat4v4float %m4
+         %70 = OpLoad %mat4v4float %m4
+         %72 = OpCompositeExtract %v4float %69 0
+         %73 = OpCompositeExtract %v4float %70 0
+         %75 = OpFOrdNotEqual %v4bool %72 %73
+         %76 = OpAny %bool %75
+         %77 = OpCompositeExtract %v4float %69 1
+         %78 = OpCompositeExtract %v4float %70 1
+         %79 = OpFOrdNotEqual %v4bool %77 %78
+         %80 = OpAny %bool %79
+         %81 = OpLogicalOr %bool %76 %80
+         %82 = OpCompositeExtract %v4float %69 2
+         %83 = OpCompositeExtract %v4float %70 2
+         %84 = OpFOrdNotEqual %v4bool %82 %83
+         %85 = OpAny %bool %84
+         %86 = OpLogicalOr %bool %81 %85
+         %87 = OpCompositeExtract %v4float %69 3
+         %88 = OpCompositeExtract %v4float %70 3
+         %89 = OpFOrdNotEqual %v4bool %87 %88
+         %90 = OpAny %bool %89
+         %91 = OpLogicalOr %bool %86 %90
+         %92 = OpLoad %mat2v2float %m2
+         %93 = OpLoad %mat2v2float %m2
+         %94 = OpCompositeExtract %v2float %92 0
+         %95 = OpCompositeExtract %v2float %93 0
+         %97 = OpFOrdEqual %v2bool %94 %95
+         %98 = OpAll %bool %97
+         %99 = OpCompositeExtract %v2float %92 1
+        %100 = OpCompositeExtract %v2float %93 1
+        %101 = OpFOrdEqual %v2bool %99 %100
+        %102 = OpAll %bool %101
+        %103 = OpLogicalAnd %bool %98 %102
+        %104 = OpLoad %int %i
+        %105 = OpLoad %int %i
+        %106 = OpSLessThanEqual %bool %104 %105
+        %111 = OpLoad %_arr_float_uint_5 %a
+        %112 = OpLoad %_arr_float_uint_5 %a
+        %113 = OpCompositeExtract %float %111 0
+        %114 = OpCompositeExtract %float %112 0
+        %115 = OpFOrdEqual %bool %113 %114
+        %116 = OpCompositeExtract %float %111 1
+        %117 = OpCompositeExtract %float %112 1
+        %118 = OpFOrdEqual %bool %116 %117
+        %119 = OpLogicalAnd %bool %115 %118
+        %120 = OpCompositeExtract %float %111 2
+        %121 = OpCompositeExtract %float %112 2
+        %122 = OpFOrdEqual %bool %120 %121
+        %123 = OpLogicalAnd %bool %119 %122
+        %124 = OpCompositeExtract %float %111 3
+        %125 = OpCompositeExtract %float %112 3
+        %126 = OpFOrdEqual %bool %124 %125
+        %127 = OpLogicalAnd %bool %123 %126
+        %128 = OpCompositeExtract %float %111 4
+        %129 = OpCompositeExtract %float %112 4
+        %130 = OpFOrdEqual %bool %128 %129
+        %131 = OpLogicalAnd %bool %127 %130
+        %135 = OpLoad %S %s
+        %136 = OpLoad %S %s
+        %137 = OpCompositeExtract %int %135 0
+        %138 = OpCompositeExtract %int %136 0
+        %139 = OpINotEqual %bool %137 %138
+        %142 = OpLoad %bool %b
+        %143 = OpLoad %bool %b
+        %144 = OpLogicalAnd %bool %142 %143
+        %145 = OpLoad %bool %b
+        %146 = OpLoad %bool %b
+        %147 = OpLogicalOr %bool %145 %146
+        %148 = OpLoad %bool %b
+        %149 = OpLoad %bool %b
+        %150 = OpLogicalNotEqual %bool %148 %149
+        %151 = OpLoad %bool %b
+        %152 = OpLogicalNot %bool %151
+        %153 = OpLoad %int %i
+        %154 = OpNot %int %153
+        %155 = OpLoad %uint %u
+        %156 = OpNot %uint %155
+        %157 = OpLoad %v3uint %uv3
+        %158 = OpNot %v3uint %157
+        %159 = OpLoad %v3int %iv3
+        %160 = OpNot %v3int %159
+        %161 = OpLoad %int %i
+        %162 = OpLoad %v3uint %uv3
+        %163 = OpCompositeConstruct %v3int %161 %161 %161
+        %164 = OpShiftLeftLogical %v3uint %162 %163
+               OpStore %uv3 %164
+        %165 = OpLoad %int %i
+        %166 = OpLoad %int %i
+        %167 = OpShiftRightArithmetic %int %165 %166
+        %168 = OpLoad %uint %u
+        %169 = OpLoad %uint %u
+        %170 = OpShiftLeftLogical %uint %168 %169
+        %171 = OpLoad %v3int %iv3
+        %172 = OpLoad %v3int %iv3
+        %173 = OpShiftRightArithmetic %v3int %171 %172
+        %174 = OpLoad %int %i
+        %175 = OpLoad %int %i
+        %176 = OpBitwiseAnd %int %174 %175
+        %177 = OpLoad %uint %u
+        %178 = OpLoad %uint %u
+        %179 = OpBitwiseOr %uint %177 %178
+        %180 = OpLoad %v3int %iv3
+        %181 = OpLoad %v3int %iv3
+        %182 = OpBitwiseXor %v3int %180 %181
+        %183 = OpLoad %uint %u
+        %184 = OpLoad %v3uint %uv3
+        %185 = OpCompositeConstruct %v3uint %183 %183 %183
+        %186 = OpBitwiseAnd %v3uint %185 %184
+        %187 = OpLoad %v3uint %uv3
+        %188 = OpLoad %uint %u
+        %189 = OpCompositeConstruct %v3uint %188 %188 %188
+        %190 = OpBitwiseOr %v3uint %187 %189
+        %191 = OpLoad %uint %u
+        %192 = OpLoad %v3uint %uv3
+        %193 = OpCompositeConstruct %v3uint %191 %191 %191
+        %194 = OpBitwiseAnd %v3uint %192 %193
+               OpStore %uv3 %194
+               OpReturn
+               OpFunctionEnd

+ 396 - 0
3rdparty/glslang/Test/baseResults/web.texture.frag.out

@@ -0,0 +1,396 @@
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 189
+; Schema: 0
+               OpCapability Shader
+               OpCapability ImageQuery
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %c2D %c4D %c3D %ic3D %ic1D %c1D %ic4D %s2 %sc %sf
+               OpExecutionMode %main OriginUpperLeft
+               OpSource ESSL 310
+               OpName %main "main"
+               OpName %v "v"
+               OpName %s2D "s2D"
+               OpName %c2D "c2D"
+               OpName %s3D "s3D"
+               OpName %c4D "c4D"
+               OpName %s2DArray "s2DArray"
+               OpName %c3D "c3D"
+               OpName %ic3D "ic3D"
+               OpName %ic1D "ic1D"
+               OpName %f "f"
+               OpName %s2DShadow "s2DShadow"
+               OpName %c1D "c1D"
+               OpName %sCube "sCube"
+               OpName %s2DArrayShadow "s2DArrayShadow"
+               OpName %iv "iv"
+               OpName %is2D "is2D"
+               OpName %is3D "is3D"
+               OpName %isCube "isCube"
+               OpName %is2DArray "is2DArray"
+               OpName %sCubeShadow "sCubeShadow"
+               OpName %us2D "us2D"
+               OpName %us3D "us3D"
+               OpName %usCube "usCube"
+               OpName %us2DArray "us2DArray"
+               OpName %ic4D "ic4D"
+               OpName %S2 "S2"
+               OpMemberName %S2 0 "c"
+               OpMemberName %S2 1 "f"
+               OpName %s2 "s2"
+               OpName %sc "sc"
+               OpName %sf "sf"
+               OpName %arrayedSampler "arrayedSampler"
+               OpDecorate %v RelaxedPrecision
+               OpDecorate %s2D RelaxedPrecision
+               OpDecorate %s2D DescriptorSet 0
+               OpDecorate %s2D Binding 1
+               OpDecorate %14 RelaxedPrecision
+               OpDecorate %c2D RelaxedPrecision
+               OpDecorate %c2D Location 5
+               OpDecorate %18 RelaxedPrecision
+               OpDecorate %19 RelaxedPrecision
+               OpDecorate %s3D RelaxedPrecision
+               OpDecorate %s3D DescriptorSet 0
+               OpDecorate %s3D Binding 2
+               OpDecorate %24 RelaxedPrecision
+               OpDecorate %c4D RelaxedPrecision
+               OpDecorate %c4D Location 7
+               OpDecorate %27 RelaxedPrecision
+               OpDecorate %28 RelaxedPrecision
+               OpDecorate %s2DArray RelaxedPrecision
+               OpDecorate %s2DArray DescriptorSet 0
+               OpDecorate %s2DArray Binding 6
+               OpDecorate %33 RelaxedPrecision
+               OpDecorate %c3D RelaxedPrecision
+               OpDecorate %c3D Location 6
+               OpDecorate %37 RelaxedPrecision
+               OpDecorate %39 RelaxedPrecision
+               OpDecorate %40 RelaxedPrecision
+               OpDecorate %ic3D RelaxedPrecision
+               OpDecorate %ic3D Flat
+               OpDecorate %ic3D Location 2
+               OpDecorate %45 RelaxedPrecision
+               OpDecorate %ic1D RelaxedPrecision
+               OpDecorate %ic1D Flat
+               OpDecorate %ic1D Location 1
+               OpDecorate %48 RelaxedPrecision
+               OpDecorate %50 RelaxedPrecision
+               OpDecorate %f RelaxedPrecision
+               OpDecorate %s2DShadow RelaxedPrecision
+               OpDecorate %s2DShadow DescriptorSet 0
+               OpDecorate %s2DShadow Binding 5
+               OpDecorate %57 RelaxedPrecision
+               OpDecorate %58 RelaxedPrecision
+               OpDecorate %c1D RelaxedPrecision
+               OpDecorate %c1D Location 4
+               OpDecorate %61 RelaxedPrecision
+               OpDecorate %67 RelaxedPrecision
+               OpDecorate %68 RelaxedPrecision
+               OpDecorate %69 RelaxedPrecision
+               OpDecorate %70 RelaxedPrecision
+               OpDecorate %71 RelaxedPrecision
+               OpDecorate %sCube RelaxedPrecision
+               OpDecorate %sCube DescriptorSet 0
+               OpDecorate %sCube Binding 3
+               OpDecorate %76 RelaxedPrecision
+               OpDecorate %77 RelaxedPrecision
+               OpDecorate %78 RelaxedPrecision
+               OpDecorate %79 RelaxedPrecision
+               OpDecorate %80 RelaxedPrecision
+               OpDecorate %s2DArrayShadow RelaxedPrecision
+               OpDecorate %s2DArrayShadow DescriptorSet 0
+               OpDecorate %s2DArrayShadow Binding 7
+               OpDecorate %85 RelaxedPrecision
+               OpDecorate %86 RelaxedPrecision
+               OpDecorate %87 RelaxedPrecision
+               OpDecorate %88 RelaxedPrecision
+               OpDecorate %90 RelaxedPrecision
+               OpDecorate %91 RelaxedPrecision
+               OpDecorate %92 RelaxedPrecision
+               OpDecorate %93 RelaxedPrecision
+               OpDecorate %94 RelaxedPrecision
+               OpDecorate %95 RelaxedPrecision
+               OpDecorate %96 RelaxedPrecision
+               OpDecorate %97 RelaxedPrecision
+               OpDecorate %98 RelaxedPrecision
+               OpDecorate %99 RelaxedPrecision
+               OpDecorate %100 RelaxedPrecision
+               OpDecorate %iv RelaxedPrecision
+               OpDecorate %is2D RelaxedPrecision
+               OpDecorate %is2D DescriptorSet 0
+               OpDecorate %is2D Binding 8
+               OpDecorate %108 RelaxedPrecision
+               OpDecorate %109 RelaxedPrecision
+               OpDecorate %110 RelaxedPrecision
+               OpDecorate %111 RelaxedPrecision
+               OpDecorate %112 RelaxedPrecision
+               OpDecorate %115 RelaxedPrecision
+               OpDecorate %116 RelaxedPrecision
+               OpDecorate %117 RelaxedPrecision
+               OpDecorate %118 RelaxedPrecision
+               OpDecorate %119 RelaxedPrecision
+               OpDecorate %120 RelaxedPrecision
+               OpDecorate %121 RelaxedPrecision
+               OpDecorate %122 RelaxedPrecision
+               OpDecorate %123 RelaxedPrecision
+               OpDecorate %124 RelaxedPrecision
+               OpDecorate %is3D RelaxedPrecision
+               OpDecorate %is3D DescriptorSet 0
+               OpDecorate %is3D Binding 9
+               OpDecorate %129 RelaxedPrecision
+               OpDecorate %130 RelaxedPrecision
+               OpDecorate %132 RelaxedPrecision
+               OpDecorate %isCube RelaxedPrecision
+               OpDecorate %isCube DescriptorSet 0
+               OpDecorate %isCube Binding 10
+               OpDecorate %137 RelaxedPrecision
+               OpDecorate %138 RelaxedPrecision
+               OpDecorate %139 RelaxedPrecision
+               OpDecorate %140 RelaxedPrecision
+               OpDecorate %is2DArray RelaxedPrecision
+               OpDecorate %is2DArray DescriptorSet 0
+               OpDecorate %is2DArray Binding 11
+               OpDecorate %145 RelaxedPrecision
+               OpDecorate %146 RelaxedPrecision
+               OpDecorate %147 RelaxedPrecision
+               OpDecorate %149 RelaxedPrecision
+               OpDecorate %sCubeShadow RelaxedPrecision
+               OpDecorate %sCubeShadow DescriptorSet 0
+               OpDecorate %sCubeShadow Binding 4
+               OpDecorate %154 RelaxedPrecision
+               OpDecorate %us2D RelaxedPrecision
+               OpDecorate %us2D DescriptorSet 0
+               OpDecorate %us2D Binding 12
+               OpDecorate %us3D RelaxedPrecision
+               OpDecorate %us3D DescriptorSet 0
+               OpDecorate %us3D Binding 13
+               OpDecorate %usCube RelaxedPrecision
+               OpDecorate %usCube DescriptorSet 0
+               OpDecorate %usCube Binding 14
+               OpDecorate %us2DArray RelaxedPrecision
+               OpDecorate %us2DArray DescriptorSet 0
+               OpDecorate %us2DArray Binding 15
+               OpDecorate %ic4D RelaxedPrecision
+               OpDecorate %ic4D Flat
+               OpDecorate %ic4D Location 3
+               OpDecorate %65 RelaxedPrecision
+               OpMemberDecorate %S2 0 RelaxedPrecision
+               OpMemberDecorate %S2 1 RelaxedPrecision
+               OpDecorate %s2 Location 8
+               OpDecorate %sc RelaxedPrecision
+               OpDecorate %sc Location 0
+               OpDecorate %sf RelaxedPrecision
+               OpDecorate %sf Location 1
+               OpDecorate %arrayedSampler RelaxedPrecision
+               OpDecorate %arrayedSampler DescriptorSet 0
+               OpDecorate %arrayedSampler Binding 0
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+         %10 = OpTypeImage %float 2D 0 0 0 1 Unknown
+         %11 = OpTypeSampledImage %10
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+        %s2D = OpVariable %_ptr_UniformConstant_11 UniformConstant
+    %v2float = OpTypeVector %float 2
+%_ptr_Input_v2float = OpTypePointer Input %v2float
+        %c2D = OpVariable %_ptr_Input_v2float Input
+         %20 = OpTypeImage %float 3D 0 0 0 1 Unknown
+         %21 = OpTypeSampledImage %20
+%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %21
+        %s3D = OpVariable %_ptr_UniformConstant_21 UniformConstant
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+        %c4D = OpVariable %_ptr_Input_v4float Input
+         %29 = OpTypeImage %float 2D 0 1 0 1 Unknown
+         %30 = OpTypeSampledImage %29
+%_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30
+   %s2DArray = OpVariable %_ptr_UniformConstant_30 UniformConstant
+    %v3float = OpTypeVector %float 3
+%_ptr_Input_v3float = OpTypePointer Input %v3float
+        %c3D = OpVariable %_ptr_Input_v3float Input
+%float_1_20000005 = OpConstant %float 1.20000005
+        %int = OpTypeInt 32 1
+      %v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+       %ic3D = OpVariable %_ptr_Input_v3int Input
+%_ptr_Input_int = OpTypePointer Input %int
+       %ic1D = OpVariable %_ptr_Input_int Input
+%_ptr_Function_float = OpTypePointer Function %float
+         %53 = OpTypeImage %float 2D 1 0 0 1 Unknown
+         %54 = OpTypeSampledImage %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+  %s2DShadow = OpVariable %_ptr_UniformConstant_54 UniformConstant
+%_ptr_Input_float = OpTypePointer Input %float
+        %c1D = OpVariable %_ptr_Input_float Input
+      %v2int = OpTypeVector %int 2
+      %int_2 = OpConstant %int 2
+      %int_3 = OpConstant %int 3
+         %65 = OpConstantComposite %v2int %int_2 %int_3
+         %72 = OpTypeImage %float Cube 0 0 0 1 Unknown
+         %73 = OpTypeSampledImage %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+      %sCube = OpVariable %_ptr_UniformConstant_73 UniformConstant
+         %81 = OpTypeImage %float 2D 1 1 0 1 Unknown
+         %82 = OpTypeSampledImage %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%s2DArrayShadow = OpVariable %_ptr_UniformConstant_82 UniformConstant
+      %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+        %104 = OpTypeImage %int 2D 0 0 0 1 Unknown
+        %105 = OpTypeSampledImage %104
+%_ptr_UniformConstant_105 = OpTypePointer UniformConstant %105
+       %is2D = OpVariable %_ptr_UniformConstant_105 UniformConstant
+        %125 = OpTypeImage %int 3D 0 0 0 1 Unknown
+        %126 = OpTypeSampledImage %125
+%_ptr_UniformConstant_126 = OpTypePointer UniformConstant %126
+       %is3D = OpVariable %_ptr_UniformConstant_126 UniformConstant
+%float_4_19999981 = OpConstant %float 4.19999981
+        %133 = OpTypeImage %int Cube 0 0 0 1 Unknown
+        %134 = OpTypeSampledImage %133
+%_ptr_UniformConstant_134 = OpTypePointer UniformConstant %134
+     %isCube = OpVariable %_ptr_UniformConstant_134 UniformConstant
+        %141 = OpTypeImage %int 2D 0 1 0 1 Unknown
+        %142 = OpTypeSampledImage %141
+%_ptr_UniformConstant_142 = OpTypePointer UniformConstant %142
+  %is2DArray = OpVariable %_ptr_UniformConstant_142 UniformConstant
+        %150 = OpTypeImage %float Cube 1 0 0 1 Unknown
+        %151 = OpTypeSampledImage %150
+%_ptr_UniformConstant_151 = OpTypePointer UniformConstant %151
+%sCubeShadow = OpVariable %_ptr_UniformConstant_151 UniformConstant
+       %uint = OpTypeInt 32 0
+        %160 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+        %161 = OpTypeSampledImage %160
+%_ptr_UniformConstant_161 = OpTypePointer UniformConstant %161
+       %us2D = OpVariable %_ptr_UniformConstant_161 UniformConstant
+        %164 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+        %165 = OpTypeSampledImage %164
+%_ptr_UniformConstant_165 = OpTypePointer UniformConstant %165
+       %us3D = OpVariable %_ptr_UniformConstant_165 UniformConstant
+        %168 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+        %169 = OpTypeSampledImage %168
+%_ptr_UniformConstant_169 = OpTypePointer UniformConstant %169
+     %usCube = OpVariable %_ptr_UniformConstant_169 UniformConstant
+        %172 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+        %173 = OpTypeSampledImage %172
+%_ptr_UniformConstant_173 = OpTypePointer UniformConstant %173
+  %us2DArray = OpVariable %_ptr_UniformConstant_173 UniformConstant
+%_ptr_Input_v4int = OpTypePointer Input %v4int
+       %ic4D = OpVariable %_ptr_Input_v4int Input
+         %S2 = OpTypeStruct %v3float %float
+%_ptr_Input_S2 = OpTypePointer Input %S2
+         %s2 = OpVariable %_ptr_Input_S2 Input
+%_ptr_Output_v3float = OpTypePointer Output %v3float
+         %sc = OpVariable %_ptr_Output_v3float Output
+%_ptr_Output_float = OpTypePointer Output %float
+         %sf = OpVariable %_ptr_Output_float Output
+     %uint_5 = OpConstant %uint 5
+%_arr_11_uint_5 = OpTypeArray %11 %uint_5
+%_ptr_UniformConstant__arr_11_uint_5 = OpTypePointer UniformConstant %_arr_11_uint_5
+%arrayedSampler = OpVariable %_ptr_UniformConstant__arr_11_uint_5 UniformConstant
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+          %v = OpVariable %_ptr_Function_v4float Function
+          %f = OpVariable %_ptr_Function_float Function
+         %iv = OpVariable %_ptr_Function_v4int Function
+         %14 = OpLoad %11 %s2D
+         %18 = OpLoad %v2float %c2D
+         %19 = OpImageSampleImplicitLod %v4float %14 %18
+               OpStore %v %19
+         %24 = OpLoad %21 %s3D
+         %27 = OpLoad %v4float %c4D
+         %28 = OpImageSampleProjImplicitLod %v4float %24 %27
+               OpStore %v %28
+         %33 = OpLoad %30 %s2DArray
+         %37 = OpLoad %v3float %c3D
+         %39 = OpImageSampleExplicitLod %v4float %33 %37 Lod %float_1_20000005
+               OpStore %v %39
+         %40 = OpLoad %21 %s3D
+         %45 = OpLoad %v3int %ic3D
+         %48 = OpLoad %int %ic1D
+         %49 = OpImage %20 %40
+         %50 = OpImageFetch %v4float %49 %45 Lod %48
+               OpStore %v %50
+         %57 = OpLoad %54 %s2DShadow
+         %58 = OpLoad %v3float %c3D
+         %61 = OpLoad %float %c1D
+         %66 = OpCompositeExtract %float %58 2
+         %67 = OpImageSampleDrefExplicitLod %float %57 %58 %66 Lod|ConstOffset %61 %65
+               OpStore %f %67
+         %68 = OpLoad %11 %s2D
+         %69 = OpLoad %v3float %c3D
+         %70 = OpLoad %float %c1D
+         %71 = OpImageSampleProjExplicitLod %v4float %68 %69 Lod|ConstOffset %70 %65
+               OpStore %v %71
+         %76 = OpLoad %73 %sCube
+         %77 = OpLoad %v3float %c3D
+         %78 = OpLoad %v3float %c3D
+         %79 = OpLoad %v3float %c3D
+         %80 = OpImageSampleExplicitLod %v4float %76 %77 Grad %78 %79
+               OpStore %v %80
+         %85 = OpLoad %82 %s2DArrayShadow
+         %86 = OpLoad %v4float %c4D
+         %87 = OpLoad %v2float %c2D
+         %88 = OpLoad %v2float %c2D
+         %89 = OpCompositeExtract %float %86 3
+         %90 = OpImageSampleDrefExplicitLod %float %85 %86 %89 Grad|ConstOffset %87 %88 %65
+               OpStore %f %90
+         %91 = OpLoad %21 %s3D
+         %92 = OpLoad %v4float %c4D
+         %93 = OpLoad %v3float %c3D
+         %94 = OpLoad %v3float %c3D
+         %95 = OpImageSampleProjExplicitLod %v4float %91 %92 Grad %93 %94
+               OpStore %v %95
+         %96 = OpLoad %11 %s2D
+         %97 = OpLoad %v3float %c3D
+         %98 = OpLoad %v2float %c2D
+         %99 = OpLoad %v2float %c2D
+        %100 = OpImageSampleProjExplicitLod %v4float %96 %97 Grad|ConstOffset %98 %99 %65
+               OpStore %v %100
+        %108 = OpLoad %105 %is2D
+        %109 = OpLoad %v2float %c2D
+        %110 = OpImageSampleImplicitLod %v4int %108 %109
+               OpStore %iv %110
+        %111 = OpLoad %105 %is2D
+        %112 = OpLoad %v4float %c4D
+        %113 = OpCompositeExtract %float %112 3
+        %114 = OpCompositeInsert %v4float %113 %112 2
+        %115 = OpImageSampleProjImplicitLod %v4int %111 %114 ConstOffset %65
+               OpStore %iv %115
+        %116 = OpLoad %105 %is2D
+        %117 = OpLoad %v3float %c3D
+        %118 = OpLoad %float %c1D
+        %119 = OpImageSampleProjExplicitLod %v4int %116 %117 Lod %118
+               OpStore %iv %119
+        %120 = OpLoad %105 %is2D
+        %121 = OpLoad %v3float %c3D
+        %122 = OpLoad %v2float %c2D
+        %123 = OpLoad %v2float %c2D
+        %124 = OpImageSampleProjExplicitLod %v4int %120 %121 Grad %122 %123
+               OpStore %iv %124
+        %129 = OpLoad %126 %is3D
+        %130 = OpLoad %v3float %c3D
+        %132 = OpImageSampleImplicitLod %v4int %129 %130 Bias %float_4_19999981
+               OpStore %iv %132
+        %137 = OpLoad %134 %isCube
+        %138 = OpLoad %v3float %c3D
+        %139 = OpLoad %float %c1D
+        %140 = OpImageSampleExplicitLod %v4int %137 %138 Lod %139
+               OpStore %iv %140
+        %145 = OpLoad %142 %is2DArray
+        %146 = OpLoad %v3int %ic3D
+        %147 = OpLoad %int %ic1D
+        %148 = OpImage %141 %145
+        %149 = OpImageFetch %v4int %148 %146 Lod %147
+               OpStore %iv %149
+        %154 = OpLoad %151 %sCubeShadow
+        %155 = OpImage %150 %154
+        %156 = OpImageQuerySizeLod %v2int %155 %int_2
+        %157 = OpLoad %v4int %iv
+        %158 = OpVectorShuffle %v4int %157 %156 4 5 2 3
+               OpStore %iv %158
+               OpReturn
+               OpFunctionEnd

+ 2 - 2
3rdparty/glslang/Test/link1.vk.frag

@@ -10,8 +10,8 @@ int b[5];
 int c[];
 int i;
 
-buffer bnameRuntime  { float r[]; };
-buffer bnameImplicit { float m[]; };
+layout (binding = 0) buffer bnameRuntime  { float r[]; };
+layout (binding = 1) buffer bnameImplicit { float m[]; };
 
 void main()
 {

+ 2 - 2
3rdparty/glslang/Test/link2.vk.frag

@@ -8,8 +8,8 @@ int b[];
 int c[7];
 int i;
 
-buffer bnameRuntime  { float r[]; };
-buffer bnameImplicit { float m[4]; };
+layout (binding = 0) buffer bnameRuntime  { float r[]; };
+layout (binding = 1) buffer bnameImplicit { float m[4]; };
 
 vec4 getColor()
 {

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

@@ -55,8 +55,8 @@ diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASER
 # multi-threaded test
 #
 echo Comparing single thread to multithread for all tests in current directory...
-$EXE -i -C *.vert *.geom *.frag *.tes* *.comp > singleThread.out
-$EXE -i -C *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out
+$EXE -i -C *.vert *.geom *.frag *.tesc *.tese *.comp > singleThread.out
+$EXE -i -C *.vert *.geom *.frag *.tesc *.tese *.comp -t > multiThread.out
 diff singleThread.out multiThread.out || HASERROR=1
 if [ $HASERROR -eq 0 ]
 then
@@ -145,7 +145,7 @@ echo Testing SPV Debug Information
 $EXE -g --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \
      -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.frag.out
 diff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1
-$EXE -g -Od --target-env vulkan1.1 --relaxed-errors --suppress-warnings --aml --hlsl-offsets --nsf --spirv-val \
+$EXE -g -Od --target-env vulkan1.1 --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \
      -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.1.1.frag.out
 diff -b $BASEDIR/spv.debugInfo.1.1.frag.out $TARGETDIR/spv.debugInfo.1.1.frag.out || HASERROR=1
 $EXE -g -D -Od -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --spirv-val --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \

+ 1 - 1
3rdparty/glslang/Test/spv.hlslOffsets.vert

@@ -1,6 +1,6 @@
 #version 450
 
-buffer block {
+layout(binding = 0) buffer block {
     float m0;
     vec3 m4;
     //////

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

@@ -21,8 +21,8 @@ void main()
 }
 
 layout(binding = 0) uniform atomic_uint aui;   // ERROR, no atomics in Vulkan
-layout(shared) uniform ub1n { int a; } ub1i;   // ERROR, no shared
-layout(packed) uniform ub2n { int a; } ub2i;   // ERROR, no packed
+layout(shared, binding = 1) uniform ub1n { int a; } ub1i;   // ERROR, no shared
+layout(packed, binding = 2) uniform ub2n { int a; } ub2i;   // ERROR, no packed
 
 layout(constant_id=222) const int arraySize = 4;
 

+ 26 - 0
3rdparty/glslang/Test/web.array.frag

@@ -0,0 +1,26 @@
+#version 310 es
+
+precision highp float;
+
+float g4[4];
+float g5[5];
+
+layout(location = 0) out vec2 colorOut;
+
+float[4] foo(float a[5])
+{
+    return float[](a[0], a[1], a[2], a[3]);
+}
+
+void main()
+{
+    g4 = foo(g5);
+
+    if (float[4](1.0, 2.0, 3.0, 4.0) == g4)
+        ;
+
+    float u[5];
+    foo(u);
+
+    colorOut = vec2(g4.length(), g5.length());
+}

+ 15 - 0
3rdparty/glslang/Test/web.basic.vert

@@ -0,0 +1,15 @@
+#version 310 es
+
+layout(location = 2) in vec4 inv4;
+layout(location = 1) out vec4 outv4;
+
+layout(binding = 3) uniform uBlock {
+    vec4 a;
+    ivec4 b;
+    uvec4 c;
+} uInst;
+
+void main()
+{
+    outv4 = normalize(inv4) * uInst.a * vec4(uInst.b) * vec4(uInst.c);
+}

+ 58 - 0
3rdparty/glslang/Test/web.builtins.frag

@@ -0,0 +1,58 @@
+#version 310 es
+
+precision lowp float;
+layout(location = 4) in float c1D;
+layout(location = 5) in vec2  c2D;
+layout(location = 6) in vec3  c3D;
+layout(location = 7) in smooth vec4  c4D;
+
+layout(location = 1) flat in int   ic1D;
+layout(location = 2) flat in ivec3 ic3D;
+layout(location = 3) flat in ivec4 ic4D;
+
+const ivec2 ic2D = ivec2(2, 3);
+
+struct s {
+    int i;
+    sampler2D s;
+};
+
+struct S2 {
+    vec3 c;
+    float f;
+};
+
+layout(location = 8) in S2 s2;
+
+layout(location = 0) out vec3 sc;
+layout(location = 1) out float sf;
+
+void main()
+{
+    float f = gl_FragCoord.y;
+    gl_FragDepth = f;
+
+    sc = s2.c;
+    sf = s2.f;
+
+    sinh(c1D) +
+    cosh(c1D) * tanh(c2D);
+    asinh(c4D) + acosh(c4D);
+    atanh(c3D);
+}
+
+void foo324(void)
+{
+    float p = pow(3.2, 4.6);
+    p += sin(0.4);
+    p += distance(vec2(10.0, 11.0), vec2(13.0, 15.0)); // 5
+    p += dot(vec3(2,3,5), vec3(-2,-1,4));              // 13
+    vec3 c3 = cross(vec3(3,-3,1), vec3(4,9,2));        // (-15, -2, 39)
+    c3 += faceforward(vec3(1,2,3), vec3(2,3,5), vec3(-2,-1,4));     // (-1,-2,-3)
+    c3 += faceforward(vec3(1,2,3), vec3(-2,-3,-5), vec3(-2,-1,4));  // (1,2,3)
+    vec2 c2 = reflect(vec2(1,3), vec2(0,1));           // (1,-3)
+    c2 += refract(vec2(1,3), vec2(0,1), 1.0);          // (1,-3)
+    c2 += refract(vec2(1,3), vec2(0,1), 3.0);
+    c2 += refract(vec2(1,0.1), vec2(0,1), 5.0);        // (0,0)
+    mat3x2 m32 = outerProduct(vec2(2,3), vec3(5,7,11));// rows: (10, 14, 22), (15, 21, 33)
+}

+ 14 - 0
3rdparty/glslang/Test/web.builtins.vert

@@ -0,0 +1,14 @@
+#version 310 es
+
+layout(location = 0) in mediump float ps;
+
+invariant gl_Position;
+
+void main()
+{
+    gl_Position = vec4(ps);
+    gl_Position *= float(4 - gl_VertexIndex);
+
+    gl_PointSize = ps; 
+    gl_PointSize *= float(5 - gl_InstanceIndex);
+}

+ 91 - 0
3rdparty/glslang/Test/web.controlFlow.frag

@@ -0,0 +1,91 @@
+#version 310 es
+
+precision mediump float;
+precision highp int;
+
+int c, d;
+layout(location = 0) in highp float x;
+layout(location = 1) in vec4 bigColor;
+layout(location = 2) in vec4 BaseColor;
+layout(location = 3) in float f;
+
+layout(location = 4) flat in int Count;
+layout(location = 5) flat in uvec4 v4;
+
+layout(location = 0) out vec4 outColor;
+
+void main()
+{
+    float f;
+    int a[2];
+
+    switch(c)
+    {
+    }
+
+    switch (c) {      // a no-error normal switch
+    case 1:
+        f = sin(x);
+        break;
+    case 2:
+        switch (d) {
+        case 1:
+            f = x * x * x;
+            break;
+        case 2:
+            f = x * x;
+            break;
+        }
+        break;
+    default:
+        f = tan(x);
+    }
+
+    vec4 color = BaseColor;
+
+    for (int i = 0; i < Count; ++i) {
+        color += bigColor;
+    }
+
+    outColor = color;
+
+    float sum = 0.0;
+    for (int i = 0; i < 4; ++i)
+        sum += float(v4[i]);
+
+    vec4 tv4;
+
+    for (int i = 0; i < 4; ++i)
+        tv4[i] = float(v4[i] * 4u);
+
+    outColor += vec4(sum) + tv4;
+
+    vec4 r;
+    r.xyz = BaseColor.xyz;
+
+    for (int i = 0; i < Count; ++i)
+        r.w = f;
+
+    outColor.xyz += r.xyz;
+
+    for (int i = 0; i < 16; i += 4)
+        outColor *= f;
+
+    int i = 0;
+    int A, B, C, D;
+    while (i<10) {
+        A = 1;
+        if (i%2 == 0) {
+            B = 2;
+            continue;
+            C = 2;
+        }
+        if (i%5 == 0) {
+            B = 2;
+            break;
+            C = 2;
+        }
+        i++;
+    }
+    D = 3;
+}

+ 73 - 0
3rdparty/glslang/Test/web.operations.frag

@@ -0,0 +1,73 @@
+#version 310 es
+
+precision highp float;
+
+layout(binding = 0) uniform block {
+    mediump float f;
+} instanceName;
+
+struct S {
+    int i;
+} s;
+
+float a[5];
+
+void main()
+{
+    bool b;
+    float f;
+    int i;
+    uint u;
+    bvec3 b3;
+    vec3 v3;
+    ivec3 iv3;
+    uvec3 uv3;
+    vec4 v4;
+    ivec4 iv4;
+    uvec4 uv4;
+    mat2 m2;
+    mat4 m4;
+
+    f * v4;
+    u + u;
+    uv4 / u;
+    iv3 -= iv3;
+    
+    i %= 3;
+    uv3 % 4u;
+    --m2;
+    iv4++;
+
+    m4 != m4;
+    m2 == m2;
+    i <= i;
+    a == a;
+    s != s;
+
+    b && b;
+    b || b;
+    b ^^ b;
+
+    !b, uv3;
+
+    ~i;
+    ~u;
+    ~uv3;
+    ~iv3;
+
+    uv3 <<= i;
+    i >> i;
+    u << u;
+    iv3 >> iv3;
+
+    i & i;
+    u | u;
+    iv3 ^ iv3;
+    u & uv3;
+    uv3 | u;
+    uv3 &= u;
+    int arr[0x222 & 0xf];
+    arr[1]; // size 2
+    int arr2[(uvec2(0, 0x2) | 0x1u).y];
+    arr2[2]; // size 3
+}

+ 38 - 0
3rdparty/glslang/Test/web.runtests

@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+TESTLIST=web.testlist
+TARGETDIR=localResults
+BASEDIR=baseResults
+EXE=../build/install/bin/glslangValidator.exe
+HASERROR=0
+mkdir -p $TARGETDIR
+
+if [ -a $TESTLIST ]
+  then
+    while read t; do
+      echo Running $t...
+      b=`basename $t`
+      $EXE -V -o webtest.spv $t
+      spirv-dis webtest.spv > $TARGETDIR/$b.out
+      rm -f webtest.spv
+      diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
+    done < $TESTLIST
+else
+  echo $TESTLIST is missing
+fi
+
+wc --bytes $EXE > $TARGETDIR/size
+echo "base size was" `cat $BASEDIR/size`
+echo "new  size  is" `cat $TARGETDIR/size`
+
+#
+# Final checking
+#
+if [ $HASERROR -eq 0 ]
+then
+    echo Tests Succeeded.
+else
+    echo Tests Failed.
+fi
+
+exit $HASERROR

+ 7 - 0
3rdparty/glslang/Test/web.testlist

@@ -0,0 +1,7 @@
+web.builtins.vert
+web.builtins.frag
+web.basic.vert
+web.controlFlow.frag
+web.operations.frag
+web.texture.frag
+web.array.frag

+ 77 - 0
3rdparty/glslang/Test/web.texture.frag

@@ -0,0 +1,77 @@
+#version 310 es
+layout(binding = 1) uniform sampler2D s2D;
+layout(binding = 2) uniform lowp sampler3D s3D;
+layout(binding = 3) uniform samplerCube sCube;
+layout(binding = 4) uniform lowp samplerCubeShadow sCubeShadow;
+layout(binding = 5) uniform lowp sampler2DShadow s2DShadow;
+layout(binding = 6) uniform lowp sampler2DArray s2DArray;
+layout(binding = 7) uniform lowp sampler2DArrayShadow s2DArrayShadow;
+layout(binding = 8) uniform lowp isampler2D is2D;
+layout(binding = 9) uniform lowp isampler3D is3D;
+layout(binding = 10) uniform lowp isamplerCube isCube;
+layout(binding = 11) uniform lowp isampler2DArray is2DArray;
+layout(binding = 12) uniform lowp usampler2D us2D;
+layout(binding = 13) uniform lowp usampler3D us3D;
+layout(binding = 14) uniform lowp usamplerCube usCube;
+layout(binding = 15) uniform lowp usampler2DArray us2DArray;
+
+precision lowp float;
+layout(location = 4) in float c1D;
+layout(location = 5) in vec2  c2D;
+layout(location = 6) in vec3  c3D;
+layout(location = 7) in smooth vec4  c4D;
+
+layout(location = 1) flat in int   ic1D;
+layout(location = 2) flat in ivec3 ic3D;
+layout(location = 3) flat in ivec4 ic4D;
+
+const ivec2 ic2D = ivec2(2, 3);
+
+struct s {
+    int i;
+    sampler2D s;
+};
+
+struct S2 {
+    vec3 c;
+    float f;
+};
+
+layout(location = 8) in S2 s2;
+
+layout(location = 0) out vec3 sc;
+layout(location = 1) out float sf;
+
+layout(binding = 0) uniform sampler2D arrayedSampler[5];
+
+void main()
+{
+    float f;
+    vec4 v;
+    v = texture(s2D, c2D);
+    v = textureProj(s3D, c4D);
+    v = textureLod(s2DArray, c3D, 1.2);
+    v = texelFetch(s3D, ic3D, ic1D);
+    f = textureLodOffset(s2DShadow, c3D, c1D, ic2D);
+    v = textureProjLodOffset(s2D, c3D, c1D, ic2D);
+    v = textureGrad(sCube, c3D, c3D, c3D);
+    f = textureGradOffset(s2DArrayShadow, c4D, c2D, c2D, ic2D);
+    v = textureProjGrad(s3D, c4D, c3D, c3D);
+    v = textureProjGradOffset(s2D, c3D, c2D, c2D, ic2D);
+
+    ivec4 iv;
+    iv = texture(is2D, c2D);
+    iv = textureProjOffset(is2D, c4D, ic2D);
+    iv = textureProjLod(is2D, c3D, c1D);
+    iv = textureProjGrad(is2D, c3D, c2D, c2D);
+    iv = texture(is3D, c3D, 4.2);
+    iv = textureLod(isCube, c3D, c1D);
+    iv = texelFetch(is2DArray, ic3D, ic1D);
+
+    iv.xy = textureSize(sCubeShadow, 2);
+}
+
+void foo23()
+{
+    textureOffset(s2DShadow, c3D, ivec2(-8, 7), c1D);
+}

+ 1 - 0
3rdparty/glslang/_config.yml

@@ -0,0 +1 @@
+theme: jekyll-theme-merlot

+ 14 - 9
3rdparty/glslang/glslang/CMakeLists.txt

@@ -7,6 +7,7 @@ else(WIN32)
 endif(WIN32)
 
 set(SOURCES
+    MachineIndependent/glslang.m4
     MachineIndependent/glslang.y
     MachineIndependent/glslang_tab.cpp
     MachineIndependent/attribute.cpp
@@ -71,15 +72,6 @@ set(HEADERS
     MachineIndependent/preprocessor/PpContext.h
     MachineIndependent/preprocessor/PpTokens.h)
 
-# This might be useful for making grammar changes:
-#
-# find_package(BISON)
-# add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp.h
-#                    COMMAND ${BISON_EXECUTABLE} --defines=${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp.h -t ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang.y -o ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp
-#                    MAIN_DEPENDENCY MachineIndependent/glslang.y
-#                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-# set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp)
-
 glslang_pch(SOURCES MachineIndependent/pch.cpp)
 
 add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS})
@@ -122,3 +114,16 @@ if(ENABLE_GLSLANG_INSTALL)
         install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/${dir})
     endforeach()
 endif(ENABLE_GLSLANG_INSTALL)
+
+if(ENABLE_GLSLANG_WEB)
+    add_executable(glslang.js glslang.js.cpp)
+    glslang_set_link_args(glslang.js)
+    target_link_libraries(glslang.js glslang SPIRV)
+    if(EMSCRIPTEN)
+        set_target_properties(glslang.js PROPERTIES
+          OUTPUT_NAME "glslang"
+          SUFFIX ".js"
+          LINK_FLAGS "--bind -s EXPORT_NAME=\"glslangModule\"")
+        em_link_pre_js(glslang.js ${CMAKE_CURRENT_SOURCE_DIR}/glslang.pre.js)
+    endif(EMSCRIPTEN)
+endif(ENABLE_GLSLANG_WEB)

+ 16 - 26
3rdparty/glslang/glslang/Include/BaseTypes.h

@@ -61,11 +61,7 @@ enum TBasicType {
     EbtSampler,
     EbtStruct,
     EbtBlock,
-
-#ifdef NV_EXTENSIONS
     EbtAccStructNV,
-#endif
-
     EbtReference,
 
     // HLSL types that live only temporarily.
@@ -94,13 +90,11 @@ enum TStorageQualifier {
     EvqBuffer,        // read/write, shared with app
     EvqShared,        // compute shader's read/write 'shared' qualifier
 
-#ifdef NV_EXTENSIONS
     EvqPayloadNV,
     EvqPayloadInNV,
     EvqHitAttrNV,
     EvqCallableDataNV,
     EvqCallableDataInNV,
-#endif
 
     // parameters
     EvqIn,            // also, for 'in' in the grammar before we know if it's a pipeline input or an 'in' parameter
@@ -221,7 +215,6 @@ enum TBuiltInVariable {
     EbvSampleMask,
     EbvHelperInvocation,
 
-#ifdef AMD_EXTENSIONS
     EbvBaryCoordNoPersp,
     EbvBaryCoordNoPerspCentroid,
     EbvBaryCoordNoPerspSample,
@@ -229,7 +222,6 @@ enum TBuiltInVariable {
     EbvBaryCoordSmoothCentroid,
     EbvBaryCoordSmoothSample,
     EbvBaryCoordPullModel,
-#endif
 
     EbvViewIndex,
     EbvDeviceIndex,
@@ -237,7 +229,6 @@ enum TBuiltInVariable {
     EbvFragSizeEXT,
     EbvFragInvocationCountEXT,
 
-#ifdef NV_EXTENSIONS
     EbvViewportMaskNV,
     EbvSecondaryPositionNV,
     EbvSecondaryViewportMaskNV,
@@ -273,7 +264,6 @@ enum TBuiltInVariable {
     EbvLayerPerViewNV,
     EbvMeshViewCountNV,
     EbvMeshViewIndicesNV,
-#endif
 
     // sm builtins
     EbvWarpsPerSM,
@@ -299,6 +289,19 @@ enum TBuiltInVariable {
     EbvLast
 };
 
+// In this enum, order matters; users can assume higher precision is a bigger value
+// and EpqNone is 0.
+enum TPrecisionQualifier {
+    EpqNone = 0,
+    EpqLow,
+    EpqMedium,
+    EpqHigh
+};
+
+#ifdef GLSLANG_WEB
+__inline const char* GetStorageQualifierString(TStorageQualifier q) { return ""; }
+__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) { return ""; }
+#else
 // These will show up in error messages
 __inline const char* GetStorageQualifierString(TStorageQualifier q)
 {
@@ -325,13 +328,11 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q)
     case EvqPointCoord:     return "gl_PointCoord";  break;
     case EvqFragColor:      return "fragColor";      break;
     case EvqFragDepth:      return "gl_FragDepth";   break;
-#ifdef NV_EXTENSIONS
     case EvqPayloadNV:        return "rayPayloadNV";     break;
     case EvqPayloadInNV:      return "rayPayloadInNV";   break;
     case EvqHitAttrNV:        return "hitAttributeNV";   break;
     case EvqCallableDataNV:   return "callableDataNV";   break;
     case EvqCallableDataInNV: return "callableDataInNV"; break;
-#endif
     default:                return "unknown qualifier";
     }
 }
@@ -413,7 +414,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
     case EbvSampleMask:           return "SampleMaskIn";
     case EbvHelperInvocation:     return "HelperInvocation";
 
-#ifdef AMD_EXTENSIONS
     case EbvBaryCoordNoPersp:           return "BaryCoordNoPersp";
     case EbvBaryCoordNoPerspCentroid:   return "BaryCoordNoPerspCentroid";
     case EbvBaryCoordNoPerspSample:     return "BaryCoordNoPerspSample";
@@ -421,7 +421,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
     case EbvBaryCoordSmoothCentroid:    return "BaryCoordSmoothCentroid";
     case EbvBaryCoordSmoothSample:      return "BaryCoordSmoothSample";
     case EbvBaryCoordPullModel:         return "BaryCoordPullModel";
-#endif
 
     case EbvViewIndex:                  return "ViewIndex";
     case EbvDeviceIndex:                return "DeviceIndex";
@@ -429,7 +428,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
     case EbvFragSizeEXT:                return "FragSizeEXT";
     case EbvFragInvocationCountEXT:     return "FragInvocationCountEXT";
 
-#ifdef NV_EXTENSIONS
     case EbvViewportMaskNV:             return "ViewportMaskNV";
     case EbvSecondaryPositionNV:        return "SecondaryPositionNV";
     case EbvSecondaryViewportMaskNV:    return "SecondaryViewportMaskNV";
@@ -464,7 +462,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
     case EbvLayerPerViewNV:             return "LayerPerViewNV";
     case EbvMeshViewCountNV:            return "MeshViewCountNV";
     case EbvMeshViewIndicesNV:          return "MeshViewIndicesNV";
-#endif
 
     case EbvWarpsPerSM:                 return "WarpsPerSMNV";
     case EbvSMCount:                    return "SMCountNV";
@@ -475,15 +472,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
     }
 }
 
-// In this enum, order matters; users can assume higher precision is a bigger value
-// and EpqNone is 0.
-enum TPrecisionQualifier {
-    EpqNone = 0,
-    EpqLow,
-    EpqMedium,
-    EpqHigh
-};
-
 __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p)
 {
     switch (p) {
@@ -494,6 +482,7 @@ __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p)
     default:        return "unknown precision qualifier";
     }
 }
+#endif
 
 __inline bool isTypeSignedInt(TBasicType type)
 {
@@ -538,7 +527,8 @@ __inline bool isTypeFloat(TBasicType type)
     }
 }
 
-__inline int getTypeRank(TBasicType type) {
+__inline int getTypeRank(TBasicType type)
+{
     int res = -1;
     switch(type) {
     case EbtInt8:

+ 132 - 96
3rdparty/glslang/glslang/Include/ConstantUnion.h

@@ -213,56 +213,59 @@ public:
             return false;
 
         switch (type) {
-        case EbtInt16:
-            if (constant.i16Const == i16Const)
+        case EbtInt:
+            if (constant.iConst == iConst)
                 return true;
 
             break;
-         case EbtUint16:
-            if (constant.u16Const == u16Const)
+        case EbtUint:
+            if (constant.uConst == uConst)
                 return true;
 
             break;
-        case EbtInt8:
-            if (constant.i8Const == i8Const)
+        case EbtBool:
+            if (constant.bConst == bConst)
                 return true;
 
             break;
-         case EbtUint8:
-            if (constant.u8Const == u8Const)
+        case EbtDouble:
+            if (constant.dConst == dConst)
                 return true;
 
             break;
-        case EbtInt:
-            if (constant.iConst == iConst)
+
+#ifndef GLSLANG_WEB
+        case EbtInt16:
+            if (constant.i16Const == i16Const)
                 return true;
 
             break;
-        case EbtUint:
-            if (constant.uConst == uConst)
+         case EbtUint16:
+            if (constant.u16Const == u16Const)
                 return true;
 
             break;
-        case EbtInt64:
-            if (constant.i64Const == i64Const)
+        case EbtInt8:
+            if (constant.i8Const == i8Const)
                 return true;
 
             break;
-        case EbtUint64:
-            if (constant.u64Const == u64Const)
+         case EbtUint8:
+            if (constant.u8Const == u8Const)
                 return true;
 
             break;
-        case EbtDouble:
-            if (constant.dConst == dConst)
+        case EbtInt64:
+            if (constant.i64Const == i64Const)
                 return true;
 
             break;
-        case EbtBool:
-            if (constant.bConst == bConst)
+        case EbtUint64:
+            if (constant.u64Const == u64Const)
                 return true;
 
             break;
+#endif
         default:
             assert(false && "Default missing");
         }
@@ -329,6 +332,22 @@ public:
     {
         assert(type == constant.type);
         switch (type) {
+        case EbtInt:
+            if (iConst > constant.iConst)
+                return true;
+
+            return false;
+        case EbtUint:
+            if (uConst > constant.uConst)
+                return true;
+
+            return false;
+        case EbtDouble:
+            if (dConst > constant.dConst)
+                return true;
+
+            return false;
+#ifndef GLSLANG_WEB
         case EbtInt8:
             if (i8Const > constant.i8Const)
                 return true;
@@ -348,16 +367,6 @@ public:
             if (u16Const > constant.u16Const)
                 return true;
 
-            return false;
-        case EbtInt:
-            if (iConst > constant.iConst)
-                return true;
-
-            return false;
-        case EbtUint:
-            if (uConst > constant.uConst)
-                return true;
-
             return false;
         case EbtInt64:
             if (i64Const > constant.i64Const)
@@ -369,11 +378,7 @@ public:
                 return true;
 
             return false;
-        case EbtDouble:
-            if (dConst > constant.dConst)
-                return true;
-
-            return false;
+#endif
         default:
             assert(false && "Default missing");
             return false;
@@ -384,6 +389,7 @@ public:
     {
         assert(type == constant.type);
         switch (type) {
+#ifndef GLSLANG_WEB
         case EbtInt8:
             if (i8Const < constant.i8Const)
                 return true;
@@ -394,7 +400,7 @@ public:
                 return true;
 
             return false;
-       case EbtInt16:
+        case EbtInt16:
             if (i16Const < constant.i16Const)
                 return true;
 
@@ -402,17 +408,6 @@ public:
         case EbtUint16:
             if (u16Const < constant.u16Const)
                 return true;
-
-            return false;
-        case EbtInt:
-            if (iConst < constant.iConst)
-                return true;
-
-            return false;
-        case EbtUint:
-            if (uConst < constant.uConst)
-                return true;
-
             return false;
         case EbtInt64:
             if (i64Const < constant.i64Const)
@@ -424,10 +419,21 @@ public:
                 return true;
 
             return false;
+#endif
         case EbtDouble:
             if (dConst < constant.dConst)
                 return true;
 
+            return false;
+        case EbtInt:
+            if (iConst < constant.iConst)
+                return true;
+
+            return false;
+        case EbtUint:
+            if (uConst < constant.uConst)
+                return true;
+
             return false;
         default:
             assert(false && "Default missing");
@@ -440,15 +446,17 @@ public:
         TConstUnion returnValue;
         assert(type == constant.type);
         switch (type) {
+        case EbtInt:    returnValue.setIConst(iConst + constant.iConst); break;
+        case EbtUint:   returnValue.setUConst(uConst + constant.uConst); break;
+        case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break;
+#ifndef GLSLANG_WEB
         case EbtInt8:   returnValue.setI8Const(i8Const + constant.i8Const); break;
         case EbtInt16:  returnValue.setI16Const(i16Const + constant.i16Const); break;
-        case EbtInt:    returnValue.setIConst(iConst + constant.iConst); break;
         case EbtInt64:  returnValue.setI64Const(i64Const + constant.i64Const); break;
         case EbtUint8:  returnValue.setU8Const(u8Const + constant.u8Const); break;
         case EbtUint16: returnValue.setU16Const(u16Const + constant.u16Const); break;
-        case EbtUint:   returnValue.setUConst(uConst + constant.uConst); break;
         case EbtUint64: returnValue.setU64Const(u64Const + constant.u64Const); break;
-        case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break;
+#endif
         default: assert(false && "Default missing");
         }
 
@@ -460,15 +468,17 @@ public:
         TConstUnion returnValue;
         assert(type == constant.type);
         switch (type) {
+        case EbtInt:    returnValue.setIConst(iConst - constant.iConst); break;
+        case EbtUint:   returnValue.setUConst(uConst - constant.uConst); break;
+        case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break;
+#ifndef GLSLANG_WEB
         case EbtInt8:   returnValue.setI8Const(i8Const - constant.i8Const); break;
         case EbtInt16:  returnValue.setI16Const(i16Const - constant.i16Const); break;
-        case EbtInt:    returnValue.setIConst(iConst - constant.iConst); break;
         case EbtInt64:  returnValue.setI64Const(i64Const - constant.i64Const); break;
         case EbtUint8:  returnValue.setU8Const(u8Const - constant.u8Const); break;
         case EbtUint16: returnValue.setU16Const(u16Const - constant.u16Const); break;
-        case EbtUint:   returnValue.setUConst(uConst - constant.uConst); break;
         case EbtUint64: returnValue.setU64Const(u64Const - constant.u64Const); break;
-        case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break;
+#endif
         default: assert(false && "Default missing");
         }
 
@@ -480,15 +490,17 @@ public:
         TConstUnion returnValue;
         assert(type == constant.type);
         switch (type) {
+        case EbtInt:    returnValue.setIConst(iConst * constant.iConst); break;
+        case EbtUint:   returnValue.setUConst(uConst * constant.uConst); break;
+        case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break;
+#ifndef GLSLANG_WEB
         case EbtInt8:   returnValue.setI8Const(i8Const * constant.i8Const); break;
         case EbtInt16:  returnValue.setI16Const(i16Const * constant.i16Const); break;
-        case EbtInt:    returnValue.setIConst(iConst * constant.iConst); break;
         case EbtInt64:  returnValue.setI64Const(i64Const * constant.i64Const); break;
         case EbtUint8:  returnValue.setU8Const(u8Const * constant.u8Const); break;
         case EbtUint16: returnValue.setU16Const(u16Const * constant.u16Const); break;
-        case EbtUint:   returnValue.setUConst(uConst * constant.uConst); break;
         case EbtUint64: returnValue.setU64Const(u64Const * constant.u64Const); break;
-        case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break;
+#endif
         default: assert(false && "Default missing");
         }
 
@@ -500,14 +512,16 @@ public:
         TConstUnion returnValue;
         assert(type == constant.type);
         switch (type) {
+        case EbtInt:    returnValue.setIConst(iConst % constant.iConst); break;
+        case EbtUint:   returnValue.setUConst(uConst % constant.uConst); break;
+#ifndef GLSLANG_WEB
         case EbtInt8:   returnValue.setI8Const(i8Const % constant.i8Const); break;
         case EbtInt16:  returnValue.setI8Const(i8Const % constant.i16Const); break;
-        case EbtInt:    returnValue.setIConst(iConst % constant.iConst); break;
         case EbtInt64:  returnValue.setI64Const(i64Const % constant.i64Const); break;
         case EbtUint8:  returnValue.setU8Const(u8Const % constant.u8Const); break;
         case EbtUint16: returnValue.setU16Const(u16Const % constant.u16Const); break;
-        case EbtUint:   returnValue.setUConst(uConst % constant.uConst); break;
         case EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break;
+#endif
         default:     assert(false && "Default missing");
         }
 
@@ -518,6 +532,7 @@ public:
     {
         TConstUnion returnValue;
         switch (type) {
+#ifndef GLSLANG_WEB
         case EbtInt8:
             switch (constant.type) {
             case EbtInt8:   returnValue.setI8Const(i8Const >> constant.i8Const);  break;
@@ -570,32 +585,38 @@ public:
             default:       assert(false && "Default missing");
             }
             break;
+#endif
         case EbtInt:
             switch (constant.type) {
+            case EbtInt:    returnValue.setIConst(iConst >> constant.iConst);   break;
+            case EbtUint:   returnValue.setIConst(iConst >> constant.uConst);   break;
+#ifndef GLSLANG_WEB
             case EbtInt8:   returnValue.setIConst(iConst >> constant.i8Const);  break;
             case EbtUint8:  returnValue.setIConst(iConst >> constant.u8Const);  break;
             case EbtInt16:  returnValue.setIConst(iConst >> constant.i16Const); break;
             case EbtUint16: returnValue.setIConst(iConst >> constant.u16Const); break;
-            case EbtInt:    returnValue.setIConst(iConst >> constant.iConst);   break;
-            case EbtUint:   returnValue.setIConst(iConst >> constant.uConst);   break;
             case EbtInt64:  returnValue.setIConst(iConst >> constant.i64Const); break;
             case EbtUint64: returnValue.setIConst(iConst >> constant.u64Const); break;
+#endif
             default:       assert(false && "Default missing");
             }
             break;
         case EbtUint:
             switch (constant.type) {
+            case EbtInt:    returnValue.setUConst(uConst >> constant.iConst);   break;
+            case EbtUint:   returnValue.setUConst(uConst >> constant.uConst);   break;
+#ifndef GLSLANG_WEB
             case EbtInt8:   returnValue.setUConst(uConst >> constant.i8Const);  break;
             case EbtUint8:  returnValue.setUConst(uConst >> constant.u8Const);  break;
             case EbtInt16:  returnValue.setUConst(uConst >> constant.i16Const); break;
             case EbtUint16: returnValue.setUConst(uConst >> constant.u16Const); break;
-            case EbtInt:    returnValue.setUConst(uConst >> constant.iConst);   break;
-            case EbtUint:   returnValue.setUConst(uConst >> constant.uConst);   break;
             case EbtInt64:  returnValue.setUConst(uConst >> constant.i64Const); break;
             case EbtUint64: returnValue.setUConst(uConst >> constant.u64Const); break;
+#endif
             default:       assert(false && "Default missing");
             }
             break;
+#ifndef GLSLANG_WEB
          case EbtInt64:
             switch (constant.type) {
             case EbtInt8:   returnValue.setI64Const(i64Const >> constant.i8Const);  break;
@@ -622,6 +643,7 @@ public:
             default:       assert(false && "Default missing");
             }
             break;
+#endif
         default:     assert(false && "Default missing");
         }
 
@@ -632,6 +654,7 @@ public:
     {
         TConstUnion returnValue;
         switch (type) {
+#ifndef GLSLANG_WEB
         case EbtInt8:
             switch (constant.type) {
             case EbtInt8:   returnValue.setI8Const(i8Const << constant.i8Const);  break;
@@ -684,32 +707,6 @@ public:
             default:       assert(false && "Default missing");
             }
             break;
-        case EbtInt:
-            switch (constant.type) {
-            case EbtInt8:   returnValue.setIConst(iConst << constant.i8Const);  break;
-            case EbtUint8:  returnValue.setIConst(iConst << constant.u8Const);  break;
-            case EbtInt16:  returnValue.setIConst(iConst << constant.i16Const); break;
-            case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break;
-            case EbtInt:    returnValue.setIConst(iConst << constant.iConst);   break;
-            case EbtUint:   returnValue.setIConst(iConst << constant.uConst);   break;
-            case EbtInt64:  returnValue.setIConst(iConst << constant.i64Const); break;
-            case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break;
-            default:       assert(false && "Default missing");
-            }
-            break;
-        case EbtUint:
-            switch (constant.type) {
-            case EbtInt8:   returnValue.setUConst(uConst << constant.i8Const);  break;
-            case EbtUint8:  returnValue.setUConst(uConst << constant.u8Const);  break;
-            case EbtInt16:  returnValue.setUConst(uConst << constant.i16Const); break;
-            case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break;
-            case EbtInt:    returnValue.setUConst(uConst << constant.iConst);   break;
-            case EbtUint:   returnValue.setUConst(uConst << constant.uConst);   break;
-            case EbtInt64:  returnValue.setUConst(uConst << constant.i64Const); break;
-            case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break;
-            default:       assert(false && "Default missing");
-            }
-            break;
          case EbtInt64:
             switch (constant.type) {
             case EbtInt8:   returnValue.setI64Const(i64Const << constant.i8Const);  break;
@@ -736,6 +733,37 @@ public:
             default:       assert(false && "Default missing");
             }
             break;
+#endif
+        case EbtInt:
+            switch (constant.type) {
+            case EbtInt:    returnValue.setIConst(iConst << constant.iConst);   break;
+            case EbtUint:   returnValue.setIConst(iConst << constant.uConst);   break;
+#ifndef GLSLANG_WEB
+            case EbtInt8:   returnValue.setIConst(iConst << constant.i8Const);  break;
+            case EbtUint8:  returnValue.setIConst(iConst << constant.u8Const);  break;
+            case EbtInt16:  returnValue.setIConst(iConst << constant.i16Const); break;
+            case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break;
+            case EbtInt64:  returnValue.setIConst(iConst << constant.i64Const); break;
+            case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break;
+#endif
+            default:       assert(false && "Default missing");
+            }
+            break;
+        case EbtUint:
+            switch (constant.type) {
+            case EbtInt:    returnValue.setUConst(uConst << constant.iConst);   break;
+            case EbtUint:   returnValue.setUConst(uConst << constant.uConst);   break;
+#ifndef GLSLANG_WEB
+            case EbtInt8:   returnValue.setUConst(uConst << constant.i8Const);  break;
+            case EbtUint8:  returnValue.setUConst(uConst << constant.u8Const);  break;
+            case EbtInt16:  returnValue.setUConst(uConst << constant.i16Const); break;
+            case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break;
+            case EbtInt64:  returnValue.setUConst(uConst << constant.i64Const); break;
+            case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break;
+#endif
+            default:       assert(false && "Default missing");
+            }
+            break;
         default:     assert(false && "Default missing");
         }
 
@@ -747,14 +775,16 @@ public:
         TConstUnion returnValue;
         assert(type == constant.type);
         switch (type) {
+        case EbtInt:    returnValue.setIConst(iConst & constant.iConst); break;
+        case EbtUint:   returnValue.setUConst(uConst & constant.uConst); break;
+#ifndef GLSLANG_WEB
         case EbtInt8:   returnValue.setI8Const(i8Const & constant.i8Const); break;
         case EbtUint8:  returnValue.setU8Const(u8Const & constant.u8Const); break;
         case EbtInt16:  returnValue.setI16Const(i16Const & constant.i16Const); break;
         case EbtUint16: returnValue.setU16Const(u16Const & constant.u16Const); break;
-        case EbtInt:    returnValue.setIConst(iConst & constant.iConst); break;
-        case EbtUint:   returnValue.setUConst(uConst & constant.uConst); break;
         case EbtInt64:  returnValue.setI64Const(i64Const & constant.i64Const); break;
         case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break;
+#endif
         default:     assert(false && "Default missing");
         }
 
@@ -766,14 +796,16 @@ public:
         TConstUnion returnValue;
         assert(type == constant.type);
         switch (type) {
+        case EbtInt:    returnValue.setIConst(iConst | constant.iConst); break;
+        case EbtUint:   returnValue.setUConst(uConst | constant.uConst); break;
+#ifndef GLSLANG_WEB
         case EbtInt8:   returnValue.setI8Const(i8Const | constant.i8Const); break;
         case EbtUint8:  returnValue.setU8Const(u8Const | constant.u8Const); break;
         case EbtInt16:  returnValue.setI16Const(i16Const | constant.i16Const); break;
         case EbtUint16: returnValue.setU16Const(u16Const | constant.u16Const); break;
-        case EbtInt:    returnValue.setIConst(iConst | constant.iConst); break;
-        case EbtUint:   returnValue.setUConst(uConst | constant.uConst); break;
         case EbtInt64:  returnValue.setI64Const(i64Const | constant.i64Const); break;
         case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break;
+#endif
         default:     assert(false && "Default missing");
         }
 
@@ -785,14 +817,16 @@ public:
         TConstUnion returnValue;
         assert(type == constant.type);
         switch (type) {
+        case EbtInt:    returnValue.setIConst(iConst ^ constant.iConst); break;
+        case EbtUint:   returnValue.setUConst(uConst ^ constant.uConst); break;
+#ifndef GLSLANG_WEB
         case EbtInt8:   returnValue.setI8Const(i8Const ^ constant.i8Const); break;
         case EbtUint8:  returnValue.setU8Const(u8Const ^ constant.u8Const); break;
         case EbtInt16:  returnValue.setI16Const(i16Const ^ constant.i16Const); break;
         case EbtUint16: returnValue.setU16Const(u16Const ^ constant.u16Const); break;
-        case EbtInt:    returnValue.setIConst(iConst ^ constant.iConst); break;
-        case EbtUint:   returnValue.setUConst(uConst ^ constant.uConst); break;
         case EbtInt64:  returnValue.setI64Const(i64Const ^ constant.i64Const); break;
         case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break;
+#endif
         default:     assert(false && "Default missing");
         }
 
@@ -803,14 +837,16 @@ public:
     {
         TConstUnion returnValue;
         switch (type) {
+        case EbtInt:    returnValue.setIConst(~iConst); break;
+        case EbtUint:   returnValue.setUConst(~uConst); break;
+#ifndef GLSLANG_WEB
         case EbtInt8:   returnValue.setI8Const(~i8Const); break;
         case EbtUint8:  returnValue.setU8Const(~u8Const); break;
         case EbtInt16:  returnValue.setI16Const(~i16Const); break;
         case EbtUint16: returnValue.setU16Const(~u16Const); break;
-        case EbtInt:    returnValue.setIConst(~iConst); break;
-        case EbtUint:   returnValue.setUConst(~uConst); break;
         case EbtInt64:  returnValue.setI64Const(~i64Const); break;
         case EbtUint64: returnValue.setU64Const(~u64Const); break;
+#endif
         default:     assert(false && "Default missing");
         }
 

+ 277 - 180
3rdparty/glslang/glslang/Include/Types.h

@@ -79,32 +79,64 @@ struct TSampler {   // misnomer now; includes images, textures without sampler,
     bool         ms : 1;
     bool      image : 1;  // image, combined should be false
     bool   combined : 1;  // true means texture is combined with a sampler, false means texture with no sampler
-    bool    sampler : 1;  // true means a pure sampler, other fields should be clear()
-    bool   external : 1;  // GL_OES_EGL_image_external
-    bool        yuv : 1;  // GL_EXT_YUV_target
+#ifdef ENABLE_HLSL
     unsigned int vectorSize : 3;  // vector return type size.
+    unsigned int getVectorSize() const { return vectorSize; }
+    void clearReturnStruct() { structReturnIndex = noReturnStruct; }
+    bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }
+    unsigned getStructReturnIndex() const { return structReturnIndex; }
 
-    // Some languages support structures as sample results.  Storing the whole structure in the
-    // TSampler is too large, so there is an index to a separate table.
     static const unsigned structReturnIndexBits = 4;                        // number of index bits to use.
     static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values
     static const unsigned noReturnStruct = structReturnSlots;               // value if no return struct type.
 
     // Index into a language specific table of texture return structures.
     unsigned int structReturnIndex : structReturnIndexBits;
+#else
+    unsigned int getVectorSize() const { return 4; }
+    void clearReturnStruct() const { }
+    bool hasReturnStruct() const { return false; }
+    unsigned getStructReturnIndex() const { return 0; }
+#endif
 
-    // Encapsulate getting members' vector sizes packed into the vectorSize bitfield.
-    unsigned int getVectorSize() const { return vectorSize; }
+#ifdef GLSLANG_WEB
+    bool is1D()          const { return false; }
+    bool isBuffer()      const { return false; }
+    bool isRect()        const { return false; }
+    bool isSubpass()     const { return false; }
+    bool isCombined()    const { return true; }
+    bool isPureSampler() const { return false; }
+    bool isTexture()     const { return false; }
+    bool isImage()       const { return false; }
+    bool isImageClass()  const { return false; }
+    bool isMultiSample() const { return false; }
+    bool isExternal()    const { return false; }
+    void setExternal(bool e) { }
+    bool isYuv()         const { return false; }
+#else
+    bool    sampler : 1;  // true means a pure sampler, other fields should be clear()
+    bool   external : 1;  // GL_OES_EGL_image_external
+    bool        yuv : 1;  // GL_EXT_YUV_target
+    // Some languages support structures as sample results.  Storing the whole structure in the
+    // TSampler is too large, so there is an index to a separate table.
 
-    bool isImage()       const { return image && dim != EsdSubpass; }
+    bool is1D()          const { return dim == Esd1D; }
+    bool isBuffer()      const { return dim == EsdBuffer; }
+    bool isRect()        const { return dim == EsdRect; }
     bool isSubpass()     const { return dim == EsdSubpass; }
     bool isCombined()    const { return combined; }
     bool isPureSampler() const { return sampler; }
     bool isTexture()     const { return !sampler && !image; }
+    bool isImage()       const { return image && !isSubpass(); }
+    bool isImageClass()  const { return image; }
+    bool isMultiSample() const { return ms; }
+    bool isExternal()    const { return external; }
+    void setExternal(bool e) { external = e; }
+    bool isYuv()         const { return yuv; }
+#endif
+    void setCombined(bool c) { combined = c; }
     bool isShadow()      const { return shadow; }
     bool isArrayed()     const { return arrayed; }
-    bool isMultiSample() const { return ms; }
-    bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }
 
     void clear()
     {
@@ -115,13 +147,17 @@ struct TSampler {   // misnomer now; includes images, textures without sampler,
         ms = false;
         image = false;
         combined = false;
+#ifndef GLSLANG_WEB
         sampler = false;
         external = false;
         yuv = false;
-        structReturnIndex = noReturnStruct;
+#endif
 
+#ifdef ENABLE_HLSL
+        clearReturnStruct();
         // by default, returns a single vec4;
         vectorSize = 4;
+#endif
     }
 
     // make a combined sampler and texture
@@ -159,6 +195,7 @@ struct TSampler {   // misnomer now; includes images, textures without sampler,
         ms = m;
     }
 
+#ifndef GLSLANG_WEB
     // make a subpass input attachment
     void setSubpass(TBasicType t, bool m = false)
     {
@@ -176,6 +213,7 @@ struct TSampler {   // misnomer now; includes images, textures without sampler,
         sampler = true;
         shadow = s;
     }
+#endif
 
     bool operator==(const TSampler& right) const
     {
@@ -183,14 +221,14 @@ struct TSampler {   // misnomer now; includes images, textures without sampler,
                      dim == right.dim &&
                  arrayed == right.arrayed &&
                   shadow == right.shadow &&
-                      ms == right.ms &&
-                   image == right.image &&
-                combined == right.combined &&
-                 sampler == right.sampler &&
-                external == right.external &&
-                     yuv == right.yuv &&
-              vectorSize == right.vectorSize &&
-       structReturnIndex == right.structReturnIndex;            
+         isMultiSample() == right.isMultiSample() &&
+          isImageClass() == right.isImageClass() &&
+            isCombined() == right.isCombined() &&
+         isPureSampler() == right.isPureSampler() &&
+            isExternal() == right.isExternal() &&
+                 isYuv() == right.isYuv() &&
+         getVectorSize() == right.getVectorSize() &&
+  getStructReturnIndex() == right.getStructReturnIndex();
     }
 
     bool operator!=(const TSampler& right) const
@@ -202,54 +240,55 @@ struct TSampler {   // misnomer now; includes images, textures without sampler,
     {
         TString s;
 
-        if (sampler) {
+        if (isPureSampler()) {
             s.append("sampler");
             return s;
         }
 
         switch (type) {
-        case EbtFloat:                   break;
-#ifdef AMD_EXTENSIONS
+        case EbtInt:    s.append("i");   break;
+        case EbtUint:   s.append("u");   break;
+#ifndef GLSLANG_WEB
         case EbtFloat16: s.append("f16"); break;
-#endif
         case EbtInt8:   s.append("i8");  break;
         case EbtUint16: s.append("u8");  break;
         case EbtInt16:  s.append("i16"); break;
         case EbtUint8:  s.append("u16"); break;
-        case EbtInt:    s.append("i");   break;
-        case EbtUint:   s.append("u");   break;
         case EbtInt64:  s.append("i64"); break;
         case EbtUint64: s.append("u64"); break;
-        default:  break;  // some compilers want this
+#endif
+        default:  break;
         }
-        if (image) {
-            if (dim == EsdSubpass)
+        if (isImageClass()) {
+            if (isSubpass())
                 s.append("subpass");
             else
                 s.append("image");
-        } else if (combined) {
+        } else if (isCombined()) {
             s.append("sampler");
         } else {
             s.append("texture");
         }
-        if (external) {
+        if (isExternal()) {
             s.append("ExternalOES");
             return s;
         }
-        if (yuv) {
+        if (isYuv()) {
             return "__" + s + "External2DY2YEXT";
         }
         switch (dim) {
-        case Esd1D:      s.append("1D");      break;
         case Esd2D:      s.append("2D");      break;
         case Esd3D:      s.append("3D");      break;
         case EsdCube:    s.append("Cube");    break;
+#ifndef GLSLANG_WEB
+        case Esd1D:      s.append("1D");      break;
         case EsdRect:    s.append("2DRect");  break;
         case EsdBuffer:  s.append("Buffer");  break;
         case EsdSubpass: s.append("Input"); break;
+#endif
         default:  break;  // some compilers want this
         }
-        if (ms)
+        if (isMultiSample())
             s.append("MS");
         if (arrayed)
             s.append("Array");
@@ -442,9 +481,11 @@ public:
     {
         precision = EpqNone;
         invariant = false;
-        noContraction = false;
         makeTemporary();
         declaredBuiltIn = EbvNone;
+#ifndef GLSLANG_WEB
+        noContraction = false;
+#endif
     }
 
     // drop qualifiers that don't belong in a temporary variable
@@ -463,8 +504,10 @@ public:
     void clearInterstage()
     {
         clearInterpolation();
+#ifndef GLSLANG_WEB
         patch = false;
         sample = false;
+#endif
     }
 
     void clearInterpolation()
@@ -472,11 +515,9 @@ public:
         centroid     = false;
         smooth       = false;
         flat         = false;
+#ifndef GLSLANG_WEB
         nopersp      = false;
-#ifdef AMD_EXTENSIONS
         explicitInterp = false;
-#endif
-#ifdef NV_EXTENSIONS
         pervertexNV = false;
         perPrimitiveNV = false;
         perViewNV = false;
@@ -498,20 +539,6 @@ public:
         writeonly    = false;
     }
 
-    // Drop just the storage qualification, which perhaps should
-    // never be done, as it is fundamentally inconsistent, but need to
-    // explore what downstream consumers need.
-    // E.g., in a dereference, it is an inconsistency between:
-    // A) partially dereferenced resource is still in the storage class it started in
-    // B) partially dereferenced resource is a new temporary object
-    // If A, then nothing should change, if B, then everything should change, but this is half way.
-    void makePartialTemporary()
-    {
-        storage      = EvqTemporary;
-        specConstant = false;
-        nonUniform   = false;
-    }
-
     const char*         semanticName;
     TStorageQualifier   storage   : 6;
     TBuiltInVariable    builtIn   : 9;
@@ -519,22 +546,9 @@ public:
     static_assert(EbvLast < 256, "need to increase size of TBuiltInVariable bitfields!");
     TPrecisionQualifier precision : 3;
     bool invariant    : 1; // require canonical treatment for cross-shader invariance
-    bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects
     bool centroid     : 1;
     bool smooth       : 1;
     bool flat         : 1;
-    bool nopersp      : 1;
-#ifdef AMD_EXTENSIONS
-    bool explicitInterp : 1;
-#endif
-#ifdef NV_EXTENSIONS
-    bool pervertexNV  : 1;
-    bool perPrimitiveNV : 1;
-    bool perViewNV : 1;
-    bool perTaskNV : 1;
-#endif
-    bool patch        : 1;
-    bool sample       : 1;
     bool coherent     : 1;
     bool devicecoherent : 1;
     bool queuefamilycoherent : 1;
@@ -545,9 +559,37 @@ public:
     bool restrict     : 1;
     bool readonly     : 1;
     bool writeonly    : 1;
-    bool specConstant : 1;  // having a constant_id is not sufficient: expressions have no id, but are still specConstant
+    // having a constant_id is not sufficient: expressions have no id, but are still specConstant
+    bool specConstant : 1;
     bool nonUniform   : 1;
 
+#ifdef GLSLANG_WEB
+    bool isWriteOnly() const { return false; }
+    bool isReadOnly() const { return false; }
+    bool isSample() const { return false; }
+    bool isMemory() const { return false; }
+    bool isMemoryQualifierImageAndSSBOOnly() const { return false; }
+    bool bufferReferenceNeedsVulkanMemoryModel() const { return false; }
+    bool isInterpolation() const { return flat || smooth; }
+    bool isExplicitInterpolation() const { return false; }
+    bool isAuxiliary() const { return centroid; }
+    bool isPatch() const { return false; }
+    bool isNoContraction() const { return false; }
+    void setNoContraction() { }
+    bool isPervertexNV() const { return false; }
+#else
+    bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects
+    bool nopersp      : 1;
+    bool explicitInterp : 1;
+    bool pervertexNV  : 1;
+    bool perPrimitiveNV : 1;
+    bool perViewNV : 1;
+    bool perTaskNV : 1;
+    bool patch        : 1;
+    bool sample       : 1;
+    bool isWriteOnly() const { return writeonly; }
+    bool isReadOnly() const { return readonly; }
+    bool isSample() const { return sample; }
     bool isMemory() const
     {
         return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate;
@@ -561,31 +603,23 @@ public:
         // include qualifiers that map to load/store availability/visibility/nonprivate memory access operands
         return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || nonprivate;
     }
-
     bool isInterpolation() const
     {
-#ifdef AMD_EXTENSIONS
         return flat || smooth || nopersp || explicitInterp;
-#else
-        return flat || smooth || nopersp;
-#endif
     }
-
-#ifdef AMD_EXTENSIONS
     bool isExplicitInterpolation() const
     {
         return explicitInterp;
     }
-#endif
-
     bool isAuxiliary() const
     {
-#ifdef NV_EXTENSIONS
         return centroid || patch || sample || pervertexNV;
-#else
-        return centroid || patch || sample;
-#endif
     }
+    bool isPatch() const { return patch; }
+    bool isNoContraction() const { return noContraction; }
+    void setNoContraction() { noContraction = true; }
+    bool isPervertexNV() const { return pervertexNV; }
+#endif
 
     bool isPipeInput() const
     {
@@ -651,33 +685,6 @@ public:
         }
     }
 
-    bool isPerPrimitive() const
-    {
-#ifdef NV_EXTENSIONS
-        return perPrimitiveNV;
-#else
-        return false;
-#endif
-    }
-
-    bool isPerView() const
-    {
-#ifdef NV_EXTENSIONS
-        return perViewNV;
-#else
-        return false;
-#endif
-    }
-
-    bool isTaskMemory() const
-    {
-#ifdef NV_EXTENSIONS
-        return perTaskNV;
-#else
-        return false;
-#endif
-    }
-
     bool isIo() const
     {
         switch (storage) {
@@ -717,6 +724,15 @@ public:
         }
     }
 
+#ifdef GLSLANG_WEB
+    bool isPerView() const { return false; }
+    bool isTaskMemory() const { return false; }
+    bool isArrayedIo(EShLanguage language) const { return false; }
+#else
+    bool isPerPrimitive() const { return perPrimitiveNV; }
+    bool isPerView() const { return perViewNV; }
+    bool isTaskMemory() const { return perTaskNV; }
+
     // True if this type of IO is supposed to be arrayed with extra level for per-vertex data
     bool isArrayedIo(EShLanguage language) const
     {
@@ -727,49 +743,50 @@ public:
             return ! patch && (isPipeInput() || isPipeOutput());
         case EShLangTessEvaluation:
             return ! patch && isPipeInput();
-#ifdef NV_EXTENSIONS
         case EShLangFragment:
             return pervertexNV && isPipeInput();
         case EShLangMeshNV:
             return ! perTaskNV && isPipeOutput();
-#endif
 
         default:
             return false;
         }
     }
+#endif
 
     // Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield
     void clearLayout()  // all layout
     {
         clearUniformLayout();
 
+#ifndef GLSLANG_WEB
         layoutPushConstant = false;
         layoutBufferReference = false;
-#ifdef NV_EXTENSIONS
         layoutPassthrough = false;
         layoutViewportRelative = false;
         // -2048 as the default value indicating layoutSecondaryViewportRelative is not set
         layoutSecondaryViewportRelativeOffset = -2048;
         layoutShaderRecordNV = false;
-#endif
-
         layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd;
+        layoutFormat = ElfNone;
+#endif
 
         clearInterstageLayout();
 
         layoutSpecConstantId = layoutSpecConstantIdEnd;
-
-        layoutFormat = ElfNone;
     }
     void clearInterstageLayout()
     {
         layoutLocation = layoutLocationEnd;
         layoutComponent = layoutComponentEnd;
         layoutIndex = layoutIndexEnd;
+#ifndef GLSLANG_WEB
         clearStreamLayout();
         clearXfbLayout();
+#endif
     }
+
+#ifndef GLSLANG_WEB
     void clearStreamLayout()
     {
         layoutStream = layoutStreamEnd;
@@ -780,6 +797,7 @@ public:
         layoutXfbStride = layoutXfbStrideEnd;
         layoutXfbOffset = layoutXfbOffsetEnd;
     }
+#endif
 
     bool hasNonXfbLayout() const
     {
@@ -787,11 +805,9 @@ public:
                hasAnyLocation() ||
                hasStream() ||
                hasFormat() ||
-#ifdef NV_EXTENSIONS
-               layoutShaderRecordNV ||
-#endif
-               layoutPushConstant ||
-               layoutBufferReference;
+               isShaderRecordNV() ||
+               isPushConstant() ||
+               hasBufferReference();
     }
     bool hasLayout() const
     {
@@ -836,6 +852,7 @@ public:
                  unsigned int layoutSpecConstantId       : 11;
     static const unsigned int layoutSpecConstantIdEnd = 0x7FF;
 
+#ifndef GLSLANG_WEB
     // stored as log2 of the actual alignment value
                  unsigned int layoutBufferReferenceAlign :  6;
     static const unsigned int layoutBufferReferenceAlignEnd = 0x3F;
@@ -844,8 +861,6 @@ public:
 
     bool layoutPushConstant;
     bool layoutBufferReference;
-
-#ifdef NV_EXTENSIONS
     bool layoutPassthrough;
     bool layoutViewportRelative;
     int layoutSecondaryViewportRelativeOffset;
@@ -881,10 +896,6 @@ public:
     {
         return layoutPacking != ElpNone;
     }
-    bool hasOffset() const
-    {
-        return layoutOffset != layoutNotSet;
-    }
     bool hasAlign() const
     {
         return layoutAlign != layoutNotSet;
@@ -899,14 +910,6 @@ public:
     {
         return layoutLocation != layoutLocationEnd;
     }
-    bool hasComponent() const
-    {
-        return layoutComponent != layoutComponentEnd;
-    }
-    bool hasIndex() const
-    {
-        return layoutIndex != layoutIndexEnd;
-    }
     bool hasSet() const
     {
         return layoutSet != layoutSetEnd;
@@ -915,6 +918,38 @@ public:
     {
         return layoutBinding != layoutBindingEnd;
     }
+#ifdef GLSLANG_WEB
+    bool hasOffset() const { return false; }
+    bool isNonPerspective() const { return false; }
+    bool hasIndex() const { return false; }
+    bool hasComponent() const { return false; }
+    bool hasStream() const { return false; }
+    bool hasFormat() const { return false; }
+    bool hasXfb() const { return false; }
+    bool hasXfbBuffer() const { return false; }
+    bool hasXfbStride() const { return false; }
+    bool hasXfbOffset() const { return false; }
+    bool hasAttachment() const { return false; }
+    TLayoutFormat getFormat() const { return ElfNone; }
+    bool isPushConstant() const { return false; }
+    bool isShaderRecordNV() const { return false; }
+    bool hasBufferReference() const { return false; }
+    bool hasBufferReferenceAlign() const { return false; }
+    bool isNonUniform() const { return false; }
+#else
+    bool hasOffset() const
+    {
+        return layoutOffset != layoutNotSet;
+    }
+    bool isNonPerspective() const { return nopersp; }
+    bool hasIndex() const
+    {
+        return layoutIndex != layoutIndexEnd;
+    }
+    bool hasComponent() const
+    {
+        return layoutComponent != layoutComponentEnd;
+    }
     bool hasStream() const
     {
         return layoutStream != layoutStreamEnd;
@@ -945,16 +980,25 @@ public:
     {
         return layoutAttachment != layoutAttachmentEnd;
     }
+    TLayoutFormat getFormat() const { return layoutFormat; }
+    bool isPushConstant() const { return layoutPushConstant; }
+    bool isShaderRecordNV() const { return layoutShaderRecordNV; }
+    bool hasBufferReference() const { return layoutBufferReference; }
+    bool hasBufferReferenceAlign() const
+    {
+        return layoutBufferReferenceAlign != layoutBufferReferenceAlignEnd;
+    }
+    bool isNonUniform() const
+    {
+        return nonUniform;
+    }
+#endif
     bool hasSpecConstantId() const
     {
         // Not the same thing as being a specialization constant, this
         // is just whether or not it was declared with an ID.
         return layoutSpecConstantId != layoutSpecConstantIdEnd;
     }
-    bool hasBufferReferenceAlign() const
-    {
-        return layoutBufferReferenceAlign != layoutBufferReferenceAlignEnd;
-    }
     bool isSpecConstant() const
     {
         // True if type is a specialization constant, whether or not it
@@ -962,10 +1006,6 @@ public:
         // true front-end constant.
         return specConstant;
     }
-    bool isNonUniform() const
-    {
-        return nonUniform;
-    }
     bool isFrontEndConstant() const
     {
         // True if the front-end knows the final constant value.
@@ -985,11 +1025,13 @@ public:
     static const char* getLayoutPackingString(TLayoutPacking packing)
     {
         switch (packing) {
+        case ElpStd140:   return "std140";
+#ifndef GLSLANG_WEB
         case ElpPacked:   return "packed";
         case ElpShared:   return "shared";
-        case ElpStd140:   return "std140";
         case ElpStd430:   return "std430";
         case ElpScalar:   return "scalar";
+#endif
         default:          return "none";
         }
     }
@@ -1001,6 +1043,9 @@ public:
         default:             return "none";
         }
     }
+#ifdef GLSLANG_WEB
+    static const char* getLayoutFormatString(TLayoutFormat f) { return "none"; }
+#else
     static const char* getLayoutFormatString(TLayoutFormat f)
     {
         switch (f) {
@@ -1135,6 +1180,7 @@ public:
         default:                                return "none";
         }
     }
+#endif
 };
 
 // Qualifiers that don't need to be keep per object.  They have shader scope, not object scope.
@@ -1150,18 +1196,20 @@ struct TShaderQualifiers {
     bool pointMode;
     int localSize[3];         // compute shader
     int localSizeSpecId[3];   // compute shader specialization id for gl_WorkGroupSize
+#ifndef GLSLANG_WEB
     bool earlyFragmentTests;  // fragment input
     bool postDepthCoverage;   // fragment input
     TLayoutDepth layoutDepth;
     bool blendEquation;       // true if any blend equation was specified
     int numViews;             // multiview extenstions
     TInterlockOrdering interlockOrdering;
-
-#ifdef NV_EXTENSIONS
     bool layoutOverrideCoverage;        // true if layout override_coverage set
     bool layoutDerivativeGroupQuads;    // true if layout derivative_group_quadsNV set
     bool layoutDerivativeGroupLinear;   // true if layout derivative_group_linearNV set
     int primitives;                     // mesh shader "max_primitives"DerivativeGroupLinear;   // true if layout derivative_group_linearNV set
+    TLayoutDepth getDepth() const { return layoutDepth; }
+#else
+    TLayoutDepth getDepth() const { return EldNone; }
 #endif
 
     void init()
@@ -1180,20 +1228,26 @@ struct TShaderQualifiers {
         localSizeSpecId[0] = TQualifier::layoutNotSet;
         localSizeSpecId[1] = TQualifier::layoutNotSet;
         localSizeSpecId[2] = TQualifier::layoutNotSet;
+#ifndef GLSLANG_WEB
         earlyFragmentTests = false;
         postDepthCoverage = false;
         layoutDepth = EldNone;
         blendEquation = false;
         numViews = TQualifier::layoutNotSet;
-#ifdef NV_EXTENSIONS
         layoutOverrideCoverage      = false;
         layoutDerivativeGroupQuads  = false;
         layoutDerivativeGroupLinear = false;
         primitives                  = TQualifier::layoutNotSet;
-#endif
         interlockOrdering = EioNone;
+#endif
     }
 
+#ifdef GLSLANG_WEB
+    bool hasBlendEquation() const { return false; }
+#else
+    bool hasBlendEquation() const { return blendEquation; }
+#endif
+
     // Merge in characteristics from the 'src' qualifier.  They can override when
     // set, but never erase when not set.
     void merge(const TShaderQualifiers& src)
@@ -1222,6 +1276,7 @@ struct TShaderQualifiers {
             if (src.localSizeSpecId[i] != TQualifier::layoutNotSet)
                 localSizeSpecId[i] = src.localSizeSpecId[i];
         }
+#ifndef GLSLANG_WEB
         if (src.earlyFragmentTests)
             earlyFragmentTests = true;
         if (src.postDepthCoverage)
@@ -1232,7 +1287,6 @@ struct TShaderQualifiers {
             blendEquation = src.blendEquation;
         if (src.numViews != TQualifier::layoutNotSet)
             numViews = src.numViews;
-#ifdef NV_EXTENSIONS
         if (src.layoutOverrideCoverage)
             layoutOverrideCoverage = src.layoutOverrideCoverage;
         if (src.layoutDerivativeGroupQuads)
@@ -1241,10 +1295,9 @@ struct TShaderQualifiers {
             layoutDerivativeGroupLinear = src.layoutDerivativeGroupLinear;
         if (src.primitives != TQualifier::layoutNotSet)
             primitives = src.primitives;
-#endif
-
         if (src.interlockOrdering != EioNone)
             interlockOrdering = src.interlockOrdering;
+#endif
     }
 };
 
@@ -1271,6 +1324,12 @@ public:
     TSourceLoc loc;
     TArraySizes* typeParameters;
 
+#ifdef GLSLANG_WEB
+    bool isCoopmat() const { return false; }
+#else
+    bool isCoopmat() const { return coopmat; }
+#endif
+
     void initType(const TSourceLoc& l)
     {
         basicType = EbtVoid;
@@ -1374,7 +1433,7 @@ public:
                                     }
                                     typeName = NewPoolTString(p.userDef->getTypeName().c_str());
                                 }
-                                if (p.coopmat && p.basicType == EbtFloat &&
+                                if (p.isCoopmat() && p.basicType == EbtFloat &&
                                     p.typeParameters && p.typeParameters->getNumDims() > 0 &&
                                     p.typeParameters->getDimSize(0) == 16) {
                                     basicType = EbtFloat16;
@@ -1483,7 +1542,7 @@ public:
             referentType = copyOf.referentType;
         }
         typeParameters = copyOf.typeParameters;
-        coopmat = copyOf.coopmat;
+        coopmat = copyOf.isCoopMat();
     }
 
     // Make complete copy of the whole type graph rooted at 'copyOf'.
@@ -1542,7 +1601,11 @@ public:
     virtual int getOuterArraySize()  const { return arraySizes->getOuterSize(); }
     virtual TIntermTyped*  getOuterArrayNode() const { return arraySizes->getOuterNode(); }
     virtual int getCumulativeArraySize()  const { return arraySizes->getCumulativeSize(); }
-    virtual bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; }
+#ifdef GLSLANG_WEB
+    bool isArrayOfArrays() const { return false; }
+#else
+    bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; }
+#endif
     virtual int getImplicitArraySize() const { return arraySizes->getImplicitSize(); }
     virtual const TArraySizes* getArraySizes() const { return arraySizes; }
     virtual       TArraySizes* getArraySizes()       { return arraySizes; }
@@ -1580,9 +1643,9 @@ public:
         }
         return false;
     }
-    virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint
-#ifdef NV_EXTENSIONS
-        || basicType == EbtAccStructNV
+    virtual bool isOpaque() const { return basicType == EbtSampler
+#ifndef GLSLANG_WEB
+         || basicType == EbtAtomicUint || basicType == EbtAccStructNV
 #endif
         ; }
     virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
@@ -1592,7 +1655,15 @@ public:
     virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); }
     virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); }
     virtual bool isParameterized()  const { return typeParameters != nullptr; }
-    virtual bool isCoopMat() const { return coopmat; }
+#ifdef GLSLANG_WEB
+    bool isAtomic() const { return false; }
+    bool isCoopMat() const { return false; }
+    bool isReference() const { return false; }
+#else
+    bool isAtomic() const { return basicType == EbtAtomicUint; }
+    bool isCoopMat() const { return coopmat; }
+    bool isReference() const { return getBasicType() == EbtReference; }
+#endif
 
     // return true if this type contains any subtype which satisfies the given predicate.
     template <typename P>
@@ -1673,20 +1744,44 @@ public:
         return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } );
     }
 
-    virtual bool contains16BitInt() const
+#ifdef GLSLANG_WEB
+    bool containsDouble() const { return false; }
+    bool contains16BitFloat() const { return false; }
+    bool contains64BitInt() const { return false; }
+    bool contains16BitInt() const { return false; }
+    bool contains8BitInt() const { return false; }
+    bool containsCoopMat() const { return false; }
+    bool containsReference() const { return false; }
+#else
+    bool containsDouble() const
+    {
+        return containsBasicType(EbtDouble);
+    }
+    bool contains16BitFloat() const
+    {
+        return containsBasicType(EbtFloat16);
+    }
+    bool contains64BitInt() const
+    {
+        return containsBasicType(EbtInt64) || containsBasicType(EbtUint64);
+    }
+    bool contains16BitInt() const
     {
         return containsBasicType(EbtInt16) || containsBasicType(EbtUint16);
     }
-
-    virtual bool contains8BitInt() const
+    bool contains8BitInt() const
     {
         return containsBasicType(EbtInt8) || containsBasicType(EbtUint8);
     }
-
-    virtual bool containsCoopMat() const
+    bool containsCoopMat() const
     {
         return contains([](const TType* t) { return t->coopmat; } );
     }
+    bool containsReference() const
+    {
+        return containsBasicType(EbtReference);
+    }
+#endif
 
     // Array editing methods.  Array descriptors can be shared across
     // type instances.  This allows all uses of the same array
@@ -1746,11 +1841,9 @@ public:
     {
         if (isUnsizedArray() && !(skipNonvariablyIndexed || isArrayVariablyIndexed()))
             changeOuterArraySize(getImplicitArraySize());
-#ifdef NV_EXTENSIONS
         // For multi-dim per-view arrays, set unsized inner dimension size to 1
         if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized())
             arraySizes->clearInnerUnsized();
-#endif
         if (isStruct() && structure->size() > 0) {
             int lastMember = (int)structure->size() - 1;
             for (int i = 0; i < lastMember; ++i)
@@ -1808,16 +1901,17 @@ public:
     static const char* getBasicString(TBasicType t)
     {
         switch (t) {
-        case EbtVoid:              return "void";
         case EbtFloat:             return "float";
+        case EbtInt:               return "int";
+        case EbtUint:              return "uint";
+#ifndef GLSLANG_WEB
+        case EbtVoid:              return "void";
         case EbtDouble:            return "double";
         case EbtFloat16:           return "float16_t";
         case EbtInt8:              return "int8_t";
         case EbtUint8:             return "uint8_t";
         case EbtInt16:             return "int16_t";
         case EbtUint16:            return "uint16_t";
-        case EbtInt:               return "int";
-        case EbtUint:              return "uint";
         case EbtInt64:             return "int64_t";
         case EbtUint64:            return "uint64_t";
         case EbtBool:              return "bool";
@@ -1825,14 +1919,20 @@ public:
         case EbtSampler:           return "sampler/image";
         case EbtStruct:            return "structure";
         case EbtBlock:             return "block";
-#ifdef NV_EXTENSIONS
         case EbtAccStructNV:       return "accelerationStructureNV";
-#endif
         case EbtReference:         return "reference";
+#endif
         default:                   return "unknown type";
         }
     }
 
+#ifdef GLSLANG_WEB
+    TString getCompleteString() const { return ""; }
+    const char* getStorageQualifierString() const { return ""; }
+    const char* getBuiltInVariableString() const { return ""; }
+    const char* getPrecisionQualifierString() const { return ""; }
+    TString getBasicTypeString() const { return ""; }
+#else
     TString getCompleteString() const
     {
         TString typeString;
@@ -1921,7 +2021,6 @@ public:
                     appendUint(1u << qualifier.layoutBufferReferenceAlign);
                 }
 
-#ifdef NV_EXTENSIONS
                 if (qualifier.layoutPassthrough)
                     appendStr(" passthrough");
                 if (qualifier.layoutViewportRelative)
@@ -1932,7 +2031,6 @@ public:
                 }
                 if (qualifier.layoutShaderRecordNV)
                     appendStr(" shaderRecordNV");
-#endif
 
                 appendStr(")");
             }
@@ -1950,11 +2048,8 @@ public:
             appendStr(" flat");
         if (qualifier.nopersp)
             appendStr(" noperspective");
-#ifdef AMD_EXTENSIONS
         if (qualifier.explicitInterp)
             appendStr(" __explicitInterpAMD");
-#endif
-#ifdef NV_EXTENSIONS
         if (qualifier.pervertexNV)
             appendStr(" pervertexNV");
         if (qualifier.perPrimitiveNV)
@@ -1963,7 +2058,6 @@ public:
             appendStr(" perviewNV");
         if (qualifier.perTaskNV)
             appendStr(" taskNV");
-#endif
         if (qualifier.patch)
             appendStr(" patch");
         if (qualifier.sample)
@@ -2078,6 +2172,8 @@ public:
     const char* getStorageQualifierString() const { return GetStorageQualifierString(qualifier.storage); }
     const char* getBuiltInVariableString() const { return GetBuiltInVariableString(qualifier.builtIn); }
     const char* getPrecisionQualifierString() const { return GetPrecisionQualifierString(qualifier.precision); }
+#endif
+
     const TTypeList* getStruct() const { assert(isStruct()); return structure; }
     void setStruct(TTypeList* s) { assert(isStruct()); structure = s; }
     TTypeList* getWritableStruct() const { assert(isStruct()); return structure; }  // This should only be used when known to not be sharing with other threads
@@ -2144,12 +2240,12 @@ public:
         return true;
     }
 
-    bool sameReferenceType(const TType& right) const
+     bool sameReferenceType(const TType& right) const
     {
-        if ((basicType == EbtReference) != (right.basicType == EbtReference))
+        if (isReference() != right.isReference())
             return false;
 
-        if ((basicType != EbtReference) && (right.basicType != EbtReference))
+        if (!isReference() && !right.isReference())
             return true;
 
         assert(referentType != nullptr);
@@ -2161,7 +2257,7 @@ public:
         return *referentType == *right.referentType;
     }
 
-    // See if two types match, in all aspects except arrayness
+   // See if two types match, in all aspects except arrayness
     bool sameElementType(const TType& right) const
     {
         return basicType == right.basicType && sameElementShape(right);
@@ -2196,7 +2292,7 @@ public:
                matrixCols == right.matrixCols &&
                matrixRows == right.matrixRows &&
                   vector1 == right.vector1    &&
-                  coopmat == right.coopmat    &&
+              isCoopMat() == right.isCoopMat() &&
                sameStructType(right)          &&
                sameReferenceType(right);
     }
@@ -2205,7 +2301,7 @@ public:
     // an OK function parameter
     bool coopMatParameterOK(const TType& right) const
     {
-        return coopmat && right.coopmat &&
+        return isCoopMat() && right.isCoopMat() &&
                typeParameters == nullptr && right.typeParameters != nullptr;
     }
 
@@ -2222,12 +2318,13 @@ public:
 
     unsigned int getBufferReferenceAlignment() const
     {
+#ifndef GLSLANG_WEB
         if (getBasicType() == glslang::EbtReference) {
             return getReferentType()->getQualifier().hasBufferReferenceAlign() ?
                         (1u << getReferentType()->getQualifier().layoutBufferReferenceAlign) : 16u;
-        } else {
-            return 0;
         }
+#endif
+        return 0;
     }
 
 protected:

+ 27 - 47
3rdparty/glslang/glslang/Include/intermediate.h

@@ -422,11 +422,9 @@ enum TOperator {
     EOpReflect,
     EOpRefract,
 
-#ifdef AMD_EXTENSIONS
     EOpMin3,
     EOpMax3,
     EOpMid3,
-#endif
 
     EOpDPdx,            // Fragment only
     EOpDPdy,            // Fragment only
@@ -441,10 +439,7 @@ enum TOperator {
     EOpInterpolateAtCentroid, // Fragment only
     EOpInterpolateAtSample,   // Fragment only
     EOpInterpolateAtOffset,   // Fragment only
-
-#ifdef AMD_EXTENSIONS
     EOpInterpolateAtVertex,
-#endif
 
     EOpMatrixTimesMatrix,
     EOpOuterProduct,
@@ -534,7 +529,6 @@ enum TOperator {
     EOpSubgroupQuadSwapVertical,
     EOpSubgroupQuadSwapDiagonal,
 
-#ifdef NV_EXTENSIONS
     EOpSubgroupPartition,
     EOpSubgroupPartitionedAdd,
     EOpSubgroupPartitionedMul,
@@ -557,11 +551,9 @@ enum TOperator {
     EOpSubgroupPartitionedExclusiveAnd,
     EOpSubgroupPartitionedExclusiveOr,
     EOpSubgroupPartitionedExclusiveXor,
-#endif
 
     EOpSubgroupGuardStop,
 
-#ifdef AMD_EXTENSIONS
     EOpMinInvocations,
     EOpMaxInvocations,
     EOpAddInvocations,
@@ -588,7 +580,6 @@ enum TOperator {
     EOpCubeFaceIndex,
     EOpCubeFaceCoord,
     EOpTime,
-#endif
 
     EOpAtomicAdd,
     EOpAtomicMin,
@@ -795,10 +786,8 @@ enum TOperator {
     EOpImageQuerySamples,
     EOpImageLoad,
     EOpImageStore,
-#ifdef AMD_EXTENSIONS
     EOpImageLoadLod,
     EOpImageStoreLod,
-#endif
     EOpImageAtomicAdd,
     EOpImageAtomicMin,
     EOpImageAtomicMax,
@@ -813,9 +802,7 @@ enum TOperator {
     EOpSubpassLoad,
     EOpSubpassLoadMS,
     EOpSparseImageLoad,
-#ifdef AMD_EXTENSIONS
     EOpSparseImageLoadLod,
-#endif
 
     EOpImageGuardEnd,
 
@@ -853,13 +840,11 @@ enum TOperator {
     EOpTextureOffsetClamp,
     EOpTextureGradClamp,
     EOpTextureGradOffsetClamp,
-#ifdef AMD_EXTENSIONS
     EOpTextureGatherLod,
     EOpTextureGatherLodOffset,
     EOpTextureGatherLodOffsets,
     EOpFragmentMaskFetch,
     EOpFragmentFetch,
-#endif
 
     EOpSparseTextureGuardBegin,
 
@@ -879,15 +864,12 @@ enum TOperator {
     EOpSparseTextureOffsetClamp,
     EOpSparseTextureGradClamp,
     EOpSparseTextureGradOffsetClamp,
-#ifdef AMD_EXTENSIONS
     EOpSparseTextureGatherLod,
     EOpSparseTextureGatherLodOffset,
     EOpSparseTextureGatherLodOffsets,
-#endif
 
     EOpSparseTextureGuardEnd,
 
-#ifdef NV_EXTENSIONS
     EOpImageFootprintGuardBegin,
     EOpImageSampleFootprintNV,
     EOpImageSampleFootprintClampNV,
@@ -895,7 +877,6 @@ enum TOperator {
     EOpImageSampleFootprintGradNV,
     EOpImageSampleFootprintGradClampNV,
     EOpImageFootprintGuardEnd,
-#endif
     EOpSamplingGuardEnd,
     EOpTextureGuardEnd,
 
@@ -914,14 +895,12 @@ enum TOperator {
     EOpFindLSB,
     EOpFindMSB,
 
-#ifdef NV_EXTENSIONS
     EOpTraceNV,
     EOpReportIntersectionNV,
     EOpIgnoreIntersectionNV,
     EOpTerminateRayNV,
     EOpExecuteCallableNV,
     EOpWritePackedPrimitiveIndices4x8NV,
-#endif
     //
     // HLSL operations
     //
@@ -1110,6 +1089,8 @@ public:
     virtual bool isStruct() const { return type.isStruct(); }
     virtual bool isFloatingDomain() const { return type.isFloatingDomain(); }
     virtual bool isIntegerDomain() const { return type.isIntegerDomain(); }
+    bool isAtomic() const { return type.isAtomic(); }
+    bool isReference() const { return type.isReference(); }
     TString getCompleteString() const { return type.getCompleteString(); }
 
 protected:
@@ -1303,9 +1284,7 @@ struct TCrackedTextureOp {
     bool grad;
     bool subpass;
     bool lodClamp;
-#ifdef AMD_EXTENSIONS
     bool fragMask;
-#endif
 };
 
 //
@@ -1321,12 +1300,17 @@ public:
     bool isConstructor() const;
     bool isTexture()  const { return op > EOpTextureGuardBegin  && op < EOpTextureGuardEnd; }
     bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; }
+#ifdef GLSLANG_WEB
+    bool isImage()          const { return false; }
+    bool isSparseTexture()  const { return false; }
+    bool isImageFootprint() const { return false; }
+    bool isSparseImage()    const { return false; }
+#else
     bool isImage()    const { return op > EOpImageGuardBegin    && op < EOpImageGuardEnd; }
     bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; }
-#ifdef NV_EXTENSIONS
     bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; }
-#endif
     bool isSparseImage()   const { return op == EOpSparseImageLoad; }
+#endif
 
     void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; }
     TPrecisionQualifier getOperationPrecision() const { return operationPrecision != EpqNone ?
@@ -1356,9 +1340,7 @@ public:
         cracked.grad = false;
         cracked.subpass = false;
         cracked.lodClamp = false;
-#ifdef AMD_EXTENSIONS
         cracked.fragMask = false;
-#endif
 
         switch (op) {
         case EOpImageQuerySize:
@@ -1373,10 +1355,6 @@ public:
         case EOpTexture:
         case EOpSparseTexture:
             break;
-        case EOpTextureClamp:
-        case EOpSparseTextureClamp:
-            cracked.lodClamp = true;
-            break;
         case EOpTextureProj:
             cracked.proj = true;
             break;
@@ -1388,22 +1366,17 @@ public:
         case EOpSparseTextureOffset:
             cracked.offset = true;
             break;
-        case EOpTextureOffsetClamp:
-        case EOpSparseTextureOffsetClamp:
-            cracked.offset = true;
-            cracked.lodClamp = true;
-            break;
         case EOpTextureFetch:
         case EOpSparseTextureFetch:
             cracked.fetch = true;
-            if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D)
+            if (sampler.is1D() || (sampler.dim == Esd2D && ! sampler.isMultiSample()) || sampler.dim == Esd3D)
                 cracked.lod = true;
             break;
         case EOpTextureFetchOffset:
         case EOpSparseTextureFetchOffset:
             cracked.fetch = true;
             cracked.offset = true;
-            if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D)
+            if (sampler.is1D() || (sampler.dim == Esd2D && ! sampler.isMultiSample()) || sampler.dim == Esd3D)
                 cracked.lod = true;
             break;
         case EOpTextureProjOffset:
@@ -1428,11 +1401,6 @@ public:
         case EOpSparseTextureGrad:
             cracked.grad = true;
             break;
-        case EOpTextureGradClamp:
-        case EOpSparseTextureGradClamp:
-            cracked.grad = true;
-            cracked.lodClamp = true;
-            break;
         case EOpTextureGradOffset:
         case EOpSparseTextureGradOffset:
             cracked.grad = true;
@@ -1447,6 +1415,21 @@ public:
             cracked.offset = true;
             cracked.proj = true;
             break;
+#ifndef GLSLANG_WEB
+        case EOpTextureClamp:
+        case EOpSparseTextureClamp:
+            cracked.lodClamp = true;
+            break;
+        case EOpTextureOffsetClamp:
+        case EOpSparseTextureOffsetClamp:
+            cracked.offset = true;
+            cracked.lodClamp = true;
+            break;
+        case EOpTextureGradClamp:
+        case EOpSparseTextureGradClamp:
+            cracked.grad = true;
+            cracked.lodClamp = true;
+            break;
         case EOpTextureGradOffsetClamp:
         case EOpSparseTextureGradOffsetClamp:
             cracked.grad = true;
@@ -1467,7 +1450,6 @@ public:
             cracked.gather = true;
             cracked.offsets = true;
             break;
-#ifdef AMD_EXTENSIONS
         case EOpTextureGatherLod:
         case EOpSparseTextureGatherLod:
             cracked.gather = true;
@@ -1498,8 +1480,6 @@ public:
             cracked.subpass = sampler.dim == EsdSubpass;
             cracked.fragMask = true;
             break;
-#endif
-#ifdef NV_EXTENSIONS
         case EOpImageSampleFootprintNV:
             break;
         case EOpImageSampleFootprintClampNV:
@@ -1515,11 +1495,11 @@ public:
             cracked.lodClamp = true;
             cracked.grad = true;
             break;
-#endif
         case EOpSubpassLoad:
         case EOpSubpassLoadMS:
             cracked.subpass = true;
             break;
+#endif
         default:
             break;
         }

+ 1 - 1
3rdparty/glslang/glslang/Include/revision.h

@@ -1,3 +1,3 @@
 // This header is generated by the make-revision script.
 
-#define GLSLANG_PATCH_LEVEL 3345
+#define GLSLANG_PATCH_LEVEL 3381

+ 89 - 78
3rdparty/glslang/glslang/MachineIndependent/Constant.cpp

@@ -189,6 +189,24 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
                 else
                     newConstArray[i].setDConst((double)NAN);
                 break;
+
+            case EbtInt:
+                if (rightUnionArray[i] == 0)
+                    newConstArray[i].setIConst(0x7FFFFFFF);
+                else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll)
+                    newConstArray[i].setIConst((int)-0x80000000ll);
+                else
+                    newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst());
+                break;
+
+            case EbtUint:
+                if (rightUnionArray[i] == 0u)
+                    newConstArray[i].setUConst(0xFFFFFFFFu);
+                else
+                    newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
+                break;
+
+#ifndef GLSLANG_WEB
             case EbtInt8:
                 if (rightUnionArray[i] == (signed char)0)
                     newConstArray[i].setI8Const((signed char)0x7F);
@@ -221,22 +239,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
                     newConstArray[i].setU16Const(leftUnionArray[i].getU16Const() / rightUnionArray[i].getU16Const());
                 break;
 
-            case EbtInt:
-                if (rightUnionArray[i] == 0)
-                    newConstArray[i].setIConst(0x7FFFFFFF);
-                else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll)
-                    newConstArray[i].setIConst((int)-0x80000000ll);
-                else
-                    newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst());
-                break;
-
-            case EbtUint:
-                if (rightUnionArray[i] == 0u)
-                    newConstArray[i].setUConst(0xFFFFFFFFu);
-                else
-                    newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
-                break;
-
             case EbtInt64:
                 if (rightUnionArray[i] == 0ll)
                     newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll);
@@ -254,6 +256,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
                 break;
             default:
                 return 0;
+#endif
             }
         }
         break;
@@ -292,13 +295,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
                         newConstArray[i].setIConst(0);
                         break;
                     } else goto modulo_default;
-
+#ifndef GLSLANG_WEB
                 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);
@@ -527,14 +529,16 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
             case EbtDouble:
             case EbtFloat16:
             case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
+            case EbtInt:   newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
+            case EbtUint:  newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst())));  break;
+#ifndef GLSLANG_WEB
             case EbtInt8:  newConstArray[i].setI8Const(-unionArray[i].getI8Const()); break;
             case EbtUint8: newConstArray[i].setU8Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU8Const())));  break;
             case EbtInt16: newConstArray[i].setI16Const(-unionArray[i].getI16Const()); break;
             case EbtUint16:newConstArray[i].setU16Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU16Const())));  break;
-            case EbtInt:   newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
-            case EbtUint:  newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst())));  break;
             case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break;
             case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(-static_cast<long long>(unionArray[i].getU64Const())));  break;
+#endif
             default:
                 return nullptr;
             }
@@ -669,6 +673,48 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
             break;
         }
 
+        case EOpConvIntToBool:
+            newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break;
+        case EOpConvUintToBool:
+            newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break;
+        case EOpConvBoolToInt:
+            newConstArray[i].setIConst(unionArray[i].getBConst()); break;
+        case EOpConvBoolToUint:
+            newConstArray[i].setUConst(unionArray[i].getBConst()); break;
+        case EOpConvIntToUint:
+            newConstArray[i].setUConst(unionArray[i].getIConst()); break;
+        case EOpConvUintToInt:
+            newConstArray[i].setIConst(unionArray[i].getUConst()); break;
+
+        case EOpConvFloatToBool:
+        case EOpConvDoubleToBool:
+            newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
+
+        case EOpConvBoolToFloat:
+        case EOpConvBoolToDouble:
+            newConstArray[i].setDConst(unionArray[i].getBConst()); break;
+
+        case EOpConvIntToFloat:
+        case EOpConvIntToDouble:
+            newConstArray[i].setDConst(unionArray[i].getIConst()); break;
+
+        case EOpConvUintToFloat:
+        case EOpConvUintToDouble:
+            newConstArray[i].setDConst(unionArray[i].getUConst()); break;
+
+        case EOpConvDoubleToFloat:
+        case EOpConvFloatToDouble:
+            newConstArray[i].setDConst(unionArray[i].getDConst()); break;
+
+        case EOpConvFloatToUint:
+        case EOpConvDoubleToUint:
+            newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
+
+        case EOpConvFloatToInt:
+        case EOpConvDoubleToInt:
+            newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
+
+#ifndef GLSLANG_WEB
         case EOpConvInt8ToBool:
             newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break;
         case EOpConvUint8ToBool:
@@ -677,20 +723,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
             newConstArray[i].setBConst(unionArray[i].getI16Const() != 0); break;
         case EOpConvUint16ToBool:
             newConstArray[i].setBConst(unionArray[i].getU16Const() != 0); break;
-        case EOpConvIntToBool:
-            newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break;
-        case EOpConvUintToBool:
-            newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break;
         case EOpConvInt64ToBool:
             newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
         case EOpConvUint64ToBool:
             newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break;
         case EOpConvFloat16ToBool:
             newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
-        case EOpConvFloatToBool:
-            newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
-        case EOpConvDoubleToBool:
-            newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break;
 
         case EOpConvBoolToInt8:
             newConstArray[i].setI8Const(unionArray[i].getBConst()); break;
@@ -700,20 +738,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
             newConstArray[i].setI16Const(unionArray[i].getBConst()); break;
         case EOpConvBoolToUint16:
             newConstArray[i].setU16Const(unionArray[i].getBConst()); break;
-        case EOpConvBoolToInt:
-            newConstArray[i].setIConst(unionArray[i].getBConst()); break;
-        case EOpConvBoolToUint:
-            newConstArray[i].setUConst(unionArray[i].getBConst()); break;
         case EOpConvBoolToInt64:
             newConstArray[i].setI64Const(unionArray[i].getBConst()); break;
         case EOpConvBoolToUint64:
             newConstArray[i].setU64Const(unionArray[i].getBConst()); break;
         case EOpConvBoolToFloat16:
             newConstArray[i].setDConst(unionArray[i].getBConst()); break;
-        case EOpConvBoolToFloat:
-            newConstArray[i].setDConst(unionArray[i].getBConst()); break;
-        case EOpConvBoolToDouble:
-            newConstArray[i].setDConst(unionArray[i].getBConst()); break;
 
         case EOpConvInt8ToInt16:
             newConstArray[i].setI16Const(unionArray[i].getI8Const()); break;
@@ -808,8 +838,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
             newConstArray[i].setU8Const((unsigned char)unionArray[i].getIConst()); break;
         case EOpConvIntToUint16:
             newConstArray[i].setU16Const((unsigned char)unionArray[i].getIConst()); break;
-        case EOpConvIntToUint:
-            newConstArray[i].setUConst(unionArray[i].getIConst()); break;
         case EOpConvIntToUint64:
             newConstArray[i].setU64Const(unionArray[i].getIConst()); break;
 
@@ -817,8 +845,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
             newConstArray[i].setI8Const((signed char)unionArray[i].getUConst()); break;
         case EOpConvUintToInt16:
             newConstArray[i].setI16Const((signed short)unionArray[i].getUConst()); break;
-        case EOpConvUintToInt:
-            newConstArray[i].setIConst(unionArray[i].getUConst()); break;
         case EOpConvUintToInt64:
             newConstArray[i].setI64Const(unionArray[i].getUConst()); break;
         case EOpConvUintToUint8:
@@ -829,16 +855,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
             newConstArray[i].setU64Const(unionArray[i].getUConst()); break;
         case EOpConvIntToFloat16:
             newConstArray[i].setDConst(unionArray[i].getIConst()); break;
-        case EOpConvIntToFloat:
-            newConstArray[i].setDConst(unionArray[i].getIConst()); break;
-        case EOpConvIntToDouble:
-            newConstArray[i].setDConst(unionArray[i].getIConst()); break;
         case EOpConvUintToFloat16:
             newConstArray[i].setDConst(unionArray[i].getUConst()); break;
-        case EOpConvUintToFloat:
-            newConstArray[i].setDConst(unionArray[i].getUConst()); break;
-        case EOpConvUintToDouble:
-            newConstArray[i].setDConst(unionArray[i].getUConst()); break;
         case EOpConvInt64ToInt8:
             newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI64Const())); break;
         case EOpConvInt64ToInt16:
@@ -903,48 +921,35 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
             newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
         case EOpConvFloatToInt16:
             newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
-        case EOpConvFloatToInt:
-            newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
         case EOpConvFloatToInt64:
             newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
         case EOpConvFloatToUint8:
             newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
         case EOpConvFloatToUint16:
             newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
-        case EOpConvFloatToUint:
-            newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
         case EOpConvFloatToUint64:
             newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
         case EOpConvFloatToFloat16:
             newConstArray[i].setDConst(unionArray[i].getDConst()); break;
-        case EOpConvFloatToDouble:
-            newConstArray[i].setDConst(unionArray[i].getDConst()); break;
         case EOpConvDoubleToInt8:
             newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break;
         case EOpConvDoubleToInt16:
             newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break;
-        case EOpConvDoubleToInt:
-            newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break;
         case EOpConvDoubleToInt64:
             newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break;
         case EOpConvDoubleToUint8:
             newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break;
         case EOpConvDoubleToUint16:
             newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break;
-        case EOpConvDoubleToUint:
-            newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break;
         case EOpConvDoubleToUint64:
             newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break;
         case EOpConvDoubleToFloat16:
             newConstArray[i].setDConst(unionArray[i].getDConst()); break;
-        case EOpConvDoubleToFloat:
-            newConstArray[i].setDConst(unionArray[i].getDConst()); break;
         case EOpConvPtrToUint64:
         case EOpConvUint64ToPtr:
         case EOpConstructReference:
             newConstArray[i].setU64Const(unionArray[i].getU64Const()); break;
-
-
+#endif
 
         // TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out
 
@@ -1076,6 +1081,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
                 case EbtDouble:
                     newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
                     break;
+                case EbtInt:
+                    newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
+                    break;
+                case EbtUint:
+                    newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
+                    break;
+#ifndef GLSLANG_WEB
                 case EbtInt8:
                     newConstArray[comp].setI8Const(std::min(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()));
                     break;
@@ -1088,18 +1100,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
                 case EbtUint16:
                     newConstArray[comp].setU16Const(std::min(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const()));
                     break;
-                case EbtInt:
-                    newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
-                    break;
-                case EbtUint:
-                    newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
-                    break;
                 case EbtInt64:
                     newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
                     break;
                 case EbtUint64:
                     newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
                     break;
+#endif
                 default: assert(false && "Default missing");
                 }
                 break;
@@ -1110,6 +1117,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
                 case EbtDouble:
                     newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
                     break;
+                case EbtInt:
+                    newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
+                    break;
+                case EbtUint:
+                    newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
+                    break;
+#ifndef GLSLANG_WEB
                 case EbtInt8:
                     newConstArray[comp].setI8Const(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()));
                     break;
@@ -1122,18 +1136,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
                 case EbtUint16:
                     newConstArray[comp].setU16Const(std::max(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const()));
                     break;
-                case EbtInt:
-                    newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
-                    break;
-                case EbtUint:
-                    newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
-                    break;
                 case EbtInt64:
                     newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
                     break;
                 case EbtUint64:
                     newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
                     break;
+#endif
                 default: assert(false && "Default missing");
                 }
                 break;
@@ -1145,6 +1154,11 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
                     newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()),
                                                                                                                childConstUnions[2][arg2comp].getDConst()));
                     break;
+                case EbtUint:
+                    newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()),
+                                                                                                                   childConstUnions[2][arg2comp].getUConst()));
+                    break;
+#ifndef GLSLANG_WEB
                 case EbtInt8:
                     newConstArray[comp].setI8Const(std::min(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()),
                                                                                                                    childConstUnions[2][arg2comp].getI8Const()));
@@ -1165,10 +1179,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
                     newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()),
                                                                                                                    childConstUnions[2][arg2comp].getIConst()));
                     break;
-                case EbtUint:
-                    newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()),
-                                                                                                                   childConstUnions[2][arg2comp].getUConst()));
-                    break;
                 case EbtInt64:
                     newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()),
                                                                                                                        childConstUnions[2][arg2comp].getI64Const()));
@@ -1177,6 +1187,7 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
                     newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()),
                                                                                                                        childConstUnions[2][arg2comp].getU64Const()));
                     break;
+#endif
                 default: assert(false && "Default missing");
                 }
                 break;

Разлика између датотеке није приказан због своје велике величине
+ 380 - 520
3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp


+ 2 - 0
3rdparty/glslang/glslang/MachineIndependent/Initialize.h

@@ -91,6 +91,8 @@ public:
     void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources);
 
 protected:
+    void addTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion);
+    void relateTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage, TSymbolTable&);
     void add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion);
     void addSubpassSampling(TSampler, const TString& typeName, int version, EProfile profile);
     void addQueryFunctions(TSampler, const TString& typeName, int version, EProfile profile);

Разлика између датотеке није приказан због своје велике величине
+ 265 - 228
3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp


+ 14 - 10
3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp

@@ -67,6 +67,8 @@ void TParseContextBase::outputMessage(const TSourceLoc& loc, const char* szReaso
     }
 }
 
+#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL)
+
 void C_DECL TParseContextBase::error(const TSourceLoc& loc, const char* szReason, const char* szToken,
                                      const char* szExtraInfoFormat, ...)
 {
@@ -113,6 +115,8 @@ void C_DECL TParseContextBase::ppWarn(const TSourceLoc& loc, const char* szReaso
     va_end(args);
 }
 
+#endif
+
 //
 // Both test and if necessary, spit out an error, to see if the node is really
 // an l-value that can be operated on this way.
@@ -149,15 +153,13 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
     case EvqConst:          message = "can't modify a const";        break;
     case EvqConstReadOnly:  message = "can't modify a const";        break;
     case EvqUniform:        message = "can't modify a uniform";      break;
+#ifndef GLSLANG_WEB
     case EvqBuffer:
-        if (node->getQualifier().readonly)
+        if (node->getQualifier().isReadOnly())
             message = "can't modify a readonly buffer";
-#ifdef NV_EXTENSIONS
-        if (node->getQualifier().layoutShaderRecordNV)
+        if (node->getQualifier().isShaderRecordNV())
             message = "can't modify a shaderrecordnv qualified buffer";
-#endif
         break;
-#ifdef NV_EXTENSIONS
     case EvqHitAttrNV:
         if (language != EShLangIntersectNV)
             message = "cannot modify hitAttributeNV in this stage";
@@ -172,13 +174,13 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op,
         case EbtSampler:
             message = "can't modify a sampler";
             break;
-        case EbtAtomicUint:
-            message = "can't modify an atomic_uint";
-            break;
         case EbtVoid:
             message = "can't modify void";
             break;
-#ifdef NV_EXTENSIONS
+#ifndef GLSLANG_WEB
+        case EbtAtomicUint:
+            message = "can't modify an atomic_uint";
+            break;
         case EbtAccStructNV:
             message = "can't modify accelerationStructureNV";
             break;
@@ -234,7 +236,7 @@ void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op,
     }
 
     TIntermSymbol* symNode = node->getAsSymbolNode();
-    if (symNode && symNode->getQualifier().writeonly)
+    if (symNode && symNode->getQualifier().isWriteOnly())
         error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str());
 }
 
@@ -574,6 +576,7 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin
         selector.push_back(0);
 }
 
+#ifdef ENABLE_HLSL
 //
 // Make the passed-in variable information become a member of the
 // global uniform block.  If this doesn't exist yet, make it.
@@ -618,6 +621,7 @@ void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& mem
 
     ++firstNewMember;
 }
+#endif
 
 void TParseContextBase::finish()
 {

Разлика између датотеке није приказан због своје велике величине
+ 145 - 137
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp


+ 16 - 4
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h

@@ -97,6 +97,7 @@ public:
     }
     virtual ~TParseContextBase() { }
 
+#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL)
     virtual void C_DECL   error(const TSourceLoc&, const char* szReason, const char* szToken,
                                 const char* szExtraInfoFormat, ...);
     virtual void C_DECL    warn(const TSourceLoc&, const char* szReason, const char* szToken,
@@ -105,6 +106,7 @@ public:
                                 const char* szExtraInfoFormat, ...);
     virtual void C_DECL  ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
                                 const char* szExtraInfoFormat, ...);
+#endif
 
     virtual void setLimits(const TBuiltInResource&) = 0;
 
@@ -150,8 +152,10 @@ public:
             extensionCallback(line, extension, behavior);
     }
 
+#ifdef ENABLE_HLSL
     // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
     virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr);
+#endif
 
     // Potentially rename shader entry point function
     void renameShaderFunction(TString*& name) const
@@ -297,10 +301,12 @@ public:
     TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
     void handleIndexLimits(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
 
+#ifndef GLSLANG_WEB
     void makeEditable(TSymbol*&) override;
+    void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier);
+#endif
     bool isIoResizeArray(const TType&) const;
     void fixIoArraySize(const TSourceLoc&, TType&);
-    void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier);
     void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base);
     void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false);
     int getIoArrayImplicitSize(const TQualifier&, TString* featureString = nullptr) const;
@@ -404,6 +410,7 @@ public:
     TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&);
     TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&);
     TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset);
+    void inheritMemoryQualifiers(const TQualifier& from, TQualifier& to);
     void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0);
     void blockStageIoCheck(const TSourceLoc&, const TQualifier&);
     void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName);
@@ -417,6 +424,7 @@ public:
     void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode);
     TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body);
 
+#ifndef GLSLANG_WEB
     TAttributeType attributeFromName(const TString& name) const;
     TAttributes* makeAttributes(const TString& identifier) const;
     TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const;
@@ -425,9 +433,9 @@ public:
     // Determine selection control from attributes
     void handleSelectionAttributes(const TAttributes& attributes, TIntermNode*);
     void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*);
-
     // Determine loop control from attributes
     void handleLoopAttributes(const TAttributes& attributes, TIntermNode*);
+#endif
 
     void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember);
 
@@ -441,7 +449,9 @@ protected:
     bool isRuntimeLength(const TIntermTyped&) const;
     TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
+#ifndef GLSLANG_WEB
     void finish() override;
+#endif
 
 public:
     //
@@ -467,10 +477,11 @@ protected:
     TQualifier globalUniformDefaults;
     TQualifier globalInputDefaults;
     TQualifier globalOutputDefaults;
-    int* atomicUintOffsets;       // to become an array of the right size to hold an offset per binding point
     TString currentCaller;        // name of last function body entered (not valid when at global scope)
-    TIdSetType inductiveLoopIds;
+#ifndef GLSLANG_WEB
+    int* atomicUintOffsets;       // to become an array of the right size to hold an offset per binding point
     bool anyIndexLimits;
+    TIdSetType inductiveLoopIds;
     TVector<TIntermTyped*> needsIndexLimitationChecking;
 
     //
@@ -506,6 +517,7 @@ protected:
     //    array-sizing declarations
     //
     TVector<TSymbol*> ioArraySymbolResizeList;
+#endif
 };
 
 } // end namespace glslang

+ 216 - 238
3rdparty/glslang/glslang/MachineIndependent/Scan.cpp

@@ -324,7 +324,9 @@ struct str_hash
 // A single global usable by all threads, by all versions, by all languages.
 // After a single process-level initialization, this is read only and thread safe
 std::unordered_map<const char*, int, str_hash, str_eq>* KeywordMap = nullptr;
+#ifndef GLSLANG_WEB
 std::unordered_set<const char*, str_hash, str_eq>* ReservedSet = nullptr;
+#endif
 
 };
 
@@ -341,9 +343,14 @@ void TScanContext::fillInKeywordMap()
 
     (*KeywordMap)["const"] =                   CONST;
     (*KeywordMap)["uniform"] =                 UNIFORM;
-    (*KeywordMap)["nonuniformEXT"] =           NONUNIFORM;
     (*KeywordMap)["in"] =                      IN;
     (*KeywordMap)["out"] =                     OUT;
+    (*KeywordMap)["smooth"] =                  SMOOTH;
+    (*KeywordMap)["flat"] =                    FLAT;
+    (*KeywordMap)["centroid"] =                CENTROID;
+    (*KeywordMap)["invariant"] =               INVARIANT;
+    (*KeywordMap)["packed"] =                  PACKED;
+    (*KeywordMap)["resource"] =                RESOURCE;
     (*KeywordMap)["inout"] =                   INOUT;
     (*KeywordMap)["struct"] =                  STRUCT;
     (*KeywordMap)["break"] =                   BREAK;
@@ -356,7 +363,6 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["default"] =                 DEFAULT;
     (*KeywordMap)["if"] =                      IF;
     (*KeywordMap)["else"] =                    ELSE;
-    (*KeywordMap)["demote"] =                  DEMOTE;
     (*KeywordMap)["discard"] =                 DISCARD;
     (*KeywordMap)["return"] =                  RETURN;
     (*KeywordMap)["void"] =                    VOID;
@@ -377,8 +383,33 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["mat4"] =                    MAT4;
     (*KeywordMap)["true"] =                    BOOLCONSTANT;
     (*KeywordMap)["false"] =                   BOOLCONSTANT;
+    (*KeywordMap)["layout"] =                  LAYOUT;
+    (*KeywordMap)["shared"] =                  SHARED;
+    (*KeywordMap)["highp"] =                   HIGH_PRECISION;
+    (*KeywordMap)["mediump"] =                 MEDIUM_PRECISION;
+    (*KeywordMap)["lowp"] =                    LOW_PRECISION;
+    (*KeywordMap)["superp"] =                  SUPERP;
+    (*KeywordMap)["precision"] =               PRECISION;
+    (*KeywordMap)["mat2x2"] =                  MAT2X2;
+    (*KeywordMap)["mat2x3"] =                  MAT2X3;
+    (*KeywordMap)["mat2x4"] =                  MAT2X4;
+    (*KeywordMap)["mat3x2"] =                  MAT3X2;
+    (*KeywordMap)["mat3x3"] =                  MAT3X3;
+    (*KeywordMap)["mat3x4"] =                  MAT3X4;
+    (*KeywordMap)["mat4x2"] =                  MAT4X2;
+    (*KeywordMap)["mat4x3"] =                  MAT4X3;
+    (*KeywordMap)["mat4x4"] =                  MAT4X4;
+    (*KeywordMap)["uint"] =                    UINT;
+    (*KeywordMap)["uvec2"] =                   UVEC2;
+    (*KeywordMap)["uvec3"] =                   UVEC3;
+    (*KeywordMap)["uvec4"] =                   UVEC4;
+
+#ifndef GLSLANG_WEB
+    (*KeywordMap)["nonuniformEXT"] =           NONUNIFORM;
+    (*KeywordMap)["demote"] =                  DEMOTE;
     (*KeywordMap)["attribute"] =               ATTRIBUTE;
     (*KeywordMap)["varying"] =                 VARYING;
+    (*KeywordMap)["noperspective"] =           NOPERSPECTIVE;
     (*KeywordMap)["buffer"] =                  BUFFER;
     (*KeywordMap)["coherent"] =                COHERENT;
     (*KeywordMap)["devicecoherent"] =          DEVICECOHERENT;
@@ -391,24 +422,9 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["writeonly"] =               WRITEONLY;
     (*KeywordMap)["atomic_uint"] =             ATOMIC_UINT;
     (*KeywordMap)["volatile"] =                VOLATILE;
-    (*KeywordMap)["layout"] =                  LAYOUT;
-    (*KeywordMap)["shared"] =                  SHARED;
     (*KeywordMap)["patch"] =                   PATCH;
     (*KeywordMap)["sample"] =                  SAMPLE;
     (*KeywordMap)["subroutine"] =              SUBROUTINE;
-    (*KeywordMap)["highp"] =                   HIGH_PRECISION;
-    (*KeywordMap)["mediump"] =                 MEDIUM_PRECISION;
-    (*KeywordMap)["lowp"] =                    LOW_PRECISION;
-    (*KeywordMap)["precision"] =               PRECISION;
-    (*KeywordMap)["mat2x2"] =                  MAT2X2;
-    (*KeywordMap)["mat2x3"] =                  MAT2X3;
-    (*KeywordMap)["mat2x4"] =                  MAT2X4;
-    (*KeywordMap)["mat3x2"] =                  MAT3X2;
-    (*KeywordMap)["mat3x3"] =                  MAT3X3;
-    (*KeywordMap)["mat3x4"] =                  MAT3X4;
-    (*KeywordMap)["mat4x2"] =                  MAT4X2;
-    (*KeywordMap)["mat4x3"] =                  MAT4X3;
-    (*KeywordMap)["mat4x4"] =                  MAT4X4;
     (*KeywordMap)["dmat2"] =                   DMAT2;
     (*KeywordMap)["dmat3"] =                   DMAT3;
     (*KeywordMap)["dmat4"] =                   DMAT4;
@@ -458,11 +474,6 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["dvec2"] =                   DVEC2;
     (*KeywordMap)["dvec3"] =                   DVEC3;
     (*KeywordMap)["dvec4"] =                   DVEC4;
-    (*KeywordMap)["uint"] =                    UINT;
-    (*KeywordMap)["uvec2"] =                   UVEC2;
-    (*KeywordMap)["uvec3"] =                   UVEC3;
-    (*KeywordMap)["uvec4"] =                   UVEC4;
-
     (*KeywordMap)["int64_t"] =                 INT64_T;
     (*KeywordMap)["uint64_t"] =                UINT64_T;
     (*KeywordMap)["i64vec2"] =                 I64VEC2;
@@ -549,6 +560,7 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["f64mat4x2"] =               F64MAT4X2;
     (*KeywordMap)["f64mat4x3"] =               F64MAT4X3;
     (*KeywordMap)["f64mat4x4"] =               F64MAT4X4;
+#endif
 
     (*KeywordMap)["sampler2D"] =               SAMPLER2D;
     (*KeywordMap)["samplerCube"] =             SAMPLERCUBE;
@@ -556,12 +568,6 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["samplerCubeArrayShadow"] =  SAMPLERCUBEARRAYSHADOW;
     (*KeywordMap)["isamplerCubeArray"] =       ISAMPLERCUBEARRAY;
     (*KeywordMap)["usamplerCubeArray"] =       USAMPLERCUBEARRAY;
-    (*KeywordMap)["sampler1DArrayShadow"] =    SAMPLER1DARRAYSHADOW;
-    (*KeywordMap)["isampler1DArray"] =         ISAMPLER1DARRAY;
-    (*KeywordMap)["usampler1D"] =              USAMPLER1D;
-    (*KeywordMap)["isampler1D"] =              ISAMPLER1D;
-    (*KeywordMap)["usampler1DArray"] =         USAMPLER1DARRAY;
-    (*KeywordMap)["samplerBuffer"] =           SAMPLERBUFFER;
     (*KeywordMap)["samplerCubeShadow"] =       SAMPLERCUBESHADOW;
     (*KeywordMap)["sampler2DArray"] =          SAMPLER2DARRAY;
     (*KeywordMap)["sampler2DArrayShadow"] =    SAMPLER2DARRAYSHADOW;
@@ -573,6 +579,16 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["usampler3D"] =              USAMPLER3D;
     (*KeywordMap)["usamplerCube"] =            USAMPLERCUBE;
     (*KeywordMap)["usampler2DArray"] =         USAMPLER2DARRAY;
+    (*KeywordMap)["sampler3D"] =               SAMPLER3D;
+    (*KeywordMap)["sampler2DShadow"] =         SAMPLER2DSHADOW;
+
+#ifndef GLSLANG_WEB
+    (*KeywordMap)["sampler1DArrayShadow"] =    SAMPLER1DARRAYSHADOW;
+    (*KeywordMap)["isampler1DArray"] =         ISAMPLER1DARRAY;
+    (*KeywordMap)["usampler1D"] =              USAMPLER1D;
+    (*KeywordMap)["isampler1D"] =              ISAMPLER1D;
+    (*KeywordMap)["usampler1DArray"] =         USAMPLER1DARRAY;
+    (*KeywordMap)["samplerBuffer"] =           SAMPLERBUFFER;
     (*KeywordMap)["isampler2DRect"] =          ISAMPLER2DRECT;
     (*KeywordMap)["usampler2DRect"] =          USAMPLER2DRECT;
     (*KeywordMap)["isamplerBuffer"] =          ISAMPLERBUFFER;
@@ -585,8 +601,6 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["usampler2DMSArray"] =       USAMPLER2DMSARRAY;
     (*KeywordMap)["sampler1D"] =               SAMPLER1D;
     (*KeywordMap)["sampler1DShadow"] =         SAMPLER1DSHADOW;
-    (*KeywordMap)["sampler3D"] =               SAMPLER3D;
-    (*KeywordMap)["sampler2DShadow"] =         SAMPLER2DSHADOW;
     (*KeywordMap)["sampler2DRect"] =           SAMPLER2DRECT;
     (*KeywordMap)["sampler2DRectShadow"] =     SAMPLER2DRECTSHADOW;
     (*KeywordMap)["sampler1DArray"] =          SAMPLER1DARRAY;
@@ -639,7 +653,6 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["usubpassInput"] =           USUBPASSINPUT;
     (*KeywordMap)["usubpassInputMS"] =         USUBPASSINPUTMS;
 
-#ifdef AMD_EXTENSIONS
     (*KeywordMap)["f16sampler1D"] =                 F16SAMPLER1D;
     (*KeywordMap)["f16sampler2D"] =                 F16SAMPLER2D;
     (*KeywordMap)["f16sampler3D"] =                 F16SAMPLER3D;
@@ -685,25 +698,10 @@ void TScanContext::fillInKeywordMap()
 
     (*KeywordMap)["f16subpassInput"] =              F16SUBPASSINPUT;
     (*KeywordMap)["f16subpassInputMS"] =            F16SUBPASSINPUTMS;
-#endif
-
-    (*KeywordMap)["noperspective"] =           NOPERSPECTIVE;
-    (*KeywordMap)["smooth"] =                  SMOOTH;
-    (*KeywordMap)["flat"] =                    FLAT;
-#ifdef AMD_EXTENSIONS
     (*KeywordMap)["__explicitInterpAMD"] =     EXPLICITINTERPAMD;
-#endif
-    (*KeywordMap)["centroid"] =                CENTROID;
-#ifdef NV_EXTENSIONS
     (*KeywordMap)["pervertexNV"] =             PERVERTEXNV;
-#endif
     (*KeywordMap)["precise"] =                 PRECISE;
-    (*KeywordMap)["invariant"] =               INVARIANT;
-    (*KeywordMap)["packed"] =                  PACKED;
-    (*KeywordMap)["resource"] =                RESOURCE;
-    (*KeywordMap)["superp"] =                  SUPERP;
 
-#ifdef NV_EXTENSIONS
     (*KeywordMap)["rayPayloadNV"] =            PAYLOADNV;
     (*KeywordMap)["rayPayloadInNV"] =          PAYLOADINNV;
     (*KeywordMap)["hitAttributeNV"] =          HITATTRNV;
@@ -713,7 +711,6 @@ void TScanContext::fillInKeywordMap()
     (*KeywordMap)["perprimitiveNV"] =          PERPRIMITIVENV;
     (*KeywordMap)["perviewNV"] =               PERVIEWNV;
     (*KeywordMap)["taskNV"] =                  PERTASKNV;
-#endif
 
     (*KeywordMap)["fcoopmatNV"] =              FCOOPMATNV;
 
@@ -756,14 +753,17 @@ void TScanContext::fillInKeywordMap()
     ReservedSet->insert("cast");
     ReservedSet->insert("namespace");
     ReservedSet->insert("using");
+#endif
 }
 
 void TScanContext::deleteKeywordMap()
 {
     delete KeywordMap;
     KeywordMap = nullptr;
+#ifndef GLSLANG_WEB
     delete ReservedSet;
     ReservedSet = nullptr;
+#endif
 }
 
 // Called by yylex to get the next token.
@@ -842,13 +842,15 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
 
         case PpAtomConstInt:           parserToken->sType.lex.i    = ppToken.ival;       return INTCONSTANT;
         case PpAtomConstUint:          parserToken->sType.lex.i    = ppToken.ival;       return UINTCONSTANT;
+        case PpAtomConstFloat:         parserToken->sType.lex.d    = ppToken.dval;       return FLOATCONSTANT;
+#ifndef GLSLANG_WEB
         case PpAtomConstInt16:         parserToken->sType.lex.i    = ppToken.ival;       return INT16CONSTANT;
         case PpAtomConstUint16:        parserToken->sType.lex.i    = ppToken.ival;       return UINT16CONSTANT;
         case PpAtomConstInt64:         parserToken->sType.lex.i64  = ppToken.i64val;     return INT64CONSTANT;
         case PpAtomConstUint64:        parserToken->sType.lex.i64  = ppToken.i64val;     return UINT64CONSTANT;
-        case PpAtomConstFloat:         parserToken->sType.lex.d    = ppToken.dval;       return FLOATCONSTANT;
         case PpAtomConstDouble:        parserToken->sType.lex.d    = ppToken.dval;       return DOUBLECONSTANT;
         case PpAtomConstFloat16:       parserToken->sType.lex.d    = ppToken.dval;       return FLOAT16CONSTANT;
+#endif
         case PpAtomIdentifier:
         {
             int token = tokenizeIdentifier();
@@ -870,8 +872,10 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
 
 int TScanContext::tokenizeIdentifier()
 {
+#ifndef GLSLANG_WEB
     if (ReservedSet->find(tokenText) != ReservedSet->end())
         return reservedWord();
+#endif
 
     auto it = KeywordMap->find(tokenText);
     if (it == KeywordMap->end()) {
@@ -902,16 +906,10 @@ int TScanContext::tokenizeIdentifier()
         afterStruct = true;
         return keyword;
 
-    case NONUNIFORM:
-        if (parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier))
-            return keyword;
-        else
-            return identifierOrType();
-
     case SWITCH:
     case DEFAULT:
-        if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
-            (parseContext.profile != EEsProfile && parseContext.version < 130))
+        if ((parseContext.isEsProfile() && parseContext.version < 300) ||
+            (!parseContext.isEsProfile() && parseContext.version < 130))
             reservedWord();
         return keyword;
 
@@ -943,20 +941,66 @@ int TScanContext::tokenizeIdentifier()
             parserToken->sType.lex.b = false;
         return keyword;
 
+    case SMOOTH:
+        if ((parseContext.isEsProfile() && parseContext.version < 300) ||
+            (!parseContext.isEsProfile() && parseContext.version < 130))
+            return identifierOrType();
+        return keyword;
+    case FLAT:
+        if (parseContext.isEsProfile() && parseContext.version < 300)
+            reservedWord();
+        else if (!parseContext.isEsProfile() && parseContext.version < 130)
+            return identifierOrType();
+        return keyword;
+    case CENTROID:
+        if (parseContext.version < 120)
+            return identifierOrType();
+        return keyword;
+    case INVARIANT:
+        if (!parseContext.isEsProfile() && parseContext.version < 120)
+            return identifierOrType();
+        return keyword;
+    case PACKED:
+        if ((parseContext.isEsProfile() && parseContext.version < 300) ||
+            (!parseContext.isEsProfile() && parseContext.version < 330))
+            return reservedWord();
+        return identifierOrType();
+
+    case RESOURCE:
+    {
+        bool reserved = (parseContext.isEsProfile() && parseContext.version >= 300) ||
+                        (!parseContext.isEsProfile() && parseContext.version >= 420);
+        return identifierOrReserved(reserved);
+    }
+    case SUPERP:
+    {
+        bool reserved = parseContext.isEsProfile() || parseContext.version >= 130;
+        return identifierOrReserved(reserved);
+    }
+
+#ifndef GLSLANG_WEB
+    case NOPERSPECTIVE:
+        if (parseContext.isEsProfile() && parseContext.version >= 300 &&
+            parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation))
+            return keyword;
+        return es30ReservedFromGLSL(130);
+
+    case NONUNIFORM:
+        if (parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier))
+            return keyword;
+        else
+            return identifierOrType();
     case ATTRIBUTE:
     case VARYING:
-        if (parseContext.profile == EEsProfile && parseContext.version >= 300)
+        if (parseContext.isEsProfile() && parseContext.version >= 300)
             reservedWord();
         return keyword;
-
     case BUFFER:
         afterBuffer = true;
-        if ((parseContext.profile == EEsProfile && parseContext.version < 310) ||
-            (parseContext.profile != EEsProfile && parseContext.version < 430))
+        if ((parseContext.isEsProfile() && parseContext.version < 310) ||
+            (!parseContext.isEsProfile() && parseContext.version < 430))
             return identifierOrType();
         return keyword;
-
-#ifdef NV_EXTENSIONS
     case PAYLOADNV:
     case PAYLOADINNV:
     case HITATTRNV:
@@ -964,14 +1008,12 @@ int TScanContext::tokenizeIdentifier()
     case CALLDATAINNV:
     case ACCSTRUCTNV:
         if (parseContext.symbolTable.atBuiltInLevel() ||
-            (parseContext.profile != EEsProfile && parseContext.version >= 460
+            (!parseContext.isEsProfile() && parseContext.version >= 460
                  && parseContext.extensionTurnedOn(E_GL_NV_ray_tracing)))
             return keyword;
         return identifierOrType();
-#endif
-
     case ATOMIC_UINT:
-        if ((parseContext.profile == EEsProfile && parseContext.version >= 310) ||
+        if ((parseContext.isEsProfile() && parseContext.version >= 310) ||
             parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters))
             return keyword;
         return es30ReservedFromGLSL(420);
@@ -985,53 +1027,52 @@ int TScanContext::tokenizeIdentifier()
     case RESTRICT:
     case READONLY:
     case WRITEONLY:
-        if (parseContext.profile == EEsProfile && parseContext.version >= 310)
+        if (parseContext.isEsProfile() && parseContext.version >= 310)
             return keyword;
         return es30ReservedFromGLSL(parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store) ? 130 : 420);
-
     case VOLATILE:
-        if (parseContext.profile == EEsProfile && parseContext.version >= 310)
+        if (parseContext.isEsProfile() && parseContext.version >= 310)
             return keyword;
-        if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile ||
+        if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.isEsProfile() ||
             (parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))))
             reservedWord();
         return keyword;
-
-    case LAYOUT:
-    {
-        const int numLayoutExts = 2;
-        const char* layoutExts[numLayoutExts] = { E_GL_ARB_shading_language_420pack,
-                                                  E_GL_ARB_explicit_attrib_location };
-        if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
-            (parseContext.profile != EEsProfile && parseContext.version < 140 &&
-            ! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts)))
-            return identifierOrType();
-        return keyword;
-    }
-    case SHARED:
-        if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
-            (parseContext.profile != EEsProfile && parseContext.version < 140))
-            return identifierOrType();
-        return keyword;
-
     case PATCH:
         if (parseContext.symbolTable.atBuiltInLevel() ||
-            (parseContext.profile == EEsProfile &&
+            (parseContext.isEsProfile() &&
              (parseContext.version >= 320 ||
               parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))) ||
-            (parseContext.profile != EEsProfile && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader)))
+            (!parseContext.isEsProfile() && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader)))
             return keyword;
 
         return es30ReservedFromGLSL(400);
 
     case SAMPLE:
-        if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
+        if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
             parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation))
             return keyword;
         return es30ReservedFromGLSL(400);
 
     case SUBROUTINE:
         return es30ReservedFromGLSL(400);
+    case SHARED:
+        if ((parseContext.isEsProfile() && parseContext.version < 300) ||
+            (!parseContext.isEsProfile() && parseContext.version < 140))
+            return identifierOrType();
+        return keyword;
+#endif
+
+    case LAYOUT:
+    {
+        const int numLayoutExts = 2;
+        const char* layoutExts[numLayoutExts] = { E_GL_ARB_shading_language_420pack,
+                                                  E_GL_ARB_explicit_attrib_location };
+        if ((parseContext.isEsProfile() && parseContext.version < 300) ||
+            (!parseContext.isEsProfile() && parseContext.version < 140 &&
+            ! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts)))
+            return identifierOrType();
+        return keyword;
+    }
 
     case HIGH_PRECISION:
     case MEDIUM_PRECISION:
@@ -1050,6 +1091,7 @@ int TScanContext::tokenizeIdentifier()
     case MAT4X4:
         return matNxM();
 
+#ifndef GLSLANG_WEB
     case DMAT2:
     case DMAT3:
     case DMAT4:
@@ -1080,7 +1122,7 @@ int TScanContext::tokenizeIdentifier()
     case IIMAGEBUFFER:
     case UIMAGEBUFFER:
         afterType = true;
-        if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
+        if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
             parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
             return keyword;
         return firstGenerationImage(false);
@@ -1104,7 +1146,7 @@ int TScanContext::tokenizeIdentifier()
     case IIMAGECUBEARRAY:
     case UIMAGECUBEARRAY:
         afterType = true;
-        if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
+        if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
             parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
             return keyword;
         return secondGenerationImage();
@@ -1123,7 +1165,7 @@ int TScanContext::tokenizeIdentifier()
     case DVEC3:
     case DVEC4:
         afterType = true;
-        if (parseContext.profile == EEsProfile || parseContext.version < 400)
+        if (parseContext.isEsProfile() || parseContext.version < 400)
             reservedWord();
         return keyword;
 
@@ -1137,7 +1179,7 @@ int TScanContext::tokenizeIdentifier()
     case U64VEC4:
         afterType = true;
         if (parseContext.symbolTable.atBuiltInLevel() ||
-            (parseContext.profile != EEsProfile && parseContext.version >= 450 &&
+            (!parseContext.isEsProfile() && parseContext.version >= 450 &&
              (parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int64))))
@@ -1157,7 +1199,7 @@ int TScanContext::tokenizeIdentifier()
             ((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_8bit_storage) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8)) &&
-              parseContext.profile != EEsProfile && parseContext.version >= 450))
+              !parseContext.isEsProfile() && parseContext.version >= 450))
             return keyword;
         return identifierOrType();
 
@@ -1171,11 +1213,8 @@ int TScanContext::tokenizeIdentifier()
     case U16VEC4:
         afterType = true;
         if (parseContext.symbolTable.atBuiltInLevel() ||
-            (parseContext.profile != EEsProfile && parseContext.version >= 450 &&
-             (
-#ifdef AMD_EXTENSIONS
-              parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) ||
-#endif
+            (!parseContext.isEsProfile() && parseContext.version >= 450 &&
+             (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16))))
@@ -1193,7 +1232,7 @@ int TScanContext::tokenizeIdentifier()
         if (parseContext.symbolTable.atBuiltInLevel() ||
            ((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
              parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int32)) &&
-             parseContext.profile != EEsProfile && parseContext.version >= 450))
+             !parseContext.isEsProfile() && parseContext.version >= 450))
             return keyword;
         return identifierOrType();
     case FLOAT32_T:
@@ -1216,7 +1255,7 @@ int TScanContext::tokenizeIdentifier()
         if (parseContext.symbolTable.atBuiltInLevel() ||
             ((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) &&
-              parseContext.profile != EEsProfile && parseContext.version >= 450))
+              !parseContext.isEsProfile() && parseContext.version >= 450))
             return keyword;
         return identifierOrType();
 
@@ -1240,7 +1279,7 @@ int TScanContext::tokenizeIdentifier()
         if (parseContext.symbolTable.atBuiltInLevel() ||
             ((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) &&
-              parseContext.profile != EEsProfile && parseContext.version >= 450))
+              !parseContext.isEsProfile() && parseContext.version >= 450))
             return keyword;
         return identifierOrType();
 
@@ -1250,11 +1289,8 @@ int TScanContext::tokenizeIdentifier()
     case F16VEC4:
         afterType = true;
         if (parseContext.symbolTable.atBuiltInLevel() ||
-            (parseContext.profile != EEsProfile && parseContext.version >= 450 &&
-             (
-#ifdef AMD_EXTENSIONS
-              parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
-#endif
+            (!parseContext.isEsProfile() && parseContext.version >= 450 &&
+             (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16))))
@@ -1276,37 +1312,27 @@ int TScanContext::tokenizeIdentifier()
     case F16MAT4X4:
         afterType = true;
         if (parseContext.symbolTable.atBuiltInLevel() ||
-            (parseContext.profile != EEsProfile && parseContext.version >= 450 &&
-             (
-#ifdef AMD_EXTENSIONS
-              parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
-#endif
+            (!parseContext.isEsProfile() && parseContext.version >= 450 &&
+             (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) ||
               parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16))))
             return keyword;
 
         return identifierOrType();
+#endif
 
     case SAMPLERCUBEARRAY:
     case SAMPLERCUBEARRAYSHADOW:
     case ISAMPLERCUBEARRAY:
     case USAMPLERCUBEARRAY:
         afterType = true;
-        if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
+        if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
             parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
             return keyword;
-        if (parseContext.profile == EEsProfile || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array)))
+        if (parseContext.isEsProfile() || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array)))
             reservedWord();
         return keyword;
 
-    case ISAMPLER1D:
-    case ISAMPLER1DARRAY:
-    case SAMPLER1DARRAYSHADOW:
-    case USAMPLER1D:
-    case USAMPLER1DARRAY:
-        afterType = true;
-        return es30ReservedFromGLSL(130);
-
     case UINT:
     case UVEC2:
     case UVEC3:
@@ -1325,6 +1351,30 @@ int TScanContext::tokenizeIdentifier()
         afterType = true;
         return nonreservedKeyword(300, 130);
 
+    case SAMPLER3D:
+        afterType = true;
+        if (parseContext.isEsProfile() && parseContext.version < 300) {
+            if (!parseContext.extensionTurnedOn(E_GL_OES_texture_3D))
+                reservedWord();
+        }
+        return keyword;
+
+    case SAMPLER2DSHADOW:
+        afterType = true;
+        if (parseContext.isEsProfile() && parseContext.version < 300) {
+            if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers))
+                reservedWord();
+        }
+        return keyword;
+
+#ifndef GLSLANG_WEB
+    case ISAMPLER1D:
+    case ISAMPLER1DARRAY:
+    case SAMPLER1DARRAYSHADOW:
+    case USAMPLER1D:
+    case USAMPLER1DARRAY:
+        afterType = true;
+        return es30ReservedFromGLSL(130);
     case ISAMPLER2DRECT:
     case USAMPLER2DRECT:
         afterType = true;
@@ -1332,7 +1382,7 @@ int TScanContext::tokenizeIdentifier()
 
     case SAMPLERBUFFER:
         afterType = true;
-        if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
+        if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
             parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
             return keyword;
         return es30ReservedFromGLSL(130);
@@ -1340,7 +1390,7 @@ int TScanContext::tokenizeIdentifier()
     case ISAMPLERBUFFER:
     case USAMPLERBUFFER:
         afterType = true;
-        if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
+        if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
             parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
             return keyword;
         return es30ReservedFromGLSL(140);
@@ -1349,7 +1399,7 @@ int TScanContext::tokenizeIdentifier()
     case ISAMPLER2DMS:
     case USAMPLER2DMS:
         afterType = true;
-        if (parseContext.profile == EEsProfile && parseContext.version >= 310)
+        if (parseContext.isEsProfile() && parseContext.version >= 310)
             return keyword;
         return es30ReservedFromGLSL(150);
 
@@ -1357,7 +1407,7 @@ int TScanContext::tokenizeIdentifier()
     case ISAMPLER2DMSARRAY:
     case USAMPLER2DMSARRAY:
         afterType = true;
-        if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
+        if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
             parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array))
             return keyword;
         return es30ReservedFromGLSL(150);
@@ -1365,30 +1415,14 @@ int TScanContext::tokenizeIdentifier()
     case SAMPLER1D:
     case SAMPLER1DSHADOW:
         afterType = true;
-        if (parseContext.profile == EEsProfile)
+        if (parseContext.isEsProfile())
             reservedWord();
         return keyword;
 
-    case SAMPLER3D:
-        afterType = true;
-        if (parseContext.profile == EEsProfile && parseContext.version < 300) {
-            if (!parseContext.extensionTurnedOn(E_GL_OES_texture_3D))
-                reservedWord();
-        }
-        return keyword;
-
-    case SAMPLER2DSHADOW:
-        afterType = true;
-        if (parseContext.profile == EEsProfile && parseContext.version < 300) {
-            if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers))
-                reservedWord();
-        }
-        return keyword;
-
     case SAMPLER2DRECT:
     case SAMPLER2DRECTSHADOW:
         afterType = true;
-        if (parseContext.profile == EEsProfile)
+        if (parseContext.isEsProfile())
             reservedWord();
         else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_rectangle)) {
             if (parseContext.relaxedErrors())
@@ -1400,10 +1434,10 @@ int TScanContext::tokenizeIdentifier()
 
     case SAMPLER1DARRAY:
         afterType = true;
-        if (parseContext.profile == EEsProfile && parseContext.version == 300)
+        if (parseContext.isEsProfile() && parseContext.version == 300)
             reservedWord();
-        else if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
-                 (parseContext.profile != EEsProfile && parseContext.version < 130))
+        else if ((parseContext.isEsProfile() && parseContext.version < 300) ||
+                 (!parseContext.isEsProfile() && parseContext.version < 130))
             return identifierOrType();
         return keyword;
 
@@ -1473,7 +1507,6 @@ int TScanContext::tokenizeIdentifier()
         else
             return identifierOrType();
 
-#ifdef AMD_EXTENSIONS
     case F16SAMPLER1D:
     case F16SAMPLER2D:
     case F16SAMPLER3D:
@@ -1522,98 +1555,42 @@ int TScanContext::tokenizeIdentifier()
         afterType = true;
         if (parseContext.symbolTable.atBuiltInLevel() ||
             (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch) &&
-             parseContext.profile != EEsProfile && parseContext.version >= 450))
+             !parseContext.isEsProfile() && parseContext.version >= 450))
             return keyword;
         return identifierOrType();
-#endif
-
-    case NOPERSPECTIVE:
-#ifdef NV_EXTENSIONS
-        if (parseContext.profile == EEsProfile && parseContext.version >= 300 &&
-            parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation))
-            return keyword;
-#endif
-        return es30ReservedFromGLSL(130);
-
-    case SMOOTH:
-        if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
-            (parseContext.profile != EEsProfile && parseContext.version < 130))
-            return identifierOrType();
-        return keyword;
 
-#ifdef AMD_EXTENSIONS
     case EXPLICITINTERPAMD:
-        if (parseContext.profile != EEsProfile && parseContext.version >= 450 &&
+        if (!parseContext.isEsProfile() && parseContext.version >= 450 &&
             parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter))
             return keyword;
         return identifierOrType();
-#endif
 
-#ifdef NV_EXTENSIONS
     case PERVERTEXNV:
-        if (((parseContext.profile != EEsProfile && parseContext.version >= 450) ||
-            (parseContext.profile == EEsProfile && parseContext.version >= 320)) &&
+        if (((!parseContext.isEsProfile() && parseContext.version >= 450) ||
+            (parseContext.isEsProfile() && parseContext.version >= 320)) &&
             parseContext.extensionTurnedOn(E_GL_NV_fragment_shader_barycentric))
             return keyword;
         return identifierOrType();
-#endif
-
-    case FLAT:
-        if (parseContext.profile == EEsProfile && parseContext.version < 300)
-            reservedWord();
-        else if (parseContext.profile != EEsProfile && parseContext.version < 130)
-            return identifierOrType();
-        return keyword;
-
-    case CENTROID:
-        if (parseContext.version < 120)
-            return identifierOrType();
-        return keyword;
 
     case PRECISE:
-        if ((parseContext.profile == EEsProfile &&
+        if ((parseContext.isEsProfile() &&
              (parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5))) ||
-            (parseContext.profile != EEsProfile && parseContext.version >= 400))
+            (!parseContext.isEsProfile() && parseContext.version >= 400))
             return keyword;
-        if (parseContext.profile == EEsProfile && parseContext.version == 310) {
+        if (parseContext.isEsProfile() && parseContext.version == 310) {
             reservedWord();
             return keyword;
         }
         return identifierOrType();
 
-    case INVARIANT:
-        if (parseContext.profile != EEsProfile && parseContext.version < 120)
-            return identifierOrType();
-        return keyword;
-
-    case PACKED:
-        if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
-            (parseContext.profile != EEsProfile && parseContext.version < 330))
-            return reservedWord();
-        return identifierOrType();
-
-    case RESOURCE:
-    {
-        bool reserved = (parseContext.profile == EEsProfile && parseContext.version >= 300) ||
-                        (parseContext.profile != EEsProfile && parseContext.version >= 420);
-        return identifierOrReserved(reserved);
-    }
-    case SUPERP:
-    {
-        bool reserved = parseContext.profile == EEsProfile || parseContext.version >= 130;
-        return identifierOrReserved(reserved);
-    }
-
-#ifdef NV_EXTENSIONS
     case PERPRIMITIVENV:
     case PERVIEWNV:
     case PERTASKNV:
-        if ((parseContext.profile != EEsProfile && parseContext.version >= 450) ||
-            (parseContext.profile == EEsProfile && parseContext.version >= 320) ||
+        if ((!parseContext.isEsProfile() && parseContext.version >= 450) ||
+            (parseContext.isEsProfile() && parseContext.version >= 320) ||
             parseContext.extensionTurnedOn(E_GL_NV_mesh_shader))
             return keyword;
         return identifierOrType();
-#endif
 
     case FCOOPMATNV:
         afterType = true;
@@ -1627,6 +1604,7 @@ int TScanContext::tokenizeIdentifier()
             return keyword;
         else
             return identifierOrType();
+#endif
 
     default:
         parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc);
@@ -1645,7 +1623,7 @@ int TScanContext::identifierOrType()
         if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) {
             if (variable->isUserType() &&
                 // treat redeclaration of forward-declared buffer/uniform reference as an identifier
-                !(variable->getType().getBasicType() == EbtReference && afterBuffer)) {
+                !(variable->getType().isReference() && afterBuffer)) {
                 afterType = true;
 
                 return TYPE_NAME;
@@ -1675,7 +1653,7 @@ int TScanContext::identifierOrReserved(bool reserved)
         return 0;
     }
 
-    if (parseContext.forwardCompatible)
+    if (parseContext.isForwardCompatible())
         parseContext.warn(loc, "using future reserved keyword", tokenText, "");
 
     return identifierOrType();
@@ -1688,13 +1666,13 @@ int TScanContext::es30ReservedFromGLSL(int version)
     if (parseContext.symbolTable.atBuiltInLevel())
         return keyword;
 
-    if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
-        (parseContext.profile != EEsProfile && parseContext.version < version)) {
-            if (parseContext.forwardCompatible)
+    if ((parseContext.isEsProfile() && parseContext.version < 300) ||
+        (!parseContext.isEsProfile() && parseContext.version < version)) {
+            if (parseContext.isForwardCompatible())
                 parseContext.warn(loc, "future reserved word in ES 300 and keyword in GLSL", tokenText, "");
 
             return identifierOrType();
-    } else if (parseContext.profile == EEsProfile && parseContext.version >= 300)
+    } else if (parseContext.isEsProfile() && parseContext.version >= 300)
         reservedWord();
 
     return keyword;
@@ -1704,9 +1682,9 @@ int TScanContext::es30ReservedFromGLSL(int version)
 // showed up, both in an es version and a non-ES version.
 int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion)
 {
-    if ((parseContext.profile == EEsProfile && parseContext.version < esVersion) ||
-        (parseContext.profile != EEsProfile && parseContext.version < nonEsVersion)) {
-        if (parseContext.forwardCompatible)
+    if ((parseContext.isEsProfile() && parseContext.version < esVersion) ||
+        (!parseContext.isEsProfile() && parseContext.version < nonEsVersion)) {
+        if (parseContext.isForwardCompatible())
             parseContext.warn(loc, "using future keyword", tokenText, "");
 
         return identifierOrType();
@@ -1717,10 +1695,10 @@ int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion)
 
 int TScanContext::precisionKeyword()
 {
-    if (parseContext.profile == EEsProfile || parseContext.version >= 130)
+    if (parseContext.isEsProfile() || parseContext.version >= 130)
         return keyword;
 
-    if (parseContext.forwardCompatible)
+    if (parseContext.isForwardCompatible())
         parseContext.warn(loc, "using ES precision qualifier keyword", tokenText, "");
 
     return identifierOrType();
@@ -1733,7 +1711,7 @@ int TScanContext::matNxM()
     if (parseContext.version > 110)
         return keyword;
 
-    if (parseContext.forwardCompatible)
+    if (parseContext.isForwardCompatible())
         parseContext.warn(loc, "using future non-square matrix type keyword", tokenText, "");
 
     return identifierOrType();
@@ -1743,16 +1721,16 @@ int TScanContext::dMat()
 {
     afterType = true;
 
-    if (parseContext.profile == EEsProfile && parseContext.version >= 300) {
+    if (parseContext.isEsProfile() && parseContext.version >= 300) {
         reservedWord();
 
         return keyword;
     }
 
-    if (parseContext.profile != EEsProfile && parseContext.version >= 400)
+    if (!parseContext.isEsProfile() && parseContext.version >= 400)
         return keyword;
 
-    if (parseContext.forwardCompatible)
+    if (parseContext.isForwardCompatible())
         parseContext.warn(loc, "using future type keyword", tokenText, "");
 
     return identifierOrType();
@@ -1761,19 +1739,19 @@ int TScanContext::dMat()
 int TScanContext::firstGenerationImage(bool inEs310)
 {
     if (parseContext.symbolTable.atBuiltInLevel() ||
-        (parseContext.profile != EEsProfile && (parseContext.version >= 420 ||
+        (!parseContext.isEsProfile() && (parseContext.version >= 420 ||
          parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) ||
-        (inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310))
+        (inEs310 && parseContext.isEsProfile() && parseContext.version >= 310))
         return keyword;
 
-    if ((parseContext.profile == EEsProfile && parseContext.version >= 300) ||
-        (parseContext.profile != EEsProfile && parseContext.version >= 130)) {
+    if ((parseContext.isEsProfile() && parseContext.version >= 300) ||
+        (!parseContext.isEsProfile() && parseContext.version >= 130)) {
         reservedWord();
 
         return keyword;
     }
 
-    if (parseContext.forwardCompatible)
+    if (parseContext.isForwardCompatible())
         parseContext.warn(loc, "using future type keyword", tokenText, "");
 
     return identifierOrType();
@@ -1781,17 +1759,17 @@ int TScanContext::firstGenerationImage(bool inEs310)
 
 int TScanContext::secondGenerationImage()
 {
-    if (parseContext.profile == EEsProfile && parseContext.version >= 310) {
+    if (parseContext.isEsProfile() && parseContext.version >= 310) {
         reservedWord();
         return keyword;
     }
 
     if (parseContext.symbolTable.atBuiltInLevel() ||
-        (parseContext.profile != EEsProfile &&
+        (!parseContext.isEsProfile() &&
          (parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))))
         return keyword;
 
-    if (parseContext.forwardCompatible)
+    if (parseContext.isForwardCompatible())
         parseContext.warn(loc, "using future type keyword", tokenText, "");
 
     return identifierOrType();

+ 57 - 17
3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp

@@ -326,6 +326,7 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable,  TS
     InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangFragment, source,
                                infoSink, commonTable, symbolTables);
 
+#ifndef GLSLANG_WEB
     // check for tessellation
     if ((profile != EEsProfile && version >= 150) ||
         (profile == EEsProfile && version >= 310)) {
@@ -347,7 +348,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable,  TS
         InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source,
                                    infoSink, commonTable, symbolTables);
 
-#ifdef NV_EXTENSIONS
     // check for ray tracing stages
     if (profile != EEsProfile && version >= 450) {
         InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGenNV, source,
@@ -377,8 +377,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable,  TS
                                    infoSink, commonTable, symbolTables);
 #endif
 
-
-
     return true;
 }
 
@@ -479,11 +477,13 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
 // Function to Print all builtins
 void DumpBuiltinSymbolTable(TInfoSink& infoSink, const TSymbolTable& symbolTable)
 {
+#ifndef GLSLANG_WEB
     infoSink.debug << "BuiltinSymbolTable {\n";
 
     symbolTable.dump(infoSink, true);
 
     infoSink.debug << "}\n";
+#endif
 }
 
 // Return true if the shader was correctly specified for version/profile/stage.
@@ -581,6 +581,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
         break;
     }
 
+#ifndef GLSLANG_WEB
     // Correct for stage type...
     switch (stage) {
     case EShLangGeometry:
@@ -612,7 +613,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
             version = profile == EEsProfile ? 310 : 420;
         }
         break;
-#ifdef NV_EXTENSIONS
     case EShLangRayGenNV:
     case EShLangIntersectNV:
     case EShLangAnyHitNV:
@@ -633,7 +633,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
             infoSink.info.message(EPrefixError, "#version: mesh/task shaders require es profile with version 320 or above, or non-es profile with version 450 or above");
             version = profile == EEsProfile ? 320 : 450;
         }
-#endif
     default:
         break;
     }
@@ -646,7 +645,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
     // Check for SPIR-V compatibility
     if (spvVersion.spv != 0) {
         switch (profile) {
-        case  EEsProfile:
+        case EEsProfile:
             if (spvVersion.vulkan > 0 && version < 310) {
                 correct = false;
                 infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher");
@@ -675,6 +674,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
             break;
         }
     }
+#endif
 
     return correct;
 }
@@ -833,13 +833,17 @@ bool ProcessDeferred(
 
     // Get all the stages, languages, clients, and other environment
     // stuff sorted out.
-    EShSource source = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl;
+    EShSource sourceGuess = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl;
     SpvVersion spvVersion;
     EShLanguage stage = compiler->getLanguage();
-    TranslateEnvironment(environment, messages, source, stage, spvVersion);
+    TranslateEnvironment(environment, messages, sourceGuess, stage, spvVersion);
+#ifdef ENABLE_HLSL
+    EShSource source = sourceGuess;
     if (environment != nullptr && environment->target.hlslFunctionality1)
         intermediate.setHlslFunctionality1();
-
+#else
+    const EShSource source = EShSourceGlsl;
+#endif
     // First, without using the preprocessor or parser, find the #version, so we know what
     // symbol tables, processing rules, etc. to set up.  This does not need the extra strings
     // outlined above, just the user shader, after the system and user preambles.
@@ -852,6 +856,7 @@ bool ProcessDeferred(
                                 : userInput.scanVersion(version, profile, versionNotFirstToken);
     bool versionNotFound = version == 0;
     if (forceDefaultVersionAndProfile && source == EShSourceGlsl) {
+#ifndef GLSLANG_WEB
         if (! (messages & EShMsgSuppressWarnings) && ! versionNotFound &&
             (version != defaultVersion || profile != defaultProfile)) {
             compiler->infoSink.info << "Warning, (version, profile) forced to be ("
@@ -859,7 +864,7 @@ bool ProcessDeferred(
                                     << "), while in source code it is ("
                                     << version << ", " << ProfileName(profile) << ")\n";
         }
-
+#endif
         if (versionNotFound) {
             versionNotFirstToken = false;
             versionNotFirst = false;
@@ -872,6 +877,7 @@ bool ProcessDeferred(
     bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage,
                                             versionNotFirst, defaultVersion, source, version, profile, spvVersion);
     bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst));
+#ifndef GLSLANG_WEB
     bool warnVersionNotFirst = false;
     if (! versionWillBeError && versionNotFirstToken) {
         if (messages & EShMsgRelaxedErrors)
@@ -879,6 +885,7 @@ bool ProcessDeferred(
         else
             versionWillBeError = true;
     }
+#endif
 
     intermediate.setSource(source);
     intermediate.setVersion(version);
@@ -887,8 +894,10 @@ bool ProcessDeferred(
     RecordProcesses(intermediate, messages, sourceEntryPointName);
     if (spvVersion.vulkan > 0)
         intermediate.setOriginUpperLeft();
+#ifdef ENABLE_HLSL
     if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
         intermediate.setHlslOffsets();
+#endif
     if (messages & EShMsgDebugInfo) {
         intermediate.setSourceFile(names[numPre]);
         for (int s = 0; s < numStrings; ++s) {
@@ -938,11 +947,13 @@ bool ProcessDeferred(
     parseContext->setLimits(*resources);
     if (! goodVersion)
         parseContext->addError();
+#ifndef GLSLANG_WEB
     if (warnVersionNotFirst) {
         TSourceLoc loc;
         loc.init();
         parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", "");
     }
+#endif
 
     parseContext->initializeExtensionBehavior();
 
@@ -973,6 +984,8 @@ bool ProcessDeferred(
     return success;
 }
 
+#ifndef GLSLANG_WEB
+
 // Responsible for keeping track of the most recent source string and line in
 // the preprocessor and outputting newlines appropriately if the source string
 // or line changes.
@@ -1169,6 +1182,8 @@ struct DoPreprocessing {
     std::string* outputString;
 };
 
+#endif
+
 // DoFullParse is a valid ProcessingConext template argument for fully
 // parsing the shader.  It populates the "intermediate" with the AST.
 struct DoFullParse{
@@ -1199,6 +1214,7 @@ struct DoFullParse{
     }
 };
 
+#ifndef GLSLANG_WEB
 // Take a single compilation unit, and run the preprocessor on it.
 // Return: True if there were no issues found in preprocessing,
 //         False if during preprocessing any unknown version, pragmas or
@@ -1231,6 +1247,7 @@ bool PreprocessDeferred(
                            forwardCompatible, messages, intermediate, parser,
                            false, includer);
 }
+#endif
 
 //
 // do a partial compile on the given strings for a single compilation unit
@@ -1749,6 +1766,11 @@ void TShader::addProcesses(const std::vector<std::string>& p)
     intermediate->addProcesses(p);
 }
 
+void TShader::setInvertY(bool invert)                   { intermediate->setInvertY(invert); }
+void TShader::setNanMinMaxClamp(bool useNonNan)         { intermediate->setNanMinMaxClamp(useNonNan); }
+
+#ifndef GLSLANG_WEB
+
 // Set binding base for given resource type
 void TShader::setShiftBinding(TResourceType res, unsigned int base) {
     intermediate->setShiftBinding(res, base);
@@ -1776,7 +1798,7 @@ void TShader::setShiftSsboBinding(unsigned int base)    { setShiftBinding(EResSs
 // Enables binding automapping using TIoMapper
 void TShader::setAutoMapBindings(bool map)              { intermediate->setAutoMapBindings(map); }
 // Enables position.Y output negation in vertex shader
-void TShader::setInvertY(bool invert)                   { intermediate->setInvertY(invert); }
+
 // Fragile: currently within one stage: simple auto-assignment of location
 void TShader::setAutoMapLocations(bool map)             { intermediate->setAutoMapLocations(map); }
 void TShader::addUniformLocationOverride(const char* name, int loc)
@@ -1787,13 +1809,16 @@ void TShader::setUniformLocationBase(int base)
 {
     intermediate->setUniformLocationBase(base);
 }
-// See comment above TDefaultHlslIoMapper in iomapper.cpp:
-void TShader::setHlslIoMapping(bool hlslIoMap)          { intermediate->setHlslIoMapping(hlslIoMap); }
-void TShader::setFlattenUniformArrays(bool flatten)     { intermediate->setFlattenUniformArrays(flatten); }
 void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
-void TShader::setNanMinMaxClamp(bool useNonNan)         { intermediate->setNanMinMaxClamp(useNonNan); }
 void TShader::setResourceSetBinding(const std::vector<std::string>& base)   { intermediate->setResourceSetBinding(base); }
 void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); }
+#endif
+
+#ifdef ENABLE_HLSL
+// See comment above TDefaultHlslIoMapper in iomapper.cpp:
+void TShader::setHlslIoMapping(bool hlslIoMap)          { intermediate->setHlslIoMapping(hlslIoMap); }
+void TShader::setFlattenUniformArrays(bool flatten)     { intermediate->setFlattenUniformArrays(flatten); }
+#endif
 
 //
 // Turn the shader strings into a parse tree in the TIntermediate.
@@ -1817,6 +1842,7 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
                            &environment);
 }
 
+#ifndef GLSLANG_WEB
 // Fill in a string with the result of preprocessing ShaderStrings
 // Returns true if all extensions, pragmas and version strings were valid.
 //
@@ -1841,6 +1867,7 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources,
                               defaultProfile, forceDefaultVersionAndProfile,
                               forwardCompatible, message, includer, *intermediate, output_string);
 }
+#endif
 
 const char* TShader::getInfoLog()
 {
@@ -1852,7 +1879,11 @@ const char* TShader::getInfoDebugLog()
     return infoSink->debug.c_str();
 }
 
-TProgram::TProgram() : reflection(0), linked(false)
+TProgram::TProgram() :
+#ifndef GLSLANG_WEB
+    reflection(0),
+#endif
+    linked(false)
 {
     pool = new TPoolAllocator;
     infoSink = new TInfoSink;
@@ -1865,7 +1896,9 @@ TProgram::TProgram() : reflection(0), linked(false)
 TProgram::~TProgram()
 {
     delete infoSink;
+#ifndef GLSLANG_WEB
     delete reflection;
+#endif
 
     for (int s = 0; s < EShLangCount; ++s)
         if (newedIntermediate[s])
@@ -1910,6 +1943,7 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
     if (stages[stage].size() == 0)
         return true;
 
+#ifndef GLSLANG_WEB
     int numEsShaders = 0, numNonEsShaders = 0;
     for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) {
         if ((*it)->intermediate->getProfile() == EEsProfile) {
@@ -1958,7 +1992,9 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
         for (it = stages[stage].begin(); it != stages[stage].end(); ++it)
             intermediate[stage]->merge(*infoSink, *(*it)->intermediate);
     }
-
+#else
+    intermediate[stage] = stages[stage].front()->intermediate;
+#endif
     intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0);
 
     if (messages & EShMsgAST)
@@ -1977,6 +2013,8 @@ const char* TProgram::getInfoDebugLog()
     return infoSink->debug.c_str();
 }
 
+#ifndef GLSLANG_WEB
+
 //
 // Reflection implementation.
 //
@@ -2054,4 +2092,6 @@ bool TProgram::mapIO(TIoMapResolver* pResolver, TIoMapper* pIoMapper)
     return ioMapper->doMap(pResolver, *infoSink);
 }
 
+#endif // GLSLANG_WEB
+
 } // end namespace glslang

+ 22 - 16
3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp

@@ -61,54 +61,56 @@ void TType::buildMangledName(TString& mangledName) const
 
     switch (basicType) {
     case EbtFloat:              mangledName += 'f';      break;
-    case EbtDouble:             mangledName += 'd';      break;
-    case EbtFloat16:            mangledName += "f16";    break;
     case EbtInt:                mangledName += 'i';      break;
     case EbtUint:               mangledName += 'u';      break;
+    case EbtBool:               mangledName += 'b';      break;
+#ifndef GLSLANG_WEB
+    case EbtDouble:             mangledName += 'd';      break;
+    case EbtFloat16:            mangledName += "f16";    break;
     case EbtInt8:               mangledName += "i8";     break;
     case EbtUint8:              mangledName += "u8";     break;
     case EbtInt16:              mangledName += "i16";    break;
     case EbtUint16:             mangledName += "u16";    break;
     case EbtInt64:              mangledName += "i64";    break;
     case EbtUint64:             mangledName += "u64";    break;
-    case EbtBool:               mangledName += 'b';      break;
     case EbtAtomicUint:         mangledName += "au";     break;
-#ifdef NV_EXTENSIONS
     case EbtAccStructNV:        mangledName += "asnv";   break;
 #endif
     case EbtSampler:
         switch (sampler.type) {
-#ifdef AMD_EXTENSIONS
+#ifndef GLSLANG_WEB
         case EbtFloat16: mangledName += "f16"; break;
 #endif
         case EbtInt:   mangledName += "i"; break;
         case EbtUint:  mangledName += "u"; break;
         default: break; // some compilers want this
         }
-        if (sampler.image)
-            mangledName += "I";  // a normal image
-        else if (sampler.sampler)
+        if (sampler.isImageClass())
+            mangledName += "I";  // a normal image or subpass
+        else if (sampler.isPureSampler())
             mangledName += "p";  // a "pure" sampler
-        else if (!sampler.combined)
+        else if (!sampler.isCombined())
             mangledName += "t";  // a "pure" texture
         else
             mangledName += "s";  // traditional combined sampler
-        if (sampler.arrayed)
+        if (sampler.isArrayed())
             mangledName += "A";
-        if (sampler.shadow)
+        if (sampler.isShadow())
             mangledName += "S";
-        if (sampler.external)
+        if (sampler.isExternal())
             mangledName += "E";
-        if (sampler.yuv)
+        if (sampler.isYuv())
             mangledName += "Y";
         switch (sampler.dim) {
-        case Esd1D:       mangledName += "1";  break;
         case Esd2D:       mangledName += "2";  break;
         case Esd3D:       mangledName += "3";  break;
         case EsdCube:     mangledName += "C";  break;
+#ifndef GLSLANG_WEB
+        case Esd1D:       mangledName += "1";  break;
         case EsdRect:     mangledName += "R2"; break;
         case EsdBuffer:   mangledName += "B";  break;
         case EsdSubpass:  mangledName += "P";  break;
+#endif
         default: break; // some compilers want this
         }
 
@@ -117,7 +119,7 @@ void TType::buildMangledName(TString& mangledName) const
             mangledName += "-tx-struct";
 
             char text[16]; // plenty enough space for the small integers.
-            snprintf(text, sizeof(text), "%d-", sampler.structReturnIndex);
+            snprintf(text, sizeof(text), "%d-", sampler.getStructReturnIndex());
             mangledName += text;
         } else {
             switch (sampler.getVectorSize()) {
@@ -128,7 +130,7 @@ void TType::buildMangledName(TString& mangledName) const
             }
         }
 
-        if (sampler.ms)
+        if (sampler.isMultiSample())
             mangledName += "M";
         break;
     case EbtStruct:
@@ -172,6 +174,8 @@ void TType::buildMangledName(TString& mangledName) const
     }
 }
 
+#ifndef GLSLANG_WEB
+
 //
 // Dump functions.
 //
@@ -250,6 +254,8 @@ void TSymbolTable::dump(TInfoSink& infoSink, bool complete) const
     }
 }
 
+#endif
+
 //
 // Functions have buried pointers to delete.
 //

+ 13 - 0
3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h

@@ -116,8 +116,11 @@ public:
     }
     virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); }
     virtual const char** getExtensions() const { return extensions->data(); }
+
+#ifndef GLSLANG_WEB
     virtual void dump(TInfoSink& infoSink, bool complete = false) const = 0;
     void dumpExtensions(TInfoSink& infoSink) const;
+#endif
 
     virtual bool isReadOnly() const { return ! writable; }
     virtual void makeReadOnly() { writable = false; }
@@ -193,7 +196,9 @@ public:
     }
     virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); }
 
+#ifndef GLSLANG_WEB
     virtual void dump(TInfoSink& infoSink, bool complete = false) const;
+#endif
 
 protected:
     explicit TVariable(const TVariable&);
@@ -314,7 +319,9 @@ public:
     virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; }
     virtual const TParameter& operator[](int i) const { return parameters[i]; }
 
+#ifndef GLSLANG_WEB
     virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
+#endif
 
 protected:
     explicit TFunction(const TFunction&);
@@ -374,7 +381,9 @@ public:
     virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); }
 
     virtual int getAnonId() const { return anonId; }
+#ifndef GLSLANG_WEB
     virtual void dump(TInfoSink& infoSink, bool complete = false) const override;
+#endif
 
 protected:
     explicit TAnonMember(const TAnonMember&);
@@ -542,7 +551,9 @@ public:
 
     void relateToOperator(const char* name, TOperator op);
     void setFunctionExtensions(const char* name, int num, const char* const extensions[]);
+#ifndef GLSLANG_WEB
     void dump(TInfoSink& infoSink, bool complete = false) const;
+#endif
     TSymbolTableLevel* clone() const;
     void readOnly();
 
@@ -843,7 +854,9 @@ public:
     }
 
     int getMaxSymbolId() { return uniqueId; }
+#ifndef GLSLANG_WEB
     void dump(TInfoSink& infoSink, bool complete = false) const;
+#endif
     void copyTable(const TSymbolTable& copyOf);
 
     void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); }

+ 68 - 82
3rdparty/glslang/glslang/MachineIndependent/Versions.cpp

@@ -145,6 +145,8 @@
 
 namespace glslang {
 
+#ifndef GLSLANG_WEB
+
 //
 // Initialize all extensions, almost always to 'disable', as once their features
 // are incorporated into a core version, their features are supported through allowing that
@@ -221,7 +223,6 @@ void TParseVersions::initializeExtensionBehavior()
     extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive]          = EBhDisable;
     extensionBehavior[E_GL_GOOGLE_include_directive]                 = EBhDisable;
 
-#ifdef AMD_EXTENSIONS
     extensionBehavior[E_GL_AMD_shader_ballot]                        = EBhDisable;
     extensionBehavior[E_GL_AMD_shader_trinary_minmax]                = EBhDisable;
     extensionBehavior[E_GL_AMD_shader_explicit_vertex_parameter]     = EBhDisable;
@@ -232,9 +233,7 @@ void TParseVersions::initializeExtensionBehavior()
     extensionBehavior[E_GL_AMD_shader_image_load_store_lod]          = EBhDisable;
     extensionBehavior[E_GL_AMD_shader_fragment_mask]                 = EBhDisable;
     extensionBehavior[E_GL_AMD_gpu_shader_half_float_fetch]          = EBhDisable;
-#endif
 
-#ifdef NV_EXTENSIONS
     extensionBehavior[E_GL_NV_sample_mask_override_coverage]         = EBhDisable;
     extensionBehavior[E_SPV_NV_geometry_shader_passthrough]          = EBhDisable;
     extensionBehavior[E_GL_NV_viewport_array2]                       = EBhDisable;
@@ -250,7 +249,6 @@ void TParseVersions::initializeExtensionBehavior()
     extensionBehavior[E_GL_NV_compute_shader_derivatives]            = EBhDisable;
     extensionBehavior[E_GL_NV_shader_texture_footprint]              = EBhDisable;
     extensionBehavior[E_GL_NV_mesh_shader]                           = EBhDisable;
-#endif
 
     extensionBehavior[E_GL_NV_cooperative_matrix]                    = EBhDisable;
     extensionBehavior[E_GL_NV_shader_sm_builtins]                    = EBhDisable;
@@ -302,15 +300,19 @@ void TParseVersions::initializeExtensionBehavior()
     extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float32] = EBhDisable;
     extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float64] = EBhDisable;
 }
+#endif // GLSLANG_WEB
 
 // Get code that is not part of a shared symbol table, is specific to this shader,
 // or needed by the preprocessor (which does not use a shared symbol table).
 void TParseVersions::getPreamble(std::string& preamble)
 {
-    if (profile == EEsProfile) {
+    if (isEsProfile()) {
         preamble =
             "#define GL_ES 1\n"
             "#define GL_FRAGMENT_PRECISION_HIGH 1\n"
+#ifdef GLSLANG_WEB
+            ;
+#else
             "#define GL_OES_texture_3D 1\n"
             "#define GL_OES_standard_derivatives 1\n"
             "#define GL_EXT_frag_depth 1\n"
@@ -350,11 +352,9 @@ void TParseVersions::getPreamble(std::string& preamble)
             "#define GL_EXT_shader_non_constant_global_initializers 1\n"
             ;
 
-#ifdef NV_EXTENSIONS
-            if (profile == EEsProfile && version >= 300) {
+            if (isEsProfile() && version >= 300) {
                 preamble += "#define GL_NV_shader_noperspective_interpolation 1\n";
             }
-#endif
 
     } else {
         preamble =
@@ -412,7 +412,6 @@ void TParseVersions::getPreamble(std::string& preamble)
             "#define E_GL_EXT_shader_atomic_int64 1\n"
             "#define E_GL_EXT_shader_realtime_clock 1\n"
 
-#ifdef AMD_EXTENSIONS
             "#define GL_AMD_shader_ballot 1\n"
             "#define GL_AMD_shader_trinary_minmax 1\n"
             "#define GL_AMD_shader_explicit_vertex_parameter 1\n"
@@ -423,9 +422,7 @@ void TParseVersions::getPreamble(std::string& preamble)
             "#define GL_AMD_shader_image_load_store_lod 1\n"
             "#define GL_AMD_shader_fragment_mask 1\n"
             "#define GL_AMD_gpu_shader_half_float_fetch 1\n"
-#endif
 
-#ifdef NV_EXTENSIONS
             "#define GL_NV_sample_mask_override_coverage 1\n"
             "#define GL_NV_geometry_shader_passthrough 1\n"
             "#define GL_NV_viewport_array2 1\n"
@@ -438,7 +435,6 @@ void TParseVersions::getPreamble(std::string& preamble)
             "#define GL_NV_compute_shader_derivatives 1\n"
             "#define GL_NV_shader_texture_footprint 1\n"
             "#define GL_NV_mesh_shader 1\n"
-#endif
             "#define GL_NV_cooperative_matrix 1\n"
 
             "#define GL_EXT_shader_explicit_arithmetic_types 1\n"
@@ -458,10 +454,12 @@ void TParseVersions::getPreamble(std::string& preamble)
             if (profile == ECompatibilityProfile)
                 preamble += "#define GL_compatibility_profile 1\n";
         }
+#endif // GLSLANG_WEB
     }
 
-    if ((profile != EEsProfile && version >= 140) ||
-        (profile == EEsProfile && version >= 310)) {
+#ifndef GLSLANG_WEB
+    if ((!isEsProfile() && version >= 140) ||
+        (isEsProfile() && version >= 310)) {
         preamble +=
             "#define GL_EXT_device_group 1\n"
             "#define GL_EXT_multiview 1\n"
@@ -481,6 +479,7 @@ void TParseVersions::getPreamble(std::string& preamble)
             "#define GL_GOOGLE_cpp_style_line_directive 1\n"
             "#define GL_GOOGLE_include_directive 1\n"
             ;
+#endif
 
     // #define VULKAN XXXX
     const int numberBufSize = 12;
@@ -491,6 +490,8 @@ void TParseVersions::getPreamble(std::string& preamble)
         preamble += numberBuf;
         preamble += "\n";
     }
+
+#ifndef GLSLANG_WEB
     // #define GL_SPIRV XXXX
     if (spvVersion.openGl > 0) {
         preamble += "#define GL_SPIRV ";
@@ -498,22 +499,7 @@ void TParseVersions::getPreamble(std::string& preamble)
         preamble += numberBuf;
         preamble += "\n";
     }
-
-}
-
-//
-// When to use requireProfile():
-//
-//     Use if only some profiles support a feature.  However, if within a profile the feature
-//     is version or extension specific, follow this call with calls to profileRequires().
-//
-// Operation:  If the current profile is not one of the profileMask,
-// give an error message.
-//
-void TParseVersions::requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc)
-{
-    if (! (profile & profileMask))
-        error(loc, "not supported with this profile:", featureDesc, ProfileName(profile));
+#endif
 }
 
 //
@@ -523,12 +509,12 @@ const char* StageName(EShLanguage stage)
 {
     switch(stage) {
     case EShLangVertex:         return "vertex";
+    case EShLangFragment:       return "fragment";
+#ifndef GLSLANG_WEB
     case EShLangTessControl:    return "tessellation control";
     case EShLangTessEvaluation: return "tessellation evaluation";
     case EShLangGeometry:       return "geometry";
-    case EShLangFragment:       return "fragment";
     case EShLangCompute:        return "compute";
-#ifdef NV_EXTENSIONS
     case EShLangRayGenNV:       return "ray-generation";
     case EShLangIntersectNV:    return "intersection";
     case EShLangAnyHitNV:       return "any-hit";
@@ -542,6 +528,42 @@ const char* StageName(EShLanguage stage)
     }
 }
 
+//
+// When to use requireStage()
+//
+//     If only some stages support a feature.
+//
+// Operation: If the current stage is not present, give an error message.
+//
+void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguageMask languageMask, const char* featureDesc)
+{
+    if (((1 << language) & languageMask) == 0)
+        error(loc, "not supported in this stage:", featureDesc, StageName(language));
+}
+
+// If only one stage supports a feature, this can be called.  But, all supporting stages
+// must be specified with one call.
+void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguage stage, const char* featureDesc)
+{
+    requireStage(loc, static_cast<EShLanguageMask>(1 << stage), featureDesc);
+}
+
+#ifndef GLSLANG_WEB
+//
+// When to use requireProfile():
+//
+//     Use if only some profiles support a feature.  However, if within a profile the feature
+//     is version or extension specific, follow this call with calls to profileRequires().
+//
+// Operation:  If the current profile is not one of the profileMask,
+// give an error message.
+//
+void TParseVersions::requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc)
+{
+    if (! (profile & profileMask))
+        error(loc, "not supported with this profile:", featureDesc, ProfileName(profile));
+}
+
 //
 // When to use profileRequires():
 //
@@ -559,12 +581,12 @@ const char* StageName(EShLanguage stage)
 //
 
 // entry point that takes multiple extensions
-void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc)
+void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions,
+    const char* const extensions[], const char* featureDesc)
 {
     if (profile & profileMask) {
-        bool okay = false;
-        if (minVersion > 0 && version >= minVersion)
-            okay = true;
+        bool okay = minVersion > 0 && version >= minVersion;
+#ifndef GLSLANG_WEB
         for (int i = 0; i < numExtensions; ++i) {
             switch (getExtensionBehavior(extensions[i])) {
             case EBhWarn:
@@ -577,36 +599,22 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int
             default: break; // some compilers want this
             }
         }
-
+#endif
         if (! okay)
             error(loc, "not supported for this version or the enabled extensions", featureDesc, "");
     }
 }
 
 // entry point for the above that takes a single extension
-void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, const char* featureDesc)
+void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension,
+    const char* featureDesc)
 {
     profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc);
 }
 
-//
-// When to use requireStage()
-//
-//     If only some stages support a feature.
-//
-// Operation: If the current stage is not present, give an error message.
-//
-void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguageMask languageMask, const char* featureDesc)
-{
-    if (((1 << language) & languageMask) == 0)
-        error(loc, "not supported in this stage:", featureDesc, StageName(language));
-}
-
-// If only one stage supports a feature, this can be called.  But, all supporting stages
-// must be specified with one call.
-void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguage stage, const char* featureDesc)
+void TParseVersions::unimplemented(const TSourceLoc& loc, const char* featureDesc)
 {
-    requireStage(loc, static_cast<EShLanguageMask>(1 << stage), featureDesc);
+    error(loc, "feature not yet implemented", featureDesc, "");
 }
 
 //
@@ -642,11 +650,6 @@ void TParseVersions::requireNotRemoved(const TSourceLoc& loc, int profileMask, i
     }
 }
 
-void TParseVersions::unimplemented(const TSourceLoc& loc, const char* featureDesc)
-{
-    error(loc, "feature not yet implemented", featureDesc, "");
-}
-
 // Returns true if at least one of the extensions in the extensions parameter is requested. Otherwise, returns false.
 // Warns appropriately if the requested behavior of an extension is "warn".
 bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc)
@@ -815,10 +818,8 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
         updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
     else if (strcmp(extension, "GL_KHR_shader_subgroup_quad") == 0)
         updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
-#ifdef NV_EXTENSIONS
     else if (strcmp(extension, "GL_NV_shader_subgroup_partitioned") == 0)
         updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString);
-#endif
     else if (strcmp(extension, "GL_EXT_buffer_reference2") == 0)
         updateExtensionBehavior(line, "GL_EXT_buffer_reference", behaviorString);
 }
@@ -866,7 +867,6 @@ void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBe
 // Check if extension is used with correct shader stage.
 void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * const extension)
 {
-#ifdef NV_EXTENSIONS
     // GL_NV_mesh_shader extension is only allowed in task/mesh shaders
     if (strcmp(extension, "GL_NV_mesh_shader") == 0) {
         requireStage(loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask | EShLangFragmentMask),
@@ -874,7 +874,6 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con
         profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_NV_mesh_shader");
         profileRequires(loc, EEsProfile, 320, 0, "#extension GL_NV_mesh_shader");
     }
-#endif
 }
 
 // Call for any operation needing full GLSL integer data-type support.
@@ -896,9 +895,7 @@ void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool bu
 {
     if (!builtIn) {
         const char* const extensions[] = {
-#if AMD_EXTENSIONS
                                            E_GL_AMD_gpu_shader_half_float,
-#endif
                                            E_GL_EXT_shader_explicit_arithmetic_types,
                                            E_GL_EXT_shader_explicit_arithmetic_types_float16};
         requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
@@ -908,9 +905,7 @@ void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool bu
 bool TParseVersions::float16Arithmetic()
 {
     const char* const extensions[] = {
-#if AMD_EXTENSIONS
                                        E_GL_AMD_gpu_shader_half_float,
-#endif
                                        E_GL_EXT_shader_explicit_arithmetic_types,
                                        E_GL_EXT_shader_explicit_arithmetic_types_float16};
     return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions);
@@ -919,9 +914,7 @@ bool TParseVersions::float16Arithmetic()
 bool TParseVersions::int16Arithmetic()
 {
     const char* const extensions[] = {
-#if AMD_EXTENSIONS
                                        E_GL_AMD_gpu_shader_int16,
-#endif
                                        E_GL_EXT_shader_explicit_arithmetic_types,
                                        E_GL_EXT_shader_explicit_arithmetic_types_int16};
     return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions);
@@ -943,9 +936,7 @@ void TParseVersions::requireFloat16Arithmetic(const TSourceLoc& loc, const char*
     combined += featureDesc;
 
     const char* const extensions[] = {
-#if AMD_EXTENSIONS
                                        E_GL_AMD_gpu_shader_half_float,
-#endif
                                        E_GL_EXT_shader_explicit_arithmetic_types,
                                        E_GL_EXT_shader_explicit_arithmetic_types_float16};
     requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str());
@@ -959,9 +950,7 @@ void TParseVersions::requireInt16Arithmetic(const TSourceLoc& loc, const char* o
     combined += featureDesc;
 
     const char* const extensions[] = {
-#if AMD_EXTENSIONS
                                        E_GL_AMD_gpu_shader_int16,
-#endif
                                        E_GL_EXT_shader_explicit_arithmetic_types,
                                        E_GL_EXT_shader_explicit_arithmetic_types_int16};
     requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str());
@@ -984,9 +973,7 @@ void TParseVersions::float16ScalarVectorCheck(const TSourceLoc& loc, const char*
 {
     if (!builtIn) {
         const char* const extensions[] = {
-#if AMD_EXTENSIONS
                                            E_GL_AMD_gpu_shader_half_float,
-#endif
                                            E_GL_EXT_shader_16bit_storage,
                                            E_GL_EXT_shader_explicit_arithmetic_types,
                                            E_GL_EXT_shader_explicit_arithmetic_types_float16};
@@ -1026,7 +1013,6 @@ void TParseVersions::explicitInt8Check(const TSourceLoc& loc, const char* op, bo
     }
 }
 
-#ifdef AMD_EXTENSIONS
 // Call for any operation needing GLSL float16 opaque-type support
 void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, bool builtIn)
 {
@@ -1036,16 +1022,13 @@ void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, b
         profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op);
     }
 }
-#endif
 
 // Call for any operation needing GLSL explicit int16 data-type support.
 void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, bool builtIn)
 {
     if (! builtIn) {
         const char* const extensions[] = {
-#if AMD_EXTENSIONS
                                            E_GL_AMD_gpu_shader_int16,
-#endif
                                            E_GL_EXT_shader_explicit_arithmetic_types,
                                            E_GL_EXT_shader_explicit_arithmetic_types_int16};
         requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
@@ -1056,9 +1039,7 @@ void TParseVersions::int16ScalarVectorCheck(const TSourceLoc& loc, const char* o
 {
     if (! builtIn) {
     	const char* const extensions[] = {
-#if AMD_EXTENSIONS
                                            E_GL_AMD_gpu_shader_int16,
-#endif
                                            E_GL_EXT_shader_16bit_storage,
                                            E_GL_EXT_shader_explicit_arithmetic_types,
                                            E_GL_EXT_shader_explicit_arithmetic_types_int16};
@@ -1107,6 +1088,7 @@ void TParseVersions::fcoopmatCheck(const TSourceLoc& loc, const char* op, bool b
         requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op);
     }
 }
+#endif // GLSLANG_WEB
 
 // Call for any operation removed because SPIR-V is in use.
 void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
@@ -1125,15 +1107,19 @@ void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op)
 // Call for any operation that requires Vulkan.
 void TParseVersions::requireVulkan(const TSourceLoc& loc, const char* op)
 {
+#ifndef GLSLANG_WEB
     if (spvVersion.vulkan == 0)
         error(loc, "only allowed when using GLSL for Vulkan", op, "");
+#endif
 }
 
 // Call for any operation that requires SPIR-V.
 void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op)
 {
+#ifndef GLSLANG_WEB
     if (spvVersion.spv == 0)
         error(loc, "only allowed when generating SPIR-V", op, "");
+#endif
 }
 
 } // end namespace glslang

+ 0 - 5
3rdparty/glslang/glslang/MachineIndependent/Versions.h

@@ -193,7 +193,6 @@ const int Num_OVR_multiview_EXTs = sizeof(OVR_multiview_EXTs) / sizeof(OVR_multi
 const char* const E_GL_GOOGLE_cpp_style_line_directive          = "GL_GOOGLE_cpp_style_line_directive";
 const char* const E_GL_GOOGLE_include_directive                 = "GL_GOOGLE_include_directive";
 
-#ifdef AMD_EXTENSIONS
 const char* const E_GL_AMD_shader_ballot                        = "GL_AMD_shader_ballot";
 const char* const E_GL_AMD_shader_trinary_minmax                = "GL_AMD_shader_trinary_minmax";
 const char* const E_GL_AMD_shader_explicit_vertex_parameter     = "GL_AMD_shader_explicit_vertex_parameter";
@@ -204,9 +203,6 @@ const char* const E_GL_AMD_gpu_shader_int16                     = "GL_AMD_gpu_sh
 const char* const E_GL_AMD_shader_image_load_store_lod          = "GL_AMD_shader_image_load_store_lod";
 const char* const E_GL_AMD_shader_fragment_mask                 = "GL_AMD_shader_fragment_mask";
 const char* const E_GL_AMD_gpu_shader_half_float_fetch          = "GL_AMD_gpu_shader_half_float_fetch";
-#endif
-
-#ifdef NV_EXTENSIONS
 
 const char* const E_GL_NV_sample_mask_override_coverage         = "GL_NV_sample_mask_override_coverage";
 const char* const E_SPV_NV_geometry_shader_passthrough          = "GL_NV_geometry_shader_passthrough";
@@ -228,7 +224,6 @@ const char* const E_GL_NV_mesh_shader                           = "GL_NV_mesh_sh
 
 const char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 };
 const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]);
-#endif
 
 const char* const E_GL_NV_cooperative_matrix                    = "GL_NV_cooperative_matrix";
 const char* const E_GL_NV_shader_sm_builtins                    = "GL_NV_shader_sm_builtins";

+ 4 - 1
3rdparty/glslang/glslang/MachineIndependent/attribute.cpp

@@ -34,6 +34,8 @@
 // POSSIBILITY OF SUCH DAMAGE.
 //
 
+#ifndef GLSLANG_WEB
+
 #include "attribute.h"
 #include "../Include/intermediate.h"
 #include "ParseHelper.h"
@@ -339,5 +341,6 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN
     }
 }
 
-
 } // end namespace glslang
+
+#endif // GLSLANG_WEB

+ 0 - 4
3rdparty/glslang/glslang/MachineIndependent/gl_types.h

@@ -78,7 +78,6 @@
 #define GL_DOUBLE_MAT4x2                  0x8F4D
 #define GL_DOUBLE_MAT4x3                  0x8F4E
 
-#ifdef AMD_EXTENSIONS
 // Those constants are borrowed from extension NV_gpu_shader5
 #define GL_FLOAT16_NV                     0x8FF8
 #define GL_FLOAT16_VEC2_NV                0x8FF9
@@ -94,7 +93,6 @@
 #define GL_FLOAT16_MAT3x4_AMD             0x91CB
 #define GL_FLOAT16_MAT4x2_AMD             0x91CC
 #define GL_FLOAT16_MAT4x3_AMD             0x91CD
-#endif
 
 #define GL_SAMPLER_1D                     0x8B5D
 #define GL_SAMPLER_2D                     0x8B5E
@@ -117,7 +115,6 @@
 #define GL_SAMPLER_CUBE_MAP_ARRAY_ARB     0x900C
 #define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
 
-#ifdef AMD_EXTENSIONS
 #define GL_FLOAT16_SAMPLER_1D_AMD                       0x91CE
 #define GL_FLOAT16_SAMPLER_2D_AMD                       0x91CF
 #define GL_FLOAT16_SAMPLER_3D_AMD                       0x91D0
@@ -149,7 +146,6 @@
 #define GL_FLOAT16_IMAGE_BUFFER_AMD                     0x91E8
 #define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD             0x91E9
 #define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD       0x91EA
-#endif
 
 #define GL_INT_SAMPLER_1D                 0x8DC9
 #define GL_INT_SAMPLER_2D                 0x8DCA

+ 3787 - 0
3rdparty/glslang/glslang/MachineIndependent/glslang.m4

@@ -0,0 +1,3787 @@
+//
+// Copyright (C) 2002-2005  3Dlabs Inc. Ltd.
+// Copyright (C) 2012-2013 LunarG, Inc.
+// Copyright (C) 2017 ARM Limited.
+// Copyright (C) 2015-2018 Google, Inc.
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+//    Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//
+//    Redistributions in binary form must reproduce the above
+//    copyright notice, this list of conditions and the following
+//    disclaimer in the documentation and/or other materials provided
+//    with the distribution.
+//
+//    Neither the name of 3Dlabs Inc. Ltd. nor the names of its
+//    contributors may be used to endorse or promote products derived
+//    from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+
+//
+// Do not edit the .y file, only edit the .m4 file.
+// The .y bison file is not a source file, it is a derivitive of the .m4 file.
+// The m4 file needs to be processed by m4 to generate the .y bison file.
+//
+// Code sandwiched between a pair:
+//
+//    GLSLANG_WEB_EXCLUDE_ON
+//      ...
+//      ...
+//      ...
+//    GLSLANG_WEB_EXCLUDE_OFF
+//
+// Will be exluded from the grammar when m4 is executed as:
+//
+//    m4 -P -DGLSLANG_WEB
+//
+// It will be included when m4 is executed as:
+//
+//    m4 -P
+//
+
+m4_define(`GLSLANG_WEB_EXCLUDE_ON', `m4_ifdef(`GLSLANG_WEB', `m4_divert(`-1')')')
+m4_define(`GLSLANG_WEB_EXCLUDE_OFF', `m4_ifdef(`GLSLANG_WEB', `m4_divert')')
+
+/**
+ * This is bison grammar and productions for parsing all versions of the
+ * GLSL shading languages.
+ */
+%{
+
+/* Based on:
+ANSI C Yacc grammar
+
+In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a
+matching Lex specification) for the April 30, 1985 draft version of the
+ANSI C standard.  Tom Stockfisch reposted it to net.sources in 1987; that
+original, as mentioned in the answer to question 17.25 of the comp.lang.c
+FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.
+
+I intend to keep this version as close to the current C Standard grammar as
+possible; please let me know if you discover discrepancies.
+
+Jutta Degener, 1995
+*/
+
+#include "SymbolTable.h"
+#include "ParseHelper.h"
+#include "../Public/ShaderLang.h"
+#include "attribute.h"
+
+using namespace glslang;
+
+%}
+
+%define parse.error verbose
+
+%union {
+    struct {
+        glslang::TSourceLoc loc;
+        union {
+            glslang::TString *string;
+            int i;
+            unsigned int u;
+            long long i64;
+            unsigned long long u64;
+            bool b;
+            double d;
+        };
+        glslang::TSymbol* symbol;
+    } lex;
+    struct {
+        glslang::TSourceLoc loc;
+        glslang::TOperator op;
+        union {
+            TIntermNode* intermNode;
+            glslang::TIntermNodePair nodePair;
+            glslang::TIntermTyped* intermTypedNode;
+            glslang::TAttributes* attributes;
+        };
+        union {
+            glslang::TPublicType type;
+            glslang::TFunction* function;
+            glslang::TParameter param;
+            glslang::TTypeLoc typeLine;
+            glslang::TTypeList* typeList;
+            glslang::TArraySizes* arraySizes;
+            glslang::TIdentifierList* identifierList;
+        };
+        glslang::TArraySizes* typeParameters;
+    } interm;
+}
+
+%{
+
+/* windows only pragma */
+#ifdef _MSC_VER
+    #pragma warning(disable : 4065)
+    #pragma warning(disable : 4127)
+    #pragma warning(disable : 4244)
+#endif
+
+#define parseContext (*pParseContext)
+#define yyerror(context, msg) context->parserError(msg)
+
+extern int yylex(YYSTYPE*, TParseContext&);
+
+%}
+
+%parse-param {glslang::TParseContext* pParseContext}
+%lex-param {parseContext}
+%pure-parser  // enable thread safety
+%expect 1     // One shift reduce conflict because of if | else
+
+%token <lex> CONST BOOL INT UINT FLOAT
+%token <lex> BVEC2 BVEC3 BVEC4
+%token <lex> IVEC2 IVEC3 IVEC4
+%token <lex> UVEC2 UVEC3 UVEC4
+%token <lex> VEC2 VEC3 VEC4
+%token <lex> MAT2 MAT3 MAT4
+%token <lex> MAT2X2 MAT2X3 MAT2X4
+%token <lex> MAT3X2 MAT3X3 MAT3X4
+%token <lex> MAT4X2 MAT4X3 MAT4X4
+
+// combined image/sampler
+%token <lex> SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER2DSHADOW
+%token <lex> SAMPLERCUBESHADOW SAMPLER2DARRAY
+%token <lex> SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
+%token <lex> ISAMPLER2DARRAY USAMPLER2D USAMPLER3D
+%token <lex> USAMPLERCUBE USAMPLER2DARRAY
+%token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
+%token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY
+
+GLSLANG_WEB_EXCLUDE_ON
+
+%token <lex> ATTRIBUTE VARYING
+%token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T
+%token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T
+%token <lex> I64VEC2 I64VEC3 I64VEC4
+%token <lex> U64VEC2 U64VEC3 U64VEC4
+%token <lex> I32VEC2 I32VEC3 I32VEC4
+%token <lex> U32VEC2 U32VEC3 U32VEC4
+%token <lex> I16VEC2 I16VEC3 I16VEC4
+%token <lex> U16VEC2 U16VEC3 U16VEC4
+%token <lex> I8VEC2  I8VEC3  I8VEC4
+%token <lex> U8VEC2  U8VEC3  U8VEC4
+%token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
+%token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
+%token <lex> F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4
+%token <lex> F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4
+%token <lex> DMAT2X2 DMAT2X3 DMAT2X4
+%token <lex> DMAT3X2 DMAT3X3 DMAT3X4
+%token <lex> DMAT4X2 DMAT4X3 DMAT4X4
+%token <lex> F16MAT2X2 F16MAT2X3 F16MAT2X4
+%token <lex> F16MAT3X2 F16MAT3X3 F16MAT3X4
+%token <lex> F16MAT4X2 F16MAT4X3 F16MAT4X4
+%token <lex> F32MAT2X2 F32MAT2X3 F32MAT2X4
+%token <lex> F32MAT3X2 F32MAT3X3 F32MAT3X4
+%token <lex> F32MAT4X2 F32MAT4X3 F32MAT4X4
+%token <lex> F64MAT2X2 F64MAT2X3 F64MAT2X4
+%token <lex> F64MAT3X2 F64MAT3X3 F64MAT3X4
+%token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4
+%token <lex> ATOMIC_UINT
+%token <lex> ACCSTRUCTNV
+%token <lex> FCOOPMATNV
+
+// combined image/sampler
+%token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
+%token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT
+%token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER
+%token <lex> SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS
+%token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY
+%token <lex> SAMPLEREXTERNALOES
+%token <lex> SAMPLEREXTERNAL2DY2YEXT
+%token <lex> ISAMPLER1DARRAY USAMPLER1D USAMPLER1DARRAY 
+%token <lex> F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE
+%token <lex> F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY
+%token <lex> F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY
+%token <lex> F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW
+%token <lex> F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW
+
+// images
+%token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D
+%token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D
+%token <lex> IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT
+%token <lex> IMAGECUBE IIMAGECUBE UIMAGECUBE
+%token <lex> IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER
+%token <lex> IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY
+%token <lex> IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY
+%token <lex> IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY
+%token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS
+%token <lex> IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY
+
+%token <lex> F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT
+%token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY
+%token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY
+
+// pure sampler
+%token <lex> SAMPLER SAMPLERSHADOW
+
+// texture without sampler
+%token <lex> TEXTURE1D TEXTURE2D TEXTURE3D TEXTURECUBE
+%token <lex> TEXTURE1DARRAY TEXTURE2DARRAY
+%token <lex> ITEXTURE1D ITEXTURE2D ITEXTURE3D ITEXTURECUBE
+%token <lex> ITEXTURE1DARRAY ITEXTURE2DARRAY UTEXTURE1D UTEXTURE2D UTEXTURE3D
+%token <lex> UTEXTURECUBE UTEXTURE1DARRAY UTEXTURE2DARRAY
+%token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT
+%token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER
+%token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
+%token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS
+%token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY
+
+%token <lex> F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE
+%token <lex> F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY
+%token <lex> F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY
+
+// input attachments
+%token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS
+%token <lex> F16SUBPASSINPUT F16SUBPASSINPUTMS
+
+GLSLANG_WEB_EXCLUDE_OFF
+
+%token <lex> LEFT_OP RIGHT_OP
+%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
+%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
+%token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
+%token <lex> SUB_ASSIGN
+
+%token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT
+%token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT
+%token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION
+
+%token <lex> INVARIANT
+%token <lex> HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
+%token <lex> PACKED RESOURCE SUPERP
+
+%token <lex> FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT
+%token <lex> IDENTIFIER TYPE_NAME
+%token <lex> CENTROID IN OUT INOUT
+%token <lex> STRUCT VOID WHILE
+%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
+%token <lex> UNIFORM SHARED
+%token <lex> FLAT SMOOTH LAYOUT
+
+GLSLANG_WEB_EXCLUDE_ON
+%token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT
+%token <lex> INT64CONSTANT UINT64CONSTANT
+%token <lex> SUBROUTINE DEMOTE
+%token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
+%token <lex> PATCH SAMPLE BUFFER NONUNIFORM
+%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
+%token <lex> SUBGROUPCOHERENT NONPRIVATE
+%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
+%token <lex> PRECISE
+GLSLANG_WEB_EXCLUDE_OFF
+
+%type <interm> assignment_operator unary_operator
+%type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
+%type <interm.intermTypedNode> expression integer_expression assignment_expression
+%type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression
+%type <interm.intermTypedNode> relational_expression equality_expression
+%type <interm.intermTypedNode> conditional_expression constant_expression
+%type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
+%type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
+%type <interm.intermTypedNode> function_call initializer condition conditionopt
+
+%type <interm.intermNode> translation_unit function_definition
+%type <interm.intermNode> statement simple_statement
+%type <interm.intermNode> statement_list switch_statement_list compound_statement
+%type <interm.intermNode> declaration_statement selection_statement selection_statement_nonattributed expression_statement
+%type <interm.intermNode> switch_statement switch_statement_nonattributed case_label
+%type <interm.intermNode> declaration external_declaration
+%type <interm.intermNode> for_init_statement compound_statement_no_new_scope
+%type <interm.nodePair> selection_rest_statement for_rest_statement
+%type <interm.intermNode> iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped
+%type <interm> single_declaration init_declarator_list
+
+%type <interm> parameter_declaration parameter_declarator parameter_type_specifier
+
+%type <interm> array_specifier
+%type <interm.type> invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier
+%type <interm.type> layout_qualifier layout_qualifier_id_list layout_qualifier_id
+
+%type <interm.typeParameters> type_parameter_specifier
+%type <interm.typeParameters> type_parameter_specifier_opt
+%type <interm.typeParameters> type_parameter_specifier_list
+
+%type <interm.type> type_qualifier fully_specified_type type_specifier
+%type <interm.type> single_type_qualifier
+%type <interm.type> type_specifier_nonarray
+%type <interm.type> struct_specifier
+%type <interm.typeLine> struct_declarator
+%type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list
+%type <interm> block_structure
+%type <interm.function> function_header function_declarator
+%type <interm.function> function_header_with_parameters
+%type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
+%type <interm> function_call_or_method function_identifier function_call_header
+
+%type <interm.identifierList> identifier_list
+
+GLSLANG_WEB_EXCLUDE_ON
+%type <interm.type> precise_qualifier non_uniform_qualifier
+%type <interm.typeList> type_name_list
+%type <interm.attributes> attribute attribute_list single_attribute
+%type <interm.intermNode> demote_statement
+%type <interm.intermTypedNode> initializer_list
+GLSLANG_WEB_EXCLUDE_OFF
+
+%start translation_unit
+%%
+
+variable_identifier
+    : IDENTIFIER {
+        $$ = parseContext.handleVariable($1.loc, $1.symbol, $1.string);
+    }
+    ;
+
+primary_expression
+    : variable_identifier {
+        $$ = $1;
+    }
+    | LEFT_PAREN expression RIGHT_PAREN {
+        $$ = $2;
+        if ($$->getAsConstantUnion())
+            $$->getAsConstantUnion()->setExpression();
+    }
+    | FLOATCONSTANT {
+        $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
+    }
+    | INTCONSTANT {
+        $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
+    }
+    | UINTCONSTANT {
+        parseContext.fullIntegerCheck($1.loc, "unsigned literal");
+        $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
+    }
+    | BOOLCONSTANT {
+        $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | INT32CONSTANT {
+        parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
+        $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
+    }
+    | UINT32CONSTANT {
+        parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
+        $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
+    }
+    | INT64CONSTANT {
+        parseContext.int64Check($1.loc, "64-bit integer literal");
+        $$ = parseContext.intermediate.addConstantUnion($1.i64, $1.loc, true);
+    }
+    | UINT64CONSTANT {
+        parseContext.int64Check($1.loc, "64-bit unsigned integer literal");
+        $$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true);
+    }
+    | INT16CONSTANT {
+        parseContext.explicitInt16Check($1.loc, "16-bit integer literal");
+        $$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true);
+    }
+    | UINT16CONSTANT {
+        parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal");
+        $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true);
+    }
+    | DOUBLECONSTANT {
+        parseContext.doubleCheck($1.loc, "double literal");
+        $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true);
+    }
+    | FLOAT16CONSTANT {
+        parseContext.float16Check($1.loc, "half float literal");
+        $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    ;
+
+postfix_expression
+    : primary_expression {
+        $$ = $1;
+    }
+    | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
+        $$ = parseContext.handleBracketDereference($2.loc, $1, $3);
+    }
+    | function_call {
+        $$ = $1;
+    }
+    | postfix_expression DOT IDENTIFIER {
+        $$ = parseContext.handleDotDereference($3.loc, $1, *$3.string);
+    }
+    | postfix_expression INC_OP {
+        parseContext.variableCheck($1);
+        parseContext.lValueErrorCheck($2.loc, "++", $1);
+        $$ = parseContext.handleUnaryMath($2.loc, "++", EOpPostIncrement, $1);
+    }
+    | postfix_expression DEC_OP {
+        parseContext.variableCheck($1);
+        parseContext.lValueErrorCheck($2.loc, "--", $1);
+        $$ = parseContext.handleUnaryMath($2.loc, "--", EOpPostDecrement, $1);
+    }
+    ;
+
+integer_expression
+    : expression {
+        parseContext.integerCheck($1, "[]");
+        $$ = $1;
+    }
+    ;
+
+function_call
+    : function_call_or_method {
+        $$ = parseContext.handleFunctionCall($1.loc, $1.function, $1.intermNode);
+        delete $1.function;
+    }
+    ;
+
+function_call_or_method
+    : function_call_generic {
+        $$ = $1;
+    }
+    ;
+
+function_call_generic
+    : function_call_header_with_parameters RIGHT_PAREN {
+        $$ = $1;
+        $$.loc = $2.loc;
+    }
+    | function_call_header_no_parameters RIGHT_PAREN {
+        $$ = $1;
+        $$.loc = $2.loc;
+    }
+    ;
+
+function_call_header_no_parameters
+    : function_call_header VOID {
+        $$ = $1;
+    }
+    | function_call_header {
+        $$ = $1;
+    }
+    ;
+
+function_call_header_with_parameters
+    : function_call_header assignment_expression {
+        TParameter param = { 0, new TType };
+        param.type->shallowCopy($2->getType());
+        $1.function->addParameter(param);
+        $$.function = $1.function;
+        $$.intermNode = $2;
+    }
+    | function_call_header_with_parameters COMMA assignment_expression {
+        TParameter param = { 0, new TType };
+        param.type->shallowCopy($3->getType());
+        $1.function->addParameter(param);
+        $$.function = $1.function;
+        $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc);
+    }
+    ;
+
+function_call_header
+    : function_identifier LEFT_PAREN {
+        $$ = $1;
+    }
+    ;
+
+// Grammar Note:  Constructors look like functions, but are recognized as types.
+
+function_identifier
+    : type_specifier {
+        // Constructor
+        $$.intermNode = 0;
+        $$.function = parseContext.handleConstructorCall($1.loc, $1);
+    }
+    | postfix_expression {
+        //
+        // Should be a method or subroutine call, but we haven't recognized the arguments yet.
+        //
+        $$.function = 0;
+        $$.intermNode = 0;
+
+        TIntermMethod* method = $1->getAsMethodNode();
+        if (method) {
+            $$.function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength);
+            $$.intermNode = method->getObject();
+        } else {
+            TIntermSymbol* symbol = $1->getAsSymbolNode();
+            if (symbol) {
+                parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName());
+                TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid));
+                $$.function = function;
+            } else
+                parseContext.error($1->getLoc(), "function call, method, or subroutine call expected", "", "");
+        }
+
+        if ($$.function == 0) {
+            // error recover
+            TString* empty = NewPoolTString("");
+            $$.function = new TFunction(empty, TType(EbtVoid), EOpNull);
+        }
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | non_uniform_qualifier {
+        // Constructor
+        $$.intermNode = 0;
+        $$.function = parseContext.handleConstructorCall($1.loc, $1);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    ;
+
+unary_expression
+    : postfix_expression {
+        parseContext.variableCheck($1);
+        $$ = $1;
+        if (TIntermMethod* method = $1->getAsMethodNode())
+            parseContext.error($1->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), "");
+    }
+    | INC_OP unary_expression {
+        parseContext.lValueErrorCheck($1.loc, "++", $2);
+        $$ = parseContext.handleUnaryMath($1.loc, "++", EOpPreIncrement, $2);
+    }
+    | DEC_OP unary_expression {
+        parseContext.lValueErrorCheck($1.loc, "--", $2);
+        $$ = parseContext.handleUnaryMath($1.loc, "--", EOpPreDecrement, $2);
+    }
+    | unary_operator unary_expression {
+        if ($1.op != EOpNull) {
+            char errorOp[2] = {0, 0};
+            switch($1.op) {
+            case EOpNegative:   errorOp[0] = '-'; break;
+            case EOpLogicalNot: errorOp[0] = '!'; break;
+            case EOpBitwiseNot: errorOp[0] = '~'; break;
+            default: break; // some compilers want this
+            }
+            $$ = parseContext.handleUnaryMath($1.loc, errorOp, $1.op, $2);
+        } else {
+            $$ = $2;
+            if ($$->getAsConstantUnion())
+                $$->getAsConstantUnion()->setExpression();
+        }
+    }
+    ;
+// Grammar Note:  No traditional style type casts.
+
+unary_operator
+    : PLUS  { $$.loc = $1.loc; $$.op = EOpNull; }
+    | DASH  { $$.loc = $1.loc; $$.op = EOpNegative; }
+    | BANG  { $$.loc = $1.loc; $$.op = EOpLogicalNot; }
+    | TILDE { $$.loc = $1.loc; $$.op = EOpBitwiseNot;
+              parseContext.fullIntegerCheck($1.loc, "bitwise not"); }
+    ;
+// Grammar Note:  No '*' or '&' unary ops.  Pointers are not supported.
+
+multiplicative_expression
+    : unary_expression { $$ = $1; }
+    | multiplicative_expression STAR unary_expression {
+        $$ = parseContext.handleBinaryMath($2.loc, "*", EOpMul, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    | multiplicative_expression SLASH unary_expression {
+        $$ = parseContext.handleBinaryMath($2.loc, "/", EOpDiv, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    | multiplicative_expression PERCENT unary_expression {
+        parseContext.fullIntegerCheck($2.loc, "%");
+        $$ = parseContext.handleBinaryMath($2.loc, "%", EOpMod, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    ;
+
+additive_expression
+    : multiplicative_expression { $$ = $1; }
+    | additive_expression PLUS multiplicative_expression {
+        $$ = parseContext.handleBinaryMath($2.loc, "+", EOpAdd, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    | additive_expression DASH multiplicative_expression {
+        $$ = parseContext.handleBinaryMath($2.loc, "-", EOpSub, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    ;
+
+shift_expression
+    : additive_expression { $$ = $1; }
+    | shift_expression LEFT_OP additive_expression {
+        parseContext.fullIntegerCheck($2.loc, "bit shift left");
+        $$ = parseContext.handleBinaryMath($2.loc, "<<", EOpLeftShift, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    | shift_expression RIGHT_OP additive_expression {
+        parseContext.fullIntegerCheck($2.loc, "bit shift right");
+        $$ = parseContext.handleBinaryMath($2.loc, ">>", EOpRightShift, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    ;
+
+relational_expression
+    : shift_expression { $$ = $1; }
+    | relational_expression LEFT_ANGLE shift_expression {
+        $$ = parseContext.handleBinaryMath($2.loc, "<", EOpLessThan, $1, $3);
+        if ($$ == 0)
+            $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
+    }
+    | relational_expression RIGHT_ANGLE shift_expression  {
+        $$ = parseContext.handleBinaryMath($2.loc, ">", EOpGreaterThan, $1, $3);
+        if ($$ == 0)
+            $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
+    }
+    | relational_expression LE_OP shift_expression  {
+        $$ = parseContext.handleBinaryMath($2.loc, "<=", EOpLessThanEqual, $1, $3);
+        if ($$ == 0)
+            $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
+    }
+    | relational_expression GE_OP shift_expression  {
+        $$ = parseContext.handleBinaryMath($2.loc, ">=", EOpGreaterThanEqual, $1, $3);
+        if ($$ == 0)
+            $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
+    }
+    ;
+
+equality_expression
+    : relational_expression { $$ = $1; }
+    | equality_expression EQ_OP relational_expression  {
+        parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
+        parseContext.opaqueCheck($2.loc, $1->getType(), "==");
+        parseContext.specializationCheck($2.loc, $1->getType(), "==");
+        parseContext.referenceCheck($2.loc, $1->getType(), "==");
+        $$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3);
+        if ($$ == 0)
+            $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
+    }
+    | equality_expression NE_OP relational_expression {
+        parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
+        parseContext.opaqueCheck($2.loc, $1->getType(), "!=");
+        parseContext.specializationCheck($2.loc, $1->getType(), "!=");
+        parseContext.referenceCheck($2.loc, $1->getType(), "!=");
+        $$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3);
+        if ($$ == 0)
+            $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
+    }
+    ;
+
+and_expression
+    : equality_expression { $$ = $1; }
+    | and_expression AMPERSAND equality_expression {
+        parseContext.fullIntegerCheck($2.loc, "bitwise and");
+        $$ = parseContext.handleBinaryMath($2.loc, "&", EOpAnd, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    ;
+
+exclusive_or_expression
+    : and_expression { $$ = $1; }
+    | exclusive_or_expression CARET and_expression {
+        parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or");
+        $$ = parseContext.handleBinaryMath($2.loc, "^", EOpExclusiveOr, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    ;
+
+inclusive_or_expression
+    : exclusive_or_expression { $$ = $1; }
+    | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
+        parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or");
+        $$ = parseContext.handleBinaryMath($2.loc, "|", EOpInclusiveOr, $1, $3);
+        if ($$ == 0)
+            $$ = $1;
+    }
+    ;
+
+logical_and_expression
+    : inclusive_or_expression { $$ = $1; }
+    | logical_and_expression AND_OP inclusive_or_expression {
+        $$ = parseContext.handleBinaryMath($2.loc, "&&", EOpLogicalAnd, $1, $3);
+        if ($$ == 0)
+            $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
+    }
+    ;
+
+logical_xor_expression
+    : logical_and_expression { $$ = $1; }
+    | logical_xor_expression XOR_OP logical_and_expression  {
+        $$ = parseContext.handleBinaryMath($2.loc, "^^", EOpLogicalXor, $1, $3);
+        if ($$ == 0)
+            $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
+    }
+    ;
+
+logical_or_expression
+    : logical_xor_expression { $$ = $1; }
+    | logical_or_expression OR_OP logical_xor_expression  {
+        $$ = parseContext.handleBinaryMath($2.loc, "||", EOpLogicalOr, $1, $3);
+        if ($$ == 0)
+            $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
+    }
+    ;
+
+conditional_expression
+    : logical_or_expression { $$ = $1; }
+    | logical_or_expression QUESTION {
+        ++parseContext.controlFlowNestingLevel;
+    }
+      expression COLON assignment_expression {
+        --parseContext.controlFlowNestingLevel;
+        parseContext.boolCheck($2.loc, $1);
+        parseContext.rValueErrorCheck($2.loc, "?", $1);
+        parseContext.rValueErrorCheck($5.loc, ":", $4);
+        parseContext.rValueErrorCheck($5.loc, ":", $6);
+        $$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc);
+        if ($$ == 0) {
+            parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(), $6->getCompleteString());
+            $$ = $6;
+        }
+    }
+    ;
+
+assignment_expression
+    : conditional_expression { $$ = $1; }
+    | unary_expression assignment_operator assignment_expression {
+        parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment");
+        parseContext.opaqueCheck($2.loc, $1->getType(), "=");
+        parseContext.storage16BitAssignmentCheck($2.loc, $1->getType(), "=");
+        parseContext.specializationCheck($2.loc, $1->getType(), "=");
+        parseContext.lValueErrorCheck($2.loc, "assign", $1);
+        parseContext.rValueErrorCheck($2.loc, "assign", $3);
+        $$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.loc);
+        if ($$ == 0) {
+            parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());
+            $$ = $1;
+        }
+    }
+    ;
+
+assignment_operator
+    : EQUAL {
+        $$.loc = $1.loc;
+        $$.op = EOpAssign;
+    }
+    | MUL_ASSIGN {
+        $$.loc = $1.loc;
+        $$.op = EOpMulAssign;
+    }
+    | DIV_ASSIGN {
+        $$.loc = $1.loc;
+        $$.op = EOpDivAssign;
+    }
+    | MOD_ASSIGN {
+        parseContext.fullIntegerCheck($1.loc, "%=");
+        $$.loc = $1.loc;
+        $$.op = EOpModAssign;
+    }
+    | ADD_ASSIGN {
+        $$.loc = $1.loc;
+        $$.op = EOpAddAssign;
+    }
+    | SUB_ASSIGN {
+        $$.loc = $1.loc;
+        $$.op = EOpSubAssign;
+    }
+    | LEFT_ASSIGN {
+        parseContext.fullIntegerCheck($1.loc, "bit-shift left assign");
+        $$.loc = $1.loc; $$.op = EOpLeftShiftAssign;
+    }
+    | RIGHT_ASSIGN {
+        parseContext.fullIntegerCheck($1.loc, "bit-shift right assign");
+        $$.loc = $1.loc; $$.op = EOpRightShiftAssign;
+    }
+    | AND_ASSIGN {
+        parseContext.fullIntegerCheck($1.loc, "bitwise-and assign");
+        $$.loc = $1.loc; $$.op = EOpAndAssign;
+    }
+    | XOR_ASSIGN {
+        parseContext.fullIntegerCheck($1.loc, "bitwise-xor assign");
+        $$.loc = $1.loc; $$.op = EOpExclusiveOrAssign;
+    }
+    | OR_ASSIGN {
+        parseContext.fullIntegerCheck($1.loc, "bitwise-or assign");
+        $$.loc = $1.loc; $$.op = EOpInclusiveOrAssign;
+    }
+    ;
+
+expression
+    : assignment_expression {
+        $$ = $1;
+    }
+    | expression COMMA assignment_expression {
+        parseContext.samplerConstructorLocationCheck($2.loc, ",", $3);
+        $$ = parseContext.intermediate.addComma($1, $3, $2.loc);
+        if ($$ == 0) {
+            parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(), $3->getCompleteString());
+            $$ = $3;
+        }
+    }
+    ;
+
+constant_expression
+    : conditional_expression {
+        parseContext.constantValueCheck($1, "");
+        $$ = $1;
+    }
+    ;
+
+declaration
+    : function_prototype SEMICOLON {
+        parseContext.handleFunctionDeclarator($1.loc, *$1.function, true /* prototype */);
+        $$ = 0;
+        // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
+    }
+    | init_declarator_list SEMICOLON {
+        if ($1.intermNode && $1.intermNode->getAsAggregate())
+            $1.intermNode->getAsAggregate()->setOperator(EOpSequence);
+        $$ = $1.intermNode;
+    }
+    | PRECISION precision_qualifier type_specifier SEMICOLON {
+        parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement");
+        // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope
+        parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]);
+        parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision);
+        $$ = 0;
+    }
+    | block_structure SEMICOLON {
+        parseContext.declareBlock($1.loc, *$1.typeList);
+        $$ = 0;
+    }
+    | block_structure IDENTIFIER SEMICOLON {
+        parseContext.declareBlock($1.loc, *$1.typeList, $2.string);
+        $$ = 0;
+    }
+    | block_structure IDENTIFIER array_specifier SEMICOLON {
+        parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes);
+        $$ = 0;
+    }
+    | type_qualifier SEMICOLON {
+        parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
+        parseContext.updateStandaloneQualifierDefaults($1.loc, $1);
+        $$ = 0;
+    }
+    | type_qualifier IDENTIFIER SEMICOLON {
+        parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
+        parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2.string);
+        $$ = 0;
+    }
+    | type_qualifier IDENTIFIER identifier_list SEMICOLON {
+        parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
+        $3->push_back($2.string);
+        parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$3);
+        $$ = 0;
+    }
+    ;
+
+block_structure
+    : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
+        --parseContext.structNestingLevel;
+        parseContext.blockName = $2.string;
+        parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
+        parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
+        parseContext.currentBlockQualifier = $1.qualifier;
+        $$.loc = $1.loc;
+        $$.typeList = $5;
+    }
+
+identifier_list
+    : COMMA IDENTIFIER {
+        $$ = new TIdentifierList;
+        $$->push_back($2.string);
+    }
+    | identifier_list COMMA IDENTIFIER {
+        $$ = $1;
+        $$->push_back($3.string);
+    }
+    ;
+
+function_prototype
+    : function_declarator RIGHT_PAREN  {
+        $$.function = $1;
+        $$.loc = $2.loc;
+    }
+    ;
+
+function_declarator
+    : function_header {
+        $$ = $1;
+    }
+    | function_header_with_parameters {
+        $$ = $1;
+    }
+    ;
+
+
+function_header_with_parameters
+    : function_header parameter_declaration {
+        // Add the parameter
+        $$ = $1;
+        if ($2.param.type->getBasicType() != EbtVoid)
+            $1->addParameter($2.param);
+        else
+            delete $2.param.type;
+    }
+    | function_header_with_parameters COMMA parameter_declaration {
+        //
+        // Only first parameter of one-parameter functions can be void
+        // The check for named parameters not being void is done in parameter_declarator
+        //
+        if ($3.param.type->getBasicType() == EbtVoid) {
+            //
+            // This parameter > first is void
+            //
+            parseContext.error($2.loc, "cannot be an argument type except for '(void)'", "void", "");
+            delete $3.param.type;
+        } else {
+            // Add the parameter
+            $$ = $1;
+            $1->addParameter($3.param);
+        }
+    }
+    ;
+
+function_header
+    : fully_specified_type IDENTIFIER LEFT_PAREN {
+        if ($1.qualifier.storage != EvqGlobal && $1.qualifier.storage != EvqTemporary) {
+            parseContext.error($2.loc, "no qualifiers allowed for function return",
+                               GetStorageQualifierString($1.qualifier.storage), "");
+        }
+        if ($1.arraySizes)
+            parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
+
+        // Add the function as a prototype after parsing it (we do not support recursion)
+        TFunction *function;
+        TType type($1);
+
+        // Potentially rename shader entry point function.  No-op most of the time.
+        parseContext.renameShaderFunction($2.string);
+
+        // Make the function
+        function = new TFunction($2.string, type);
+        $$ = function;
+    }
+    ;
+
+parameter_declarator
+    // Type + name
+    : type_specifier IDENTIFIER {
+        if ($1.arraySizes) {
+            parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
+            parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
+            parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
+        }
+        if ($1.basicType == EbtVoid) {
+            parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), "");
+        }
+        parseContext.reservedErrorCheck($2.loc, *$2.string);
+
+        TParameter param = {$2.string, new TType($1)};
+        $$.loc = $2.loc;
+        $$.param = param;
+    }
+    | type_specifier IDENTIFIER array_specifier {
+        if ($1.arraySizes) {
+            parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
+            parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
+            parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
+        }
+        TType* type = new TType($1);
+        type->transferArraySizes($3.arraySizes);
+        type->copyArrayInnerSizes($1.arraySizes);
+
+        parseContext.arrayOfArrayVersionCheck($2.loc, type->getArraySizes());
+        parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes);
+        parseContext.reservedErrorCheck($2.loc, *$2.string);
+
+        TParameter param = { $2.string, type };
+
+        $$.loc = $2.loc;
+        $$.param = param;
+    }
+    ;
+
+parameter_declaration
+    //
+    // With name
+    //
+    : type_qualifier parameter_declarator {
+        $$ = $2;
+        if ($1.qualifier.precision != EpqNone)
+            $$.param.type->getQualifier().precision = $1.qualifier.precision;
+        parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
+
+        parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
+        parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
+        parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
+
+    }
+    | parameter_declarator {
+        $$ = $1;
+
+        parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
+        parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
+        parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
+    }
+    //
+    // Without name
+    //
+    | type_qualifier parameter_type_specifier {
+        $$ = $2;
+        if ($1.qualifier.precision != EpqNone)
+            $$.param.type->getQualifier().precision = $1.qualifier.precision;
+        parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
+
+        parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
+        parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
+        parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
+    }
+    | parameter_type_specifier {
+        $$ = $1;
+
+        parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
+        parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
+        parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
+    }
+    ;
+
+parameter_type_specifier
+    : type_specifier {
+        TParameter param = { 0, new TType($1) };
+        $$.param = param;
+        if ($1.arraySizes)
+            parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
+    }
+    ;
+
+init_declarator_list
+    : single_declaration {
+        $$ = $1;
+    }
+    | init_declarator_list COMMA IDENTIFIER {
+        $$ = $1;
+        parseContext.declareVariable($3.loc, *$3.string, $1.type);
+    }
+    | init_declarator_list COMMA IDENTIFIER array_specifier {
+        $$ = $1;
+        parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes);
+    }
+    | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer {
+        $$.type = $1.type;
+        TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6);
+        $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $5.loc);
+    }
+    | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
+        $$.type = $1.type;
+        TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5);
+        $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $4.loc);
+    }
+    ;
+
+single_declaration
+    : fully_specified_type {
+        $$.type = $1;
+        $$.intermNode = 0;
+GLSLANG_WEB_EXCLUDE_ON
+        parseContext.declareTypeDefaults($$.loc, $$.type);
+GLSLANG_WEB_EXCLUDE_OFF
+    }
+    | fully_specified_type IDENTIFIER {
+        $$.type = $1;
+        $$.intermNode = 0;
+        parseContext.declareVariable($2.loc, *$2.string, $1);
+    }
+    | fully_specified_type IDENTIFIER array_specifier {
+        $$.type = $1;
+        $$.intermNode = 0;
+        parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes);
+    }
+    | fully_specified_type IDENTIFIER array_specifier EQUAL initializer {
+        $$.type = $1;
+        TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5);
+        $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $4.loc);
+    }
+    | fully_specified_type IDENTIFIER EQUAL initializer {
+        $$.type = $1;
+        TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
+        $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $3.loc);
+    }
+
+// Grammar Note:  No 'enum', or 'typedef'.
+
+fully_specified_type
+    : type_specifier {
+        $$ = $1;
+
+        parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$);
+        if ($1.arraySizes) {
+            parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
+            parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
+        }
+        parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier);
+    }
+    | type_qualifier type_specifier  {
+        parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
+        parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2);
+
+        if ($2.arraySizes) {
+            parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
+            parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
+        }
+
+        if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier))
+            $2.arraySizes = nullptr;
+
+        parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers);
+        $2.shaderQualifiers.merge($1.shaderQualifiers);
+        parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
+        parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
+
+        $$ = $2;
+
+        if (! $$.qualifier.isInterpolation() &&
+            ((parseContext.language == EShLangVertex   && $$.qualifier.storage == EvqVaryingOut) ||
+             (parseContext.language == EShLangFragment && $$.qualifier.storage == EvqVaryingIn)))
+            $$.qualifier.smooth = true;
+    }
+    ;
+
+invariant_qualifier
+    : INVARIANT {
+        parseContext.globalCheck($1.loc, "invariant");
+        parseContext.profileRequires($$.loc, ENoProfile, 120, 0, "invariant");
+        $$.init($1.loc);
+        $$.qualifier.invariant = true;
+    }
+    ;
+
+interpolation_qualifier
+    : SMOOTH {
+        parseContext.globalCheck($1.loc, "smooth");
+        parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "smooth");
+        parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "smooth");
+        $$.init($1.loc);
+        $$.qualifier.smooth = true;
+    }
+    | FLAT {
+        parseContext.globalCheck($1.loc, "flat");
+        parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "flat");
+        parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "flat");
+        $$.init($1.loc);
+        $$.qualifier.flat = true;
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | NOPERSPECTIVE {
+        parseContext.globalCheck($1.loc, "noperspective");
+        parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective");
+        parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective");
+        $$.init($1.loc);
+        $$.qualifier.nopersp = true;
+    }
+    | EXPLICITINTERPAMD {
+        parseContext.globalCheck($1.loc, "__explicitInterpAMD");
+        parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
+        parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
+        $$.init($1.loc);
+        $$.qualifier.explicitInterp = true;
+    }
+    | PERVERTEXNV {
+        parseContext.globalCheck($1.loc, "pervertexNV");
+        parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
+        parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
+        parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
+        $$.init($1.loc);
+        $$.qualifier.pervertexNV = true;
+    }
+    | PERPRIMITIVENV {
+        // No need for profile version or extension check. Shader stage already checks both.
+        parseContext.globalCheck($1.loc, "perprimitiveNV");
+        parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV");
+        // Fragment shader stage doesn't check for extension. So we explicitly add below extension check.
+        if (parseContext.language == EShLangFragment)
+            parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV");
+        $$.init($1.loc);
+        $$.qualifier.perPrimitiveNV = true;
+    }
+    | PERVIEWNV {
+        // No need for profile version or extension check. Shader stage already checks both.
+        parseContext.globalCheck($1.loc, "perviewNV");
+        parseContext.requireStage($1.loc, EShLangMeshNV, "perviewNV");
+        $$.init($1.loc);
+        $$.qualifier.perViewNV = true;
+    }
+    | PERTASKNV {
+        // No need for profile version or extension check. Shader stage already checks both.
+        parseContext.globalCheck($1.loc, "taskNV");
+        parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV");
+        $$.init($1.loc);
+        $$.qualifier.perTaskNV = true;
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    ;
+
+layout_qualifier
+    : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
+        $$ = $3;
+    }
+    ;
+
+layout_qualifier_id_list
+    : layout_qualifier_id {
+        $$ = $1;
+    }
+    | layout_qualifier_id_list COMMA layout_qualifier_id {
+        $$ = $1;
+        $$.shaderQualifiers.merge($3.shaderQualifiers);
+        parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false);
+    }
+
+layout_qualifier_id
+    : IDENTIFIER {
+        $$.init($1.loc);
+        parseContext.setLayoutQualifier($1.loc, $$, *$1.string);
+    }
+    | IDENTIFIER EQUAL constant_expression {
+        $$.init($1.loc);
+        parseContext.setLayoutQualifier($1.loc, $$, *$1.string, $3);
+    }
+    | SHARED { // because "shared" is both an identifier and a keyword
+        $$.init($1.loc);
+        TString strShared("shared");
+        parseContext.setLayoutQualifier($1.loc, $$, strShared);
+    }
+    ;
+
+GLSLANG_WEB_EXCLUDE_ON
+precise_qualifier
+    : PRECISE {
+        parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise");
+        parseContext.profileRequires($1.loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise");
+        $$.init($1.loc);
+        $$.qualifier.noContraction = true;
+    }
+    ;
+GLSLANG_WEB_EXCLUDE_OFF
+
+type_qualifier
+    : single_type_qualifier {
+        $$ = $1;
+    }
+    | type_qualifier single_type_qualifier {
+        $$ = $1;
+        if ($$.basicType == EbtVoid)
+            $$.basicType = $2.basicType;
+
+        $$.shaderQualifiers.merge($2.shaderQualifiers);
+        parseContext.mergeQualifiers($$.loc, $$.qualifier, $2.qualifier, false);
+    }
+    ;
+
+single_type_qualifier
+    : storage_qualifier {
+        $$ = $1;
+    }
+    | layout_qualifier {
+        $$ = $1;
+    }
+    | precision_qualifier {
+        parseContext.checkPrecisionQualifier($1.loc, $1.qualifier.precision);
+        $$ = $1;
+    }
+    | interpolation_qualifier {
+        // allow inheritance of storage qualifier from block declaration
+        $$ = $1;
+    }
+    | invariant_qualifier {
+        // allow inheritance of storage qualifier from block declaration
+        $$ = $1;
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | precise_qualifier {
+        // allow inheritance of storage qualifier from block declaration
+        $$ = $1;
+    }
+    | non_uniform_qualifier {
+        $$ = $1;
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    ;
+
+storage_qualifier
+    : CONST {
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqConst;  // will later turn into EvqConstReadOnly, if the initializer is not constant
+    }
+    | INOUT {
+        parseContext.globalCheck($1.loc, "inout");
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqInOut;
+    }
+    | IN {
+        parseContext.globalCheck($1.loc, "in");
+        $$.init($1.loc);
+        // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later
+        $$.qualifier.storage = EvqIn;
+    }
+    | OUT {
+        parseContext.globalCheck($1.loc, "out");
+        $$.init($1.loc);
+        // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later
+        $$.qualifier.storage = EvqOut;
+    }
+    | CENTROID {
+        parseContext.profileRequires($1.loc, ENoProfile, 120, 0, "centroid");
+        parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "centroid");
+        parseContext.globalCheck($1.loc, "centroid");
+        $$.init($1.loc);
+        $$.qualifier.centroid = true;
+    }
+    | UNIFORM {
+        parseContext.globalCheck($1.loc, "uniform");
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqUniform;
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | SHARED {
+        parseContext.globalCheck($1.loc, "shared");
+        parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
+        parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
+        parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared");
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqShared;
+    }
+    | BUFFER {
+        parseContext.globalCheck($1.loc, "buffer");
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqBuffer;
+    }
+    | ATTRIBUTE {
+        parseContext.requireStage($1.loc, EShLangVertex, "attribute");
+        parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
+        parseContext.checkDeprecated($1.loc, ENoProfile, 130, "attribute");
+        parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "attribute");
+        parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "attribute");
+
+        parseContext.globalCheck($1.loc, "attribute");
+
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqVaryingIn;
+    }
+    | VARYING {
+        parseContext.checkDeprecated($1.loc, ENoProfile, 130, "varying");
+        parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "varying");
+        parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "varying");
+        parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "varying");
+
+        parseContext.globalCheck($1.loc, "varying");
+
+        $$.init($1.loc);
+        if (parseContext.language == EShLangVertex)
+            $$.qualifier.storage = EvqVaryingOut;
+        else
+            $$.qualifier.storage = EvqVaryingIn;
+    }
+    | PATCH {
+        parseContext.globalCheck($1.loc, "patch");
+        parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch");
+        $$.init($1.loc);
+        $$.qualifier.patch = true;
+    }
+    | SAMPLE {
+        parseContext.globalCheck($1.loc, "sample");
+        $$.init($1.loc);
+        $$.qualifier.sample = true;
+    }
+    | HITATTRNV {
+        parseContext.globalCheck($1.loc, "hitAttributeNV");
+        parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectNVMask | EShLangClosestHitNVMask
+            | EShLangAnyHitNVMask), "hitAttributeNV");
+        parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV");
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqHitAttrNV;
+    }
+    | PAYLOADNV {
+        parseContext.globalCheck($1.loc, "rayPayloadNV");
+        parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask |
+            EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadNV");
+        parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV");
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqPayloadNV;
+    }
+    | PAYLOADINNV {
+        parseContext.globalCheck($1.loc, "rayPayloadInNV");
+        parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitNVMask |
+            EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadInNV");
+        parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV");
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqPayloadInNV;
+    }
+    | CALLDATANV {
+        parseContext.globalCheck($1.loc, "callableDataNV");
+        parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenNVMask |
+            EShLangClosestHitNVMask | EShLangMissNVMask | EShLangCallableNVMask), "callableDataNV");
+        parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV");
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqCallableDataNV;
+    }
+    | CALLDATAINNV {
+        parseContext.globalCheck($1.loc, "callableDataInNV");
+        parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableNVMask), "callableDataInNV");
+        parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV");
+        $$.init($1.loc);
+        $$.qualifier.storage = EvqCallableDataInNV;
+    }
+    | COHERENT {
+        $$.init($1.loc);
+        $$.qualifier.coherent = true;
+    }
+    | DEVICECOHERENT {
+        $$.init($1.loc);
+        parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent");
+        $$.qualifier.devicecoherent = true;
+    }
+    | QUEUEFAMILYCOHERENT {
+        $$.init($1.loc);
+        parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent");
+        $$.qualifier.queuefamilycoherent = true;
+    }
+    | WORKGROUPCOHERENT {
+        $$.init($1.loc);
+        parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent");
+        $$.qualifier.workgroupcoherent = true;
+    }
+    | SUBGROUPCOHERENT {
+        $$.init($1.loc);
+        parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent");
+        $$.qualifier.subgroupcoherent = true;
+    }
+    | NONPRIVATE {
+        $$.init($1.loc);
+        parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate");
+        $$.qualifier.nonprivate = true;
+    }
+    | VOLATILE {
+        $$.init($1.loc);
+        $$.qualifier.volatil = true;
+    }
+    | RESTRICT {
+        $$.init($1.loc);
+        $$.qualifier.restrict = true;
+    }
+    | READONLY {
+        $$.init($1.loc);
+        $$.qualifier.readonly = true;
+    }
+    | WRITEONLY {
+        $$.init($1.loc);
+        $$.qualifier.writeonly = true;
+    }
+    | SUBROUTINE {
+        parseContext.spvRemoved($1.loc, "subroutine");
+        parseContext.globalCheck($1.loc, "subroutine");
+        parseContext.unimplemented($1.loc, "subroutine");
+        $$.init($1.loc);
+    }
+    | SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN {
+        parseContext.spvRemoved($1.loc, "subroutine");
+        parseContext.globalCheck($1.loc, "subroutine");
+        parseContext.unimplemented($1.loc, "subroutine");
+        $$.init($1.loc);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    ;
+
+GLSLANG_WEB_EXCLUDE_ON
+non_uniform_qualifier
+    : NONUNIFORM {
+        $$.init($1.loc);
+        $$.qualifier.nonUniform = true;
+    }
+    ;
+
+type_name_list
+    : IDENTIFIER {
+        // TODO
+    }
+    | type_name_list COMMA IDENTIFIER {
+        // TODO: 4.0 semantics: subroutines
+        // 1) make sure each identifier is a type declared earlier with SUBROUTINE
+        // 2) save all of the identifiers for future comparison with the declared function
+    }
+    ;
+GLSLANG_WEB_EXCLUDE_OFF
+
+type_specifier
+    : type_specifier_nonarray type_parameter_specifier_opt {
+        $$ = $1;
+        $$.qualifier.precision = parseContext.getDefaultPrecision($$);
+        $$.typeParameters = $2;
+    }
+    | type_specifier_nonarray type_parameter_specifier_opt array_specifier {
+        parseContext.arrayOfArrayVersionCheck($3.loc, $3.arraySizes);
+        $$ = $1;
+        $$.qualifier.precision = parseContext.getDefaultPrecision($$);
+        $$.typeParameters = $2;
+        $$.arraySizes = $3.arraySizes;
+    }
+    ;
+
+array_specifier
+    : LEFT_BRACKET RIGHT_BRACKET {
+        $$.loc = $1.loc;
+        $$.arraySizes = new TArraySizes;
+        $$.arraySizes->addInnerSize();
+    }
+    | LEFT_BRACKET conditional_expression RIGHT_BRACKET {
+        $$.loc = $1.loc;
+        $$.arraySizes = new TArraySizes;
+
+        TArraySize size;
+        parseContext.arraySizeCheck($2->getLoc(), $2, size, "array size");
+        $$.arraySizes->addInnerSize(size);
+    }
+    | array_specifier LEFT_BRACKET RIGHT_BRACKET {
+        $$ = $1;
+        $$.arraySizes->addInnerSize();
+    }
+    | array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET {
+        $$ = $1;
+
+        TArraySize size;
+        parseContext.arraySizeCheck($3->getLoc(), $3, size, "array size");
+        $$.arraySizes->addInnerSize(size);
+    }
+    ;
+
+type_parameter_specifier_opt
+    : type_parameter_specifier {
+        $$ = $1;
+    }
+    | /* May be null */ {
+        $$ = 0;
+    }
+    ;
+
+type_parameter_specifier
+    : LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE {
+        $$ = $2;
+    }
+    ;
+
+type_parameter_specifier_list
+    : unary_expression {
+        $$ = new TArraySizes;
+
+        TArraySize size;
+        parseContext.arraySizeCheck($1->getLoc(), $1, size, "type parameter");
+        $$->addInnerSize(size);
+    }
+    | type_parameter_specifier_list COMMA unary_expression {
+        $$ = $1;
+
+        TArraySize size;
+        parseContext.arraySizeCheck($3->getLoc(), $3, size, "type parameter");
+        $$->addInnerSize(size);
+    }
+    ;
+
+type_specifier_nonarray
+    : VOID {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtVoid;
+    }
+    | FLOAT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+    }
+    | INT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+    }
+    | UINT {
+        parseContext.fullIntegerCheck($1.loc, "unsigned integer");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+    }
+    | BOOL {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtBool;
+    }
+    | VEC2 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setVector(2);
+    }
+    | VEC3 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setVector(3);
+    }
+    | VEC4 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setVector(4);
+    }
+    | BVEC2 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtBool;
+        $$.setVector(2);
+    }
+    | BVEC3 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtBool;
+        $$.setVector(3);
+    }
+    | BVEC4 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtBool;
+        $$.setVector(4);
+    }
+    | IVEC2 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+        $$.setVector(2);
+    }
+    | IVEC3 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+        $$.setVector(3);
+    }
+    | IVEC4 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+        $$.setVector(4);
+    }
+    | UVEC2 {
+        parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+        $$.setVector(2);
+    }
+    | UVEC3 {
+        parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+        $$.setVector(3);
+    }
+    | UVEC4 {
+        parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+        $$.setVector(4);
+    }
+    | MAT2 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(2, 2);
+    }
+    | MAT3 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(3, 3);
+    }
+    | MAT4 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(4, 4);
+    }
+    | MAT2X2 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(2, 2);
+    }
+    | MAT2X3 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(2, 3);
+    }
+    | MAT2X4 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(2, 4);
+    }
+    | MAT3X2 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(3, 2);
+    }
+    | MAT3X3 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(3, 3);
+    }
+    | MAT3X4 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(3, 4);
+    }
+    | MAT4X2 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(4, 2);
+    }
+    | MAT4X3 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(4, 3);
+    }
+    | MAT4X4 {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(4, 4);
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | DOUBLE {
+        parseContext.doubleCheck($1.loc, "double");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+    }
+    | FLOAT16_T {
+        parseContext.float16ScalarVectorCheck($1.loc, "float16_t", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+    }
+    | FLOAT32_T {
+        parseContext.explicitFloat32Check($1.loc, "float32_t", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+    }
+    | FLOAT64_T {
+        parseContext.explicitFloat64Check($1.loc, "float64_t", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+    }
+    | INT8_T {
+        parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt8;
+    }
+    | UINT8_T {
+        parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint8;
+    }
+    | INT16_T {
+        parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt16;
+    }
+    | UINT16_T {
+        parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint16;
+    }
+    | INT32_T {
+        parseContext.explicitInt32Check($1.loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+    }
+    | UINT32_T {
+        parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+    }
+    | INT64_T {
+        parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt64;
+    }
+    | UINT64_T {
+        parseContext.int64Check($1.loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint64;
+    }
+    | DVEC2 {
+        parseContext.doubleCheck($1.loc, "double vector");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setVector(2);
+    }
+    | DVEC3 {
+        parseContext.doubleCheck($1.loc, "double vector");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setVector(3);
+    }
+    | DVEC4 {
+        parseContext.doubleCheck($1.loc, "double vector");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setVector(4);
+    }
+    | F16VEC2 {
+        parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setVector(2);
+    }
+    | F16VEC3 {
+        parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setVector(3);
+    }
+    | F16VEC4 {
+        parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setVector(4);
+    }
+    | F32VEC2 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setVector(2);
+    }
+    | F32VEC3 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setVector(3);
+    }
+    | F32VEC4 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setVector(4);
+    }
+    | F64VEC2 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setVector(2);
+    }
+    | F64VEC3 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setVector(3);
+    }
+    | F64VEC4 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setVector(4);
+    }
+    | I8VEC2 {
+        parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt8;
+        $$.setVector(2);
+    }
+    | I8VEC3 {
+        parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt8;
+        $$.setVector(3);
+    }
+    | I8VEC4 {
+        parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt8;
+        $$.setVector(4);
+    }
+    | I16VEC2 {
+        parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt16;
+        $$.setVector(2);
+    }
+    | I16VEC3 {
+        parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt16;
+        $$.setVector(3);
+    }
+    | I16VEC4 {
+        parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt16;
+        $$.setVector(4);
+    }
+    | I32VEC2 {
+        parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+        $$.setVector(2);
+    }
+    | I32VEC3 {
+        parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+        $$.setVector(3);
+    }
+    | I32VEC4 {
+        parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt;
+        $$.setVector(4);
+    }
+    | I64VEC2 {
+        parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt64;
+        $$.setVector(2);
+    }
+    | I64VEC3 {
+        parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt64;
+        $$.setVector(3);
+    }
+    | I64VEC4 {
+        parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtInt64;
+        $$.setVector(4);
+    }
+    | U8VEC2 {
+        parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint8;
+        $$.setVector(2);
+    }
+    | U8VEC3 {
+        parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint8;
+        $$.setVector(3);
+    }
+    | U8VEC4 {
+        parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint8;
+        $$.setVector(4);
+    }
+    | U16VEC2 {
+        parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint16;
+        $$.setVector(2);
+    }
+    | U16VEC3 {
+        parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint16;
+        $$.setVector(3);
+    }
+    | U16VEC4 {
+        parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint16;
+        $$.setVector(4);
+    }
+    | U32VEC2 {
+        parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+        $$.setVector(2);
+    }
+    | U32VEC3 {
+        parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+        $$.setVector(3);
+    }
+    | U32VEC4 {
+        parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint;
+        $$.setVector(4);
+    }
+    | U64VEC2 {
+        parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint64;
+        $$.setVector(2);
+    }
+    | U64VEC3 {
+        parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint64;
+        $$.setVector(3);
+    }
+    | U64VEC4 {
+        parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtUint64;
+        $$.setVector(4);
+    }
+    | DMAT2 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(2, 2);
+    }
+    | DMAT3 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(3, 3);
+    }
+    | DMAT4 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(4, 4);
+    }
+    | DMAT2X2 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(2, 2);
+    }
+    | DMAT2X3 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(2, 3);
+    }
+    | DMAT2X4 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(2, 4);
+    }
+    | DMAT3X2 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(3, 2);
+    }
+    | DMAT3X3 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(3, 3);
+    }
+    | DMAT3X4 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(3, 4);
+    }
+    | DMAT4X2 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(4, 2);
+    }
+    | DMAT4X3 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(4, 3);
+    }
+    | DMAT4X4 {
+        parseContext.doubleCheck($1.loc, "double matrix");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(4, 4);
+    }
+    | F16MAT2 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(2, 2);
+    }
+    | F16MAT3 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(3, 3);
+    }
+    | F16MAT4 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(4, 4);
+    }
+    | F16MAT2X2 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(2, 2);
+    }
+    | F16MAT2X3 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(2, 3);
+    }
+    | F16MAT2X4 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(2, 4);
+    }
+    | F16MAT3X2 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(3, 2);
+    }
+    | F16MAT3X3 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(3, 3);
+    }
+    | F16MAT3X4 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(3, 4);
+    }
+    | F16MAT4X2 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(4, 2);
+    }
+    | F16MAT4X3 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(4, 3);
+    }
+    | F16MAT4X4 {
+        parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat16;
+        $$.setMatrix(4, 4);
+    }
+    | F32MAT2 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(2, 2);
+    }
+    | F32MAT3 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(3, 3);
+    }
+    | F32MAT4 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(4, 4);
+    }
+    | F32MAT2X2 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(2, 2);
+    }
+    | F32MAT2X3 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(2, 3);
+    }
+    | F32MAT2X4 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(2, 4);
+    }
+    | F32MAT3X2 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(3, 2);
+    }
+    | F32MAT3X3 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(3, 3);
+    }
+    | F32MAT3X4 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(3, 4);
+    }
+    | F32MAT4X2 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(4, 2);
+    }
+    | F32MAT4X3 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(4, 3);
+    }
+    | F32MAT4X4 {
+        parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.setMatrix(4, 4);
+    }
+    | F64MAT2 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(2, 2);
+    }
+    | F64MAT3 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(3, 3);
+    }
+    | F64MAT4 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(4, 4);
+    }
+    | F64MAT2X2 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(2, 2);
+    }
+    | F64MAT2X3 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(2, 3);
+    }
+    | F64MAT2X4 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(2, 4);
+    }
+    | F64MAT3X2 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(3, 2);
+    }
+    | F64MAT3X3 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(3, 3);
+    }
+    | F64MAT3X4 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(3, 4);
+    }
+    | F64MAT4X2 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(4, 2);
+    }
+    | F64MAT4X3 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(4, 3);
+    }
+    | F64MAT4X4 {
+        parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtDouble;
+        $$.setMatrix(4, 4);
+    }
+    | ACCSTRUCTNV {
+       $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+       $$.basicType = EbtAccStructNV;
+    }
+    | ATOMIC_UINT {
+        parseContext.vulkanRemoved($1.loc, "atomic counter types");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtAtomicUint;
+    }
+    | SAMPLER1D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd1D);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    | SAMPLER2D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd2D);
+    }
+    | SAMPLER3D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd3D);
+    }
+    | SAMPLERCUBE {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, EsdCube);
+    }
+    | SAMPLER2DSHADOW {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd2D, false, true);
+    }
+    | SAMPLERCUBESHADOW {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, EsdCube, false, true);
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | SAMPLER1DSHADOW {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd1D, false, true);
+    }
+    | SAMPLER1DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd1D, true);
+    }
+    | SAMPLER1DARRAYSHADOW {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd1D, true, true);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    | SAMPLER2DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd2D, true);
+    }
+    | SAMPLER2DARRAYSHADOW {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd2D, true, true);
+    }
+    | SAMPLERCUBEARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, EsdCube, true);
+    }
+    | SAMPLERCUBEARRAYSHADOW {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, EsdCube, true, true);
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | F16SAMPLER1D {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd1D);
+    }
+    | F16SAMPLER2D {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd2D);
+    }
+    | F16SAMPLER3D {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd3D);
+    }
+    | F16SAMPLERCUBE {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, EsdCube);
+    }
+    | F16SAMPLER1DSHADOW {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd1D, false, true);
+    }
+    | F16SAMPLER2DSHADOW {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd2D, false, true);
+    }
+    | F16SAMPLERCUBESHADOW {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, EsdCube, false, true);
+    }
+    | F16SAMPLER1DARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd1D, true);
+    }
+    | F16SAMPLER2DARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd2D, true);
+    }
+    | F16SAMPLER1DARRAYSHADOW {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd1D, true, true);
+    }
+    | F16SAMPLER2DARRAYSHADOW {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd2D, true, true);
+    }
+    | F16SAMPLERCUBEARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, EsdCube, true);
+    }
+    | F16SAMPLERCUBEARRAYSHADOW {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, EsdCube, true, true);
+    }
+    | ISAMPLER1D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, Esd1D);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    | ISAMPLER2D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, Esd2D);
+    }
+    | ISAMPLER3D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, Esd3D);
+    }
+    | ISAMPLERCUBE {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, EsdCube);
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | ISAMPLER1DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, Esd1D, true);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    | ISAMPLER2DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, Esd2D, true);
+    }
+    | ISAMPLERCUBEARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, EsdCube, true);
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | USAMPLER1D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, Esd1D);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    | USAMPLER2D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, Esd2D);
+    }
+    | USAMPLER3D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, Esd3D);
+    }
+    | USAMPLERCUBE {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, EsdCube);
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | USAMPLER1DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, Esd1D, true);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    | USAMPLER2DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, Esd2D, true);
+    }
+    | USAMPLERCUBEARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, EsdCube, true);
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | SAMPLER2DRECT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, EsdRect);
+    }
+    | SAMPLER2DRECTSHADOW {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, EsdRect, false, true);
+    }
+    | F16SAMPLER2DRECT {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, EsdRect);
+    }
+    | F16SAMPLER2DRECTSHADOW {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, EsdRect, false, true);
+    }
+    | ISAMPLER2DRECT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, EsdRect);
+    }
+    | USAMPLER2DRECT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, EsdRect);
+    }
+    | SAMPLERBUFFER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, EsdBuffer);
+    }
+    | F16SAMPLERBUFFER {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, EsdBuffer);
+    }
+    | ISAMPLERBUFFER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, EsdBuffer);
+    }
+    | USAMPLERBUFFER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, EsdBuffer);
+    }
+    | SAMPLER2DMS {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd2D, false, false, true);
+    }
+    | F16SAMPLER2DMS {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd2D, false, false, true);
+    }
+    | ISAMPLER2DMS {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, Esd2D, false, false, true);
+    }
+    | USAMPLER2DMS {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, Esd2D, false, false, true);
+    }
+    | SAMPLER2DMSARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd2D, true, false, true);
+    }
+    | F16SAMPLER2DMSARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat16, Esd2D, true, false, true);
+    }
+    | ISAMPLER2DMSARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtInt, Esd2D, true, false, true);
+    }
+    | USAMPLER2DMSARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtUint, Esd2D, true, false, true);
+    }
+    | SAMPLER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setPureSampler(false);
+    }
+    | SAMPLERSHADOW {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setPureSampler(true);
+    }
+    | TEXTURE1D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, Esd1D);
+    }
+    | F16TEXTURE1D {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, Esd1D);
+    }
+    | TEXTURE2D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, Esd2D);
+    }
+    | F16TEXTURE2D {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, Esd2D);
+    }
+    | TEXTURE3D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, Esd3D);
+    }
+    | F16TEXTURE3D {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, Esd3D);
+    }
+    | TEXTURECUBE {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, EsdCube);
+    }
+    | F16TEXTURECUBE {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, EsdCube);
+    }
+    | TEXTURE1DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, Esd1D, true);
+    }
+    | F16TEXTURE1DARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, Esd1D, true);
+    }
+    | TEXTURE2DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, Esd2D, true);
+    }
+    | F16TEXTURE2DARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, Esd2D, true);
+    }
+    | TEXTURECUBEARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, EsdCube, true);
+    }
+    | F16TEXTURECUBEARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, EsdCube, true);
+    }
+    | ITEXTURE1D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, Esd1D);
+    }
+    | ITEXTURE2D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, Esd2D);
+    }
+    | ITEXTURE3D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, Esd3D);
+    }
+    | ITEXTURECUBE {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, EsdCube);
+    }
+    | ITEXTURE1DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, Esd1D, true);
+    }
+    | ITEXTURE2DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, Esd2D, true);
+    }
+    | ITEXTURECUBEARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, EsdCube, true);
+    }
+    | UTEXTURE1D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, Esd1D);
+    }
+    | UTEXTURE2D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, Esd2D);
+    }
+    | UTEXTURE3D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, Esd3D);
+    }
+    | UTEXTURECUBE {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, EsdCube);
+    }
+    | UTEXTURE1DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, Esd1D, true);
+    }
+    | UTEXTURE2DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, Esd2D, true);
+    }
+    | UTEXTURECUBEARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, EsdCube, true);
+    }
+    | TEXTURE2DRECT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, EsdRect);
+    }
+    | F16TEXTURE2DRECT {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, EsdRect);
+    }
+    | ITEXTURE2DRECT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, EsdRect);
+    }
+    | UTEXTURE2DRECT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, EsdRect);
+    }
+    | TEXTUREBUFFER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, EsdBuffer);
+    }
+    | F16TEXTUREBUFFER {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, EsdBuffer);
+    }
+    | ITEXTUREBUFFER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, EsdBuffer);
+    }
+    | UTEXTUREBUFFER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, EsdBuffer);
+    }
+    | TEXTURE2DMS {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true);
+    }
+    | F16TEXTURE2DMS {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, Esd2D, false, false, true);
+    }
+    | ITEXTURE2DMS {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, Esd2D, false, false, true);
+    }
+    | UTEXTURE2DMS {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, Esd2D, false, false, true);
+    }
+    | TEXTURE2DMSARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true);
+    }
+    | F16TEXTURE2DMSARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtFloat16, Esd2D, true, false, true);
+    }
+    | ITEXTURE2DMSARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtInt, Esd2D, true, false, true);
+    }
+    | UTEXTURE2DMSARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setTexture(EbtUint, Esd2D, true, false, true);
+    }
+    | IMAGE1D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, Esd1D);
+    }
+    | F16IMAGE1D {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, Esd1D);
+    }
+    | IIMAGE1D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, Esd1D);
+    }
+    | UIMAGE1D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, Esd1D);
+    }
+    | IMAGE2D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, Esd2D);
+    }
+    | F16IMAGE2D {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, Esd2D);
+    }
+    | IIMAGE2D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, Esd2D);
+    }
+    | UIMAGE2D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, Esd2D);
+    }
+    | IMAGE3D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, Esd3D);
+    }
+    | F16IMAGE3D {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, Esd3D);
+    }
+    | IIMAGE3D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, Esd3D);
+    }
+    | UIMAGE3D {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, Esd3D);
+    }
+    | IMAGE2DRECT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, EsdRect);
+    }
+    | F16IMAGE2DRECT {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, EsdRect);
+    }
+    | IIMAGE2DRECT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, EsdRect);
+    }
+    | UIMAGE2DRECT {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, EsdRect);
+    }
+    | IMAGECUBE {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, EsdCube);
+    }
+    | F16IMAGECUBE {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, EsdCube);
+    }
+    | IIMAGECUBE {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, EsdCube);
+    }
+    | UIMAGECUBE {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, EsdCube);
+    }
+    | IMAGEBUFFER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, EsdBuffer);
+    }
+    | F16IMAGEBUFFER {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, EsdBuffer);
+    }
+    | IIMAGEBUFFER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, EsdBuffer);
+    }
+    | UIMAGEBUFFER {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, EsdBuffer);
+    }
+    | IMAGE1DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, Esd1D, true);
+    }
+    | F16IMAGE1DARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, Esd1D, true);
+    }
+    | IIMAGE1DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, Esd1D, true);
+    }
+    | UIMAGE1DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, Esd1D, true);
+    }
+    | IMAGE2DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, Esd2D, true);
+    }
+    | F16IMAGE2DARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, Esd2D, true);
+    }
+    | IIMAGE2DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, Esd2D, true);
+    }
+    | UIMAGE2DARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, Esd2D, true);
+    }
+    | IMAGECUBEARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, EsdCube, true);
+    }
+    | F16IMAGECUBEARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, EsdCube, true);
+    }
+    | IIMAGECUBEARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, EsdCube, true);
+    }
+    | UIMAGECUBEARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, EsdCube, true);
+    }
+    | IMAGE2DMS {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, Esd2D, false, false, true);
+    }
+    | F16IMAGE2DMS {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, Esd2D, false, false, true);
+    }
+    | IIMAGE2DMS {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, Esd2D, false, false, true);
+    }
+    | UIMAGE2DMS {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, Esd2D, false, false, true);
+    }
+    | IMAGE2DMSARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat, Esd2D, true, false, true);
+    }
+    | F16IMAGE2DMSARRAY {
+        parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtFloat16, Esd2D, true, false, true);
+    }
+    | IIMAGE2DMSARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtInt, Esd2D, true, false, true);
+    }
+    | UIMAGE2DMSARRAY {
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setImage(EbtUint, Esd2D, true, false, true);
+    }
+    | SAMPLEREXTERNALOES {  // GL_OES_EGL_image_external
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd2D);
+        $$.sampler.external = true;
+    }
+    | SAMPLEREXTERNAL2DY2YEXT { // GL_EXT_YUV_target
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.set(EbtFloat, Esd2D);
+        $$.sampler.yuv = true;
+    }
+    | SUBPASSINPUT {
+        parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setSubpass(EbtFloat);
+    }
+    | SUBPASSINPUTMS {
+        parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setSubpass(EbtFloat, true);
+    }
+    | F16SUBPASSINPUT {
+        parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
+        parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setSubpass(EbtFloat16);
+    }
+    | F16SUBPASSINPUTMS {
+        parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
+        parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setSubpass(EbtFloat16, true);
+    }
+    | ISUBPASSINPUT {
+        parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setSubpass(EbtInt);
+    }
+    | ISUBPASSINPUTMS {
+        parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setSubpass(EbtInt, true);
+    }
+    | USUBPASSINPUT {
+        parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setSubpass(EbtUint);
+    }
+    | USUBPASSINPUTMS {
+        parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtSampler;
+        $$.sampler.setSubpass(EbtUint, true);
+    }
+    | FCOOPMATNV {
+        parseContext.fcoopmatCheck($1.loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel());
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        $$.basicType = EbtFloat;
+        $$.coopmat = true;
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    | struct_specifier {
+        $$ = $1;
+        $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
+        parseContext.structTypeCheck($$.loc, $$);
+    }
+    | TYPE_NAME {
+        //
+        // This is for user defined type names.  The lexical phase looked up the
+        // type.
+        //
+        if (const TVariable* variable = ($1.symbol)->getAsVariable()) {
+            const TType& structure = variable->getType();
+            $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+            $$.basicType = EbtStruct;
+            $$.userDef = &structure;
+        } else
+            parseContext.error($1.loc, "expected type name", $1.string->c_str(), "");
+    }
+    ;
+
+precision_qualifier
+    : HIGH_PRECISION {
+        parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "highp precision qualifier");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqHigh);
+    }
+    | MEDIUM_PRECISION {
+        parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "mediump precision qualifier");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqMedium);
+    }
+    | LOW_PRECISION {
+        parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "lowp precision qualifier");
+        $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
+        parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqLow);
+    }
+    ;
+
+struct_specifier
+    : STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
+        TType* structure = new TType($5, *$2.string);
+        parseContext.structArrayCheck($2.loc, *structure);
+        TVariable* userTypeDef = new TVariable($2.string, *structure, true);
+        if (! parseContext.symbolTable.insert(*userTypeDef))
+            parseContext.error($2.loc, "redefinition", $2.string->c_str(), "struct");
+        $$.init($1.loc);
+        $$.basicType = EbtStruct;
+        $$.userDef = structure;
+        --parseContext.structNestingLevel;
+    }
+    | STRUCT LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
+        TType* structure = new TType($4, TString(""));
+        $$.init($1.loc);
+        $$.basicType = EbtStruct;
+        $$.userDef = structure;
+        --parseContext.structNestingLevel;
+    }
+    ;
+
+struct_declaration_list
+    : struct_declaration {
+        $$ = $1;
+    }
+    | struct_declaration_list struct_declaration {
+        $$ = $1;
+        for (unsigned int i = 0; i < $2->size(); ++i) {
+            for (unsigned int j = 0; j < $$->size(); ++j) {
+                if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName())
+                    parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str());
+            }
+            $$->push_back((*$2)[i]);
+        }
+    }
+    ;
+
+struct_declaration
+    : type_specifier struct_declarator_list SEMICOLON {
+        if ($1.arraySizes) {
+            parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
+            parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
+            if (parseContext.isEsProfile())
+                parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
+        }
+
+        $$ = $2;
+
+        parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType);
+        parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier);
+
+        for (unsigned int i = 0; i < $$->size(); ++i) {
+            TType type($1);
+            type.setFieldName((*$$)[i].type->getFieldName());
+            type.transferArraySizes((*$$)[i].type->getArraySizes());
+            type.copyArrayInnerSizes($1.arraySizes);
+            parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
+            (*$$)[i].type->shallowCopy(type);
+        }
+    }
+    | type_qualifier type_specifier struct_declarator_list SEMICOLON {
+        if ($2.arraySizes) {
+            parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
+            parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
+            if (parseContext.isEsProfile())
+                parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes);
+        }
+
+        $$ = $3;
+
+        parseContext.memberQualifierCheck($1);
+        parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType);
+        parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
+        parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
+
+        for (unsigned int i = 0; i < $$->size(); ++i) {
+            TType type($2);
+            type.setFieldName((*$$)[i].type->getFieldName());
+            type.transferArraySizes((*$$)[i].type->getArraySizes());
+            type.copyArrayInnerSizes($2.arraySizes);
+            parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
+            (*$$)[i].type->shallowCopy(type);
+        }
+    }
+    ;
+
+struct_declarator_list
+    : struct_declarator {
+        $$ = new TTypeList;
+        $$->push_back($1);
+    }
+    | struct_declarator_list COMMA struct_declarator {
+        $$->push_back($3);
+    }
+    ;
+
+struct_declarator
+    : IDENTIFIER {
+        $$.type = new TType(EbtVoid);
+        $$.loc = $1.loc;
+        $$.type->setFieldName(*$1.string);
+    }
+    | IDENTIFIER array_specifier {
+        parseContext.arrayOfArrayVersionCheck($1.loc, $2.arraySizes);
+
+        $$.type = new TType(EbtVoid);
+        $$.loc = $1.loc;
+        $$.type->setFieldName(*$1.string);
+        $$.type->transferArraySizes($2.arraySizes);
+    }
+    ;
+
+initializer
+    : assignment_expression {
+        $$ = $1;
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | LEFT_BRACE initializer_list RIGHT_BRACE {
+        const char* initFeature = "{ } style initializers";
+        parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
+        parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
+        $$ = $2;
+    }
+    | LEFT_BRACE initializer_list COMMA RIGHT_BRACE {
+        const char* initFeature = "{ } style initializers";
+        parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
+        parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
+        $$ = $2;
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    ;
+
+GLSLANG_WEB_EXCLUDE_ON
+initializer_list
+    : initializer {
+        $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc());
+    }
+    | initializer_list COMMA initializer {
+        $$ = parseContext.intermediate.growAggregate($1, $3);
+    }
+    ;
+GLSLANG_WEB_EXCLUDE_OFF
+
+declaration_statement
+    : declaration { $$ = $1; }
+    ;
+
+statement
+    : compound_statement  { $$ = $1; }
+    | simple_statement    { $$ = $1; }
+    ;
+
+// Grammar Note:  labeled statements for switch statements only; 'goto' is not supported.
+
+simple_statement
+    : declaration_statement { $$ = $1; }
+    | expression_statement  { $$ = $1; }
+    | selection_statement   { $$ = $1; }
+    | switch_statement      { $$ = $1; }
+    | case_label            { $$ = $1; }
+    | iteration_statement   { $$ = $1; }
+    | jump_statement        { $$ = $1; }
+GLSLANG_WEB_EXCLUDE_ON
+    | demote_statement      { $$ = $1; }
+GLSLANG_WEB_EXCLUDE_OFF
+    ;
+
+GLSLANG_WEB_EXCLUDE_ON
+demote_statement
+    : DEMOTE SEMICOLON {
+        parseContext.requireStage($1.loc, EShLangFragment, "demote");
+        parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote");
+        $$ = parseContext.intermediate.addBranch(EOpDemote, $1.loc);
+    }
+    ;
+GLSLANG_WEB_EXCLUDE_OFF
+
+compound_statement
+    : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
+    | LEFT_BRACE {
+        parseContext.symbolTable.push();
+        ++parseContext.statementNestingLevel;
+    }
+      statement_list {
+        parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
+        --parseContext.statementNestingLevel;
+    }
+      RIGHT_BRACE {
+        if ($3 && $3->getAsAggregate())
+            $3->getAsAggregate()->setOperator(EOpSequence);
+        $$ = $3;
+    }
+    ;
+
+statement_no_new_scope
+    : compound_statement_no_new_scope { $$ = $1; }
+    | simple_statement                { $$ = $1; }
+    ;
+
+statement_scoped
+    : {
+        ++parseContext.controlFlowNestingLevel;
+    }
+      compound_statement  {
+        --parseContext.controlFlowNestingLevel;
+        $$ = $2;
+    }
+    | {
+        parseContext.symbolTable.push();
+        ++parseContext.statementNestingLevel;
+        ++parseContext.controlFlowNestingLevel;
+    }
+      simple_statement {
+        parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
+        --parseContext.statementNestingLevel;
+        --parseContext.controlFlowNestingLevel;
+        $$ = $2;
+    }
+
+compound_statement_no_new_scope
+    // Statement that doesn't create a new scope, for selection_statement, iteration_statement
+    : LEFT_BRACE RIGHT_BRACE {
+        $$ = 0;
+    }
+    | LEFT_BRACE statement_list RIGHT_BRACE {
+        if ($2 && $2->getAsAggregate())
+            $2->getAsAggregate()->setOperator(EOpSequence);
+        $$ = $2;
+    }
+    ;
+
+statement_list
+    : statement {
+        $$ = parseContext.intermediate.makeAggregate($1);
+        if ($1 && $1->getAsBranchNode() && ($1->getAsBranchNode()->getFlowOp() == EOpCase ||
+                                            $1->getAsBranchNode()->getFlowOp() == EOpDefault)) {
+            parseContext.wrapupSwitchSubsequence(0, $1);
+            $$ = 0;  // start a fresh subsequence for what's after this case
+        }
+    }
+    | statement_list statement {
+        if ($2 && $2->getAsBranchNode() && ($2->getAsBranchNode()->getFlowOp() == EOpCase ||
+                                            $2->getAsBranchNode()->getFlowOp() == EOpDefault)) {
+            parseContext.wrapupSwitchSubsequence($1 ? $1->getAsAggregate() : 0, $2);
+            $$ = 0;  // start a fresh subsequence for what's after this case
+        } else
+            $$ = parseContext.intermediate.growAggregate($1, $2);
+    }
+    ;
+
+expression_statement
+    : SEMICOLON  { $$ = 0; }
+    | expression SEMICOLON  { $$ = static_cast<TIntermNode*>($1); }
+    ;
+
+selection_statement
+    : selection_statement_nonattributed {
+        $$ = $1;
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | attribute selection_statement_nonattributed {
+        parseContext.handleSelectionAttributes(*$1, $2);
+        $$ = $2;
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+
+selection_statement_nonattributed
+    : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
+        parseContext.boolCheck($1.loc, $3);
+        $$ = parseContext.intermediate.addSelection($3, $5, $1.loc);
+    }
+    ;
+
+selection_rest_statement
+    : statement_scoped ELSE statement_scoped {
+        $$.node1 = $1;
+        $$.node2 = $3;
+    }
+    | statement_scoped {
+        $$.node1 = $1;
+        $$.node2 = 0;
+    }
+    ;
+
+condition
+    // In 1996 c++ draft, conditions can include single declarations
+    : expression {
+        $$ = $1;
+        parseContext.boolCheck($1->getLoc(), $1);
+    }
+    | fully_specified_type IDENTIFIER EQUAL initializer {
+        parseContext.boolCheck($2.loc, $1);
+
+        TType type($1);
+        TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
+        if (initNode)
+            $$ = initNode->getAsTyped();
+        else
+            $$ = 0;
+    }
+    ;
+
+switch_statement
+    : switch_statement_nonattributed {
+        $$ = $1;
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | attribute switch_statement_nonattributed {
+        parseContext.handleSwitchAttributes(*$1, $2);
+        $$ = $2;
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+
+switch_statement_nonattributed
+    : SWITCH LEFT_PAREN expression RIGHT_PAREN {
+        // start new switch sequence on the switch stack
+        ++parseContext.controlFlowNestingLevel;
+        ++parseContext.statementNestingLevel;
+        parseContext.switchSequenceStack.push_back(new TIntermSequence);
+        parseContext.switchLevel.push_back(parseContext.statementNestingLevel);
+        parseContext.symbolTable.push();
+    }
+    LEFT_BRACE switch_statement_list RIGHT_BRACE {
+        $$ = parseContext.addSwitch($1.loc, $3, $7 ? $7->getAsAggregate() : 0);
+        delete parseContext.switchSequenceStack.back();
+        parseContext.switchSequenceStack.pop_back();
+        parseContext.switchLevel.pop_back();
+        parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
+        --parseContext.statementNestingLevel;
+        --parseContext.controlFlowNestingLevel;
+    }
+    ;
+
+switch_statement_list
+    : /* nothing */ {
+        $$ = 0;
+    }
+    | statement_list {
+        $$ = $1;
+    }
+    ;
+
+case_label
+    : CASE expression COLON {
+        $$ = 0;
+        if (parseContext.switchLevel.size() == 0)
+            parseContext.error($1.loc, "cannot appear outside switch statement", "case", "");
+        else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
+            parseContext.error($1.loc, "cannot be nested inside control flow", "case", "");
+        else {
+            parseContext.constantValueCheck($2, "case");
+            parseContext.integerCheck($2, "case");
+            $$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc);
+        }
+    }
+    | DEFAULT COLON {
+        $$ = 0;
+        if (parseContext.switchLevel.size() == 0)
+            parseContext.error($1.loc, "cannot appear outside switch statement", "default", "");
+        else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
+            parseContext.error($1.loc, "cannot be nested inside control flow", "default", "");
+        else
+            $$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc);
+    }
+    ;
+
+iteration_statement
+    : iteration_statement_nonattributed {
+        $$ = $1;
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | attribute iteration_statement_nonattributed {
+        parseContext.handleLoopAttributes(*$1, $2);
+        $$ = $2;
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+
+iteration_statement_nonattributed
+    : WHILE LEFT_PAREN {
+        if (! parseContext.limits.whileLoops)
+            parseContext.error($1.loc, "while loops not available", "limitation", "");
+        parseContext.symbolTable.push();
+        ++parseContext.loopNestingLevel;
+        ++parseContext.statementNestingLevel;
+        ++parseContext.controlFlowNestingLevel;
+    }
+      condition RIGHT_PAREN statement_no_new_scope {
+        parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
+        $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.loc);
+        --parseContext.loopNestingLevel;
+        --parseContext.statementNestingLevel;
+        --parseContext.controlFlowNestingLevel;
+    }
+    | DO {
+        ++parseContext.loopNestingLevel;
+        ++parseContext.statementNestingLevel;
+        ++parseContext.controlFlowNestingLevel;
+    }
+      statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
+        if (! parseContext.limits.whileLoops)
+            parseContext.error($1.loc, "do-while loops not available", "limitation", "");
+
+        parseContext.boolCheck($8.loc, $6);
+
+        $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc);
+        --parseContext.loopNestingLevel;
+        --parseContext.statementNestingLevel;
+        --parseContext.controlFlowNestingLevel;
+    }
+    | FOR LEFT_PAREN {
+        parseContext.symbolTable.push();
+        ++parseContext.loopNestingLevel;
+        ++parseContext.statementNestingLevel;
+        ++parseContext.controlFlowNestingLevel;
+    }
+      for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
+        parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
+        $$ = parseContext.intermediate.makeAggregate($4, $2.loc);
+        TIntermLoop* forLoop = parseContext.intermediate.addLoop($7, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), true, $1.loc);
+        if (! parseContext.limits.nonInductiveForLoops)
+            parseContext.inductiveLoopCheck($1.loc, $4, forLoop);
+        $$ = parseContext.intermediate.growAggregate($$, forLoop, $1.loc);
+        $$->getAsAggregate()->setOperator(EOpSequence);
+        --parseContext.loopNestingLevel;
+        --parseContext.statementNestingLevel;
+        --parseContext.controlFlowNestingLevel;
+    }
+    ;
+
+for_init_statement
+    : expression_statement {
+        $$ = $1;
+    }
+    | declaration_statement {
+        $$ = $1;
+    }
+    ;
+
+conditionopt
+    : condition {
+        $$ = $1;
+    }
+    | /* May be null */ {
+        $$ = 0;
+    }
+    ;
+
+for_rest_statement
+    : conditionopt SEMICOLON {
+        $$.node1 = $1;
+        $$.node2 = 0;
+    }
+    | conditionopt SEMICOLON expression  {
+        $$.node1 = $1;
+        $$.node2 = $3;
+    }
+    ;
+
+jump_statement
+    : CONTINUE SEMICOLON {
+        if (parseContext.loopNestingLevel <= 0)
+            parseContext.error($1.loc, "continue statement only allowed in loops", "", "");
+        $$ = parseContext.intermediate.addBranch(EOpContinue, $1.loc);
+    }
+    | BREAK SEMICOLON {
+        if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0)
+            parseContext.error($1.loc, "break statement only allowed in switch and loops", "", "");
+        $$ = parseContext.intermediate.addBranch(EOpBreak, $1.loc);
+    }
+    | RETURN SEMICOLON {
+        $$ = parseContext.intermediate.addBranch(EOpReturn, $1.loc);
+        if (parseContext.currentFunctionType->getBasicType() != EbtVoid)
+            parseContext.error($1.loc, "non-void function must return a value", "return", "");
+        if (parseContext.inMain)
+            parseContext.postEntryPointReturn = true;
+    }
+    | RETURN expression SEMICOLON {
+        $$ = parseContext.handleReturnValue($1.loc, $2);
+    }
+    | DISCARD SEMICOLON {
+        parseContext.requireStage($1.loc, EShLangFragment, "discard");
+        $$ = parseContext.intermediate.addBranch(EOpKill, $1.loc);
+    }
+    ;
+
+// Grammar Note:  No 'goto'.  Gotos are not supported.
+
+translation_unit
+    : external_declaration {
+        $$ = $1;
+        parseContext.intermediate.setTreeRoot($$);
+    }
+    | translation_unit external_declaration {
+        if ($2 != nullptr) {
+            $$ = parseContext.intermediate.growAggregate($1, $2);
+            parseContext.intermediate.setTreeRoot($$);
+        }
+    }
+    ;
+
+external_declaration
+    : function_definition {
+        $$ = $1;
+    }
+    | declaration {
+        $$ = $1;
+    }
+GLSLANG_WEB_EXCLUDE_ON
+    | SEMICOLON {
+        parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
+        parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
+        $$ = nullptr;
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+    ;
+
+function_definition
+    : function_prototype {
+        $1.function = parseContext.handleFunctionDeclarator($1.loc, *$1.function, false /* not prototype */);
+        $1.intermNode = parseContext.handleFunctionDefinition($1.loc, *$1.function);
+    }
+    compound_statement_no_new_scope {
+        //   May be best done as post process phase on intermediate code
+        if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue)
+            parseContext.error($1.loc, "function does not return a value:", "", $1.function->getName().c_str());
+        parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
+        $$ = parseContext.intermediate.growAggregate($1.intermNode, $3);
+        parseContext.intermediate.setAggregateOperator($$, EOpFunction, $1.function->getType(), $1.loc);
+        $$->getAsAggregate()->setName($1.function->getMangledName().c_str());
+
+        // store the pragma information for debug and optimize and other vendor specific
+        // information. This information can be queried from the parse tree
+        $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
+        $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
+        $$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable);
+    }
+    ;
+
+GLSLANG_WEB_EXCLUDE_ON
+attribute
+    : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET {
+        $$ = $3;
+        parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_control_flow_attributes, "attribute");
+    }
+
+attribute_list
+    : single_attribute {
+        $$ = $1;
+    }
+    | attribute_list COMMA single_attribute {
+        $$ = parseContext.mergeAttributes($1, $3);
+    }
+
+single_attribute
+    : IDENTIFIER {
+        $$ = parseContext.makeAttributes(*$1.string);
+    }
+    | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN {
+        $$ = parseContext.makeAttributes(*$1.string, $3);
+    }
+GLSLANG_WEB_EXCLUDE_OFF
+
+%%

Разлика између датотеке није приказан због своје велике величине
+ 331 - 293
3rdparty/glslang/glslang/MachineIndependent/glslang.y


Разлика између датотеке није приказан због своје велике величине
+ 519 - 517
3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp


+ 407 - 407
3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h

@@ -45,412 +45,412 @@ extern int yydebug;
 # define YYTOKENTYPE
   enum yytokentype
   {
-    ATTRIBUTE = 258,
-    VARYING = 259,
-    FLOAT16_T = 260,
-    FLOAT = 261,
-    FLOAT32_T = 262,
-    DOUBLE = 263,
-    FLOAT64_T = 264,
-    CONST = 265,
-    BOOL = 266,
-    INT = 267,
-    UINT = 268,
-    INT64_T = 269,
-    UINT64_T = 270,
-    INT32_T = 271,
-    UINT32_T = 272,
-    INT16_T = 273,
-    UINT16_T = 274,
-    INT8_T = 275,
-    UINT8_T = 276,
-    BREAK = 277,
-    CONTINUE = 278,
-    DO = 279,
-    ELSE = 280,
-    FOR = 281,
-    IF = 282,
-    DISCARD = 283,
-    RETURN = 284,
-    SWITCH = 285,
-    CASE = 286,
-    DEFAULT = 287,
-    SUBROUTINE = 288,
-    DEMOTE = 289,
-    BVEC2 = 290,
-    BVEC3 = 291,
-    BVEC4 = 292,
-    IVEC2 = 293,
-    IVEC3 = 294,
-    IVEC4 = 295,
-    UVEC2 = 296,
-    UVEC3 = 297,
-    UVEC4 = 298,
-    I64VEC2 = 299,
-    I64VEC3 = 300,
-    I64VEC4 = 301,
-    U64VEC2 = 302,
-    U64VEC3 = 303,
-    U64VEC4 = 304,
-    I32VEC2 = 305,
-    I32VEC3 = 306,
-    I32VEC4 = 307,
-    U32VEC2 = 308,
-    U32VEC3 = 309,
-    U32VEC4 = 310,
-    I16VEC2 = 311,
-    I16VEC3 = 312,
-    I16VEC4 = 313,
-    U16VEC2 = 314,
-    U16VEC3 = 315,
-    U16VEC4 = 316,
-    I8VEC2 = 317,
-    I8VEC3 = 318,
-    I8VEC4 = 319,
-    U8VEC2 = 320,
-    U8VEC3 = 321,
-    U8VEC4 = 322,
-    VEC2 = 323,
-    VEC3 = 324,
-    VEC4 = 325,
-    MAT2 = 326,
-    MAT3 = 327,
-    MAT4 = 328,
-    CENTROID = 329,
-    IN = 330,
-    OUT = 331,
-    INOUT = 332,
-    UNIFORM = 333,
-    PATCH = 334,
-    SAMPLE = 335,
-    BUFFER = 336,
-    SHARED = 337,
-    NONUNIFORM = 338,
-    PAYLOADNV = 339,
-    PAYLOADINNV = 340,
-    HITATTRNV = 341,
-    CALLDATANV = 342,
-    CALLDATAINNV = 343,
-    COHERENT = 344,
-    VOLATILE = 345,
-    RESTRICT = 346,
-    READONLY = 347,
-    WRITEONLY = 348,
-    DEVICECOHERENT = 349,
-    QUEUEFAMILYCOHERENT = 350,
-    WORKGROUPCOHERENT = 351,
-    SUBGROUPCOHERENT = 352,
-    NONPRIVATE = 353,
-    DVEC2 = 354,
-    DVEC3 = 355,
-    DVEC4 = 356,
-    DMAT2 = 357,
-    DMAT3 = 358,
-    DMAT4 = 359,
-    F16VEC2 = 360,
-    F16VEC3 = 361,
-    F16VEC4 = 362,
-    F16MAT2 = 363,
-    F16MAT3 = 364,
-    F16MAT4 = 365,
-    F32VEC2 = 366,
-    F32VEC3 = 367,
-    F32VEC4 = 368,
-    F32MAT2 = 369,
-    F32MAT3 = 370,
-    F32MAT4 = 371,
-    F64VEC2 = 372,
-    F64VEC3 = 373,
-    F64VEC4 = 374,
-    F64MAT2 = 375,
-    F64MAT3 = 376,
-    F64MAT4 = 377,
-    NOPERSPECTIVE = 378,
-    FLAT = 379,
-    SMOOTH = 380,
-    LAYOUT = 381,
-    EXPLICITINTERPAMD = 382,
-    PERVERTEXNV = 383,
-    PERPRIMITIVENV = 384,
-    PERVIEWNV = 385,
-    PERTASKNV = 386,
-    MAT2X2 = 387,
-    MAT2X3 = 388,
-    MAT2X4 = 389,
-    MAT3X2 = 390,
-    MAT3X3 = 391,
-    MAT3X4 = 392,
-    MAT4X2 = 393,
-    MAT4X3 = 394,
-    MAT4X4 = 395,
-    DMAT2X2 = 396,
-    DMAT2X3 = 397,
-    DMAT2X4 = 398,
-    DMAT3X2 = 399,
-    DMAT3X3 = 400,
-    DMAT3X4 = 401,
-    DMAT4X2 = 402,
-    DMAT4X3 = 403,
-    DMAT4X4 = 404,
-    F16MAT2X2 = 405,
-    F16MAT2X3 = 406,
-    F16MAT2X4 = 407,
-    F16MAT3X2 = 408,
-    F16MAT3X3 = 409,
-    F16MAT3X4 = 410,
-    F16MAT4X2 = 411,
-    F16MAT4X3 = 412,
-    F16MAT4X4 = 413,
-    F32MAT2X2 = 414,
-    F32MAT2X3 = 415,
-    F32MAT2X4 = 416,
-    F32MAT3X2 = 417,
-    F32MAT3X3 = 418,
-    F32MAT3X4 = 419,
-    F32MAT4X2 = 420,
-    F32MAT4X3 = 421,
-    F32MAT4X4 = 422,
-    F64MAT2X2 = 423,
-    F64MAT2X3 = 424,
-    F64MAT2X4 = 425,
-    F64MAT3X2 = 426,
-    F64MAT3X3 = 427,
-    F64MAT3X4 = 428,
-    F64MAT4X2 = 429,
-    F64MAT4X3 = 430,
-    F64MAT4X4 = 431,
-    ATOMIC_UINT = 432,
-    ACCSTRUCTNV = 433,
-    FCOOPMATNV = 434,
-    SAMPLER1D = 435,
-    SAMPLER2D = 436,
-    SAMPLER3D = 437,
-    SAMPLERCUBE = 438,
-    SAMPLER1DSHADOW = 439,
-    SAMPLER2DSHADOW = 440,
-    SAMPLERCUBESHADOW = 441,
-    SAMPLER1DARRAY = 442,
-    SAMPLER2DARRAY = 443,
-    SAMPLER1DARRAYSHADOW = 444,
-    SAMPLER2DARRAYSHADOW = 445,
-    ISAMPLER1D = 446,
-    ISAMPLER2D = 447,
-    ISAMPLER3D = 448,
-    ISAMPLERCUBE = 449,
-    ISAMPLER1DARRAY = 450,
-    ISAMPLER2DARRAY = 451,
-    USAMPLER1D = 452,
-    USAMPLER2D = 453,
-    USAMPLER3D = 454,
-    USAMPLERCUBE = 455,
-    USAMPLER1DARRAY = 456,
-    USAMPLER2DARRAY = 457,
-    SAMPLER2DRECT = 458,
-    SAMPLER2DRECTSHADOW = 459,
-    ISAMPLER2DRECT = 460,
-    USAMPLER2DRECT = 461,
-    SAMPLERBUFFER = 462,
-    ISAMPLERBUFFER = 463,
-    USAMPLERBUFFER = 464,
-    SAMPLERCUBEARRAY = 465,
-    SAMPLERCUBEARRAYSHADOW = 466,
-    ISAMPLERCUBEARRAY = 467,
-    USAMPLERCUBEARRAY = 468,
-    SAMPLER2DMS = 469,
-    ISAMPLER2DMS = 470,
-    USAMPLER2DMS = 471,
-    SAMPLER2DMSARRAY = 472,
-    ISAMPLER2DMSARRAY = 473,
-    USAMPLER2DMSARRAY = 474,
-    SAMPLEREXTERNALOES = 475,
-    SAMPLEREXTERNAL2DY2YEXT = 476,
-    F16SAMPLER1D = 477,
-    F16SAMPLER2D = 478,
-    F16SAMPLER3D = 479,
-    F16SAMPLER2DRECT = 480,
-    F16SAMPLERCUBE = 481,
-    F16SAMPLER1DARRAY = 482,
-    F16SAMPLER2DARRAY = 483,
-    F16SAMPLERCUBEARRAY = 484,
-    F16SAMPLERBUFFER = 485,
-    F16SAMPLER2DMS = 486,
-    F16SAMPLER2DMSARRAY = 487,
-    F16SAMPLER1DSHADOW = 488,
-    F16SAMPLER2DSHADOW = 489,
-    F16SAMPLER1DARRAYSHADOW = 490,
-    F16SAMPLER2DARRAYSHADOW = 491,
-    F16SAMPLER2DRECTSHADOW = 492,
-    F16SAMPLERCUBESHADOW = 493,
-    F16SAMPLERCUBEARRAYSHADOW = 494,
-    SAMPLER = 495,
-    SAMPLERSHADOW = 496,
-    TEXTURE1D = 497,
-    TEXTURE2D = 498,
-    TEXTURE3D = 499,
-    TEXTURECUBE = 500,
-    TEXTURE1DARRAY = 501,
-    TEXTURE2DARRAY = 502,
-    ITEXTURE1D = 503,
-    ITEXTURE2D = 504,
-    ITEXTURE3D = 505,
-    ITEXTURECUBE = 506,
-    ITEXTURE1DARRAY = 507,
-    ITEXTURE2DARRAY = 508,
-    UTEXTURE1D = 509,
-    UTEXTURE2D = 510,
-    UTEXTURE3D = 511,
-    UTEXTURECUBE = 512,
-    UTEXTURE1DARRAY = 513,
-    UTEXTURE2DARRAY = 514,
-    TEXTURE2DRECT = 515,
-    ITEXTURE2DRECT = 516,
-    UTEXTURE2DRECT = 517,
-    TEXTUREBUFFER = 518,
-    ITEXTUREBUFFER = 519,
-    UTEXTUREBUFFER = 520,
-    TEXTURECUBEARRAY = 521,
-    ITEXTURECUBEARRAY = 522,
-    UTEXTURECUBEARRAY = 523,
-    TEXTURE2DMS = 524,
-    ITEXTURE2DMS = 525,
-    UTEXTURE2DMS = 526,
-    TEXTURE2DMSARRAY = 527,
-    ITEXTURE2DMSARRAY = 528,
-    UTEXTURE2DMSARRAY = 529,
-    F16TEXTURE1D = 530,
-    F16TEXTURE2D = 531,
-    F16TEXTURE3D = 532,
-    F16TEXTURE2DRECT = 533,
-    F16TEXTURECUBE = 534,
-    F16TEXTURE1DARRAY = 535,
-    F16TEXTURE2DARRAY = 536,
-    F16TEXTURECUBEARRAY = 537,
-    F16TEXTUREBUFFER = 538,
-    F16TEXTURE2DMS = 539,
-    F16TEXTURE2DMSARRAY = 540,
-    SUBPASSINPUT = 541,
-    SUBPASSINPUTMS = 542,
-    ISUBPASSINPUT = 543,
-    ISUBPASSINPUTMS = 544,
-    USUBPASSINPUT = 545,
-    USUBPASSINPUTMS = 546,
-    F16SUBPASSINPUT = 547,
-    F16SUBPASSINPUTMS = 548,
-    IMAGE1D = 549,
-    IIMAGE1D = 550,
-    UIMAGE1D = 551,
-    IMAGE2D = 552,
-    IIMAGE2D = 553,
-    UIMAGE2D = 554,
-    IMAGE3D = 555,
-    IIMAGE3D = 556,
-    UIMAGE3D = 557,
-    IMAGE2DRECT = 558,
-    IIMAGE2DRECT = 559,
-    UIMAGE2DRECT = 560,
-    IMAGECUBE = 561,
-    IIMAGECUBE = 562,
-    UIMAGECUBE = 563,
-    IMAGEBUFFER = 564,
-    IIMAGEBUFFER = 565,
-    UIMAGEBUFFER = 566,
-    IMAGE1DARRAY = 567,
-    IIMAGE1DARRAY = 568,
-    UIMAGE1DARRAY = 569,
-    IMAGE2DARRAY = 570,
-    IIMAGE2DARRAY = 571,
-    UIMAGE2DARRAY = 572,
-    IMAGECUBEARRAY = 573,
-    IIMAGECUBEARRAY = 574,
-    UIMAGECUBEARRAY = 575,
-    IMAGE2DMS = 576,
-    IIMAGE2DMS = 577,
-    UIMAGE2DMS = 578,
-    IMAGE2DMSARRAY = 579,
-    IIMAGE2DMSARRAY = 580,
-    UIMAGE2DMSARRAY = 581,
-    F16IMAGE1D = 582,
-    F16IMAGE2D = 583,
-    F16IMAGE3D = 584,
-    F16IMAGE2DRECT = 585,
-    F16IMAGECUBE = 586,
-    F16IMAGE1DARRAY = 587,
-    F16IMAGE2DARRAY = 588,
-    F16IMAGECUBEARRAY = 589,
-    F16IMAGEBUFFER = 590,
-    F16IMAGE2DMS = 591,
-    F16IMAGE2DMSARRAY = 592,
-    STRUCT = 593,
-    VOID = 594,
-    WHILE = 595,
-    IDENTIFIER = 596,
-    TYPE_NAME = 597,
-    FLOATCONSTANT = 598,
-    DOUBLECONSTANT = 599,
-    INT16CONSTANT = 600,
-    UINT16CONSTANT = 601,
-    INT32CONSTANT = 602,
-    UINT32CONSTANT = 603,
-    INTCONSTANT = 604,
-    UINTCONSTANT = 605,
-    INT64CONSTANT = 606,
-    UINT64CONSTANT = 607,
-    BOOLCONSTANT = 608,
-    FLOAT16CONSTANT = 609,
-    LEFT_OP = 610,
-    RIGHT_OP = 611,
-    INC_OP = 612,
-    DEC_OP = 613,
-    LE_OP = 614,
-    GE_OP = 615,
-    EQ_OP = 616,
-    NE_OP = 617,
-    AND_OP = 618,
-    OR_OP = 619,
-    XOR_OP = 620,
-    MUL_ASSIGN = 621,
-    DIV_ASSIGN = 622,
-    ADD_ASSIGN = 623,
-    MOD_ASSIGN = 624,
-    LEFT_ASSIGN = 625,
-    RIGHT_ASSIGN = 626,
-    AND_ASSIGN = 627,
-    XOR_ASSIGN = 628,
-    OR_ASSIGN = 629,
-    SUB_ASSIGN = 630,
-    LEFT_PAREN = 631,
-    RIGHT_PAREN = 632,
-    LEFT_BRACKET = 633,
-    RIGHT_BRACKET = 634,
-    LEFT_BRACE = 635,
-    RIGHT_BRACE = 636,
-    DOT = 637,
-    COMMA = 638,
-    COLON = 639,
-    EQUAL = 640,
-    SEMICOLON = 641,
-    BANG = 642,
-    DASH = 643,
-    TILDE = 644,
-    PLUS = 645,
-    STAR = 646,
-    SLASH = 647,
-    PERCENT = 648,
-    LEFT_ANGLE = 649,
-    RIGHT_ANGLE = 650,
-    VERTICAL_BAR = 651,
-    CARET = 652,
-    AMPERSAND = 653,
-    QUESTION = 654,
-    INVARIANT = 655,
-    PRECISE = 656,
-    HIGH_PRECISION = 657,
-    MEDIUM_PRECISION = 658,
-    LOW_PRECISION = 659,
-    PRECISION = 660,
-    PACKED = 661,
-    RESOURCE = 662,
-    SUPERP = 663
+    CONST = 258,
+    BOOL = 259,
+    INT = 260,
+    UINT = 261,
+    FLOAT = 262,
+    BVEC2 = 263,
+    BVEC3 = 264,
+    BVEC4 = 265,
+    IVEC2 = 266,
+    IVEC3 = 267,
+    IVEC4 = 268,
+    UVEC2 = 269,
+    UVEC3 = 270,
+    UVEC4 = 271,
+    VEC2 = 272,
+    VEC3 = 273,
+    VEC4 = 274,
+    MAT2 = 275,
+    MAT3 = 276,
+    MAT4 = 277,
+    MAT2X2 = 278,
+    MAT2X3 = 279,
+    MAT2X4 = 280,
+    MAT3X2 = 281,
+    MAT3X3 = 282,
+    MAT3X4 = 283,
+    MAT4X2 = 284,
+    MAT4X3 = 285,
+    MAT4X4 = 286,
+    SAMPLER2D = 287,
+    SAMPLER3D = 288,
+    SAMPLERCUBE = 289,
+    SAMPLER2DSHADOW = 290,
+    SAMPLERCUBESHADOW = 291,
+    SAMPLER2DARRAY = 292,
+    SAMPLER2DARRAYSHADOW = 293,
+    ISAMPLER2D = 294,
+    ISAMPLER3D = 295,
+    ISAMPLERCUBE = 296,
+    ISAMPLER2DARRAY = 297,
+    USAMPLER2D = 298,
+    USAMPLER3D = 299,
+    USAMPLERCUBE = 300,
+    USAMPLER2DARRAY = 301,
+    SAMPLERCUBEARRAY = 302,
+    SAMPLERCUBEARRAYSHADOW = 303,
+    ISAMPLERCUBEARRAY = 304,
+    USAMPLERCUBEARRAY = 305,
+    ATTRIBUTE = 306,
+    VARYING = 307,
+    FLOAT16_T = 308,
+    FLOAT32_T = 309,
+    DOUBLE = 310,
+    FLOAT64_T = 311,
+    INT64_T = 312,
+    UINT64_T = 313,
+    INT32_T = 314,
+    UINT32_T = 315,
+    INT16_T = 316,
+    UINT16_T = 317,
+    INT8_T = 318,
+    UINT8_T = 319,
+    I64VEC2 = 320,
+    I64VEC3 = 321,
+    I64VEC4 = 322,
+    U64VEC2 = 323,
+    U64VEC3 = 324,
+    U64VEC4 = 325,
+    I32VEC2 = 326,
+    I32VEC3 = 327,
+    I32VEC4 = 328,
+    U32VEC2 = 329,
+    U32VEC3 = 330,
+    U32VEC4 = 331,
+    I16VEC2 = 332,
+    I16VEC3 = 333,
+    I16VEC4 = 334,
+    U16VEC2 = 335,
+    U16VEC3 = 336,
+    U16VEC4 = 337,
+    I8VEC2 = 338,
+    I8VEC3 = 339,
+    I8VEC4 = 340,
+    U8VEC2 = 341,
+    U8VEC3 = 342,
+    U8VEC4 = 343,
+    DVEC2 = 344,
+    DVEC3 = 345,
+    DVEC4 = 346,
+    DMAT2 = 347,
+    DMAT3 = 348,
+    DMAT4 = 349,
+    F16VEC2 = 350,
+    F16VEC3 = 351,
+    F16VEC4 = 352,
+    F16MAT2 = 353,
+    F16MAT3 = 354,
+    F16MAT4 = 355,
+    F32VEC2 = 356,
+    F32VEC3 = 357,
+    F32VEC4 = 358,
+    F32MAT2 = 359,
+    F32MAT3 = 360,
+    F32MAT4 = 361,
+    F64VEC2 = 362,
+    F64VEC3 = 363,
+    F64VEC4 = 364,
+    F64MAT2 = 365,
+    F64MAT3 = 366,
+    F64MAT4 = 367,
+    DMAT2X2 = 368,
+    DMAT2X3 = 369,
+    DMAT2X4 = 370,
+    DMAT3X2 = 371,
+    DMAT3X3 = 372,
+    DMAT3X4 = 373,
+    DMAT4X2 = 374,
+    DMAT4X3 = 375,
+    DMAT4X4 = 376,
+    F16MAT2X2 = 377,
+    F16MAT2X3 = 378,
+    F16MAT2X4 = 379,
+    F16MAT3X2 = 380,
+    F16MAT3X3 = 381,
+    F16MAT3X4 = 382,
+    F16MAT4X2 = 383,
+    F16MAT4X3 = 384,
+    F16MAT4X4 = 385,
+    F32MAT2X2 = 386,
+    F32MAT2X3 = 387,
+    F32MAT2X4 = 388,
+    F32MAT3X2 = 389,
+    F32MAT3X3 = 390,
+    F32MAT3X4 = 391,
+    F32MAT4X2 = 392,
+    F32MAT4X3 = 393,
+    F32MAT4X4 = 394,
+    F64MAT2X2 = 395,
+    F64MAT2X3 = 396,
+    F64MAT2X4 = 397,
+    F64MAT3X2 = 398,
+    F64MAT3X3 = 399,
+    F64MAT3X4 = 400,
+    F64MAT4X2 = 401,
+    F64MAT4X3 = 402,
+    F64MAT4X4 = 403,
+    ATOMIC_UINT = 404,
+    ACCSTRUCTNV = 405,
+    FCOOPMATNV = 406,
+    SAMPLER1D = 407,
+    SAMPLER1DARRAY = 408,
+    SAMPLER1DARRAYSHADOW = 409,
+    ISAMPLER1D = 410,
+    SAMPLER1DSHADOW = 411,
+    SAMPLER2DRECT = 412,
+    SAMPLER2DRECTSHADOW = 413,
+    ISAMPLER2DRECT = 414,
+    USAMPLER2DRECT = 415,
+    SAMPLERBUFFER = 416,
+    ISAMPLERBUFFER = 417,
+    USAMPLERBUFFER = 418,
+    SAMPLER2DMS = 419,
+    ISAMPLER2DMS = 420,
+    USAMPLER2DMS = 421,
+    SAMPLER2DMSARRAY = 422,
+    ISAMPLER2DMSARRAY = 423,
+    USAMPLER2DMSARRAY = 424,
+    SAMPLEREXTERNALOES = 425,
+    SAMPLEREXTERNAL2DY2YEXT = 426,
+    ISAMPLER1DARRAY = 427,
+    USAMPLER1D = 428,
+    USAMPLER1DARRAY = 429,
+    F16SAMPLER1D = 430,
+    F16SAMPLER2D = 431,
+    F16SAMPLER3D = 432,
+    F16SAMPLER2DRECT = 433,
+    F16SAMPLERCUBE = 434,
+    F16SAMPLER1DARRAY = 435,
+    F16SAMPLER2DARRAY = 436,
+    F16SAMPLERCUBEARRAY = 437,
+    F16SAMPLERBUFFER = 438,
+    F16SAMPLER2DMS = 439,
+    F16SAMPLER2DMSARRAY = 440,
+    F16SAMPLER1DSHADOW = 441,
+    F16SAMPLER2DSHADOW = 442,
+    F16SAMPLER1DARRAYSHADOW = 443,
+    F16SAMPLER2DARRAYSHADOW = 444,
+    F16SAMPLER2DRECTSHADOW = 445,
+    F16SAMPLERCUBESHADOW = 446,
+    F16SAMPLERCUBEARRAYSHADOW = 447,
+    IMAGE1D = 448,
+    IIMAGE1D = 449,
+    UIMAGE1D = 450,
+    IMAGE2D = 451,
+    IIMAGE2D = 452,
+    UIMAGE2D = 453,
+    IMAGE3D = 454,
+    IIMAGE3D = 455,
+    UIMAGE3D = 456,
+    IMAGE2DRECT = 457,
+    IIMAGE2DRECT = 458,
+    UIMAGE2DRECT = 459,
+    IMAGECUBE = 460,
+    IIMAGECUBE = 461,
+    UIMAGECUBE = 462,
+    IMAGEBUFFER = 463,
+    IIMAGEBUFFER = 464,
+    UIMAGEBUFFER = 465,
+    IMAGE1DARRAY = 466,
+    IIMAGE1DARRAY = 467,
+    UIMAGE1DARRAY = 468,
+    IMAGE2DARRAY = 469,
+    IIMAGE2DARRAY = 470,
+    UIMAGE2DARRAY = 471,
+    IMAGECUBEARRAY = 472,
+    IIMAGECUBEARRAY = 473,
+    UIMAGECUBEARRAY = 474,
+    IMAGE2DMS = 475,
+    IIMAGE2DMS = 476,
+    UIMAGE2DMS = 477,
+    IMAGE2DMSARRAY = 478,
+    IIMAGE2DMSARRAY = 479,
+    UIMAGE2DMSARRAY = 480,
+    F16IMAGE1D = 481,
+    F16IMAGE2D = 482,
+    F16IMAGE3D = 483,
+    F16IMAGE2DRECT = 484,
+    F16IMAGECUBE = 485,
+    F16IMAGE1DARRAY = 486,
+    F16IMAGE2DARRAY = 487,
+    F16IMAGECUBEARRAY = 488,
+    F16IMAGEBUFFER = 489,
+    F16IMAGE2DMS = 490,
+    F16IMAGE2DMSARRAY = 491,
+    SAMPLER = 492,
+    SAMPLERSHADOW = 493,
+    TEXTURE1D = 494,
+    TEXTURE2D = 495,
+    TEXTURE3D = 496,
+    TEXTURECUBE = 497,
+    TEXTURE1DARRAY = 498,
+    TEXTURE2DARRAY = 499,
+    ITEXTURE1D = 500,
+    ITEXTURE2D = 501,
+    ITEXTURE3D = 502,
+    ITEXTURECUBE = 503,
+    ITEXTURE1DARRAY = 504,
+    ITEXTURE2DARRAY = 505,
+    UTEXTURE1D = 506,
+    UTEXTURE2D = 507,
+    UTEXTURE3D = 508,
+    UTEXTURECUBE = 509,
+    UTEXTURE1DARRAY = 510,
+    UTEXTURE2DARRAY = 511,
+    TEXTURE2DRECT = 512,
+    ITEXTURE2DRECT = 513,
+    UTEXTURE2DRECT = 514,
+    TEXTUREBUFFER = 515,
+    ITEXTUREBUFFER = 516,
+    UTEXTUREBUFFER = 517,
+    TEXTURECUBEARRAY = 518,
+    ITEXTURECUBEARRAY = 519,
+    UTEXTURECUBEARRAY = 520,
+    TEXTURE2DMS = 521,
+    ITEXTURE2DMS = 522,
+    UTEXTURE2DMS = 523,
+    TEXTURE2DMSARRAY = 524,
+    ITEXTURE2DMSARRAY = 525,
+    UTEXTURE2DMSARRAY = 526,
+    F16TEXTURE1D = 527,
+    F16TEXTURE2D = 528,
+    F16TEXTURE3D = 529,
+    F16TEXTURE2DRECT = 530,
+    F16TEXTURECUBE = 531,
+    F16TEXTURE1DARRAY = 532,
+    F16TEXTURE2DARRAY = 533,
+    F16TEXTURECUBEARRAY = 534,
+    F16TEXTUREBUFFER = 535,
+    F16TEXTURE2DMS = 536,
+    F16TEXTURE2DMSARRAY = 537,
+    SUBPASSINPUT = 538,
+    SUBPASSINPUTMS = 539,
+    ISUBPASSINPUT = 540,
+    ISUBPASSINPUTMS = 541,
+    USUBPASSINPUT = 542,
+    USUBPASSINPUTMS = 543,
+    F16SUBPASSINPUT = 544,
+    F16SUBPASSINPUTMS = 545,
+    LEFT_OP = 546,
+    RIGHT_OP = 547,
+    INC_OP = 548,
+    DEC_OP = 549,
+    LE_OP = 550,
+    GE_OP = 551,
+    EQ_OP = 552,
+    NE_OP = 553,
+    AND_OP = 554,
+    OR_OP = 555,
+    XOR_OP = 556,
+    MUL_ASSIGN = 557,
+    DIV_ASSIGN = 558,
+    ADD_ASSIGN = 559,
+    MOD_ASSIGN = 560,
+    LEFT_ASSIGN = 561,
+    RIGHT_ASSIGN = 562,
+    AND_ASSIGN = 563,
+    XOR_ASSIGN = 564,
+    OR_ASSIGN = 565,
+    SUB_ASSIGN = 566,
+    LEFT_PAREN = 567,
+    RIGHT_PAREN = 568,
+    LEFT_BRACKET = 569,
+    RIGHT_BRACKET = 570,
+    LEFT_BRACE = 571,
+    RIGHT_BRACE = 572,
+    DOT = 573,
+    COMMA = 574,
+    COLON = 575,
+    EQUAL = 576,
+    SEMICOLON = 577,
+    BANG = 578,
+    DASH = 579,
+    TILDE = 580,
+    PLUS = 581,
+    STAR = 582,
+    SLASH = 583,
+    PERCENT = 584,
+    LEFT_ANGLE = 585,
+    RIGHT_ANGLE = 586,
+    VERTICAL_BAR = 587,
+    CARET = 588,
+    AMPERSAND = 589,
+    QUESTION = 590,
+    INVARIANT = 591,
+    HIGH_PRECISION = 592,
+    MEDIUM_PRECISION = 593,
+    LOW_PRECISION = 594,
+    PRECISION = 595,
+    PACKED = 596,
+    RESOURCE = 597,
+    SUPERP = 598,
+    FLOATCONSTANT = 599,
+    INTCONSTANT = 600,
+    UINTCONSTANT = 601,
+    BOOLCONSTANT = 602,
+    IDENTIFIER = 603,
+    TYPE_NAME = 604,
+    CENTROID = 605,
+    IN = 606,
+    OUT = 607,
+    INOUT = 608,
+    STRUCT = 609,
+    VOID = 610,
+    WHILE = 611,
+    BREAK = 612,
+    CONTINUE = 613,
+    DO = 614,
+    ELSE = 615,
+    FOR = 616,
+    IF = 617,
+    DISCARD = 618,
+    RETURN = 619,
+    SWITCH = 620,
+    CASE = 621,
+    DEFAULT = 622,
+    UNIFORM = 623,
+    SHARED = 624,
+    FLAT = 625,
+    SMOOTH = 626,
+    LAYOUT = 627,
+    DOUBLECONSTANT = 628,
+    INT16CONSTANT = 629,
+    UINT16CONSTANT = 630,
+    FLOAT16CONSTANT = 631,
+    INT32CONSTANT = 632,
+    UINT32CONSTANT = 633,
+    INT64CONSTANT = 634,
+    UINT64CONSTANT = 635,
+    SUBROUTINE = 636,
+    DEMOTE = 637,
+    PAYLOADNV = 638,
+    PAYLOADINNV = 639,
+    HITATTRNV = 640,
+    CALLDATANV = 641,
+    CALLDATAINNV = 642,
+    PATCH = 643,
+    SAMPLE = 644,
+    BUFFER = 645,
+    NONUNIFORM = 646,
+    COHERENT = 647,
+    VOLATILE = 648,
+    RESTRICT = 649,
+    READONLY = 650,
+    WRITEONLY = 651,
+    DEVICECOHERENT = 652,
+    QUEUEFAMILYCOHERENT = 653,
+    WORKGROUPCOHERENT = 654,
+    SUBGROUPCOHERENT = 655,
+    NONPRIVATE = 656,
+    NOPERSPECTIVE = 657,
+    EXPLICITINTERPAMD = 658,
+    PERVERTEXNV = 659,
+    PERPRIMITIVENV = 660,
+    PERVIEWNV = 661,
+    PERTASKNV = 662,
+    PRECISE = 663
   };
 #endif
 
@@ -459,7 +459,7 @@ extern int yydebug;
 
 union YYSTYPE
 {
-#line 71 "MachineIndependent/glslang.y" /* yacc.c:1909  */
+#line 96 "MachineIndependent/glslang.y" /* yacc.c:1909  */
 
     struct {
         glslang::TSourceLoc loc;

+ 5 - 25
3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp

@@ -35,6 +35,8 @@
 // POSSIBILITY OF SUCH DAMAGE.
 //
 
+#ifndef GLSLANG_WEB
+
 #include "localintermediate.h"
 #include "../Include/InfoSink.h"
 
@@ -174,7 +176,7 @@ bool TOutputTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node)
     case EOpIndexIndirect: out.debug << "indirect index"; break;
     case EOpIndexDirectStruct:
         {
-            bool reference = node->getLeft()->getType().getBasicType() == EbtReference;
+            bool reference = node->getLeft()->getType().isReference();
             const TTypeList *members = reference ? node->getLeft()->getType().getReferentType()->getStruct() : node->getLeft()->getType().getStruct();
             out.debug << (*members)[node->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst()].type->getFieldName();
             out.debug << ": direct index for structure";      break;
@@ -615,7 +617,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
     case EOpSubgroupQuadSwapVertical:        out.debug << "subgroupQuadSwapVertical";        break;
     case EOpSubgroupQuadSwapDiagonal:        out.debug << "subgroupQuadSwapDiagonal";        break;
 
-#ifdef NV_EXTENSIONS
     case EOpSubgroupPartition:                          out.debug << "subgroupPartitionNV";                          break;
     case EOpSubgroupPartitionedAdd:                     out.debug << "subgroupPartitionedAddNV";                     break;
     case EOpSubgroupPartitionedMul:                     out.debug << "subgroupPartitionedMulNV";                     break;
@@ -638,7 +639,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
     case EOpSubgroupPartitionedExclusiveAnd:            out.debug << "subgroupPartitionedExclusiveAndNV";            break;
     case EOpSubgroupPartitionedExclusiveOr:             out.debug << "subgroupPartitionedExclusiveOrNV";             break;
     case EOpSubgroupPartitionedExclusiveXor:            out.debug << "subgroupPartitionedExclusiveXorNV";            break;
-#endif
 
     case EOpClip:                   out.debug << "clip";                  break;
     case EOpIsFinite:               out.debug << "isfinite";              break;
@@ -648,7 +648,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
 
     case EOpSparseTexelsResident:   out.debug << "sparseTexelsResident";  break;
 
-#ifdef AMD_EXTENSIONS
     case EOpMinInvocations:             out.debug << "minInvocations";              break;
     case EOpMaxInvocations:             out.debug << "maxInvocations";              break;
     case EOpAddInvocations:             out.debug << "addInvocations";              break;
@@ -677,7 +676,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
 
     case EOpCubeFaceIndex:          out.debug << "cubeFaceIndex";               break;
     case EOpCubeFaceCoord:          out.debug << "cubeFaceCoord";               break;
-#endif
 
     case EOpSubpassLoad:   out.debug << "subpassLoad";   break;
     case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
@@ -863,7 +861,6 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
 
     case EOpReadInvocation:             out.debug << "readInvocation";        break;
 
-#ifdef AMD_EXTENSIONS
     case EOpSwizzleInvocations:         out.debug << "swizzleInvocations";       break;
     case EOpSwizzleInvocationsMasked:   out.debug << "swizzleInvocationsMasked"; break;
     case EOpWriteInvocation:            out.debug << "writeInvocation";          break;
@@ -871,9 +868,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
     case EOpMin3:                       out.debug << "min3";                  break;
     case EOpMax3:                       out.debug << "max3";                  break;
     case EOpMid3:                       out.debug << "mid3";                  break;
-
     case EOpTime:                       out.debug << "time";                  break;
-#endif
 
     case EOpAtomicAdd:                  out.debug << "AtomicAdd";             break;
     case EOpAtomicMin:                  out.debug << "AtomicMin";             break;
@@ -910,10 +905,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
     case EOpImageAtomicCompSwap:        out.debug << "imageAtomicCompSwap";   break;
     case EOpImageAtomicLoad:            out.debug << "imageAtomicLoad";       break;
     case EOpImageAtomicStore:           out.debug << "imageAtomicStore";      break;
-#ifdef AMD_EXTENSIONS
     case EOpImageLoadLod:               out.debug << "imageLoadLod";          break;
     case EOpImageStoreLod:              out.debug << "imageStoreLod";         break;
-#endif
 
     case EOpTextureQuerySize:           out.debug << "textureSize";           break;
     case EOpTextureQueryLod:            out.debug << "textureQueryLod";       break;
@@ -940,11 +933,9 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
     case EOpTextureOffsetClamp:         out.debug << "textureOffsetClamp";    break;
     case EOpTextureGradClamp:           out.debug << "textureGradClamp";      break;
     case EOpTextureGradOffsetClamp:     out.debug << "textureGradOffsetClamp";  break;
-#ifdef AMD_EXTENSIONS
     case EOpTextureGatherLod:           out.debug << "textureGatherLod";        break;
     case EOpTextureGatherLodOffset:     out.debug << "textureGatherLodOffset";  break;
     case EOpTextureGatherLodOffsets:    out.debug << "textureGatherLodOffsets"; break;
-#endif
 
     case EOpSparseTexture:                  out.debug << "sparseTexture";                   break;
     case EOpSparseTextureOffset:            out.debug << "sparseTextureOffset";             break;
@@ -962,19 +953,15 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
     case EOpSparseTextureOffsetClamp:       out.debug << "sparseTextureOffsetClamp";        break;
     case EOpSparseTextureGradClamp:         out.debug << "sparseTextureGradClamp";          break;
     case EOpSparseTextureGradOffsetClamp:   out.debug << "sparseTextureGradOffsetClam";     break;
-#ifdef AMD_EXTENSIONS
     case EOpSparseTextureGatherLod:         out.debug << "sparseTextureGatherLod";          break;
     case EOpSparseTextureGatherLodOffset:   out.debug << "sparseTextureGatherLodOffset";    break;
     case EOpSparseTextureGatherLodOffsets:  out.debug << "sparseTextureGatherLodOffsets";   break;
     case EOpSparseImageLoadLod:             out.debug << "sparseImageLoadLod";              break;
-#endif
-#ifdef NV_EXTENSIONS
     case EOpImageSampleFootprintNV:             out.debug << "imageSampleFootprintNV";          break;
     case EOpImageSampleFootprintClampNV:        out.debug << "imageSampleFootprintClampNV";     break;
     case EOpImageSampleFootprintLodNV:          out.debug << "imageSampleFootprintLodNV";       break;
     case EOpImageSampleFootprintGradNV:         out.debug << "imageSampleFootprintGradNV";      break;
     case EOpImageSampleFootprintGradClampNV:    out.debug << "mageSampleFootprintGradClampNV";  break;
-#endif
     case EOpAddCarry:                   out.debug << "addCarry";              break;
     case EOpSubBorrow:                  out.debug << "subBorrow";             break;
     case EOpUMulExtended:               out.debug << "uMulExtended";          break;
@@ -988,9 +975,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
 
     case EOpInterpolateAtSample:   out.debug << "interpolateAtSample";    break;
     case EOpInterpolateAtOffset:   out.debug << "interpolateAtOffset";    break;
-#ifdef AMD_EXTENSIONS
     case EOpInterpolateAtVertex:   out.debug << "interpolateAtVertex";    break;
-#endif
 
     case EOpSinCos:                     out.debug << "sincos";                break;
     case EOpGenMul:                     out.debug << "mul";                   break;
@@ -1057,7 +1042,6 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
     case EOpSubgroupQuadSwapVertical:        out.debug << "subgroupQuadSwapVertical"; break;
     case EOpSubgroupQuadSwapDiagonal:        out.debug << "subgroupQuadSwapDiagonal"; break;
 
-#ifdef NV_EXTENSIONS
     case EOpSubgroupPartition:                          out.debug << "subgroupPartitionNV";                          break;
     case EOpSubgroupPartitionedAdd:                     out.debug << "subgroupPartitionedAddNV";                     break;
     case EOpSubgroupPartitionedMul:                     out.debug << "subgroupPartitionedMulNV";                     break;
@@ -1080,19 +1064,16 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
     case EOpSubgroupPartitionedExclusiveAnd:            out.debug << "subgroupPartitionedExclusiveAndNV";            break;
     case EOpSubgroupPartitionedExclusiveOr:             out.debug << "subgroupPartitionedExclusiveOrNV";             break;
     case EOpSubgroupPartitionedExclusiveXor:            out.debug << "subgroupPartitionedExclusiveXorNV";            break;
-#endif
 
     case EOpSubpassLoad:   out.debug << "subpassLoad";   break;
     case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
 
-#ifdef NV_EXTENSIONS
     case EOpTraceNV:                          out.debug << "traceNV"; break;
     case EOpReportIntersectionNV:             out.debug << "reportIntersectionNV"; break;
     case EOpIgnoreIntersectionNV:             out.debug << "ignoreIntersectionNV"; break;
     case EOpTerminateRayNV:                   out.debug << "terminateRayNV"; break;
     case EOpExecuteCallableNV:                out.debug << "executeCallableNV"; break;
     case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break;
-#endif
 
     case EOpCooperativeMatrixLoad:  out.debug << "Load cooperative matrix";  break;
     case EOpCooperativeMatrixStore:  out.debug << "Store cooperative matrix";  break;
@@ -1509,16 +1490,13 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
             infoSink.debug << "interlock ordering = " << TQualifier::getInterlockOrderingString(interlockOrdering) << "\n";
         break;
 
-#ifdef NV_EXTENSIONS
     case EShLangMeshNV:
         infoSink.debug << "max_vertices = " << vertices << "\n";
         infoSink.debug << "max_primitives = " << primitives << "\n";
         infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
         // Fall through
-
     case EShLangTaskNV:
         // Fall through
-#endif
     case EShLangCompute:
         infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n";
         {
@@ -1547,3 +1525,5 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
 }
 
 } // end namespace glslang
+
+#endif // not GLSLANG_WEB

+ 15 - 4
3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp

@@ -33,6 +33,8 @@
 // POSSIBILITY OF SUCH DAMAGE.
 //
 
+#ifndef GLSLANG_WEB
+
 #include "../Include/Common.h"
 #include "../Include/InfoSink.h"
 
@@ -75,7 +77,7 @@ public:
             target = &inputList;
         else if (base->getQualifier().storage == EvqVaryingOut)
             target = &outputList;
-        else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().layoutPushConstant)
+        else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().isPushConstant())
             target = &uniformList;
         if (target) {
             TVarEntryInfo ent = {base->getId(), base, ! traverseAll};
@@ -355,7 +357,7 @@ struct TSymbolValidater
                 }
                 return;
             }
-        } else if (base->getQualifier().isUniformOrBuffer() && ! base->getQualifier().layoutPushConstant) {
+        } else if (base->getQualifier().isUniformOrBuffer() && ! base->getQualifier().isPushConstant()) {
             // validate uniform type;
             for (int i = 0; i < EShLangCount; i++) {
                 if (i != currentStage && outVarMaps[i] != nullptr) {
@@ -475,7 +477,7 @@ int TDefaultIoResolverBase::resolveUniformLocation(EShLanguage /*stage*/, TVarEn
     }
     // no locations added if already present, a built-in variable, a block, or an opaque
     if (type.getQualifier().hasLocation() || type.isBuiltIn() || type.getBasicType() == EbtBlock ||
-        type.getBasicType() == EbtAtomicUint || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) {
+        type.isAtomic() || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) {
         return ent.newLocation = -1;
     }
     // no locations on blocks of built-in variables
@@ -672,7 +674,7 @@ int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEn
     } else {
         // no locations added if already present, a built-in variable, a block, or an opaque
         if (type.getQualifier().hasLocation() || type.isBuiltIn() || type.getBasicType() == EbtBlock ||
-            type.getBasicType() == EbtAtomicUint || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) {
+            type.isAtomic() || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) {
             return ent.newLocation = -1;
         }
         // no locations on blocks of built-in variables
@@ -943,6 +945,7 @@ struct TDefaultIoResolver : public TDefaultIoResolverBase {
     }
 };
 
+#ifdef ENABLE_HLSL
 /********************************************************************************
 The following IO resolver maps types in HLSL register space, as follows:
 
@@ -1023,6 +1026,7 @@ struct TDefaultHlslIoResolver : public TDefaultIoResolverBase {
         return ent.newBinding = -1;
     }
 };
+#endif
 
 // Map I/O variables to provided offsets, and make bindings for
 // unbound but live variables.
@@ -1044,6 +1048,7 @@ 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(intermediate);
+#ifdef ENABLE_HLSL
     TDefaultHlslIoResolver defaultHlslResolver(intermediate);
     if (resolver == nullptr) {
         // TODO: use a passed in IO mapper for this
@@ -1053,6 +1058,10 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSi
             resolver = &defaultResolver;
     }
     resolver->addStage(stage);
+#else
+    resolver = &defaultResolver;
+#endif
+
     TVarLiveMap inVarMap, outVarMap, uniformVarMap;
     TVarLiveVector inVector, outVector, uniformVector;
     TVarGatherTraverser iter_binding_all(intermediate, true, inVarMap, outVarMap, uniformVarMap);
@@ -1232,3 +1241,5 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
 }
 
 } // end namespace glslang
+
+#endif // GLSLANG_WEB

+ 5 - 1
3rdparty/glslang/glslang/MachineIndependent/iomapper.h

@@ -33,6 +33,8 @@
 // POSSIBILITY OF SUCH DAMAGE.
 //
 
+#ifndef GLSLANG_WEB
+
 #ifndef _IOMAPPER_INCLUDED
 #define _IOMAPPER_INCLUDED
 
@@ -176,7 +178,7 @@ protected:
 
     // Return true if this is a UAV (unordered access view) type:
     static bool isUavType(const glslang::TType& type) {
-        if (type.getQualifier().readonly)
+        if (type.getQualifier().isReadOnly())
             return false;
         return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) ||
                 (type.getQualifier().storage == EvqBuffer);
@@ -293,3 +295,5 @@ public:
 } // end namespace glslang
 
 #endif // _IOMAPPER_INCLUDED
+
+#endif //  GLSLANG_WEB

+ 2 - 0
3rdparty/glslang/glslang/MachineIndependent/limits.cpp

@@ -187,12 +187,14 @@ bool TIndexTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node)
 //
 void TParseContext::constantIndexExpressionCheck(TIntermNode* index)
 {
+#ifndef GLSLANG_WEB
     TIndexTraverser it(inductiveLoopIds);
 
     index->traverse(&it);
 
     if (it.bad)
         error(it.badLoc, "Non-constant-index-expression", "limitations", "");
+#endif
 }
 
 } // end namespace glslang

+ 45 - 80
3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp

@@ -56,8 +56,10 @@ namespace glslang {
 //
 void TIntermediate::error(TInfoSink& infoSink, const char* message)
 {
+#ifndef GLSLANG_WEB
     infoSink.info.prefix(EPrefixError);
     infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
+#endif
 
     ++numErrors;
 }
@@ -65,8 +67,10 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message)
 // Link-time warning.
 void TIntermediate::warn(TInfoSink& infoSink, const char* message)
 {
+#ifndef GLSLANG_WEB
     infoSink.info.prefix(EPrefixWarning);
     infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n";
+#endif
 }
 
 // TODO: 4.4 offset/align:  "Two blocks linked together in the same program with the same block
@@ -78,9 +82,11 @@ void TIntermediate::warn(TInfoSink& infoSink, const char* message)
 //
 void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
 {
+#ifndef GLSLANG_WEB
     mergeCallGraphs(infoSink, unit);
     mergeModes(infoSink, unit);
     mergeTrees(infoSink, unit);
+#endif
 }
 
 void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit)
@@ -98,6 +104,8 @@ void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit)
     callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end());
 }
 
+#ifndef GLSLANG_WEB
+
 #define MERGE_MAX(member) member = std::max(member, unit.member)
 #define MERGE_TRUE(member) if (unit.member) member = unit.member;
 
@@ -106,9 +114,9 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
     if (language != unit.language)
         error(infoSink, "stages must match when linking into a single stage");
 
-    if (source == EShSourceNone)
-        source = unit.source;
-    if (source != unit.source)
+    if (getSource() == EShSourceNone)
+        setSource(unit.getSource());
+    if (getSource() != unit.getSource())
         error(infoSink, "can't link compilation units from different source languages");
 
     if (treeRoot == nullptr) {
@@ -116,7 +124,7 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
         version = unit.version;
         requestedExtensions = unit.requestedExtensions;
     } else {
-        if ((profile == EEsProfile) != (unit.profile == EEsProfile))
+        if ((isEsProfile()) != (unit.isEsProfile()))
             error(infoSink, "Cannot cross link ES and desktop profiles");
         else if (unit.profile == ECompatibilityProfile)
             profile = ECompatibilityProfile;
@@ -142,18 +150,13 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
     if (vertices == TQualifier::layoutNotSet)
         vertices = unit.vertices;
     else if (vertices != unit.vertices) {
-        if (language == EShLangGeometry
-#ifdef NV_EXTENSIONS
-            || language == EShLangMeshNV
-#endif
-            )
+        if (language == EShLangGeometry || language == EShLangMeshNV)
             error(infoSink, "Contradictory layout max_vertices values");
         else if (language == EShLangTessControl)
             error(infoSink, "Contradictory layout vertices values");
         else
             assert(0);
     }
-#ifdef NV_EXTENSIONS
     if (primitives == TQualifier::layoutNotSet)
         primitives = unit.primitives;
     else if (primitives != unit.primitives) {
@@ -162,7 +165,6 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
         else
             assert(0);
     }
-#endif
 
     if (inputPrimitive == ElgNone)
         inputPrimitive = unit.inputPrimitive;
@@ -224,21 +226,16 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
         xfbBuffers[b].implicitStride = std::max(xfbBuffers[b].implicitStride, unit.xfbBuffers[b].implicitStride);
         if (unit.xfbBuffers[b].contains64BitType)
             xfbBuffers[b].contains64BitType = true;
-#ifdef AMD_EXTENSIONS
         if (unit.xfbBuffers[b].contains32BitType)
             xfbBuffers[b].contains32BitType = true;
         if (unit.xfbBuffers[b].contains16BitType)
             xfbBuffers[b].contains16BitType = true;
-#endif
         // TODO: 4.4 link: enhanced layouts: compare ranges
     }
 
     MERGE_TRUE(multiStream);
-
-#ifdef NV_EXTENSIONS
     MERGE_TRUE(layoutOverrideCoverage);
     MERGE_TRUE(geoPassthroughEXT);
-#endif
 
     for (unsigned int i = 0; i < unit.shiftBinding.size(); ++i) {
         if (unit.shiftBinding[i] > 0)
@@ -287,13 +284,8 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit)
     }
 
     // Getting this far means we have two existing trees to merge...
-#ifdef NV_EXTENSIONS
     numShaderRecordNVBlocks += unit.numShaderRecordNVBlocks;
-#endif
-
-#ifdef NV_EXTENSIONS
     numTaskNVBlocks += unit.numTaskNVBlocks;
-#endif
 
     // Get the top-level globals of each unit
     TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence();
@@ -315,6 +307,8 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit)
     ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end());
 }
 
+#endif
+
 // Traverser that seeds an ID map with all built-ins, and tracks the
 // maximum ID used.
 // (It would be nice to put this in a function, but that causes warnings
@@ -536,7 +530,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
     }
 
     // Precise...
-    if (! crossStage && symbol.getQualifier().noContraction != unitSymbol.getQualifier().noContraction) {
+    if (! crossStage && symbol.getQualifier().isNoContraction() != unitSymbol.getQualifier().isNoContraction()) {
         error(infoSink, "Presence of precise qualifier must match:");
         writeTypeComparison = true;
     }
@@ -545,13 +539,14 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
     if (symbol.getQualifier().centroid  != unitSymbol.getQualifier().centroid ||
         symbol.getQualifier().smooth    != unitSymbol.getQualifier().smooth ||
         symbol.getQualifier().flat      != unitSymbol.getQualifier().flat ||
-        symbol.getQualifier().sample    != unitSymbol.getQualifier().sample ||
-        symbol.getQualifier().patch     != unitSymbol.getQualifier().patch ||
-        symbol.getQualifier().nopersp   != unitSymbol.getQualifier().nopersp) {
+        symbol.getQualifier().isSample()!= unitSymbol.getQualifier().isSample() ||
+        symbol.getQualifier().isPatch() != unitSymbol.getQualifier().isPatch() ||
+        symbol.getQualifier().isNonPerspective() != unitSymbol.getQualifier().isNonPerspective()) {
         error(infoSink, "Interpolation and auxiliary storage qualifiers must match:");
         writeTypeComparison = true;
     }
 
+#ifndef GLSLANG_WEB
     // Memory...
     if (symbol.getQualifier().coherent          != unitSymbol.getQualifier().coherent ||
         symbol.getQualifier().devicecoherent    != unitSymbol.getQualifier().devicecoherent ||
@@ -566,6 +561,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
         error(infoSink, "Memory qualifiers must match:");
         writeTypeComparison = true;
     }
+#endif
 
     // Layouts...
     // TODO: 4.4 enhanced layouts: Generalize to include offset/align: current spec
@@ -609,15 +605,12 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
         return;
 
     if (numEntryPoints < 1) {
-        if (source == EShSourceGlsl)
+        if (getSource() == EShSourceGlsl)
             error(infoSink, "Missing entry point: Each stage requires one entry point");
         else
             warn(infoSink, "Entry point not found");
     }
 
-    if (numPushConstants > 1)
-        error(infoSink, "Only one push_constant block is allowed per stage");
-
     // recursion and missing body checking
     checkCallGraphCycles(infoSink);
     checkCallGraphBodies(infoSink, keepUncalled);
@@ -625,6 +618,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
     // overlap/alias/missing I/O, etc.
     inOutLocationCheck(infoSink);
 
+#ifndef GLSLANG_WEB
+    if (getNumPushConstants() > 1)
+        error(infoSink, "Only one push_constant block is allowed per stage");
+
     // invocations
     if (invocations == TQualifier::layoutNotSet)
         invocations = 1;
@@ -642,12 +639,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
     for (size_t b = 0; b < xfbBuffers.size(); ++b) {
         if (xfbBuffers[b].contains64BitType)
             RoundToPow2(xfbBuffers[b].implicitStride, 8);
-#ifdef AMD_EXTENSIONS
         else if (xfbBuffers[b].contains32BitType)
             RoundToPow2(xfbBuffers[b].implicitStride, 4);
         else if (xfbBuffers[b].contains16BitType)
             RoundToPow2(xfbBuffers[b].implicitStride, 2);
-#endif
 
         // "It is a compile-time or link-time error to have
         // any xfb_offset that overflows xfb_stride, whether stated on declarations before or after the xfb_stride, or
@@ -668,16 +663,11 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
             error(infoSink, "xfb_stride must be multiple of 8 for buffer holding a double or 64-bit integer:");
             infoSink.info.prefix(EPrefixError);
             infoSink.info << "    xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
-#ifdef AMD_EXTENSIONS
         } else if (xfbBuffers[b].contains32BitType && ! IsMultipleOfPow2(xfbBuffers[b].stride, 4)) {
-#else
-        } else if (! IsMultipleOfPow2(xfbBuffers[b].stride, 4)) {
-#endif
             error(infoSink, "xfb_stride must be multiple of 4:");
             infoSink.info.prefix(EPrefixError);
             infoSink.info << "    xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
         }
-#ifdef AMD_EXTENSIONS
         // "If the buffer is capturing any
         // outputs with half-precision or 16-bit integer components, the stride must be a multiple of 2"
         else if (xfbBuffers[b].contains16BitType && ! IsMultipleOfPow2(xfbBuffers[b].stride, 2)) {
@@ -686,7 +676,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
             infoSink.info << "    xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
         }
 
-#endif
         // "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the
         // implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents."
         if (xfbBuffers[b].stride > (unsigned int)(4 * resources.maxTransformFeedbackInterleavedComponents)) {
@@ -704,7 +693,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
             error(infoSink, "At least one shader must specify an output layout(vertices=...)");
         break;
     case EShLangTessEvaluation:
-        if (source == EShSourceGlsl) {
+        if (getSource() == EShSourceGlsl) {
             if (inputPrimitive == ElgNone)
                 error(infoSink, "At least one shader must specify an input layout primitive");
             if (vertexSpacing == EvsNone)
@@ -730,8 +719,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
         break;
     case EShLangCompute:
         break;
-
-#ifdef NV_EXTENSIONS
     case EShLangRayGenNV:
     case EShLangIntersectNV:
     case EShLangAnyHitNV:
@@ -764,8 +751,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
         if (numTaskNVBlocks > 1)
             error(infoSink, "Only one taskNV interface block is allowed per shader");
         break;
-#endif
-
     default:
         error(infoSink, "Unknown Stage.");
         break;
@@ -787,6 +772,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
     } finalLinkTraverser;
 
     treeRoot->traverse(&finalLinkTraverser);
+#endif
 }
 
 //
@@ -973,7 +959,7 @@ void TIntermediate::inOutLocationCheck(TInfoSink& infoSink)
         }
     }
 
-    if (profile == EEsProfile) {
+    if (isEsProfile()) {
         if (numFragOut > 1 && fragOutWithNoLocation)
             error(infoSink, "when more than one fragment shader output, all must have location qualifiers");
     }
@@ -1066,6 +1052,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
     // So, for the case of dvec3, we need two independent ioRanges.
 
     int collision = -1; // no collision
+#ifndef GLSLANG_WEB
     if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 &&
         (qualifier.isPipeInput() || qualifier.isPipeOutput())) {
         // Dealing with dvec3 in/out split across two locations.
@@ -1092,7 +1079,9 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
             if (collision < 0)
                 usedIo[set].push_back(range2);
         }
-    } else {
+    } else
+#endif
+    {
         // Not a dvec3 in/out split across two locations, generic path.
         // Need a single IO-range block.
 
@@ -1109,7 +1098,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
         TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 0);
 
         // check for collisions, except for vertex inputs on desktop targeting OpenGL
-        if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)
+        if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)
             collision = checkLocationRange(set, range, type, typeCollision);
 
         if (collision < 0)
@@ -1187,14 +1176,10 @@ int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage)
         // TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
         // TODO: are there valid cases of having an unsized array with a location?  If so, running this code too early.
         TType elementType(type, 0);
-        if (type.isSizedArray()
-#ifdef NV_EXTENSIONS
-            && !type.getQualifier().isPerView()
-#endif
-            )
+        if (type.isSizedArray() && !type.getQualifier().isPerView())
             return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage);
         else {
-#ifdef NV_EXTENSIONS
+#ifndef GLSLANG_WEB
             // unset perViewNV attributes for arrayed per-view outputs: "perviewNV vec4 v[MAX_VIEWS][3];"
             elementType.getQualifier().perViewNV = false;
 #endif
@@ -1273,6 +1258,8 @@ int TIntermediate::computeTypeUniformLocationSize(const TType& type)
     return 1;
 }
 
+#ifndef GLSLANG_WEB
+
 // Accumulate xfb buffer ranges and check for collisions as the accumulation is done.
 //
 // Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
@@ -1285,11 +1272,7 @@ int TIntermediate::addXfbBufferOffset(const TType& type)
     TXfbBuffer& buffer = xfbBuffers[qualifier.layoutXfbBuffer];
 
     // compute the range
-#ifdef AMD_EXTENSIONS
     unsigned int size = computeTypeXfbSize(type, buffer.contains64BitType, buffer.contains32BitType, buffer.contains16BitType);
-#else
-    unsigned int size = computeTypeXfbSize(type, buffer.contains64BitType);
-#endif
     buffer.implicitStride = std::max(buffer.implicitStride, qualifier.layoutXfbOffset + size);
     TRange range(qualifier.layoutXfbOffset, qualifier.layoutXfbOffset + size - 1);
 
@@ -1309,15 +1292,10 @@ int TIntermediate::addXfbBufferOffset(const TType& type)
 // Recursively figure out how many bytes of xfb buffer are used by the given type.
 // Return the size of type, in bytes.
 // Sets contains64BitType to true if the type contains a 64-bit data type.
-#ifdef AMD_EXTENSIONS
 // Sets contains32BitType to true if the type contains a 32-bit data type.
 // Sets contains16BitType to true if the type contains a 16-bit data type.
 // N.B. Caller must set contains64BitType, contains32BitType, and contains16BitType to false before calling.
 unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const
-#else
-// N.B. Caller must set contains64BitType to false before calling.
-unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains64BitType) const
-#endif
 {
     // "...if applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8,
     // and the space taken in the buffer will be a multiple of 8.
@@ -1330,44 +1308,32 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
         // TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
         assert(type.isSizedArray());
         TType elementType(type, 0);
-#ifdef AMD_EXTENSIONS
         return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType, contains16BitType, contains16BitType);
-#else
-        return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType);
-#endif
     }
 
     if (type.isStruct()) {
         unsigned int size = 0;
         bool structContains64BitType = false;
-#ifdef AMD_EXTENSIONS
         bool structContains32BitType = false;
         bool structContains16BitType = false;
-#endif
         for (int member = 0; member < (int)type.getStruct()->size(); ++member) {
             TType memberType(type, member);
             // "... if applied to
             // an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8,
             // and the space taken in the buffer will be a multiple of 8."
             bool memberContains64BitType = false;
-#ifdef AMD_EXTENSIONS
             bool memberContains32BitType = false;
             bool memberContains16BitType = false;
             int memberSize = computeTypeXfbSize(memberType, memberContains64BitType, memberContains32BitType, memberContains16BitType);
-#else
-            int memberSize = computeTypeXfbSize(memberType, memberContains64BitType);
-#endif
             if (memberContains64BitType) {
                 structContains64BitType = true;
                 RoundToPow2(size, 8);
-#ifdef AMD_EXTENSIONS
             } else if (memberContains32BitType) {
                 structContains32BitType = true;
                 RoundToPow2(size, 4);
             } else if (memberContains16BitType) {
                 structContains16BitType = true;
                 RoundToPow2(size, 2);
-#endif
             }
             size += memberSize;
         }
@@ -1375,14 +1341,12 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
         if (structContains64BitType) {
             contains64BitType = true;
             RoundToPow2(size, 8);
-#ifdef AMD_EXTENSIONS
         } else if (structContains32BitType) {
             contains32BitType = true;
             RoundToPow2(size, 4);
         } else if (structContains16BitType) {
             contains16BitType = true;
             RoundToPow2(size, 2);
-#endif
         }
         return size;
     }
@@ -1402,7 +1366,6 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
     if (type.getBasicType() == EbtDouble || type.getBasicType() == EbtInt64 || type.getBasicType() == EbtUint64) {
         contains64BitType = true;
         return 8 * numComponents;
-#ifdef AMD_EXTENSIONS
     } else if (type.getBasicType() == EbtFloat16 || type.getBasicType() == EbtInt16 || type.getBasicType() == EbtUint16) {
         contains16BitType = true;
         return 2 * numComponents;
@@ -1412,12 +1375,10 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
         contains32BitType = true;
         return 4 * numComponents;
     }
-#else
-    } else
-        return 4 * numComponents;
-#endif
 }
 
+#endif
+
 const int baseAlignmentVec4Std140 = 16;
 
 // Return the size and alignment of a component of the given type.
@@ -1425,6 +1386,10 @@ const int baseAlignmentVec4Std140 = 16;
 // Return value is the alignment..
 int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
 {
+#ifdef GLSLANG_WEB
+    size = 4; return 4;
+#endif
+
     switch (type.getBasicType()) {
     case EbtInt64:
     case EbtUint64:
@@ -1741,7 +1706,7 @@ int TIntermediate::getBlockSize(const TType& blockType)
 
 int TIntermediate::computeBufferReferenceTypeSize(const TType& type)
 {
-    assert(type.getBasicType() == EbtReference);
+    assert(type.isReference());
     int size = getBlockSize(*type.getReferentType());
 
     int align = type.getBufferReferenceAlignment();

+ 305 - 253
3rdparty/glslang/glslang/MachineIndependent/localintermediate.h

@@ -149,20 +149,14 @@ struct TOffsetRange {
 
 // Things that need to be tracked per xfb buffer.
 struct TXfbBuffer {
-#ifdef AMD_EXTENSIONS
     TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false),
                    contains32BitType(false), contains16BitType(false) { }
-#else
-    TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false) { }
-#endif
     std::vector<TRange> ranges;  // byte offsets that have already been assigned
     unsigned int stride;
     unsigned int implicitStride;
     bool contains64BitType;
-#ifdef AMD_EXTENSIONS
     bool contains32BitType;
     bool contains16BitType;
-#endif
 };
 
 // Track a set of strings describing how the module was processed.
@@ -217,7 +211,6 @@ class TSymbolTable;
 class TSymbol;
 class TVariable;
 
-#ifdef NV_EXTENSIONS
 //
 // Texture and Sampler transformation mode.
 //
@@ -226,7 +219,6 @@ enum ComputeDerivativeMode {
     LayoutDerivativeGroupQuads,   // derivative_group_quadsNV
     LayoutDerivativeGroupLinear,  // derivative_group_linearNV
 };
-#endif
 
 //
 // Set of helper functions to help parse and build the tree.
@@ -234,41 +226,48 @@ enum ComputeDerivativeMode {
 class TIntermediate {
 public:
     explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) :
+        language(l),
+#ifdef ENABLE_HLSL
         implicitThisName("@this"), implicitCounterName("@count"),
-        language(l), source(EShSourceNone), profile(p), version(v), treeRoot(0),
+        source(EShSourceNone),
+#endif
+        profile(p), version(v), treeRoot(0),
         numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false),
+        invertY(false),
+        useStorageBuffer(false),
+        nanMinMaxClamp(false),
+        depthReplacing(false)
+#ifndef GLSLANG_WEB
+        ,
+        useVulkanMemoryModel(false),
         invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet),
         inputPrimitive(ElgNone), outputPrimitive(ElgNone),
         pixelCenterInteger(false), originUpperLeft(false),
         vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false),
-        postDepthCoverage(false), depthLayout(EldNone), depthReplacing(false),
+        postDepthCoverage(false), depthLayout(EldNone), 
         hlslFunctionality1(false),
         blendEquations(0), xfbMode(false), multiStream(false),
-#ifdef NV_EXTENSIONS
         layoutOverrideCoverage(false),
         geoPassthroughEXT(false),
         numShaderRecordNVBlocks(0),
         computeDerivativeMode(LayoutDerivativeNone),
         primitives(TQualifier::layoutNotSet),
         numTaskNVBlocks(0),
-#endif
         autoMapBindings(false),
         autoMapLocations(false),
-        invertY(false),
         flattenUniformArrays(false),
         useUnknownFormat(false),
         hlslOffsets(false),
-        useStorageBuffer(false),
-        useVulkanMemoryModel(false),
         hlslIoMapping(false),
         useVariablePointers(false),
         textureSamplerTransformMode(EShTexSampTransKeep),
         needToLegalize(false),
         binaryDoubleOutput(false),
         usePhysicalStorageBuffer(false),
-        uniformLocationBase(0),
-        nanMinMaxClamp(false)
+        uniformLocationBase(0)
+#endif
     {
+#ifndef GLSLANG_WEB
         localSize[0] = 1;
         localSize[1] = 1;
         localSize[2] = 1;
@@ -276,152 +275,9 @@ public:
         localSizeSpecId[1] = TQualifier::layoutNotSet;
         localSizeSpecId[2] = TQualifier::layoutNotSet;
         xfbBuffers.resize(TQualifier::layoutXfbBufferEnd);
-
         shiftBinding.fill(0);
+#endif
     }
-    void setLimits(const TBuiltInResource& r) { resources = r; }
-
-    bool postProcess(TIntermNode*, EShLanguage);
-    void output(TInfoSink&, bool tree);
-    void removeTree();
-
-    void setSource(EShSource s) { source = s; }
-    EShSource getSource() const { return source; }
-    void setEntryPointName(const char* ep)
-    {
-        entryPointName = ep;
-        processes.addProcess("entry-point");
-        processes.addArgument(entryPointName);
-    }
-    void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; }
-    const std::string& getEntryPointName() const { return entryPointName; }
-    const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
-
-    void setShiftBinding(TResourceType res, unsigned int shift)
-    {
-        shiftBinding[res] = shift;
-
-        const char* name = getResourceName(res);
-        if (name != nullptr)
-            processes.addIfNonZero(name, shift);
-    }
-
-    unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; }
-
-    void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set)
-    {
-        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(shift);
-            processes.addArgument(set);
-        }
-    }
-
-    int getShiftBindingForSet(TResourceType res, unsigned int set) const
-    {
-        const auto shift = shiftBindingForSet[res].find(set);
-        return shift == shiftBindingForSet[res].end() ? -1 : shift->second;
-    }
-    bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); }
-
-    void setResourceSetBinding(const std::vector<std::string>& shift)
-    {
-        resourceSetBinding = shift;
-        if (shift.size() > 0) {
-            processes.addProcess("resource-set-binding");
-            for (int s = 0; s < (int)shift.size(); ++s)
-                processes.addArgument(shift[s]);
-        }
-    }
-    const std::vector<std::string>& getResourceSetBinding() const { return resourceSetBinding; }
-    void setAutoMapBindings(bool map)
-    {
-        autoMapBindings = map;
-        if (autoMapBindings)
-            processes.addProcess("auto-map-bindings");
-    }
-    bool getAutoMapBindings() const { return autoMapBindings; }
-    void setAutoMapLocations(bool map)
-    {
-        autoMapLocations = map;
-        if (autoMapLocations)
-            processes.addProcess("auto-map-locations");
-    }
-    bool getAutoMapLocations() const { return autoMapLocations; }
-    void setInvertY(bool invert)
-    {
-        invertY = invert;
-        if (invertY)
-            processes.addProcess("invert-y");
-    }
-    bool getInvertY() const { return invertY; }
-
-    void setFlattenUniformArrays(bool flatten)
-    {
-        flattenUniformArrays = flatten;
-        if (flattenUniformArrays)
-            processes.addProcess("flatten-uniform-arrays");
-    }
-    bool getFlattenUniformArrays() const { return flattenUniformArrays; }
-    void setNoStorageFormat(bool b)
-    {
-        useUnknownFormat = b;
-        if (useUnknownFormat)
-            processes.addProcess("no-storage-format");
-    }
-    bool getNoStorageFormat() const { return useUnknownFormat; }
-    void setHlslOffsets()
-    {
-        hlslOffsets = true;
-        if (hlslOffsets)
-            processes.addProcess("hlsl-offsets");
-    }
-    bool usingHlslOffsets() const { return hlslOffsets; }
-    void setUseStorageBuffer()
-    {
-        useStorageBuffer = true;
-        processes.addProcess("use-storage-buffer");
-    }
-    bool usingStorageBuffer() const { return useStorageBuffer; }
-    void setHlslIoMapping(bool b)
-    {
-        hlslIoMapping = b;
-        if (hlslIoMapping)
-            processes.addProcess("hlsl-iomap");
-    }
-    bool usingHlslIoMapping() { return hlslIoMapping; }
-    void setUseVulkanMemoryModel()
-    {
-        useVulkanMemoryModel = true;
-        processes.addProcess("use-vulkan-memory-model");
-    }
-    bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; }
-    void setUsePhysicalStorageBuffer()
-    {
-        usePhysicalStorageBuffer = true;
-    }
-    bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; }
-    void setUseVariablePointers()
-    {
-        useVariablePointers = true;
-        processes.addProcess("use-variable-pointers");
-    }
-    bool usingVariablePointers() const { return useVariablePointers; }
-
-    template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; }
-    bool hasCounterBufferName(const TString& name) const {
-        size_t len = strlen(implicitCounterName);
-        return name.size() > len &&
-               name.compare(name.size() - len, len, implicitCounterName) == 0;
-    }
-
-    void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; }
 
     void setVersion(int v) { version = v; }
     int getVersion() const { return version; }
@@ -485,9 +341,35 @@ public:
     int getNumEntryPoints() const { return numEntryPoints; }
     int getNumErrors() const { return numErrors; }
     void addPushConstantCount() { ++numPushConstants; }
-#ifdef NV_EXTENSIONS
-    void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; }
-    void addTaskNVCount() { ++numTaskNVBlocks; }
+    void setLimits(const TBuiltInResource& r) { resources = r; }
+
+    bool postProcess(TIntermNode*, EShLanguage);
+    void removeTree();
+
+    void setEntryPointName(const char* ep)
+    {
+        entryPointName = ep;
+        processes.addProcess("entry-point");
+        processes.addArgument(entryPointName);
+    }
+    void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; }
+    const std::string& getEntryPointName() const { return entryPointName; }
+    const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
+
+    void setInvertY(bool invert)
+    {
+        invertY = invert;
+        if (invertY)
+            processes.addProcess("invert-y");
+    }
+    bool getInvertY() const { return invertY; }
+
+#ifdef ENABLE_HLSL
+    void setSource(EShSource s) { source = s; }
+    EShSource getSource() const { return source; }
+#else
+    void setSource(EShSource s) { assert(s == EShSourceGlsl); }
+    EShSource getSource() const { return EShSourceGlsl; }
 #endif
 
     bool isRecursive() const { return recursive; }
@@ -566,6 +448,152 @@ public:
     void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&);
     void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&);
 
+    void setUseStorageBuffer()
+    {
+        useStorageBuffer = true;
+        processes.addProcess("use-storage-buffer");
+    }
+    bool usingStorageBuffer() const { return useStorageBuffer; }
+    void setDepthReplacing() { depthReplacing = true; }
+    bool isDepthReplacing() const { return depthReplacing; }
+
+#ifdef GLSLANG_WEB
+    void output(TInfoSink&, bool tree) { }
+
+    bool isEsProfile() const { return false; }
+    bool getXfbMode() const { return false; }
+    bool isMultiStream() const { return false; }
+    TLayoutGeometry getOutputPrimitive() const { return ElgNone; }
+    bool getPostDepthCoverage() const { return false; }
+    bool getEarlyFragmentTests() const { return false; }
+    TLayoutDepth getDepth() const { return EldNone; }
+    bool getPixelCenterInteger() const { return false; }
+    void setOriginUpperLeft() { }
+    bool getOriginUpperLeft() const { return true; }
+    TInterlockOrdering getInterlockOrdering() const { return EioNone; }
+
+    bool getAutoMapBindings() const { return false; }
+    bool getAutoMapLocations() const { return false; }
+    int getNumPushConstants() const { return 0; }
+    void addShaderRecordNVCount() { }
+    void addTaskNVCount() { }
+    void setUseVulkanMemoryModel() { }
+    bool usingVulkanMemoryModel() const { return false; }
+    bool usingPhysicalStorageBuffer() const { return false; }
+    bool usingVariablePointers() const { return false; }
+    unsigned getXfbStride(int buffer) const { return 0; }
+    bool hasLayoutDerivativeModeNone() const { return false; }
+#else
+    void output(TInfoSink&, bool tree);
+
+    bool isEsProfile() const { return profile == EEsProfile; }
+
+    void setShiftBinding(TResourceType res, unsigned int shift)
+    {
+        shiftBinding[res] = shift;
+
+        const char* name = getResourceName(res);
+        if (name != nullptr)
+            processes.addIfNonZero(name, shift);
+    }
+
+    unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; }
+
+    void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set)
+    {
+        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(shift);
+            processes.addArgument(set);
+        }
+    }
+
+    int getShiftBindingForSet(TResourceType res, unsigned int set) const
+    {
+        const auto shift = shiftBindingForSet[res].find(set);
+        return shift == shiftBindingForSet[res].end() ? -1 : shift->second;
+    }
+    bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); }
+
+    void setResourceSetBinding(const std::vector<std::string>& shift)
+    {
+        resourceSetBinding = shift;
+        if (shift.size() > 0) {
+            processes.addProcess("resource-set-binding");
+            for (int s = 0; s < (int)shift.size(); ++s)
+                processes.addArgument(shift[s]);
+        }
+    }
+    const std::vector<std::string>& getResourceSetBinding() const { return resourceSetBinding; }
+    void setAutoMapBindings(bool map)
+    {
+        autoMapBindings = map;
+        if (autoMapBindings)
+            processes.addProcess("auto-map-bindings");
+    }
+    bool getAutoMapBindings() const { return autoMapBindings; }
+    void setAutoMapLocations(bool map)
+    {
+        autoMapLocations = map;
+        if (autoMapLocations)
+            processes.addProcess("auto-map-locations");
+    }
+    bool getAutoMapLocations() const { return autoMapLocations; }
+
+#ifdef ENABLE_HLSL
+    void setFlattenUniformArrays(bool flatten)
+    {
+        flattenUniformArrays = flatten;
+        if (flattenUniformArrays)
+            processes.addProcess("flatten-uniform-arrays");
+    }
+    bool getFlattenUniformArrays() const { return flattenUniformArrays; }
+#endif 
+    void setNoStorageFormat(bool b)
+    {
+        useUnknownFormat = b;
+        if (useUnknownFormat)
+            processes.addProcess("no-storage-format");
+    }
+    bool getNoStorageFormat() const { return useUnknownFormat; }
+    void setUseVulkanMemoryModel()
+    {
+        useVulkanMemoryModel = true;
+        processes.addProcess("use-vulkan-memory-model");
+    }
+    bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; }
+    void setUsePhysicalStorageBuffer()
+    {
+        usePhysicalStorageBuffer = true;
+    }
+    bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; }
+    void setUseVariablePointers()
+    {
+        useVariablePointers = true;
+        processes.addProcess("use-variable-pointers");
+    }
+    bool usingVariablePointers() const { return useVariablePointers; }
+
+#ifdef ENABLE_HLSL
+    template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; }
+    bool hasCounterBufferName(const TString& name) const {
+        size_t len = strlen(implicitCounterName);
+        return name.size() > len &&
+               name.compare(name.size() - len, len, implicitCounterName) == 0;
+    }
+#endif
+
+    void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; }
+    int getNumPushConstants() const { return numPushConstants; }
+    void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; }
+    void addTaskNVCount() { ++numTaskNVBlocks; }
+
     bool setInvocations(int i)
     {
         if (invocations != TQualifier::layoutNotSet)
@@ -635,7 +663,6 @@ public:
         return true;
     }
     int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
-
     void setXfbMode() { xfbMode = true; }
     bool getXfbMode() const { return xfbMode; }
     void setMultiStream() { multiStream = true; }
@@ -648,14 +675,10 @@ public:
         return true;
     }
     TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; }
-    void setOriginUpperLeft() { originUpperLeft = true; }
-    bool getOriginUpperLeft() const { return originUpperLeft; }
-    void setPixelCenterInteger() { pixelCenterInteger = true; }
-    bool getPixelCenterInteger() const { return pixelCenterInteger; }
-    void setEarlyFragmentTests() { earlyFragmentTests = true; }
-    bool getEarlyFragmentTests() const { return earlyFragmentTests; }
     void setPostDepthCoverage() { postDepthCoverage = true; }
     bool getPostDepthCoverage() const { return postDepthCoverage; }
+    void setEarlyFragmentTests() { earlyFragmentTests = true; }
+    bool getEarlyFragmentTests() const { return earlyFragmentTests; }
     bool setDepth(TLayoutDepth d)
     {
         if (depthLayout != EldNone)
@@ -664,29 +687,12 @@ public:
         return true;
     }
     TLayoutDepth getDepth() const { return depthLayout; }
-    void setDepthReplacing() { depthReplacing = true; }
-    bool isDepthReplacing() const { return depthReplacing; }
-
-    void setHlslFunctionality1() { hlslFunctionality1 = true; }
-    bool getHlslFunctionality1() const { return hlslFunctionality1; }
-
+    void setOriginUpperLeft() { originUpperLeft = true; }
+    bool getOriginUpperLeft() const { return originUpperLeft; }
+    void setPixelCenterInteger() { pixelCenterInteger = true; }
+    bool getPixelCenterInteger() const { return pixelCenterInteger; }
     void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
     unsigned int getBlendEquations() const { return blendEquations; }
-
-    void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
-    void merge(TInfoSink&, TIntermediate&);
-    void finalCheck(TInfoSink&, bool keepUncalled);
-
-    void addIoAccessed(const TString& name) { ioAccessed.insert(name); }
-    bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); }
-
-    int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision);
-    int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision);
-    int addUsedOffsets(int binding, int offset, int numOffsets);
-    bool addUsedConstantId(int id);
-    static int computeTypeLocationSize(const TType&, EShLanguage);
-    static int computeTypeUniformLocationSize(const TType&);
-
     bool setXfbBufferStride(int buffer, unsigned stride)
     {
         if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd)
@@ -696,28 +702,14 @@ public:
     }
     unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; }
     int addXfbBufferOffset(const TType&);
-#ifdef AMD_EXTENSIONS
     unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const;
-#else
     unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType) const;
-#endif
-    static int getBaseAlignmentScalar(const TType&, int& size);
-    static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
-    static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor);
-    static int getMemberAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
-    static bool improperStraddle(const TType& type, int size, int offset);
-    static void updateOffset(const TType& parentType, const TType& memberType, int& offset, int& memberSize);
-    static int getOffset(const TType& type, int index);
-    static int getBlockSize(const TType& blockType);
-    static int computeBufferReferenceTypeSize(const TType&);
-    bool promote(TIntermOperator*);
-
-#ifdef NV_EXTENSIONS
     void setLayoutOverrideCoverage() { layoutOverrideCoverage = true; }
     bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; }
     void setGeoPassthroughEXT() { geoPassthroughEXT = true; }
     bool getGeoPassthroughEXT() const { return geoPassthroughEXT; }
     void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; }
+    bool hasLayoutDerivativeModeNone() const { return computeDerivativeMode != LayoutDerivativeNone; }
     ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; }
     bool setPrimitives(int m)
     {
@@ -727,28 +719,10 @@ public:
         return true;
     }
     int getPrimitives() const { return primitives; }
-#endif
-
     const char* addSemanticName(const TString& name)
     {
         return semanticNameSet.insert(name).first->c_str();
     }
-
-    void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; }
-    const std::string& getSourceFile() const { return sourceFile; }
-    void addSourceText(const char* text, size_t len) { sourceText.append(text, len); }
-    const std::string& getSourceText() const { return sourceText; }
-    const std::map<std::string, std::string>& getIncludeText() const { return includeText; }
-    void addIncludeText(const char* name, const char* text, size_t len) { includeText[name].assign(text,len); }
-    void addProcesses(const std::vector<std::string>& p)
-    {
-        for (int i = 0; i < (int)p.size(); ++i)
-            processes.addProcess(p[i]);
-    }
-    void addProcess(const std::string& process) { processes.addProcess(process); }
-    void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
-    const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
-
     void addUniformLocationOverride(const char* nameStr, int location)
     {
         std::string name = nameStr;
@@ -768,38 +742,100 @@ public:
     void setUniformLocationBase(int base) { uniformLocationBase = base; }
     int getUniformLocationBase() const { return uniformLocationBase; }
 
-    void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; }
-    bool getNanMinMaxClamp() const { return nanMinMaxClamp; }
-
     void setNeedsLegalization() { needToLegalize = true; }
     bool needsLegalization() const { return needToLegalize; }
 
     void setBinaryDoubleOutput() { binaryDoubleOutput = true; }
     bool getBinaryDoubleOutput() { return binaryDoubleOutput; }
+#endif
 
-    const char* const implicitThisName;
-    const char* const implicitCounterName;
+#ifdef ENABLE_HLSL
+    void setHlslFunctionality1() { hlslFunctionality1 = true; }
+    bool getHlslFunctionality1() const { return hlslFunctionality1; }
+    void setHlslOffsets()
+    {
+        hlslOffsets = true;
+        if (hlslOffsets)
+            processes.addProcess("hlsl-offsets");
+    }
+    bool usingHlslOffsets() const { return hlslOffsets; }
+    void setHlslIoMapping(bool b)
+    {
+        hlslIoMapping = b;
+        if (hlslIoMapping)
+            processes.addProcess("hlsl-iomap");
+    }
+    bool usingHlslIoMapping() { return hlslIoMapping; }
+#else
+    bool getHlslFunctionality1() const { return false; }
+    bool usingHlslOffsets() const { return false; }
+    bool usingHlslIoMapping() { return false; }
+#endif
+
+    void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
+    void merge(TInfoSink&, TIntermediate&);
+    void finalCheck(TInfoSink&, bool keepUncalled);
+
+    void addIoAccessed(const TString& name) { ioAccessed.insert(name); }
+    bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); }
+
+    int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision);
+    int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision);
+    int addUsedOffsets(int binding, int offset, int numOffsets);
+    bool addUsedConstantId(int id);
+    static int computeTypeLocationSize(const TType&, EShLanguage);
+    static int computeTypeUniformLocationSize(const TType&);
+
+    static int getBaseAlignmentScalar(const TType&, int& size);
+    static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
+    static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor);
+    static int getMemberAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
+    static bool improperStraddle(const TType& type, int size, int offset);
+    static void updateOffset(const TType& parentType, const TType& memberType, int& offset, int& memberSize);
+    static int getOffset(const TType& type, int index);
+    static int getBlockSize(const TType& blockType);
+    static int computeBufferReferenceTypeSize(const TType&);
+    bool promote(TIntermOperator*);
+    void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; }
+    bool getNanMinMaxClamp() const { return nanMinMaxClamp; }
+
+    void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; }
+    const std::string& getSourceFile() const { return sourceFile; }
+    void addSourceText(const char* text, size_t len) { sourceText.append(text, len); }
+    const std::string& getSourceText() const { return sourceText; }
+    const std::map<std::string, std::string>& getIncludeText() const { return includeText; }
+    void addIncludeText(const char* name, const char* text, size_t len) { includeText[name].assign(text,len); }
+    void addProcesses(const std::vector<std::string>& p)
+    {
+        for (int i = 0; i < (int)p.size(); ++i)
+            processes.addProcess(p[i]);
+    }
+    void addProcess(const std::string& process) { processes.addProcess(process); }
+    void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
+    const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
 
     // Certain explicit conversions are allowed conditionally
+#ifdef GLSLANG_WEB
+    bool getArithemeticInt8Enabled() const { return false; }
+    bool getArithemeticInt16Enabled() const { return false; }
+    bool getArithemeticFloat16Enabled() const { return false; }
+#else
     bool getArithemeticInt8Enabled() const {
         return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
                extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
     }
     bool getArithemeticInt16Enabled() const {
         return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
-#ifdef AMD_EXTENSIONS
                extensionRequested(E_GL_AMD_gpu_shader_int16) ||
-#endif
                extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
     }
 
     bool getArithemeticFloat16Enabled() const {
         return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
-#ifdef AMD_EXTENSIONS
                extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
-#endif
                extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16);
     }
+#endif
 
 protected:
     TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&);
@@ -832,11 +868,27 @@ protected:
     bool isConversionAllowed(TOperator op, TIntermTyped* node) const;
     TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const;
     std::tuple<TBasicType, TBasicType> getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const;
+
+    // JohnK: I think this function should go away.
+    // This data structure is just a log to pass on to back ends.
+    // Versioning and extensions are handled in Version.cpp, with a rich
+    // set of functions for querying stages, versions, extension enable/disabled, etc.
+#ifdef GLSLANG_WEB
+    bool extensionRequested(const char *extension) const { return false; }
+#else
     bool extensionRequested(const char *extension) const {return requestedExtensions.find(extension) != requestedExtensions.end();}
+#endif
+
     static const char* getResourceName(TResourceType);
 
     const EShLanguage language;  // stage, known at construction time
+#ifdef ENABLE_HLSL
+public:
+    const char* const implicitThisName;
+    const char* const implicitCounterName;
+protected:
     EShSource source;            // source language, known a bit later
+#endif
     std::string entryPointName;
     std::string entryPointMangledName;
     typedef std::list<TCall> TGraph;
@@ -852,6 +904,12 @@ protected:
     int numErrors;
     int numPushConstants;
     bool recursive;
+    bool invertY;
+    bool useStorageBuffer;
+    bool nanMinMaxClamp;            // true if desiring min/max/clamp to favor non-NaN over NaN
+    bool depthReplacing;
+#ifndef GLSLANG_WEB
+    bool useVulkanMemoryModel;
     int invocations;
     int vertices;
     TLayoutGeometry inputPrimitive;
@@ -867,21 +925,17 @@ protected:
     bool earlyFragmentTests;
     bool postDepthCoverage;
     TLayoutDepth depthLayout;
-    bool depthReplacing;
     bool hlslFunctionality1;
     int blendEquations;        // an 'or'ing of masks of shifts of TBlendEquationShift
     bool xfbMode;
     std::vector<TXfbBuffer> xfbBuffers;     // all the data we need to track per xfb buffer
     bool multiStream;
-
-#ifdef NV_EXTENSIONS
     bool layoutOverrideCoverage;
     bool geoPassthroughEXT;
     int numShaderRecordNVBlocks;
     ComputeDerivativeMode computeDerivativeMode;
     int primitives;
     int numTaskNVBlocks;
-#endif
 
     // Base shift values
     std::array<unsigned int, EResCount> shiftBinding;
@@ -892,23 +946,29 @@ protected:
     std::vector<std::string> resourceSetBinding;
     bool autoMapBindings;
     bool autoMapLocations;
-    bool invertY;
     bool flattenUniformArrays;
     bool useUnknownFormat;
     bool hlslOffsets;
-    bool useStorageBuffer;
-    bool useVulkanMemoryModel;
     bool hlslIoMapping;
     bool useVariablePointers;
 
-    std::set<TString> ioAccessed;           // set of names of statically read/written I/O that might need extra checking
-    std::vector<TIoRange> usedIo[4];        // sets of used locations, one for each of in, out, uniform, and buffers
-    std::vector<TOffsetRange> usedAtomics;  // sets of bindings used by atomic counters
-    std::unordered_set<int> usedConstantId; // specialization constant ids used
     std::set<TString> semanticNameSet;
 
     EShTextureSamplerTransformMode textureSamplerTransformMode;
 
+    bool needToLegalize;
+    bool binaryDoubleOutput;
+    bool usePhysicalStorageBuffer;
+
+    std::unordered_map<std::string, int> uniformLocationOverrides;
+    int uniformLocationBase;
+#endif
+
+    std::unordered_set<int> usedConstantId; // specialization constant ids used
+    std::vector<TOffsetRange> usedAtomics;  // sets of bindings used by atomic counters
+    std::vector<TIoRange> usedIo[4];        // sets of used locations, one for each of in, out, uniform, and buffers
+    // set of names of statically read/written I/O that might need extra checking
+    std::set<TString> ioAccessed;
     // source code of shader, useful as part of debug information
     std::string sourceFile;
     std::string sourceText;
@@ -919,14 +979,6 @@ protected:
     // for OpModuleProcessed, or equivalent
     TProcesses processes;
 
-    bool needToLegalize;
-    bool binaryDoubleOutput;
-    bool usePhysicalStorageBuffer;
-
-    std::unordered_map<std::string, int> uniformLocationOverrides;
-    int uniformLocationBase;
-    bool nanMinMaxClamp;            // true if desiring min/max/clamp to favor non-NaN over NaN
-
 private:
     void operator=(TIntermediate&); // prevent assignments
 };

+ 97 - 21
3rdparty/glslang/glslang/MachineIndependent/parseVersions.h

@@ -57,26 +57,91 @@ public:
     TParseVersions(TIntermediate& interm, int version, EProfile profile,
                    const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink,
                    bool forwardCompatible, EShMessages messages)
-        : infoSink(infoSink), version(version), profile(profile), language(language),
-          spvVersion(spvVersion), forwardCompatible(forwardCompatible),
-          intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { }
+        :
+#ifndef GLSLANG_WEB
+        forwardCompatible(forwardCompatible),
+        profile(profile),
+#endif
+        infoSink(infoSink), version(version), 
+        language(language),
+        spvVersion(spvVersion), 
+        intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { }
     virtual ~TParseVersions() { }
+    void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc);
+    void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc);
+#ifdef GLSLANG_WEB
+    const EProfile profile = EEsProfile;
+    bool isEsProfile() const { return true; }
+    void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc)
+    {
+        if (! (EEsProfile & profileMask))
+            error(loc, "not supported with this profile:", featureDesc, ProfileName(profile));
+    }
+    void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions,
+        const char* const extensions[], const char* featureDesc)
+    {
+        if ((EEsProfile & profileMask) && (minVersion == 0 || version < minVersion))
+            error(loc, "not supported for this version or the enabled extensions", featureDesc, "");
+    }
+    void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension,
+        const char* featureDesc)
+    {
+        profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc);
+    }
+    void initializeExtensionBehavior() { }
+    void checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc) { }
+    void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, const char* featureDesc) { }
+    void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[],
+        const char* featureDesc) { }
+    void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[],
+        const char* featureDesc) { }
+    TExtensionBehavior getExtensionBehavior(const char*) { return EBhMissing; }
+    bool extensionTurnedOn(const char* const extension) { return false; }
+    bool extensionsTurnedOn(int numExtensions, const char* const extensions[]) { return false; }
+    void updateExtensionBehavior(int line, const char* const extension, const char* behavior) { }
+    void updateExtensionBehavior(const char* const extension, TExtensionBehavior) { }
+    void checkExtensionStage(const TSourceLoc&, const char* const extension) { }
+    void fullIntegerCheck(const TSourceLoc&, const char* op) { }
+    void doubleCheck(const TSourceLoc&, const char* op) { }
+    bool float16Arithmetic() { return false; }
+    void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { }
+    bool int16Arithmetic() { return false; }
+    void requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { }
+    bool int8Arithmetic() { return false; }
+    void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { }
+    void int64Check(const TSourceLoc&, const char* op, bool builtIn = false) { }
+    void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false) { }
+    void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false) { }
+    bool relaxedErrors()    const { return false; }
+    bool suppressWarnings() const { return true; }
+    bool isForwardCompatible() const { return false; }
+#else
+    bool forwardCompatible;      // true if errors are to be given for use of deprecated features
+    EProfile profile;            // the declared profile in the shader (core by default)
+    bool isEsProfile() const { return profile == EEsProfile; }
+    void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc);
+    void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions,
+        const char* const extensions[], const char* featureDesc);
+    void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension,
+        const char* featureDesc);
     virtual void initializeExtensionBehavior();
-    virtual void requireProfile(const TSourceLoc&, int queryProfiles, const char* featureDesc);
-    virtual void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc);
-    virtual void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, const char* const extension, const char* featureDesc);
-    virtual void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc);
-    virtual void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc);
     virtual void checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc);
     virtual void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, const char* featureDesc);
-    virtual void unimplemented(const TSourceLoc&, const char* featureDesc);
-    virtual void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc);
-    virtual void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc);
+    virtual void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[],
+        const char* featureDesc);
+    virtual void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[],
+        const char* featureDesc);
     virtual TExtensionBehavior getExtensionBehavior(const char*);
     virtual bool extensionTurnedOn(const char* const extension);
     virtual bool extensionsTurnedOn(int numExtensions, const char* const extensions[]);
     virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior);
+    virtual void updateExtensionBehavior(const char* const extension, TExtensionBehavior);
+    virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[],
+        const char* featureDesc);
+    virtual void checkExtensionStage(const TSourceLoc&, const char* const extension);
     virtual void fullIntegerCheck(const TSourceLoc&, const char* op);
+
+    virtual void unimplemented(const TSourceLoc&, const char* featureDesc);
     virtual void doubleCheck(const TSourceLoc&, const char* op);
     virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false);
     virtual void float16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false);
@@ -88,24 +153,34 @@ public:
     virtual void int8ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false);
     virtual bool int8Arithmetic();
     virtual void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc);
-#ifdef AMD_EXTENSIONS
     virtual void float16OpaqueCheck(const TSourceLoc&, const char* op, bool builtIn = false);
-#endif
     virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false);
     virtual void explicitInt8Check(const TSourceLoc&, const char* op, bool builtIn = false);
     virtual void explicitInt16Check(const TSourceLoc&, const char* op, bool builtIn = false);
     virtual void explicitInt32Check(const TSourceLoc&, const char* op, bool builtIn = false);
     virtual void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false);
     virtual void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false);
+    virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false);
+    bool relaxedErrors()    const { return (messages & EShMsgRelaxedErrors) != 0; }
+    bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
+    bool isForwardCompatible() const { return forwardCompatible; }
+#endif // GLSLANG_WEB
     virtual void spvRemoved(const TSourceLoc&, const char* op);
     virtual void vulkanRemoved(const TSourceLoc&, const char* op);
     virtual void requireVulkan(const TSourceLoc&, const char* op);
     virtual void requireSpv(const TSourceLoc&, const char* op);
-    virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc);
-    virtual void updateExtensionBehavior(const char* const extension, TExtensionBehavior);
-    virtual void checkExtensionStage(const TSourceLoc&, const char* const extension);
-    virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false);
 
+
+#if defined(GLSLANG_WEB) && !defined(GLSLANG_WEB_DEVEL)
+    void C_DECL   error(const TSourceLoc&, const char* szReason, const char* szToken,
+                        const char* szExtraInfoFormat, ...) { addError(); }
+    void C_DECL    warn(const TSourceLoc&, const char* szReason, const char* szToken,
+                        const char* szExtraInfoFormat, ...) { }
+    void C_DECL ppError(const TSourceLoc&, const char* szReason, const char* szToken,
+                        const char* szExtraInfoFormat, ...) { addError(); }
+    void C_DECL  ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
+                        const char* szExtraInfoFormat, ...) { }
+#else
     virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken,
         const char* szExtraInfoFormat, ...) = 0;
     virtual void C_DECL  warn(const TSourceLoc&, const char* szReason, const char* szToken,
@@ -114,6 +189,7 @@ public:
         const char* szExtraInfoFormat, ...) = 0;
     virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
         const char* szExtraInfoFormat, ...) = 0;
+#endif
 
     void addError() { ++numErrors; }
     int getNumErrors() const { return numErrors; }
@@ -127,20 +203,20 @@ public:
     void setCurrentString(int string) { currentScanner->setString(string); }
 
     void getPreamble(std::string&);
-    bool relaxedErrors()    const { return (messages & EShMsgRelaxedErrors) != 0; }
-    bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
+#ifdef ENABLE_HLSL
     bool isReadingHLSL()    const { return (messages & EShMsgReadHlsl) == EShMsgReadHlsl; }
     bool hlslEnable16BitTypes() const { return (messages & EShMsgHlslEnable16BitTypes) != 0; }
     bool hlslDX9Compatible() const { return (messages & EShMsgHlslDX9Compatible) != 0; }
+#else
+    bool isReadingHLSL()    const { return false; }
+#endif
 
     TInfoSink& infoSink;
 
     // compilation mode
     int version;                 // version, updated by #version in the shader
-    EProfile profile;            // the declared profile in the shader (core by default)
     EShLanguage language;        // really the stage
     SpvVersion spvVersion;
-    bool forwardCompatible;      // true if errors are to be given for use of deprecated features
     TIntermediate& intermediate; // helper for making and hooking up pieces of the parse tree
 
 protected:

+ 10 - 7
3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp

@@ -545,7 +545,7 @@ int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, T
         case MacroExpandStarted:
             break;
         case MacroExpandUndef:
-            if (! shortCircuit && parseContext.profile == EEsProfile) {
+            if (! shortCircuit && parseContext.isEsProfile()) {
                 const char* message = "undefined macro in expression not allowed in es profile";
                 if (parseContext.relaxedErrors())
                     parseContext.ppWarn(ppToken->loc, message, "preprocessor evaluation", ppToken->name);
@@ -722,6 +722,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
         parseContext.setCurrentLine(lineRes);
 
         if (token != '\n') {
+#ifndef GLSLANG_WEB
             if (token == PpAtomConstString) {
                 parseContext.ppRequireExtensions(directiveLoc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based #line");
                 // We need to save a copy of the string instead of pointing
@@ -731,7 +732,9 @@ int TPpContext::CPPline(TPpToken* ppToken)
                 parseContext.setCurrentSourceName(sourceName);
                 hasFile = true;
                 token = scanToken(ppToken);
-            } else {
+            } else
+#endif
+            {
                 token = eval(token, MIN_PRECEDENCE, false, fileRes, fileErr, ppToken);
                 if (! fileErr) {
                     parseContext.setCurrentString(fileRes);
@@ -792,10 +795,8 @@ int TPpContext::CPPpragma(TPpToken* ppToken)
         case PpAtomConstUint:
         case PpAtomConstInt64:
         case PpAtomConstUint64:
-#ifdef AMD_EXTENSIONS
         case PpAtomConstInt16:
         case PpAtomConstUint16:
-#endif
         case PpAtomConstFloat:
         case PpAtomConstDouble:
         case PpAtomConstFloat16:
@@ -954,18 +955,20 @@ int TPpContext::readCPPline(TPpToken* ppToken)
         case PpAtomIfndef:
             token = CPPifdef(0, ppToken);
             break;
+        case PpAtomLine:
+            token = CPPline(ppToken);
+            break;
+#ifndef GLSLANG_WEB
         case PpAtomInclude:
             if(!parseContext.isReadingHLSL()) {
                 parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_include_directive, "#include");
             }
             token = CPPinclude(ppToken);
             break;
-        case PpAtomLine:
-            token = CPPline(ppToken);
-            break;
         case PpAtomPragma:
             token = CPPpragma(ppToken);
             break;
+#endif
         case PpAtomUndef:
             token = CPPundef(ppToken);
             break;

+ 11 - 12
3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp

@@ -142,6 +142,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
         ch = getChar();
         int firstDecimal = len;
 
+#ifdef ENABLE_HLSL
         // 1.#INF or -1.#INF
         if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) {
             if ((len <  2) ||
@@ -169,6 +170,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
                 }
             }
         }
+#endif
 
         // Consume leading-zero digits after the decimal point
         while (ch == '0') {
@@ -257,6 +259,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
     // Suffix:
     bool isDouble = false;
     bool isFloat16 = false;
+#ifndef GLSLANG_WEB
     if (ch == 'l' || ch == 'L') {
         if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl)
             parseContext.doubleCheck(ppToken->loc, "double floating-point suffix");
@@ -295,11 +298,15 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
             saveName(ch);
             isFloat16 = true;
         }
-    } else if (ch == 'f' || ch == 'F') {
+    } else
+#endif
+    if (ch == 'f' || ch == 'F') {
+#ifndef GLSLANG_WEB
         if (ifdepth == 0)
             parseContext.profileRequires(ppToken->loc,  EEsProfile, 300, nullptr, "floating-point suffix");
         if (ifdepth == 0 && !parseContext.relaxedErrors())
             parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix");
+#endif
         if (ifdepth == 0 && !hasDecimalOrExponent)
             parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
         saveName(ch);
@@ -468,9 +475,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
     static const int Num_Int64_Extensions = sizeof(Int64_Extensions) / sizeof(Int64_Extensions[0]);
 
     static const char* const Int16_Extensions[] = {
-#ifdef AMD_EXTENSIONS
         E_GL_AMD_gpu_shader_int16,
-#endif
         E_GL_EXT_shader_explicit_arithmetic_types,
         E_GL_EXT_shader_explicit_arithmetic_types_int16 };
     static const int Num_Int16_Extensions = sizeof(Int16_Extensions) / sizeof(Int16_Extensions[0]);
@@ -579,6 +584,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                         ppToken->name[len++] = (char)ch;
                     isUnsigned = true;
 
+#ifndef GLSLANG_WEB
                     int nextCh = getch();
                     if (nextCh == 'l' || nextCh == 'L') {
                         if (len < MaxTokenLength)
@@ -587,7 +593,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                     } else
                         ungetch();
 
-#ifdef AMD_EXTENSIONS
                     nextCh = getch();
                     if ((nextCh == 's' || nextCh == 'S') &&
                             pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
@@ -596,12 +601,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                         isInt16 = true;
                     } else
                         ungetch();
-#endif
                 } else if (ch == 'l' || ch == 'L') {
                     if (len < MaxTokenLength)
                         ppToken->name[len++] = (char)ch;
                     isInt64 = true;
-#ifdef AMD_EXTENSIONS
                 } else if ((ch == 's' || ch == 'S') &&
                            pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
                     if (len < MaxTokenLength)
@@ -689,6 +692,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                         ppToken->name[len++] = (char)ch;
                     isUnsigned = true;
 
+#ifndef GLSLANG_WEB
                     int nextCh = getch();
                     if (nextCh == 'l' || nextCh == 'L') {
                         if (len < MaxTokenLength)
@@ -697,7 +701,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                     } else
                         ungetch();
 
-#ifdef AMD_EXTENSIONS
                     nextCh = getch();
                     if ((nextCh == 's' || nextCh == 'S') && 
                                 pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
@@ -706,12 +709,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                         isInt16 = true;
                     } else
                         ungetch();
-#endif
                 } else if (ch == 'l' || ch == 'L') {
                     if (len < MaxTokenLength)
                         ppToken->name[len++] = (char)ch;
                     isInt64 = true;
-#ifdef AMD_EXTENSIONS
                 } else if ((ch == 's' || ch == 'S') && 
                                 pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
                     if (len < MaxTokenLength)
@@ -780,6 +781,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                         ppToken->name[len++] = (char)ch;
                     isUnsigned = true;
 
+#ifndef GLSLANG_WEB
                     int nextCh = getch();
                     if (nextCh == 'l' || nextCh == 'L') {
                         if (len < MaxTokenLength)
@@ -788,7 +790,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                     } else
                         ungetch();
 
-#ifdef AMD_EXTENSIONS
                     nextCh = getch();
                     if ((nextCh == 's' || nextCh == 'S') &&
                                 pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
@@ -797,12 +798,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
                         isInt16 = true;
                     } else
                         ungetch();
-#endif
                 } else if (ch == 'l' || ch == 'L') {
                     if (len < MaxTokenLength)
                         ppToken->name[len++] = (char)ch;
                     isInt64 = true;
-#ifdef AMD_EXTENSIONS
                 } else if ((ch == 's' || ch == 'S') &&
                                 pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
                     if (len < MaxTokenLength)

+ 2 - 0
3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp

@@ -116,6 +116,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
     int atom = stream[currentPos++].get(*ppToken);
     ppToken->loc = parseContext.getCurrentLoc();
 
+#ifndef GLSLANG_WEB
     // Check for ##, unless the current # is the last character
     if (atom == '#') {
         if (peekToken('#')) {
@@ -125,6 +126,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
             atom = PpAtomPaste;
         }
     }
+#endif
 
     return atom;
 }

+ 5 - 1
3rdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp

@@ -37,6 +37,8 @@
 // propagate the 'noContraction' qualifier.
 //
 
+#ifndef GLSLANG_WEB
+
 #include "propagateNoContraction.h"
 
 #include <cstdlib>
@@ -79,7 +81,7 @@ typedef std::unordered_set<glslang::TIntermBranch*> ReturnBranchNodeSet;
 // the node has 'noContraction' qualifier, otherwise false.
 bool isPreciseObjectNode(glslang::TIntermTyped* node)
 {
-    return node->getType().getQualifier().noContraction;
+    return node->getType().getQualifier().isNoContraction();
 }
 
 // Returns true if the opcode is a dereferencing one.
@@ -864,3 +866,5 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate)
     }
 }
 };
+
+#endif // GLSLANG_WEB

+ 7 - 11
3rdparty/glslang/glslang/MachineIndependent/reflection.cpp

@@ -33,6 +33,8 @@
 // POSSIBILITY OF SUCH DAMAGE.
 //
 
+#ifndef GLSLANG_WEB
+
 #include "../Include/Common.h"
 #include "reflection.h"
 #include "LiveTraverser.h"
@@ -396,7 +398,7 @@ public:
                     topLevelArrayStride = variables.back().arrayStride;
             }
 
-            if ((reflection.options & EShReflectionSeparateBuffers) && terminalType->getBasicType() == EbtAtomicUint)
+            if ((reflection.options & EShReflectionSeparateBuffers) && terminalType->isAtomic())
                 reflection.atomicCounterUniformIndices.push_back(uniformIndex);
 
             variables.back().topLevelArrayStride = topLevelArrayStride;
@@ -701,7 +703,6 @@ public:
                 case EsdBuffer:
                     return GL_SAMPLER_BUFFER;
                 }
-#ifdef AMD_EXTENSIONS
             case EbtFloat16:
                 switch ((int)sampler.dim) {
                 case Esd1D:
@@ -730,7 +731,6 @@ public:
                 case EsdBuffer:
                     return GL_FLOAT16_SAMPLER_BUFFER_AMD;
                 }
-#endif
             case EbtInt:
                 switch ((int)sampler.dim) {
                 case Esd1D:
@@ -793,7 +793,6 @@ public:
                 case EsdBuffer:
                     return GL_IMAGE_BUFFER;
                 }
-#ifdef AMD_EXTENSIONS
             case EbtFloat16:
                 switch ((int)sampler.dim) {
                 case Esd1D:
@@ -812,7 +811,6 @@ public:
                 case EsdBuffer:
                     return GL_FLOAT16_IMAGE_BUFFER_AMD;
                 }
-#endif
             case EbtInt:
                 switch ((int)sampler.dim) {
                 case Esd1D:
@@ -878,9 +876,7 @@ public:
             switch (type.getBasicType()) {
             case EbtFloat:      return GL_FLOAT_VEC2                  + offset;
             case EbtDouble:     return GL_DOUBLE_VEC2                 + offset;
-#ifdef AMD_EXTENSIONS
             case EbtFloat16:    return GL_FLOAT16_VEC2_NV             + offset;
-#endif
             case EbtInt:        return GL_INT_VEC2                    + offset;
             case EbtUint:       return GL_UNSIGNED_INT_VEC2           + offset;
             case EbtInt64:      return GL_INT64_ARB                   + offset;
@@ -940,7 +936,6 @@ public:
                     default:   return 0;
                     }
                 }
-#ifdef AMD_EXTENSIONS
             case EbtFloat16:
                 switch (type.getMatrixCols()) {
                 case 2:
@@ -965,7 +960,6 @@ public:
                     default:   return 0;
                     }
                 }
-#endif
             default:
                 return 0;
             }
@@ -974,9 +968,7 @@ public:
             switch (type.getBasicType()) {
             case EbtFloat:      return GL_FLOAT;
             case EbtDouble:     return GL_DOUBLE;
-#ifdef AMD_EXTENSIONS
             case EbtFloat16:    return GL_FLOAT16_NV;
-#endif
             case EbtInt:        return GL_INT;
             case EbtUint:       return GL_UNSIGNED_INT;
             case EbtInt64:      return GL_INT64_ARB;
@@ -1093,6 +1085,7 @@ void TReflection::buildAttributeReflection(EShLanguage stage, const TIntermediat
 // build counter block index associations for buffers
 void TReflection::buildCounterIndices(const TIntermediate& intermediate)
 {
+#ifdef ENABLE_HLSL
     // search for ones that have counters
     for (int i = 0; i < int(indexToUniformBlock.size()); ++i) {
         const TString counterName(intermediate.addCounterBufferName(indexToUniformBlock[i].name).c_str());
@@ -1101,6 +1094,7 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate)
         if (index >= 0)
             indexToUniformBlock[i].counterIndex = index;
     }
+#endif
 }
 
 // build Shader Stages mask for all uniforms
@@ -1198,3 +1192,5 @@ void TReflection::dump()
 }
 
 } // end namespace glslang
+
+#endif // GLSLANG_WEB

+ 4 - 0
3rdparty/glslang/glslang/MachineIndependent/reflection.h

@@ -33,6 +33,8 @@
 // POSSIBILITY OF SUCH DAMAGE.
 //
 
+#ifndef GLSLANG_WEB
+
 #ifndef _REFLECTION_INCLUDED
 #define _REFLECTION_INCLUDED
 
@@ -201,3 +203,5 @@ protected:
 } // end namespace glslang
 
 #endif // _REFLECTION_INCLUDED
+
+#endif // GLSLANG_WEB

+ 16 - 4
3rdparty/glslang/glslang/Public/ShaderLang.h

@@ -68,7 +68,7 @@
 // This should always increase, as some paths to do not consume
 // a more major number.
 // It should increment by one when new functionality is added.
-#define GLSLANG_MINOR_VERSION 12
+#define GLSLANG_MINOR_VERSION 13
 
 //
 // Call before doing any other compiler/linker operations.
@@ -432,8 +432,10 @@ public:
     void addUniformLocationOverride(const char* name, int loc);
     void setUniformLocationBase(int base);
     void setInvertY(bool invert);
+#ifdef ENABLE_HLSL
     void setHlslIoMapping(bool hlslIoMap);
     void setFlattenUniformArrays(bool flatten);
+#endif
     void setNoStorageFormat(bool useUnknownFormat);
     void setNanMinMaxClamp(bool nanMinMaxClamp);
     void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode);
@@ -459,8 +461,12 @@ public:
         environment.target.language = lang;
         environment.target.version = version;
     }
+#ifdef ENABLE_HLSL
     void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
     bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }
+#else
+    bool getEnvTargetHlslFunctionality1() const { return false; }
+#endif
 
     // Interface to #include handlers.
     //
@@ -611,6 +617,8 @@ private:
     TShader& operator=(TShader&);
 };
 
+#ifndef GLSLANG_WEB
+
 //
 // A reflection database and its interface, consistent with the OpenGL API reflection queries.
 //
@@ -726,6 +734,8 @@ public:
     virtual void addStage(EShLanguage stage) = 0;
 };
 
+#endif // GLSLANG_WEB
+
 // Make one TProgram per set of shaders that will get linked together.  Add all
 // the shaders that are to be linked together.  After calling shader.parse()
 // for all shaders, call link().
@@ -745,14 +755,14 @@ public:
 
     TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; }
 
+#ifndef GLSLANG_WEB
+
     // Reflection Interface
 
     // call first, to do liveness analysis, index mapping, etc.; returns false on failure
     bool buildReflection(int opts = EShReflectionDefault);
-
     unsigned getLocalSize(int dim) const;                  // return dim'th local size
     int getReflectionIndex(const char *name) const;
-
     int getNumUniformVariables() const;
     const TObjectReflection& getUniform(int index) const;
     int getNumUniformBlocks() const;
@@ -831,11 +841,11 @@ public:
     const TType *getAttributeTType(int index) const    { return getPipeInput(index).getType(); }
 
     void dumpReflection();
-
     // I/O mapping: apply base offsets and map live unbound variables
     // If resolver is not provided it uses the previous approach
     // and respects auto assignment and offsets.
     bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr);
+#endif
 
 protected:
     bool linkStage(EShLanguage, EShMessages);
@@ -845,7 +855,9 @@ protected:
     TIntermediate* intermediate[EShLangCount];
     bool newedIntermediate[EShLangCount];      // track which intermediate were "new" versus reusing a singleton unit in a stage
     TInfoSink* infoSink;
+#ifndef GLSLANG_WEB
     TReflection* reflection;
+#endif
     bool linked;
 
 private:

+ 270 - 0
3rdparty/glslang/glslang/glslang.js.cpp

@@ -0,0 +1,270 @@
+//
+// Copyright (C) 2019 Google, Inc.
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+//    Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//
+//    Redistributions in binary form must reproduce the above
+//    copyright notice, this list of conditions and the following
+//    disclaimer in the documentation and/or other materials provided
+//    with the distribution.
+//
+//    Neither the name of 3Dlabs Inc. Ltd. nor the names of its
+//    contributors may be used to endorse or promote products derived
+//    from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+
+#include <cstdio>
+#include <cstdint>
+
+#ifdef __EMSCRIPTEN__
+#include <emscripten.h>
+#endif  // __EMSCRIPTEN__
+#include <memory>
+
+#include "../SPIRV/GlslangToSpv.h"
+#include "../SPIRV/doc.h"
+#include "./../glslang/Public/ShaderLang.h"
+
+#ifndef EMSCRIPTEN_KEEPALIVE
+#define EMSCRIPTEN_KEEPALIVE
+#endif
+
+const TBuiltInResource DefaultTBuiltInResource = {
+    /* .MaxLights = */ 32,
+    /* .MaxClipPlanes = */ 6,
+    /* .MaxTextureUnits = */ 32,
+    /* .MaxTextureCoords = */ 32,
+    /* .MaxVertexAttribs = */ 64,
+    /* .MaxVertexUniformComponents = */ 4096,
+    /* .MaxVaryingFloats = */ 64,
+    /* .MaxVertexTextureImageUnits = */ 32,
+    /* .MaxCombinedTextureImageUnits = */ 80,
+    /* .MaxTextureImageUnits = */ 32,
+    /* .MaxFragmentUniformComponents = */ 4096,
+    /* .MaxDrawBuffers = */ 32,
+    /* .MaxVertexUniformVectors = */ 128,
+    /* .MaxVaryingVectors = */ 8,
+    /* .MaxFragmentUniformVectors = */ 16,
+    /* .MaxVertexOutputVectors = */ 16,
+    /* .MaxFragmentInputVectors = */ 15,
+    /* .MinProgramTexelOffset = */ -8,
+    /* .MaxProgramTexelOffset = */ 7,
+    /* .MaxClipDistances = */ 8,
+    /* .MaxComputeWorkGroupCountX = */ 65535,
+    /* .MaxComputeWorkGroupCountY = */ 65535,
+    /* .MaxComputeWorkGroupCountZ = */ 65535,
+    /* .MaxComputeWorkGroupSizeX = */ 1024,
+    /* .MaxComputeWorkGroupSizeY = */ 1024,
+    /* .MaxComputeWorkGroupSizeZ = */ 64,
+    /* .MaxComputeUniformComponents = */ 1024,
+    /* .MaxComputeTextureImageUnits = */ 16,
+    /* .MaxComputeImageUniforms = */ 8,
+    /* .MaxComputeAtomicCounters = */ 8,
+    /* .MaxComputeAtomicCounterBuffers = */ 1,
+    /* .MaxVaryingComponents = */ 60,
+    /* .MaxVertexOutputComponents = */ 64,
+    /* .MaxGeometryInputComponents = */ 64,
+    /* .MaxGeometryOutputComponents = */ 128,
+    /* .MaxFragmentInputComponents = */ 128,
+    /* .MaxImageUnits = */ 8,
+    /* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
+    /* .MaxCombinedShaderOutputResources = */ 8,
+    /* .MaxImageSamples = */ 0,
+    /* .MaxVertexImageUniforms = */ 0,
+    /* .MaxTessControlImageUniforms = */ 0,
+    /* .MaxTessEvaluationImageUniforms = */ 0,
+    /* .MaxGeometryImageUniforms = */ 0,
+    /* .MaxFragmentImageUniforms = */ 8,
+    /* .MaxCombinedImageUniforms = */ 8,
+    /* .MaxGeometryTextureImageUnits = */ 16,
+    /* .MaxGeometryOutputVertices = */ 256,
+    /* .MaxGeometryTotalOutputComponents = */ 1024,
+    /* .MaxGeometryUniformComponents = */ 1024,
+    /* .MaxGeometryVaryingComponents = */ 64,
+    /* .MaxTessControlInputComponents = */ 128,
+    /* .MaxTessControlOutputComponents = */ 128,
+    /* .MaxTessControlTextureImageUnits = */ 16,
+    /* .MaxTessControlUniformComponents = */ 1024,
+    /* .MaxTessControlTotalOutputComponents = */ 4096,
+    /* .MaxTessEvaluationInputComponents = */ 128,
+    /* .MaxTessEvaluationOutputComponents = */ 128,
+    /* .MaxTessEvaluationTextureImageUnits = */ 16,
+    /* .MaxTessEvaluationUniformComponents = */ 1024,
+    /* .MaxTessPatchComponents = */ 120,
+    /* .MaxPatchVertices = */ 32,
+    /* .MaxTessGenLevel = */ 64,
+    /* .MaxViewports = */ 16,
+    /* .MaxVertexAtomicCounters = */ 0,
+    /* .MaxTessControlAtomicCounters = */ 0,
+    /* .MaxTessEvaluationAtomicCounters = */ 0,
+    /* .MaxGeometryAtomicCounters = */ 0,
+    /* .MaxFragmentAtomicCounters = */ 8,
+    /* .MaxCombinedAtomicCounters = */ 8,
+    /* .MaxAtomicCounterBindings = */ 1,
+    /* .MaxVertexAtomicCounterBuffers = */ 0,
+    /* .MaxTessControlAtomicCounterBuffers = */ 0,
+    /* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
+    /* .MaxGeometryAtomicCounterBuffers = */ 0,
+    /* .MaxFragmentAtomicCounterBuffers = */ 1,
+    /* .MaxCombinedAtomicCounterBuffers = */ 1,
+    /* .MaxAtomicCounterBufferSize = */ 16384,
+    /* .MaxTransformFeedbackBuffers = */ 4,
+    /* .MaxTransformFeedbackInterleavedComponents = */ 64,
+    /* .MaxCullDistances = */ 8,
+    /* .MaxCombinedClipAndCullDistances = */ 8,
+    /* .MaxSamples = */ 4,
+    /* .maxMeshOutputVerticesNV = */ 256,
+    /* .maxMeshOutputPrimitivesNV = */ 512,
+    /* .maxMeshWorkGroupSizeX_NV = */ 32,
+    /* .maxMeshWorkGroupSizeY_NV = */ 1,
+    /* .maxMeshWorkGroupSizeZ_NV = */ 1,
+    /* .maxTaskWorkGroupSizeX_NV = */ 32,
+    /* .maxTaskWorkGroupSizeY_NV = */ 1,
+    /* .maxTaskWorkGroupSizeZ_NV = */ 1,
+    /* .maxMeshViewCountNV = */ 4,
+
+    /* .limits = */ {
+        /* .nonInductiveForLoops = */ 1,
+        /* .whileLoops = */ 1,
+        /* .doWhileLoops = */ 1,
+        /* .generalUniformIndexing = */ 1,
+        /* .generalAttributeMatrixVectorIndexing = */ 1,
+        /* .generalVaryingIndexing = */ 1,
+        /* .generalSamplerIndexing = */ 1,
+        /* .generalVariableIndexing = */ 1,
+        /* .generalConstantMatrixVectorIndexing = */ 1,
+    }};
+
+static bool initialized = false;
+
+extern "C" {
+
+/*
+ * Takes in a GLSL shader as a string and converts it to SPIR-V in binary form.
+ *
+ * |glsl|          Null-terminated string containing the shader to be converted.
+ * |stage_int|     Magic number indicating the type of shader being processed.
+*                  Legal values are as follows:
+ *                   Vertex = 0
+ *                   Fragment = 4
+ *                   Compute = 5
+ * |gen_debug|     Flag to indicate if debug information should be generated.
+ * |spirv|         Output parameter for a pointer to the resulting SPIR-V data.
+ * |spirv_len|     Output parameter for the length of the output binary buffer.
+ *
+ * Returns a void* pointer which, if not null, must be destroyed by
+ * destroy_output_buffer.o. (This is not the same pointer returned in |spirv|.)
+ * If null, the compilation failed.
+ */
+EMSCRIPTEN_KEEPALIVE
+void* convert_glsl_to_spirv(const char* glsl, int stage_int, bool gen_debug, uint32_t** spirv, size_t* spirv_len)
+{
+    if (glsl == nullptr) {
+        fprintf(stderr, "Input pointer null\n");
+        return nullptr;
+    }
+    if (spirv == nullptr || spirv_len == nullptr) {
+        fprintf(stderr, "Output pointer null\n");
+        return nullptr;
+    }
+    *spirv = nullptr;
+    *spirv_len = 0;
+
+    if (stage_int != 0 && stage_int != 4 && stage_int != 5) {
+        fprintf(stderr, "Invalid shader stage\n");
+        return nullptr;
+    }
+    EShLanguage stage = static_cast<EShLanguage>(stage_int);
+
+    if (!initialized) {
+        glslang::InitializeProcess();
+        initialized = true;
+    }
+
+    glslang::TShader shader(stage);
+    shader.setStrings(&glsl, 1);
+    shader.setEnvInput(glslang::EShSourceGlsl, stage, glslang::EShClientVulkan, 100);
+    shader.setEnvClient(glslang::EShClientVulkan, glslang::EShTargetVulkan_1_1);
+    shader.setEnvTarget(glslang::EShTargetSpv, glslang::EShTargetSpv_1_3);
+    if (!shader.parse(&DefaultTBuiltInResource, 100, true, EShMsgDefault)) {
+        fprintf(stderr, "Parse failed\n");
+        fprintf(stderr, "%s\n", shader.getInfoLog());
+        return nullptr;
+    }
+
+    glslang::TProgram program;
+    program.addShader(&shader);
+    if (!program.link(EShMsgDefault)) {
+        fprintf(stderr, "Link failed\n");
+        fprintf(stderr, "%s\n", program.getInfoLog());
+        return nullptr;
+    }
+
+    glslang::SpvOptions spvOptions;
+    spvOptions.generateDebugInfo = gen_debug;
+    spvOptions.optimizeSize = false;
+    spvOptions.disassemble = false;
+    spvOptions.validate = false;
+
+    std::vector<uint32_t>* output = new std::vector<uint32_t>;
+    glslang::GlslangToSpv(*program.getIntermediate(stage), *output, nullptr, &spvOptions);
+
+    *spirv_len = output->size();
+    *spirv = output->data();
+    return output;
+}
+
+/*
+ * Destroys a buffer created by convert_glsl_to_spirv
+ */
+EMSCRIPTEN_KEEPALIVE
+void destroy_output_buffer(void* p)
+{
+    delete static_cast<std::vector<uint32_t>*>(p);
+}
+
+}  // extern "C"
+
+/*
+ * For non-Emscripten builds we supply a generic main, so that the glslang.js
+ * build target can generate an executable with a trivial use case instead of
+ * generating a WASM binary. This is done so that there is a target that can be
+ * built and output analyzed using desktop tools, since WASM binaries are
+ * specific to the Emscripten toolchain.
+ */
+#ifndef __EMSCRIPTEN__
+int main() {
+    const char* input = R"(#version 310 es
+
+void main() { })";
+
+    uint32_t* output;
+    size_t output_len;
+
+    void* id = convert_glsl_to_spirv(input, 4, false, &output, &output_len);
+    assert(output != nullptr);
+    assert(output_len != 0);
+    destroy_output_buffer(id);
+    return 0;
+}
+#endif  // ifndef __EMSCRIPTEN__

+ 45 - 0
3rdparty/glslang/glslang/glslang.pre.js

@@ -0,0 +1,45 @@
+Module['compileGLSLZeroCopy'] = function(glsl, shader_stage, gen_debug) {
+    gen_debug = !!gen_debug;
+
+    var shader_stage_int;
+    if (shader_stage === 'vertex') {
+        shader_stage_int = 0;
+    } else if (shader_stage === 'fragment') {
+        shader_stage_int = 4;
+    } else if (shader_stage === 'compute') {
+        shader_stage_int = 5;
+    } else {
+        throw new Error("shader_stage must be 'vertex', 'fragment', or 'compute'");
+    }
+
+    var p_output = Module['_malloc'](4);
+    var p_output_len = Module['_malloc'](4);
+    var id = ccall('convert_glsl_to_spirv',
+        'number',
+        ['string', 'number', 'boolean', 'number', 'number'],
+        [glsl, shader_stage_int, gen_debug, p_output, p_output_len]);
+    var output = getValue(p_output, 'i32');
+    var output_len = getValue(p_output_len, 'i32');
+    Module['_free'](p_output);
+    Module['_free'](p_output_len);
+
+    if (id === 0) {
+        throw new Error('GLSL compilation failed');
+    }
+
+    var ret = {};
+    var outputIndexU32 = output / 4;
+    ret.data = Module['HEAPU32'].subarray(outputIndexU32, outputIndexU32 + output_len);
+    ret.free = function() {
+        Module['_destroy_output_buffer'](id);
+    };
+
+    return ret;
+};
+
+Module['compileGLSL'] = function(glsl, shader_stage, gen_debug) {
+    var compiled = Module['compileGLSLZeroCopy'](glsl, shader_stage, gen_debug);
+    var ret = compiled.data.slice()
+    compiled.free();
+    return ret;
+};

+ 14 - 1
3rdparty/glslang/glslang/updateGrammar

@@ -1,3 +1,16 @@
-#!/usr/bin/env bash
+#!/usr/bin/bash
+
+if [ "$1" = 'web' ]
+then
+    m4 -P -DGLSLANG_WEB MachineIndependent/glslang.m4 > MachineIndependent/glslang.y
+elif [ "$#" -eq 0 ]
+then
+    m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y
+else
+    echo usage:
+    echo $0 web
+    echo $0
+    exit
+fi
 
 bison --defines=MachineIndependent/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o MachineIndependent/glslang_tab.cpp

+ 1 - 6
3rdparty/glslang/gtests/AST.FromFile.cpp

@@ -41,9 +41,7 @@ namespace {
 
 using CompileToAstTest = GlslangTest<::testing::TestWithParam<std::string>>;
 
-#ifdef NV_EXTENSIONS
 using CompileToAstTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
-#endif
 
 TEST_P(CompileToAstTest, FromFile)
 {
@@ -52,7 +50,6 @@ TEST_P(CompileToAstTest, FromFile)
                             Target::AST);
 }
 
-#ifdef NV_EXTENSIONS
 // Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled).
 TEST_P(CompileToAstTestNV, FromFile)
 {
@@ -60,7 +57,6 @@ TEST_P(CompileToAstTestNV, FromFile)
                             Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
                             Target::AST);
 }
-#endif
 
 // clang-format off
 INSTANTIATE_TEST_CASE_P(
@@ -125,6 +121,7 @@ INSTANTIATE_TEST_CASE_P(
         "310.tesc",
         "310.tese",
         "310implicitSizeArrayError.vert",
+        "310.inheritMemory.frag",
         "310AofA.vert",
         "310runtimeArray.vert",
         "320.comp",
@@ -281,7 +278,6 @@ INSTANTIATE_TEST_CASE_P(
     FileNameAsCustomTestSuffix
 );
 
-#ifdef NV_EXTENSIONS
 INSTANTIATE_TEST_CASE_P(
     Glsl, CompileToAstTestNV,
     ::testing::ValuesIn(std::vector<std::string>({
@@ -289,7 +285,6 @@ INSTANTIATE_TEST_CASE_P(
     })),
     FileNameAsCustomTestSuffix
 );
-#endif
 // clang-format on
 
 }  // anonymous namespace

+ 0 - 12
3rdparty/glslang/gtests/Spv.FromFile.cpp

@@ -72,12 +72,8 @@ using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
 using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
 using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
 using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
-#ifdef AMD_EXTENSIONS
 using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
-#endif
-#ifdef NV_EXTENSIONS
 using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
-#endif
 using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
 
 // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
@@ -179,7 +175,6 @@ TEST_P(GlslIoMap, FromFile)
                                  GetParam().flattenUniforms);
 }
 
-#ifdef AMD_EXTENSIONS
 // Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
 // Expected to successfully generate SPIR-V.
 TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
@@ -188,9 +183,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
                             Target::Spv);
 }
-#endif
 
-#ifdef NV_EXTENSIONS
 // Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled).
 // Expected to successfully generate SPIR-V.
 TEST_P(CompileVulkanToSpirvTestNV, FromFile)
@@ -199,7 +192,6 @@ TEST_P(CompileVulkanToSpirvTestNV, FromFile)
                             Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
                             Target::Spv);
 }
-#endif
 
 TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
 {
@@ -572,7 +564,6 @@ INSTANTIATE_TEST_CASE_P(
     FileNameAsCustomTestSuffix
 );
 
-#ifdef AMD_EXTENSIONS
 INSTANTIATE_TEST_CASE_P(
     Glsl, CompileVulkanToSpirvTestAMD,
     ::testing::ValuesIn(std::vector<std::string>({
@@ -588,9 +579,7 @@ INSTANTIATE_TEST_CASE_P(
     })),
     FileNameAsCustomTestSuffix
 );
-#endif
 
-#ifdef NV_EXTENSIONS
 INSTANTIATE_TEST_CASE_P(
     Glsl, CompileVulkanToSpirvTestNV,
     ::testing::ValuesIn(std::vector<std::string>({
@@ -638,7 +627,6 @@ INSTANTIATE_TEST_CASE_P(
 })),
 FileNameAsCustomTestSuffix
 );
-#endif
 
 INSTANTIATE_TEST_CASE_P(
     Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,

+ 0 - 2
3rdparty/glslang/gtests/TestFixture.cpp

@@ -60,7 +60,6 @@ EShLanguage GetShaderStage(const std::string& stage)
         return EShLangFragment;
     } else if (stage == "comp") {
         return EShLangCompute;
-#ifdef NV_EXTENSIONS
     } else if (stage == "rgen") {
         return EShLangRayGenNV;
     } else if (stage == "rint") {
@@ -77,7 +76,6 @@ EShLanguage GetShaderStage(const std::string& stage)
         return EShLangTaskNV;
     } else if (stage == "mesh") {
         return EShLangMeshNV;
-#endif
     } else {
         assert(0 && "Unknown shader stage");
         return EShLangCount;

+ 6 - 0
3rdparty/glslang/gtests/TestFixture.h

@@ -227,7 +227,9 @@ public:
             shader.setAutoMapBindings(true);
         }
         shader.setTextureSamplerTransformMode(texSampTransMode);
+#ifdef ENABLE_HLSL
         shader.setFlattenUniformArrays(flattenUniformArrays);
+#endif
 
         if (controls & EShMsgSpvRules) {
             if (controls & EShMsgVulkanRules) {
@@ -300,7 +302,9 @@ public:
         shader.setShiftSsboBinding(baseSsboBinding);
         shader.setAutoMapBindings(autoMapBindings);
         shader.setAutoMapLocations(true);
+#ifdef ENABLE_HLSL
         shader.setFlattenUniformArrays(flattenUniformArrays);
+#endif
 
         bool success = compile(&shader, code, entryPointName, controls);
 
@@ -308,7 +312,9 @@ public:
         program.addShader(&shader);
         
         success &= program.link(controls);
+#ifndef GLSLANG_WEB
         success &= program.mapIO();
+#endif
 
         spv::SpvBuildLogger logger;
 

+ 0 - 6
3rdparty/glslang/hlsl/hlslParseHelper.cpp

@@ -8703,25 +8703,19 @@ void HlslParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
     for (unsigned int member = 0; member < typeList.size(); ++member) {
         TQualifier& memberQualifier = typeList[member].type->getQualifier();
         bool contains64BitType = false;
-#ifdef AMD_EXTENSIONS
         bool contains32BitType = false;
         bool contains16BitType = false;
         int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, contains64BitType, contains32BitType, contains16BitType);
-#else
-        int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, contains64BitType);
-#endif
         // see if we need to auto-assign an offset to this member
         if (! memberQualifier.hasXfbOffset()) {
             // "if applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8"
             if (contains64BitType)
                 RoundToPow2(nextOffset, 8);
-#ifdef AMD_EXTENSIONS
             else if (contains32BitType)
                 RoundToPow2(nextOffset, 4);
             // "if applied to an aggregate containing a half float or 16-bit integer, the offset must also be a multiple of 2"
             else if (contains16BitType)
                 RoundToPow2(nextOffset, 2);
-#endif
             memberQualifier.layoutXfbOffset = nextOffset;
         } else
             nextOffset = memberQualifier.layoutXfbOffset;

Неке датотеке нису приказане због велике количине промена