Skip outermost array when assigning locations to auto-array interfaces

When assigning a location to an interface whose stage automatically
converts the interfaces to an array, it now strips off the outermost
array from the type before calculating how many locations it consumes.
This commit is contained in:
Neil Roberts 2018-05-10 15:49:28 +02:00
parent fd9d9ef436
commit 22b71f9af9

View File

@ -478,7 +478,16 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
// Placeholder. This does not do proper cross-stage lining up, nor // Placeholder. This does not do proper cross-stage lining up, nor
// work with mixed location/no-location declarations. // work with mixed location/no-location declarations.
int location = nextLocation; int location = nextLocation;
nextLocation += TIntermediate::computeTypeLocationSize(type, stage); int typeLocationSize;
// Dont take into account the outer-most array if the stages
// interface is automatically an array.
if (type.getQualifier().isArrayedIo(stage)) {
TType elementType(type, 0);
typeLocationSize = TIntermediate::computeTypeLocationSize(elementType, stage);
} else {
typeLocationSize = TIntermediate::computeTypeLocationSize(type, stage);
}
nextLocation += typeLocationSize;
return location; return location;
} }