ParseHelper: assign xfb_offset for struct members too

If the out variable is a struct type, with a xfb_offset explicitly
assigned, the members need to get their xfb_offset assigned. This is
specially relevant, as we cannot use layout qualifiers on struct
members.
This commit is contained in:
Alejandro Piñeiro 2018-10-26 12:35:54 +02:00
parent 0ac199df32
commit af8c1bdb16
7 changed files with 129 additions and 7 deletions

View file

@ -4030,7 +4030,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
if (currentBlockQualifier.storage == EvqVaryingOut && globalOutputDefaults.hasXfbBuffer()) {
if (!currentBlockQualifier.hasXfbBuffer())
currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer;
fixBlockXfbOffsets(currentBlockQualifier, newTypeList);
fixXfbOffsets(currentBlockQualifier, newTypeList);
}
// Edit and error check the container against the redeclaration
@ -6099,6 +6099,11 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
// fix up
fixOffset(loc, *symbol);
if (symbol->getType().getBasicType() == EbtStruct) {
fixXfbOffsets(symbol->getWritableType().getQualifier(),
*(symbol->getWritableType().getWritableStruct()));
}
return initNode;
}
@ -6823,7 +6828,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
// Process the members
fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation);
fixBlockXfbOffsets(currentBlockQualifier, typeList);
fixXfbOffsets(currentBlockQualifier, typeList);
fixBlockUniformOffsets(currentBlockQualifier, typeList);
for (unsigned int member = 0; member < typeList.size(); ++member)
layoutTypeCheck(typeList[member].loc, *typeList[member].type);
@ -7065,7 +7070,7 @@ void TParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qualifi
}
}
void TParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
{
// "If a block is qualified with xfb_offset, all its
// members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any