Non-functional: Encapsulate testing for IO that is supposed to be arrayed with extra level for per-vertex data.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27169 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-06-27 06:17:16 +00:00
parent 34d687512a
commit a63faa7907
3 changed files with 18 additions and 7 deletions

View File

@ -39,6 +39,7 @@
#include "../Include/Common.h"
#include "../Include/BaseTypes.h"
#include "../Public/ShaderLang.h"
namespace glslang {
@ -384,6 +385,21 @@ public:
}
}
// True if this type of IO is supposed to be arrayed with extra level for per-vertex data
bool isArrayedIo(EShLanguage language) const
{
switch (language) {
case EShLangGeometry:
return isPipeInput();
case EShLangTessControl:
return ! patch && (isPipeInput() || isPipeOutput());
case EShLangTessEvaluation:
return ! patch && isPipeInput();
default:
return false;
}
}
// Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield
void clearLayout()
{

View File

@ -590,9 +590,7 @@ void TParseContext::fixIoArraySize(TSourceLoc loc, TType& type)
void TParseContext::ioArrayCheck(TSourceLoc loc, const TType& type, const TString& identifier)
{
if (! type.isArray() && ! symbolTable.atBuiltInLevel()) {
if ((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) ||
(language == EShLangTessControl && (type.getQualifier().storage == EvqVaryingOut || type.getQualifier().storage == EvqVaryingIn) && ! type.getQualifier().patch) ||
(language == EShLangTessEvaluation && type.getQualifier().storage == EvqVaryingIn && ! type.getQualifier().patch))
if (type.getQualifier().isArrayedIo(language))
error(loc, "type must be an array:", type.getStorageQualifierString(), identifier.c_str());
}
}

View File

@ -607,10 +607,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
size = 1;
} else {
// Strip off the outer array dimension for those having an extra one.
if (type.isArray() && ! qualifier.patch &&
(language == EShLangGeometry && qualifier.isPipeInput()) ||
language == EShLangTessControl ||
(language == EShLangTessEvaluation && qualifier.isPipeInput())) {
if (type.isArray() && qualifier.isArrayedIo(language)) {
TType elementType(type, 0);
size = computeTypeLocationSize(elementType);
} else