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:
parent
34d687512a
commit
a63faa7907
3 changed files with 18 additions and 7 deletions
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#include "../Include/Common.h"
|
#include "../Include/Common.h"
|
||||||
#include "../Include/BaseTypes.h"
|
#include "../Include/BaseTypes.h"
|
||||||
|
#include "../Public/ShaderLang.h"
|
||||||
|
|
||||||
namespace glslang {
|
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
|
// Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield
|
||||||
void clearLayout()
|
void clearLayout()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -590,9 +590,7 @@ void TParseContext::fixIoArraySize(TSourceLoc loc, TType& type)
|
||||||
void TParseContext::ioArrayCheck(TSourceLoc loc, const TType& type, const TString& identifier)
|
void TParseContext::ioArrayCheck(TSourceLoc loc, const TType& type, const TString& identifier)
|
||||||
{
|
{
|
||||||
if (! type.isArray() && ! symbolTable.atBuiltInLevel()) {
|
if (! type.isArray() && ! symbolTable.atBuiltInLevel()) {
|
||||||
if ((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) ||
|
if (type.getQualifier().isArrayedIo(language))
|
||||||
(language == EShLangTessControl && (type.getQualifier().storage == EvqVaryingOut || type.getQualifier().storage == EvqVaryingIn) && ! type.getQualifier().patch) ||
|
|
||||||
(language == EShLangTessEvaluation && type.getQualifier().storage == EvqVaryingIn && ! type.getQualifier().patch))
|
|
||||||
error(loc, "type must be an array:", type.getStorageQualifierString(), identifier.c_str());
|
error(loc, "type must be an array:", type.getStorageQualifierString(), identifier.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -607,10 +607,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
||||||
size = 1;
|
size = 1;
|
||||||
} else {
|
} else {
|
||||||
// Strip off the outer array dimension for those having an extra one.
|
// Strip off the outer array dimension for those having an extra one.
|
||||||
if (type.isArray() && ! qualifier.patch &&
|
if (type.isArray() && qualifier.isArrayedIo(language)) {
|
||||||
(language == EShLangGeometry && qualifier.isPipeInput()) ||
|
|
||||||
language == EShLangTessControl ||
|
|
||||||
(language == EShLangTessEvaluation && qualifier.isPipeInput())) {
|
|
||||||
TType elementType(type, 0);
|
TType elementType(type, 0);
|
||||||
size = computeTypeLocationSize(elementType);
|
size = computeTypeLocationSize(elementType);
|
||||||
} else
|
} else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue