Allow layout aliasing for desktop vertex inputs.
authorJohn Kessenich <cepheus@frii.com>
Sat, 7 Dec 2013 00:28:07 +0000 (00:28 +0000)
committerJohn Kessenich <cepheus@frii.com>
Sat, 7 Dec 2013 00:28:07 +0000 (00:28 +0000)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24400 e7fa87d3-cd2b-0410-9028-fcbf551c1848

Test/430.vert
Test/baseResults/430.vert.out
Todo.txt
glslang/Include/revision.h
glslang/MachineIndependent/ParseHelper.cpp
glslang/MachineIndependent/linkValidate.cpp

index 4a6b5c8..e5b27c4 100644 (file)
@@ -41,4 +41,7 @@ layout(location = 10) out S cs[2];     // 10 through 10 + 2 * 22 - 1 = 53
 layout(location = 54) out float cf;\r
 layout(location = 53) out float cg; // ERROR, collision at 31\r
 \r
+layout(location = 10) in vec4 alias1;\r
+layout(location = 10) in vec4 alias2;  // okay for vertex input on desktop\r
+\r
 float gl_ClipDistance[17];  // ERROR, size too big
\ No newline at end of file
index 2041802..486d0c0 100644 (file)
@@ -12,7 +12,7 @@ ERROR: 0:28: '' : cannot use invariant qualifier on a function parameter
 ERROR: 0:30: '' : cannot use layout qualifiers on a function parameter \r
 ERROR: 0:31: '' : cannot use auxiliary or interpolation qualifiers on a function parameter \r
 ERROR: 0:42: 'location' : repeated use of location 53\r
-ERROR: 0:44: 'gl_ClipDistance array size' : must be less than gl_MaxClipDistances (8)\r
+ERROR: 0:47: 'gl_ClipDistance array size' : must be less than gl_MaxClipDistances (8)\r
 ERROR: 13 compilation errors.  No code generated.\r
 \r
 \r
@@ -45,6 +45,8 @@ ERROR: node is still EOpNull!
 0:?     'cs' (layout(location=10 ) smooth out 2-element array of structure{m,f})\r
 0:?     'cf' (layout(location=54 ) smooth out float)\r
 0:?     'cg' (layout(location=53 ) smooth out float)\r
+0:?     'alias1' (layout(location=10 ) in 4-component vector of float)\r
+0:?     'alias2' (layout(location=10 ) in 4-component vector of float)\r
 0:?     'gl_VertexID' (gl_VertexId int)\r
 0:?     'gl_InstanceID' (gl_InstanceId int)\r
 \r
index 6d6fdbe..16b1306 100644 (file)
--- a/Todo.txt
+++ b/Todo.txt
@@ -33,9 +33,8 @@ Link Validation
           - ...
       + exactly one main
       + ES 3.0: fragment outputs all have locations, if more than one
-      - ES 3.0: location aliasing/overlap (except desktop vertex shader inputs)
-      - Non ES: binding overlap
-      + location overlap
+      + location aliasing/overlap (except desktop vertex shader inputs)
+      - Non ES: binding overlap for atomic counters
       + Non ES: geometry shader input array sizes and input layout qualifier declaration
       + Non ES: read or write to both gl_ClipVertex and gl_ClipDistance
       + Non ES: write to only one of gl_FragColor, gl_FragData, or user-declared
index c2ee219..85375b6 100644 (file)
@@ -9,5 +9,5 @@
 // source have to figure out how to create revision.h just to get a build\r
 // going.  However, if it is not updated, it can be a version behind.\r
 \r
-#define GLSLANG_REVISION "24396"\r
-#define GLSLANG_DATE     "2013/12/06 14:45:15"\r
+#define GLSLANG_REVISION "24397"\r
+#define GLSLANG_DATE     "2013/12/06 16:57:42"\r
index af6265d..2b77f21 100644 (file)
@@ -2694,8 +2694,6 @@ void TParseContext::layoutTypeCheck(TSourceLoc loc, const TSymbol& symbol)
         // an array of size N, all elements of the array from binding through binding + N \96 1 must be within this
         // range."
         //
-        // TODO: 4.2 binding limits: binding error checking against limits, arrays
-        //
         if (type.getBasicType() != EbtSampler && type.getBasicType() != EbtBlock)
             error(loc, "requires block, or sampler/image, or atomic-counter type", "binding", "");
             // TODO: 4.2 functionality: atomic counter: include in test above
index b4f32d9..f005728 100644 (file)
@@ -476,12 +476,14 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
 \r
     TRange range = { qualifier.layoutSlotLocation, qualifier.layoutSlotLocation + size - 1 };\r
 \r
-    // check for collisions\r
-    for (size_t r = 0; r < usedLocations[set].size(); ++r) {\r
-        if (range.last  >= usedLocations[set][r].start &&\r
-            range.start <= usedLocations[set][r].last) {\r
-            // there is a collision; pick one\r
-            return std::max(range.start, usedLocations[set][r].start);\r
+    // check for collisions, except for vertex inputs on desktop\r
+    if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput())) {\r
+        for (size_t r = 0; r < usedLocations[set].size(); ++r) {\r
+            if (range.last  >= usedLocations[set][r].start &&\r
+                range.start <= usedLocations[set][r].last) {\r
+                // there is a collision; pick one\r
+                return std::max(range.start, usedLocations[set][r].start);\r
+            }\r
         }\r
     }\r
 \r