WIP: add other builtins to interstage IO

(Still adding tests: do not commit)

This fixes PR #632 so that:

(a) The 4 PerVertex builtins are added to an interface block for all stages except fragment.

(b) Other builtin qualified variables are added as "loose" linkage members.

(c) Arrayness from the PerVertex builtins is moved to the PerVertex block.

(d) Sometimes, two PerVertex blocks are created, one for in, one for out (e.g, for some GS that
    both reads and writes a Position)
This commit is contained in:
steve-lunarg 2017-01-07 09:07:14 -07:00
parent 5d89d4d483
commit 46d5428422
16 changed files with 519 additions and 196 deletions

View file

@ -1319,9 +1319,18 @@ public:
virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); }
virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); }
// Return true if this is interstage IO
virtual bool isBuiltInInterstageIO() const
virtual bool isBuiltInInterstageIO(EShLanguage language) const
{
return isPerVertexAndBuiltIn(language) || isLooseAndBuiltIn(language);
}
// Return true if this is an interstage IO builtin
virtual bool isPerVertexAndBuiltIn(EShLanguage language) const
{
if (language == EShLangFragment)
return false;
// Any non-fragment stage
switch (getQualifier().builtIn) {
case EbvPosition:
case EbvPointSize:
@ -1333,6 +1342,15 @@ public:
}
}
// Return true if this is a loose builtin
virtual bool isLooseAndBuiltIn(EShLanguage language) const
{
if (getQualifier().builtIn == EbvNone)
return false;
return !isPerVertexAndBuiltIn(language);
}
// Recursively checks if the type contains the given basic type
virtual bool containsBasicType(TBasicType checkType) const
{
@ -1401,33 +1419,20 @@ public:
}
// Recursively checks if the type contains an interstage IO builtin
virtual bool containsBuiltInInterstageIO() const
virtual bool containsBuiltInInterstageIO(EShLanguage language) const
{
if (isBuiltInInterstageIO())
if (isBuiltInInterstageIO(language))
return true;
if (! structure)
return false;
for (unsigned int i = 0; i < structure->size(); ++i) {
if ((*structure)[i].type->containsBuiltInInterstageIO())
if ((*structure)[i].type->containsBuiltInInterstageIO(language))
return true;
}
return false;
}
// Recursively checks whether a struct contains only interstage IO
virtual bool containsOnlyBuiltInInterstageIO() const
{
if (! structure)
return isBuiltInInterstageIO();
for (unsigned int i = 0; i < structure->size(); ++i) {
if (!(*structure)[i].type->containsOnlyBuiltInInterstageIO())
return false;
}
return true;
}
virtual bool containsNonOpaque() const
{
// list all non-opaque types