SPV: Fix #1016: Don't allow non-GLSL-extension protected Layer and ViewportIndex members.
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 1661d5b..4833cd7 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -2465,6 +2465,10 @@
     if (member.getFieldName() == "gl_ViewportMaskPerViewNV" &&
         extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end())
         return true;
+    if ((member.getFieldName() == "gl_ViewportIndex" || member.getFieldName() == "gl_Layer") &&
+        extensions.find(glslang::E_GL_ARB_shader_viewport_layer_array) == extensions.end() &&
+        extensions.find(glslang::E_GL_NV_viewport_array2) == extensions.end())
+        return true;
 
     return false;
 };