GLSL/Vulkan: Enforce no location aliasing in vertex inputs.
authorJohn Kessenich <cepheus@frii.com>
Thu, 12 Apr 2018 17:37:57 +0000 (11:37 -0600)
committerJohn Kessenich <cepheus@frii.com>
Thu, 12 Apr 2018 17:37:57 +0000 (11:37 -0600)
Test/baseResults/vulkan.vert.out
Test/vulkan.vert
glslang/MachineIndependent/linkValidate.cpp

index 0f64d64..19fdade 100644 (file)
@@ -36,7 +36,8 @@ ERROR: 0:51: '[]' : only outermost dimension of an array of arrays can be a spec
 ERROR: 0:54: '[]' : only outermost dimension of an array of arrays can be a specialization constant 
 ERROR: 0:54: 'location' : SPIR-V requires location for user input/output 
 ERROR: 0:58: 'location' : SPIR-V requires location for user input/output 
-ERROR: 37 compilation errors.  No code generated.
+ERROR: 0:65: 'location' : overlapping use of location 10
+ERROR: 38 compilation errors.  No code generated.
 
 
 SPIR-V is not generated for failed compile or link
index e670e95..a6af2d5 100644 (file)
@@ -61,3 +61,5 @@ out ban2 {
 \r
 layout(binding = 3000) uniform sampler2D s3000;\r
 layout(binding = 3001) uniform b3001 { int a; };\r
+layout(location = 10) in vec4 in1;\r
+layout(location = 10) in vec4 in2;  // ERROR, no location aliasing\r
index c80fdb3..c540ae6 100644 (file)
@@ -847,8 +847,8 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
         // combine location and component ranges
         TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 0);
 
-        // check for collisions, except for vertex inputs on desktop
-        if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput()))
+        // check for collisions, except for vertex inputs on desktop targeting OpenGL
+        if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)
             collision = checkLocationRange(set, range, type, typeCollision);
 
         if (collision < 0)