SPV: Implement new extensions GL_KHX_device_group and GL_KHX_multiview.

These correspond to SPV_KHR_device_group and SPV_KHR_multiview.
Also, bring tests up to date with Khronos internals, and some misc. related changes.
diff --git a/SPIRV/GLSL.ext.KHR.h b/SPIRV/GLSL.ext.KHR.h
index 4614a3c..a8f20c3 100644
--- a/SPIRV/GLSL.ext.KHR.h
+++ b/SPIRV/GLSL.ext.KHR.h
@@ -27,10 +27,17 @@
 #ifndef GLSLextKHR_H
 #define GLSLextKHR_H
 
-// SPV_KHR_shader_ballot
-static const char* const E_SPV_KHR_shader_ballot                = "SPV_KHR_shader_ballot";
+enum BuiltIn;
+enum Op;
+enum Capability;
 
-// SPV_KHR_shader_draw_parameters
-static const char* const E_SPV_KHR_shader_draw_parameters       = "SPV_KHR_shader_draw_parameters";
-static const char* const E_SPV_KHR_subgroup_vote                = "SPV_KHR_subgroup_vote";
+static const int GLSLextKHRVersion = 100;
+static const int GLSLextKHRRevision = 1;
+
+static const char* const E_SPV_KHR_shader_ballot          = "SPV_KHR_shader_ballot";
+static const char* const E_SPV_KHR_subgroup_vote          = "SPV_KHR_subgroup_vote";
+static const char* const E_SPV_KHR_device_group           = "SPV_KHR_device_group";
+static const char* const E_SPV_KHR_multiview              = "SPV_KHR_multiview";
+static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters";
+
 #endif  // #ifndef GLSLextKHR_H
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 13bc305..a7b0f05 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -628,6 +628,16 @@
         return spv::BuiltInBaryCoordPullModelAMD;
 #endif
 
+    case glslang::EbvDeviceIndex:
+        builder.addExtension(spv::E_SPV_KHR_device_group);
+        builder.addCapability(spv::CapabilityDeviceGroup);
+        return spv::BuiltinDeviceIndex;
+
+    case glslang::EbvViewIndex:
+        builder.addExtension(spv::E_SPV_KHR_multiview);
+        builder.addCapability(spv::CapabilityMultiView);
+        return spv::BuiltinViewIndex;
+
 #ifdef NV_EXTENSIONS
     case glslang::EbvViewportMaskNV:
         builder.addExtension(spv::E_SPV_NV_viewport_array2);
diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp
index 91e3b89..52af6a7 100755
--- a/SPIRV/doc.cpp
+++ b/SPIRV/doc.cpp
@@ -48,6 +48,7 @@
 namespace spv {
     extern "C" {
         // Include C-based headers that don't have a namespace
+        #include "GLSL.ext.KHR.h"
 #ifdef AMD_EXTENSIONS
         #include "GLSL.ext.AMD.h"
 #endif
@@ -318,15 +319,13 @@
     case 42: return "VertexIndex";                 // TBD: put next to VertexId?
     case 43: return "InstanceIndex";               // TBD: put next to InstanceId?
 
-    case BuiltInCeiling:
-    default: return "Bad";
-
     case 4416: return "SubgroupEqMaskKHR";
     case 4417: return "SubgroupGeMaskKHR";
     case 4418: return "SubgroupGtMaskKHR";
     case 4419: return "SubgroupLeMaskKHR";
     case 4420: return "SubgroupLtMaskKHR";
-
+    case 4438: return "DeviceIndex";
+    case 4440: return "ViewIndex";
     case 4424: return "BaseVertex";
     case 4425: return "BaseInstance";
     case 4426: return "DrawIndex";
@@ -340,6 +339,7 @@
     case 4997: return "BaryCoordSmoothSampleAMD";
     case 4998: return "BaryCoordPullModelAMD";
 #endif
+
 #ifdef NV_EXTENSIONS
     case 5253: return "ViewportMaskNV";
     case 5257: return "SecondaryPositionNV";
@@ -347,6 +347,9 @@
     case 5260: return "PositionPerViewNV";
     case 5261: return "ViewportMaskPerViewNV";
 #endif
+
+    case BuiltInCeiling:
+    default: return "Bad";
     }
 }
 
@@ -823,13 +826,13 @@
     case 56: return "StorageImageWriteWithoutFormat";
     case 57: return "MultiViewport";
 
-    case CapabilityCeiling:
-    default: return "Bad";
-
     case 4423: return "SubgroupBallotKHR";
     case 4427: return "DrawParameters";
     case 4431: return "SubgroupVoteKHR";
 
+    case 4437: return "DeviceGroup";
+    case 4439: return "MultiView";
+
 #ifdef NV_EXTENSIONS
     case 5251: return "GeometryShaderPassthroughNV";
     case 5254: return "ShaderViewportIndexLayerNV";
@@ -838,6 +841,8 @@
     case 5262: return "PerViewAttributesNV";
 #endif
 
+    case CapabilityCeiling:
+    default: return "Bad";
     }
 }
 
@@ -1166,10 +1171,6 @@
     case 319: return "OpAtomicFlagClear";
     case 320: return "OpImageSparseRead";
 
-    case OpcodeCeiling:
-    default:
-        return "Bad";
-
     case 4421: return "OpSubgroupBallotKHR";
     case 4422: return "OpSubgroupFirstInvocationKHR";
     case 4428: return "OpSubgroupAllKHR";
@@ -1187,6 +1188,10 @@
     case 5006: return "OpGroupUMaxNonUniformAMD";
     case 5007: return "OpGroupSMaxNonUniformAMD";
 #endif
+
+    case OpcodeCeiling:
+    default:
+        return "Bad";
     }
 }
 
diff --git a/SPIRV/spirv.hpp b/SPIRV/spirv.hpp
index c7b3d5f..6bfd014 100755
--- a/SPIRV/spirv.hpp
+++ b/SPIRV/spirv.hpp
@@ -428,6 +428,8 @@
     BuiltInBaseVertex = 4424,
     BuiltInBaseInstance = 4425,
     BuiltInDrawIndex = 4426,
+    BuiltinDeviceIndex = 4438,
+    BuiltinViewIndex = 4440,
     BuiltInMax = 0x7fffffff,
 };
 
@@ -606,6 +608,8 @@
     CapabilitySubgroupBallotKHR = 4423,
     CapabilityDrawParameters = 4427,
     CapabilitySubgroupVoteKHR = 4431,
+    CapabilityDeviceGroup = 4437,
+    CapabilityMultiView = 4439,
     CapabilityMax = 0x7fffffff,
 };
 
@@ -906,10 +910,10 @@
     OpImageSparseRead = 320,
     OpSubgroupBallotKHR = 4421,
     OpSubgroupFirstInvocationKHR = 4422,
-    OpSubgroupReadInvocationKHR = 4432,
-    OpSubgroupAllKHR = 4428,

-    OpSubgroupAnyKHR = 4429,

+    OpSubgroupAllKHR = 4428,
+    OpSubgroupAnyKHR = 4429,
     OpSubgroupAllEqualKHR = 4430,
+    OpSubgroupReadInvocationKHR = 4432,
     OpMax = 0x7fffffff,
 };