Add array sizing/checking/overlapping semantics for tessellation inputs.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24594 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-12-20 18:36:27 +00:00
parent e8fe7b81d7
commit 08d182470b
8 changed files with 152 additions and 21 deletions

View file

@ -500,9 +500,10 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
else
size = 1;
} else {
if (type.isArray() &&
(language == EShLangGeometry && qualifier.isPipeInput() ||
(language == EShLangTessControl && qualifier.isPipeOutput() && ! qualifier.patch))) {
if (type.isArray() && ! qualifier.patch &&
(language == EShLangGeometry && qualifier.isPipeInput()) ||
language == EShLangTessControl ||
(language == EShLangTessEvaluation && qualifier.isPipeInput())) {
TType elementType(type, 0);
size = computeTypeLocationSize(elementType);
} else
@ -534,8 +535,12 @@ int TIntermediate::computeTypeLocationSize(const TType& type)
// "If the declared input is an array of size n and each element takes m locations, it will be assigned m * n
// consecutive locations..."
if (type.isArray()) {
TType elementType(type, 0);
return type.getArraySize() * computeTypeLocationSize(elementType);
TType elementType(type, 0);
if (type.getArraySize() == 0) {
// TODO: are there valid cases of having an unsized array with a location? If so, running this code too early.
return computeTypeLocationSize(elementType);
} else
return type.getArraySize() * computeTypeLocationSize(elementType);
}
// "The locations consumed by block and structure members are determined by applying the rules above