Web: Selectively remove a few key features, using #ifndef GLSLANG_WEB

Save about 100K.

N.B.: This is done by eliminating a function call, at a high level,
not by #ifdef'ing a bunch of code.

Also, removed no longer needed *_EXTENSION #ifdef in the code not
needed by GLSLANG_WEB.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c84ae8..be55137 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,6 +79,10 @@
     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)
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 8a17ce3..dea911b 100644
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -1592,9 +1592,11 @@
     for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it)
         entryPoint->addIdOperand(*it);
 
+#ifndef GLSLANG_WEB
     // Add capabilities, extensions, remove unneeded decorations, etc., 
     // based on the resulting SPIR-V.
     builder.postProcess();
+#endif
 }
 
 // Write the SPV into 'out'.
diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp
index 4ef7e5f..51cf3c8 100644
--- a/SPIRV/SpvBuilder.cpp
+++ b/SPIRV/SpvBuilder.cpp
@@ -2089,6 +2089,7 @@
     if (parameters.lod)
         query->addIdOperand(parameters.lod);
     buildPoint->addInstruction(std::unique_ptr<Instruction>(query));
+    addCapability(CapabilityImageQuery);
 
     return query->getResultId();
 }
diff --git a/SPIRV/SpvPostProcess.cpp b/SPIRV/SpvPostProcess.cpp
index 6e1f7cf..18765a3 100644
--- a/SPIRV/SpvPostProcess.cpp
+++ b/SPIRV/SpvPostProcess.cpp
@@ -51,12 +51,8 @@
     #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 @@
         }
         break;
     case OpExtInst:
-#if AMD_EXTENSIONS
         switch (inst.getImmediateOperand(1)) {
         case GLSLstd450Frexp:
         case GLSLstd450FrexpStruct:
@@ -176,7 +171,6 @@
         default:
             break;
         }
-#endif
         break;
     default:
         if (basicTypeOp == OpTypeFloat && width == 16)
@@ -222,12 +216,10 @@
         addCapability(CapabilityImageQuery);
         break;
 
-#ifdef NV_EXTENSIONS
     case OpGroupNonUniformPartitionNV:
         addExtension(E_SPV_NV_shader_subgroup_partitioned);
         addCapability(CapabilityGroupNonUniformPartitionedNV);
         break;
-#endif
 
     case OpLoad:
     case OpStore:
diff --git a/SPIRV/disassemble.cpp b/SPIRV/disassemble.cpp
index 80ebac4..930e799 100644
--- a/SPIRV/disassemble.cpp
+++ b/SPIRV/disassemble.cpp
@@ -52,26 +52,16 @@
     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 @@
 // 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 @@
                 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 @@
     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 @@
 
     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 @@
     }
     return "Bad";
 }
-#endif
 
 void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream)
 {
diff --git a/StandAlone/ResourceLimits.cpp b/StandAlone/ResourceLimits.cpp
index 66e79af..028caa6 100644
--- a/StandAlone/ResourceLimits.cpp
+++ b/StandAlone/ResourceLimits.cpp
@@ -234,7 +234,6 @@
             << "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 @@
             << "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 @@
             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 @@
             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")
diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp
index 6af00dc..68cb8e9 100644
--- a/StandAlone/StandAlone.cpp
+++ b/StandAlone/StandAlone.cpp
@@ -146,11 +146,13 @@
 {
     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;
@@ -1118,8 +1120,10 @@
                         } else {
                             glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage));
                         }
+#ifndef GLSLANG_WEB
                         if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv))
                             spv::Disassemble(std::cout, spirv);
+#endif
                     }
                 }
             }
@@ -1207,11 +1211,13 @@
         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",
diff --git a/Test/baseResults/size b/Test/baseResults/size
index f2e3e21..060c142 100644
--- a/Test/baseResults/size
+++ b/Test/baseResults/size
@@ -1 +1 @@
-1202688 ../build/install/bin/glslangValidator.exe
+1097728 ../build/install/bin/glslangValidator.exe
diff --git a/Test/runtests b/Test/runtests
index c50f148..cf947a6 100755
--- a/Test/runtests
+++ b/Test/runtests
@@ -55,8 +55,8 @@
 # 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
diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp
index 19b24af..8cb4f85 100644
--- a/glslang/MachineIndependent/Intermediate.cpp
+++ b/glslang/MachineIndependent/Intermediate.cpp
@@ -2729,6 +2729,7 @@
     if (aggRoot && aggRoot->getOp() == EOpNull)
         aggRoot->setOperator(EOpSequence);
 
+#ifndef GLSLANG_WEB
     // Propagate 'noContraction' label in backward from 'precise' variables.
     glslang::PropagateNoContraction(*this);
 
@@ -2739,6 +2740,7 @@
         performTextureUpgradeAndSamplerRemovalTransformation(root);
         break;
     }
+#endif
 
     return true;
 }
diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp
index 6df25f0..9c99367 100644
--- a/glslang/MachineIndependent/ParseHelper.cpp
+++ b/glslang/MachineIndependent/ParseHelper.cpp
@@ -4737,9 +4737,11 @@
     if (parsingBuiltins)
         return;
 
+#ifndef GLSLANG_WEB
     // Check on array indexes for ES 2.0 (version 100) limitations.
     for (size_t i = 0; i < needsIndexLimitationChecking.size(); ++i)
         constantIndexExpressionCheck(needsIndexLimitationChecking[i]);
+#endif
 
     // Check for stages that are enabled by extension.
     // Can't do this at the beginning, it is chicken and egg to add a stage by