Partial fix for inconsistencies re: #2578
gl_SecondaryPositionNV and gl_PositionPerViewNV are inconsistently declared inside and outside of gl_PerVertex. This breaks interface block matching. For now ignore these errors since it should be fixed with how they are declared.
This commit is contained in:
parent
d18bcd64fa
commit
9b962f611c
5 changed files with 411 additions and 11 deletions
|
|
@ -2336,6 +2336,17 @@ public:
|
|||
name += ';' ;
|
||||
}
|
||||
|
||||
// These variables are inconsistently declared inside and outside of gl_PerVertex in glslang right now.
|
||||
// They are declared inside of 'in gl_PerVertex', but sitting as standalone when they are 'out'puts.
|
||||
bool isInconsistentGLPerVertexMember(const TString& name) const
|
||||
{
|
||||
if (name == "gl_SecondaryPositionNV" ||
|
||||
name == "gl_PositionPerViewNV")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Do two structure types match? They could be declared independently,
|
||||
// in different places, but still might satisfy the definition of matching.
|
||||
// From the spec:
|
||||
|
|
@ -2351,22 +2362,48 @@ public:
|
|||
(isStruct() && right.isStruct() && structure == right.structure))
|
||||
return true;
|
||||
|
||||
// Both being nullptr was caught above, now they both have to be structures of the same number of elements
|
||||
if (!isStruct() || !right.isStruct() ||
|
||||
structure->size() != right.structure->size())
|
||||
return false;
|
||||
|
||||
// Structure names have to match
|
||||
if (*typeName != *right.typeName)
|
||||
return false;
|
||||
|
||||
// Compare the names and types of all the members, which have to match
|
||||
for (unsigned int i = 0; i < structure->size(); ++i) {
|
||||
if ((*structure)[i].type->getFieldName() != (*right.structure)[i].type->getFieldName())
|
||||
return false;
|
||||
// There are inconsistencies with how gl_PerVertex is setup. For now ignore those as errors if they
|
||||
// are known inconsistencies.
|
||||
bool isGLPerVertex = *typeName == "gl_PerVertex";
|
||||
|
||||
if (*(*structure)[i].type != *(*right.structure)[i].type)
|
||||
return false;
|
||||
// Both being nullptr was caught above, now they both have to be structures of the same number of elements
|
||||
if (!isStruct() || !right.isStruct() ||
|
||||
(structure->size() != right.structure->size() && !isGLPerVertex))
|
||||
return false;
|
||||
|
||||
// Compare the names and types of all the members, which have to match
|
||||
for (int li = 0, ri = 0; li < structure->size() || ri < right.structure->size(); ++li, ++ri) {
|
||||
if (li < structure->size() && ri < right.structure->size()) {
|
||||
if ((*structure)[li].type->getFieldName() == (*right.structure)[ri].type->getFieldName()) {
|
||||
if (*(*structure)[li].type != *(*right.structure)[ri].type)
|
||||
return false;
|
||||
} else {
|
||||
// If one of the members is something that's inconsistently declared, skip over it
|
||||
// for now.
|
||||
if (isGLPerVertex) {
|
||||
if (isInconsistentGLPerVertexMember((*structure)[li].type->getFieldName())) {
|
||||
ri--;
|
||||
continue;
|
||||
} else if (isInconsistentGLPerVertexMember((*right.structure)[ri].type->getFieldName())) {
|
||||
li--;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// If we get here, then there should only be inconsistently declared members left
|
||||
} else if (li < structure->size()) {
|
||||
if (!isInconsistentGLPerVertexMember((*structure)[li].type->getFieldName()))
|
||||
return false;
|
||||
} else {
|
||||
if (!isInconsistentGLPerVertexMember((*right.structure)[ri].type->getFieldName()))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue