HLSL: fix dereferencing when copying split structures with arrays

When copying split types with mixtures of user variables and buitins,
where the builtins are extracted, there is a parallel structures traversal.
The traversal was not obtaining the derefenced types in the array case.
This commit is contained in:
steve-lunarg
2017-01-19 15:18:00 -07:00
parent 33dadd1287
commit 65cdff9a54
4 changed files with 213 additions and 5 deletions

View File

@@ -1827,10 +1827,6 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
// If the RHS is a simple symbol node, we'll copy it for each member.
TIntermSymbol* cloneSymNode = nullptr;
// Array structs are not yet handled in flattening. (Compilation error upstream, so
// this should never fire).
assert(!(left->getType().isStruct() && left->getType().isArray()));
int memberCount = 0;
// Track how many items there are to copy.
@@ -1921,10 +1917,13 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
TIntermTyped* subLeft = getMember(true, left, element, left, element);
TIntermTyped* subRight = getMember(false, right, element, right, element);
TIntermTyped* subSplitLeft = isSplitLeft ? getMember(true, left, element, splitLeft, element) : subLeft;
TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right, element, splitRight, element) : subRight;
if (isFinalFlattening(dereferencedType))
assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, subLeft, subRight, loc), loc);
else
traverse(subLeft, subRight, splitLeft, splitRight);
traverse(subLeft, subRight, subSplitLeft, subSplitRight);
}
} else if (left->getType().isStruct()) {
// struct case