Implement most of GL_ARB_explicit_attrib_location (all but index on fragment output).
authorJohn Kessenich <cepheus@frii.com>
Tue, 29 Jul 2014 19:31:13 +0000 (19:31 +0000)
committerJohn Kessenich <cepheus@frii.com>
Tue, 29 Jul 2014 19:31:13 +0000 (19:31 +0000)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27545 e7fa87d3-cd2b-0410-9028-fcbf551c1848

Test/140.frag
Test/140.vert
Test/baseResults/140.frag.out
Test/baseResults/140.vert.out
glslang/MachineIndependent/ParseHelper.cpp
glslang/MachineIndependent/Versions.cpp
glslang/MachineIndependent/Versions.h

index 50fe391..0abc574 100644 (file)
@@ -23,6 +23,12 @@ float patch = 3.1;
 
 layout(location=3) in vec4 vl;  // ERROR
 
+layout(location = 3) out vec4 factorBad;  // ERROR
+
+#extension GL_ARB_explicit_attrib_location : enable
+
+layout(location = 5) out vec4 factor;
+
 #extension GL_ARB_separate_shader_objects : enable
 
 layout(location=4) in vec4 vl2;
index 6e162be..5dfa71e 100644 (file)
@@ -22,6 +22,12 @@ void main()
 \r
 out vec4 gl_Position;  // ERROR\r
 \r
+layout(location = 9) in vec4 locBad;  // ERROR\r
+\r
+#extension GL_ARB_explicit_attrib_location : enable\r
+\r
+layout(location = 9) in vec4 loc;\r
+\r
 #extension GL_ARB_separate_shader_objects : enable\r
 \r
 out vec4 gl_Position;\r
index 9ce7cac..8600e92 100644 (file)
@@ -4,12 +4,16 @@ ERROR: 0:17: '#error' : GL_ES is not set
 ERROR: 0:20: 'fragment-shader struct input' : not supported for this version or the enabled extensions \r
 ERROR: 0:24: 'location' : not supported for this version or the enabled extensions \r
 ERROR: 0:24: 'location qualifier on input' : not supported for this version or the enabled extensions \r
