From 521ca375e03b8590380282cfbb4704f33d6c82f3 Mon Sep 17 00:00:00 2001
From: John Kessenich <cepheus@frii.com>
Date: Thu, 5 Dec 2013 20:58:16 +0000
Subject: [PATCH] Remove one layer of arrayness on geometry shader inputs
 before checking for location overlaps.  I think there is a spec. bug here.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24377 e7fa87d3-cd2b-0410-9028-fcbf551c1848
---
 Test/400.geom                               |  4 ++++
 Test/baseResults/400.geom.out               |  6 +++++-
 glslang/Include/revision.h                  |  4 ++--
 glslang/MachineIndependent/linkValidate.cpp | 10 ++++++++--
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/Test/400.geom b/Test/400.geom
index 5388bb6cf..9699ef7f1 100644
--- a/Test/400.geom
+++ b/Test/400.geom
@@ -49,3 +49,7 @@ void foo3()
     color2.length();
     colorS.length();
 }
+
+layout(location = 4) in vec4 cva[3];
+layout(location = 5) in vec4 cvb[3];
+layout(location = 2) in mat3 cmc[3];  // ERROR, collision
diff --git a/Test/baseResults/400.geom.out b/Test/baseResults/400.geom.out
index 0b9242df8..937fda1b8 100644
--- a/Test/baseResults/400.geom.out
+++ b/Test/baseResults/400.geom.out
@@ -5,7 +5,8 @@ ERROR: 0:24: 'length' :  array must be declared with a size before using this me
 ERROR: 0:35: 'length' :  array must be declared with a size before using this method
 ERROR: 0:39: 'triangles' : inconsistent input primitive for array size colorBad
 ERROR: 0:43: 'triangles' : inconsistent input primitive for array size colorbad2
-ERROR: 5 compilation errors.  No code generated.
+ERROR: 0:55: 'location' : repeated use of location 4
+ERROR: 6 compilation errors.  No code generated.
 
 
 invocations = 4
@@ -66,6 +67,9 @@ ERROR: node is still EOpNull!
 0:?     'colorS' (in 3-element array of 4-component vector of float)
 0:?     'colorBad' (in 4-element array of 4-component vector of float)
 0:?     'colorbad2' (in 2-element array of 4-component vector of float)
+0:?     'cva' (layout(location=4 ) in 3-element array of 4-component vector of float)
+0:?     'cvb' (layout(location=5 ) in 3-element array of 4-component vector of float)
+0:?     'cmc' (layout(location=2 ) in 3-element array of 3X3 matrix of float)
 
 
 Linked geometry stage:
diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h
index 9efa61a72..200110ab9 100644
--- a/glslang/Include/revision.h
+++ b/glslang/Include/revision.h
@@ -9,5 +9,5 @@
 // source have to figure out how to create revision.h just to get a build
 // going.  However, if it is not updated, it can be a version behind.
 
-#define GLSLANG_REVISION "24356"
-#define GLSLANG_DATE     "2013/12/04 14:50:38"
+#define GLSLANG_REVISION "24376"
+#define GLSLANG_DATE     "2013/12/05 13:07:56"
diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp
index bacf4449e..b4f32d9da 100644
--- a/glslang/MachineIndependent/linkValidate.cpp
+++ b/glslang/MachineIndependent/linkValidate.cpp
@@ -465,8 +465,14 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
             size = type.getArraySize();
         else
             size = 1;
-    } else
-        size = computeTypeLocationSize(type);
+    } else {
+        if (language == EShLangGeometry && qualifier.isPipeInput()) {
+            assert(type.isArray());
+            TType elementType(type, 0);
+            size = computeTypeLocationSize(elementType);
+        } else
+            size = computeTypeLocationSize(type);
+    }
 
     TRange range = { qualifier.layoutSlotLocation, qualifier.layoutSlotLocation + size - 1 };
 
-- 
GitLab