Merge pull request #2788 from alelenv/iomapper_sr_fix

Skip auto decorating shader record buffer blocks with 'set' and 'binding'.
diff --git a/Test/baseResults/spv.viewportArray2.tesc.out b/Test/baseResults/spv.viewportArray2.tesc.out
index 74235a5..e95ada4 100644
--- a/Test/baseResults/spv.viewportArray2.tesc.out
+++ b/Test/baseResults/spv.viewportArray2.tesc.out
@@ -1,8 +1,7 @@
 spv.viewportArray2.tesc
-Validation failed
 // Module Version 10000
 // Generated by (magic number): 8000a
-// Id's are bound by 25
+// Id's are bound by 23
 
                               Capability Tessellation
                               Capability ShaderViewportIndexLayerNV
@@ -11,23 +10,21 @@
                               Extension  "SPV_NV_viewport_array2"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint TessellationControl 4  "main" 14 16 22 24
+                              EntryPoint TessellationControl 4  "main" 14 16 22
                               ExecutionMode 4 OutputVertices 4
-                              Source GLSL 450
+                              Source GLSL 430
                               SourceExtension  "GL_NV_viewport_array2"
                               Name 4  "main"
                               Name 10  "gl_PerVertex"
                               MemberName 10(gl_PerVertex) 0  "gl_ViewportMask"
                               Name 14  "gl_out"
                               Name 16  "gl_InvocationID"
-                              Name 22  "gl_ViewportIndex"
-                              Name 24  "gl_Layer"
+                              Name 22  "gl_Layer"
                               MemberDecorate 10(gl_PerVertex) 0 BuiltIn ViewportMaskNV
                               Decorate 10(gl_PerVertex) Block
                               Decorate 16(gl_InvocationID) BuiltIn InvocationId
-                              Decorate 22(gl_ViewportIndex) BuiltIn ViewportIndex
-                              Decorate 24(gl_Layer) BuiltIn Layer
-                              Decorate 24(gl_Layer) ViewportRelativeNV
+                              Decorate 22(gl_Layer) BuiltIn Layer
+                              Decorate 22(gl_Layer) ViewportRelativeNV
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
@@ -44,14 +41,11 @@
               18:      6(int) Constant 0
               19:      6(int) Constant 1
               20:             TypePointer Output 6(int)
-22(gl_ViewportIndex):     20(ptr) Variable Output
-              23:      6(int) Constant 2
-    24(gl_Layer):     20(ptr) Variable Output
+    22(gl_Layer):     20(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
               17:      6(int) Load 16(gl_InvocationID)
               21:     20(ptr) AccessChain 14(gl_out) 17 18 18
                               Store 21 19
-                              Store 22(gl_ViewportIndex) 23
                               Return
                               FunctionEnd
diff --git a/Test/spv.viewportArray2.tesc b/Test/spv.viewportArray2.tesc
index 7fc208a..24a1d8c 100644
--- a/Test/spv.viewportArray2.tesc
+++ b/Test/spv.viewportArray2.tesc
@@ -1,4 +1,4 @@
-#version 450

+#version 430

 #extension GL_NV_viewport_array2 :require

 

 layout(vertices = 4) out;

@@ -12,5 +12,4 @@
 void main()

 {

     gl_out[gl_InvocationID].gl_ViewportMask[0] = 1;

-    gl_ViewportIndex = 2;

 }

diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp
index 9f92529..b633331 100644
--- a/glslang/MachineIndependent/Initialize.cpp
+++ b/glslang/MachineIndependent/Initialize.cpp
@@ -5172,9 +5172,13 @@
                 );
         }
 
-        if (version >= 450)
+        if (version >= 430)
             stageBuiltins[EShLangVertex].append(
                 "out int gl_ViewportMask[];"             // GL_NV_viewport_array2
+                );
+
+        if (version >= 450)
+            stageBuiltins[EShLangVertex].append(
                 "out int gl_SecondaryViewportMaskNV[];"  // GL_NV_stereo_view_rendering
                 "out vec4 gl_SecondaryPositionNV;"       // GL_NV_stereo_view_rendering
                 "out vec4 gl_PositionPerViewNV[];"       // GL_NVX_multiview_per_view_attributes
@@ -5310,9 +5314,13 @@
             "in int gl_InvocationID;"
             );
 
-        if (version >= 450)
+        if (version >= 430)
             stageBuiltins[EShLangGeometry].append(
                 "out int gl_ViewportMask[];"               // GL_NV_viewport_array2
+            );
+
+        if (version >= 450)
+            stageBuiltins[EShLangGeometry].append(
                 "out int gl_SecondaryViewportMaskNV[];"    // GL_NV_stereo_view_rendering
                 "out vec4 gl_SecondaryPositionNV;"         // GL_NV_stereo_view_rendering
                 "out vec4 gl_PositionPerViewNV[];"         // GL_NVX_multiview_per_view_attributes
@@ -5388,7 +5396,13 @@
         if (version >= 450)
             stageBuiltins[EShLangTessControl].append(
                 "float gl_CullDistance[];"
+            );
+        if (version >= 430)
+            stageBuiltins[EShLangTessControl].append(
                 "int  gl_ViewportMask[];"             // GL_NV_viewport_array2
+            );
+        if (version >= 450)
+            stageBuiltins[EShLangTessControl].append(
                 "vec4 gl_SecondaryPositionNV;"        // GL_NV_stereo_view_rendering
                 "int  gl_SecondaryViewportMaskNV[];"  // GL_NV_stereo_view_rendering
                 "vec4 gl_PositionPerViewNV[];"        // GL_NVX_multiview_per_view_attributes
@@ -5491,9 +5505,13 @@
                 "out int gl_Layer;"
                 "\n");
 
-        if (version >= 450)
+        if (version >= 430)
             stageBuiltins[EShLangTessEvaluation].append(
                 "out int  gl_ViewportMask[];"             // GL_NV_viewport_array2
+            );
+
+        if (version >= 450)
+            stageBuiltins[EShLangTessEvaluation].append(
                 "out vec4 gl_SecondaryPositionNV;"        // GL_NV_stereo_view_rendering
                 "out int  gl_SecondaryViewportMaskNV[];"  // GL_NV_stereo_view_rendering
                 "out vec4 gl_PositionPerViewNV[];"        // GL_NVX_multiview_per_view_attributes