-ERROR: 0:32: 'assign' :  l-value required "v" (can't modify shader input)\r
-ERROR: 0:32: 'out' : Non-L-value cannot be passed for 'out' or 'inout' parameters. \r
-ERROR: 6 compilation errors.  No code generated.\r
+ERROR: 0:26: 'location' : not supported for this version or the enabled extensions \r
+ERROR: 0:26: 'location qualifier on output' : not supported for this version or the enabled extensions \r
+WARNING: 0:28: '#extension' : extension is only partially supported: GL_ARB_explicit_attrib_location\r
+ERROR: 0:38: 'assign' :  l-value required "v" (can't modify shader input)\r
+ERROR: 0:38: 'out' : Non-L-value cannot be passed for 'out' or 'inout' parameters. \r
+ERROR: 8 compilation errors.  No code generated.\r
 \r
 \r
 Shader version: 140\r
+Requested GL_ARB_explicit_attrib_location\r
 Requested GL_ARB_separate_shader_objects\r
 ERROR: node is still EOpNull!\r
 0:10  Function Definition: main( (void)\r
@@ -27,45 +31,45 @@ ERROR: node is still EOpNull!
 0:22      'patch' (float)\r
 0:22      Constant:\r
 0:22        3.100000\r
-0:30  Function Definition: foo( (void)\r
-0:30    Function Parameters: \r
-0:32    Sequence\r
-0:32      Sequence\r
-0:32        move second child to first child (2-component vector of float)\r
-0:32          'r1' (2-component vector of float)\r
-0:32          modf (2-component vector of float)\r
-0:32            vector swizzle (2-component vector of float)\r
-0:32              'v' (smooth in 4-component vector of float)\r
-0:32              Sequence\r
-0:32                Constant:\r
-0:32                  0 (const int)\r
-0:32                Constant:\r
-0:32                  1 (const int)\r
-0:32            vector swizzle (2-component vector of float)\r
-0:32              'v' (smooth in 4-component vector of float)\r
-0:32              Sequence\r
-0:32                Constant:\r
-0:32                  2 (const int)\r
-0:32                Constant:\r
-0:32                  3 (const int)\r
-0:33      Sequence\r
-0:33        move second child to first child (2-component vector of float)\r
-0:33          'r2' (2-component vector of float)\r
-0:33          modf (2-component vector of float)\r
-0:33            vector swizzle (2-component vector of float)\r
-0:33              'o' (out 4-component vector of float)\r
-0:33              Sequence\r
-0:33                Constant:\r
-0:33                  0 (const int)\r
-0:33                Constant:\r
-0:33                  1 (const int)\r
-0:33            vector swizzle (2-component vector of float)\r
-0:33              'o' (out 4-component vector of float)\r
-0:33              Sequence\r
-0:33                Constant:\r
-0:33                  2 (const int)\r
-0:33                Constant:\r
-0:33                  3 (const int)\r
+0:36  Function Definition: foo( (void)\r
+0:36    Function Parameters: \r
+0:38    Sequence\r
+0:38      Sequence\r
+0:38        move second child to first child (2-component vector of float)\r
+0:38          'r1' (2-component vector of float)\r
+0:38          modf (2-component vector of float)\r
+0:38            vector swizzle (2-component vector of float)\r
+0:38              'v' (smooth in 4-component vector of float)\r
+0:38              Sequence\r
+0:38                Constant:\r
+0:38                  0 (const int)\r
+0:38                Constant:\r
+0:38                  1 (const int)\r
+0:38            vector swizzle (2-component vector of float)\r
+0:38              'v' (smooth in 4-component vector of float)\r
+0:38              Sequence\r
+0:38                Constant:\r
+0:38                  2 (const int)\r
+0:38                Constant:\r
+0:38                  3 (const int)\r
+0:39      Sequence\r
+0:39        move second child to first child (2-component vector of float)\r
+0:39          'r2' (2-component vector of float)\r
+0:39          modf (2-component vector of float)\r
+0:39            vector swizzle (2-component vector of float)\r
+0:39              'o' (out 4-component vector of float)\r
+0:39              Sequence\r
+0:39                Constant:\r
+0:39                  0 (const int)\r
+0:39                Constant:\r
+0:39                  1 (const int)\r
+0:39            vector swizzle (2-component vector of float)\r
+0:39              'o' (out 4-component vector of float)\r
+0:39              Sequence\r
+0:39                Constant:\r
+0:39                  2 (const int)\r
+0:39                Constant:\r
+0:39                  3 (const int)\r
 0:?   Linker Objects\r
 0:?     'v' (smooth in 4-component vector of float)\r
 0:?     'i' (smooth in 4-component vector of float)\r
@@ -75,6 +79,8 @@ ERROR: node is still EOpNull!
 0:?     's' (smooth in structure{float f})\r
 0:?     'patch' (float)\r
 0:?     'vl' (layout(location=3 ) smooth in 4-component vector of float)\r
+0:?     'factorBad' (layout(location=3 ) out 4-component vector of float)\r
+0:?     'factor' (layout(location=5 ) out 4-component vector of float)\r
 0:?     'vl2' (layout(location=4 ) smooth in 4-component vector of float)\r
 \r
 \r
@@ -82,6 +88,7 @@ Linked fragment stage:
 \r
 \r
 Shader version: 140\r
+Requested GL_ARB_explicit_attrib_location\r
 Requested GL_ARB_separate_shader_objects\r
 ERROR: node is still EOpNull!\r
 0:10  Function Definition: main( (void)\r
@@ -99,45 +106,45 @@ ERROR: node is still EOpNull!
 0:22      'patch' (float)\r
 0:22      Constant:\r
 0:22        3.100000\r
-0:30  Function Definition: foo( (void)\r
-0:30    Function Parameters: \r
-0:32    Sequence\r
-0:32      Sequence\r
-0:32        move second child to first child (2-component vector of float)\r
-0:32          'r1' (2-component vector of float)\r
-0:32          modf (2-component vector of float)\r
-0:32            vector swizzle (2-component vector of float)\r
-0:32              'v' (smooth in 4-component vector of float)\r
-0:32              Sequence\r
-0:32                Constant:\r
-0:32                  0 (const int)\r
-0:32                Constant:\r
-0:32                  1 (const int)\r
-0:32            vector swizzle (2-component vector of float)\r
-0:32              'v' (smooth in 4-component vector of float)\r
-0:32              Sequence\r
-0:32                Constant:\r
-0:32                  2 (const int)\r
-0:32                Constant:\r
-0:32                  3 (const int)\r
-0:33      Sequence\r
-0:33        move second child to first child (2-component vector of float)\r
-0:33          'r2' (2-component vector of float)\r
-0:33          modf (2-component vector of float)\r
-0:33            vector swizzle (2-component vector of float)\r
-0:33              'o' (out 4-component vector of float)\r
-0:33              Sequence\r
-0:33                Constant:\r
-0:33                  0 (const int)\r
-0:33                Constant:\r
-0:33                  1 (const int)\r
-0:33            vector swizzle (2-component vector of float)\r
-0:33              'o' (out 4-component vector of float)\r
-0:33              Sequence\r
-0:33                Constant:\r
-0:33                  2 (const int)\r
-0:33                Constant:\r
-0:33                  3 (const int)\r
+0:36  Function Definition: foo( (void)\r
+0:36    Function Parameters: \r
+0:38    Sequence\r
+0:38      Sequence\r
+0:38        move second child to first child (2-component vector of float)\r
+0:38          'r1' (2-component vector of float)\r
+0:38          modf (2-component vector of float)\r
+0:38            vector swizzle (2-component vector of float)\r
+0:38              'v' (smooth in 4-component vector of float)\r
+0:38              Sequence\r
+0:38                Constant:\r
+0:38                  0 (const int)\r
+0:38                Constant:\r
+0:38                  1 (const int)\r
+0:38            vector swizzle (2-component vector of float)\r
+0:38              'v' (smooth in 4-component vector of float)\r
+0:38              Sequence\r
+0:38                Constant:\r
+0:38                  2 (const int)\r
+0:38                Constant:\r
+0:38                  3 (const int)\r
+0:39      Sequence\r
+0:39        move second child to first child (2-component vector of float)\r
+0:39          'r2' (2-component vector of float)\r
+0:39          modf (2-component vector of float)\r
+0:39            vector swizzle (2-component vector of float)\r
+0:39              'o' (out 4-component vector of float)\r
+0:39              Sequence\r
+0:39                Constant:\r
+0:39                  0 (const int)\r
+0:39                Constant:\r
+0:39                  1 (const int)\r
+0:39            vector swizzle (2-component vector of float)\r
+0:39              'o' (out 4-component vector of float)\r
+0:39              Sequence\r
+0:39                Constant:\r
+0:39                  2 (const int)\r
+0:39                Constant:\r
+0:39                  3 (const int)\r
 0:?   Linker Objects\r
 0:?     'v' (smooth in 4-component vector of float)\r
 0:?     'i' (smooth in 4-component vector of float)\r
@@ -147,5 +154,7 @@ ERROR: node is still EOpNull!
 0:?     's' (smooth in structure{float f})\r
 0:?     'patch' (float)\r
 0:?     'vl' (layout(location=3 ) smooth in 4-component vector of float)\r
+0:?     'factorBad' (layout(location=3 ) out 4-component vector of float)\r
+0:?     'factor' (layout(location=5 ) out 4-component vector of float)\r
 0:?     'vl2' (layout(location=4 ) smooth in 4-component vector of float)\r
 \r
index 61f6af8..2fa9191 100644 (file)
@@ -1,14 +1,18 @@
 140.vert\r
 ERROR: 0:23: 'gl_Position' : identifiers starting with "gl_" are reserved \r
-ERROR: 0:28: 'redeclaration' : cannot change storage, memory, or auxiliary qualification of gl_Position\r
-ERROR: 0:28: 'redeclaration' : cannot change interpolation qualification of gl_Position\r
-ERROR: 0:29: 'redeclaration' : cannot change the type of gl_Position\r
-ERROR: 0:32: 'gl_ClipVertex' : cannot redeclare after use \r
-ERROR: 0:33: 'gl_FogFragCoord' : cannot redeclare after use \r
-ERROR: 6 compilation errors.  No code generated.\r
+ERROR: 0:25: 'location' : not supported for this version or the enabled extensions \r
+ERROR: 0:25: 'location qualifier on input' : not supported for this version or the enabled extensions \r
+WARNING: 0:27: '#extension' : extension is only partially supported: GL_ARB_explicit_attrib_location\r
+ERROR: 0:34: 'redeclaration' : cannot change storage, memory, or auxiliary qualification of gl_Position\r
+ERROR: 0:34: 'redeclaration' : cannot change interpolation qualification of gl_Position\r
+ERROR: 0:35: 'redeclaration' : cannot change the type of gl_Position\r
+ERROR: 0:38: 'gl_ClipVertex' : cannot redeclare after use \r
+ERROR: 0:39: 'gl_FogFragCoord' : cannot redeclare after use \r
+ERROR: 8 compilation errors.  No code generated.\r
 \r
 \r
 Shader version: 140\r
+Requested GL_ARB_explicit_attrib_location\r
 Requested GL_ARB_separate_shader_objects\r
 ERROR: node is still EOpNull!\r
 0:9  Function Definition: main( (void)\r
@@ -51,6 +55,8 @@ ERROR: node is still EOpNull!
 0:?     'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 offset=0 ) uniform int anonMem})\r
 0:?     'gl_TexCoord' (smooth out implicitly-sized array of 4-component vector of float)\r
 0:?     'gl_Position' (smooth out 4-component vector of float)\r
+0:?     'locBad' (layout(location=9 ) in 4-component vector of float)\r
+0:?     'loc' (layout(location=9 ) in 4-component vector of float)\r
 0:?     'gl_PointSize' (gl_PointSize float)\r
 0:?     'gl_PointSize' (gl_PointSize float)\r
 0:?     'gl_ClipVertex' (gl_ClipVertex 4-component vector of float)\r
@@ -65,6 +71,7 @@ Linked vertex stage:
 \r
 \r
 Shader version: 140\r
+Requested GL_ARB_explicit_attrib_location\r
 Requested GL_ARB_separate_shader_objects\r
 ERROR: node is still EOpNull!\r
 0:9  Function Definition: main( (void)\r
@@ -107,6 +114,8 @@ ERROR: node is still EOpNull!
 0:?     'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 offset=0 ) uniform int anonMem})\r
 0:?     'gl_TexCoord' (smooth out 1-element array of 4-component vector of float)\r
 0:?     'gl_Position' (smooth out 4-component vector of float)\r
+0:?     'locBad' (layout(location=9 ) in 4-component vector of float)\r
+0:?     'loc' (layout(location=9 ) in 4-component vector of float)\r
 0:?     'gl_PointSize' (gl_PointSize float)\r
 0:?     'gl_PointSize' (gl_PointSize float)\r
 0:?     'gl_ClipVertex' (gl_ClipVertex 4-component vector of float)\r
index addd8f6..e950eff 100644 (file)
@@ -3037,7 +3037,8 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
         return;
     } else if (id == "location") {
         profileRequires(loc, EEsProfile, 300, 0, "location");
-        profileRequires(loc, ~EEsProfile, 330, GL_ARB_separate_shader_objects, "location");
+        const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
+        profileRequires(loc, ~EEsProfile, 330, 2, exts, "location");
         if ((unsigned int)value >= TQualifier::layoutLocationEnd)
             error(loc, "location is too large", id.c_str(), "");
         else
@@ -3354,9 +3355,10 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
             if (profile == EEsProfile)
                 requireStage(loc, EShLangVertex, feature);
             requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature);
-            if (language == EShLangVertex)
-                profileRequires(loc, ~EEsProfile, 330, GL_ARB_separate_shader_objects, feature);
-            else
+            if (language == EShLangVertex) {
+                const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
+                profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
+            } else
                 profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
             break;
         }
@@ -3366,9 +3368,10 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
             if (profile == EEsProfile)
                 requireStage(loc, EShLangFragment, feature);
             requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature);
-            if (language == EShLangFragment)
-                profileRequires(loc, ~EEsProfile, 330, GL_ARB_separate_shader_objects, feature);
-            else
+            if (language == EShLangFragment) {
+                const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
+                profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
+            } else
                 profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
             break;
         }
index eaff500..eee23f1 100644 (file)
@@ -154,7 +154,6 @@ void TParseContext::initializeExtensionBehavior()
     extensionBehavior[GL_EXT_frag_depth]               = EBhDisable;
     extensionBehavior[GL_OES_EGL_image_external]       = EBhDisable;
     extensionBehavior[GL_EXT_shader_texture_lod]       = EBhDisable;
-    extensionBehavior[GL_ARB_shader_texture_lod]       = EBhDisable;
 
     extensionBehavior[GL_ARB_texture_rectangle]        = EBhDisable;
     extensionBehavior[GL_3DL_array_objects]            = EBhDisable;
@@ -165,6 +164,8 @@ void TParseContext::initializeExtensionBehavior()
     extensionBehavior[GL_ARB_tessellation_shader]      = EBhDisable;
     extensionBehavior[GL_ARB_enhanced_layouts]         = EBhDisable;
     extensionBehavior[GL_ARB_texture_cube_map_array]   = EBhDisable;
+    extensionBehavior[GL_ARB_shader_texture_lod]       = EBhDisable;
+    extensionBehavior[GL_ARB_explicit_attrib_location] = EBhDisablePartial; // "index" for fragment outputs is missing
 }
 
 // Get code that is not part of a shared symbol table, is specific to this shader,
@@ -201,7 +202,8 @@ const char* TParseContext::getPreamble()
             "#define GL_ARB_tessellation_shader 1\n"
             "#define GL_ARB_enhanced_layouts 1\n"
             "#define GL_ARB_texture_cube_map_array 1\n"
-            "#define GL_ARB_shader_texture_lod 1\n";
+            "#define GL_ARB_shader_texture_lod 1\n"
+            "#define GL_ARB_explicit_attrib_location 1\n";
     }
 }
 
index e9d85df..fce980a 100644 (file)
@@ -89,6 +89,7 @@ const char* const GL_ARB_tessellation_shader      = "GL_ARB_tessellation_shader"
 const char* const GL_ARB_enhanced_layouts         = "GL_ARB_enhanced_layouts";
 const char* const GL_ARB_texture_cube_map_array   = "GL_ARB_texture_cube_map_array";
 const char* const GL_ARB_shader_texture_lod       = "GL_ARB_shader_texture_lod";
+const char* const GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location";
 
 } // end namespace glslang