Unverified Commit 396de16c by John Kessenich Committed by GitHub

Merge pull request #1183 from LoopDawg/builtin-output-array-indirect

HLSL: for split output structs, propagate indirection to builtins.
parents 69feabc9 0cff5100
...@@ -80,10 +80,9 @@ ERROR: node is still EOpNull! ...@@ -80,10 +80,9 @@ ERROR: node is still EOpNull!
0:? 'cpid' ( in uint InvocationID) 0:? 'cpid' ( in uint InvocationID)
0:39 Sequence 0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float) 0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position) 0:39 indirect index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant: 0:? 'cpid' ( in uint InvocationID)
0:39 0 (const int)
0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'cpid' ( temp uint) 0:? 'cpid' ( temp uint)
...@@ -174,10 +173,9 @@ ERROR: node is still EOpNull! ...@@ -174,10 +173,9 @@ ERROR: node is still EOpNull!
0:? 'cpid' ( in uint InvocationID) 0:? 'cpid' ( in uint InvocationID)
0:39 Sequence 0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float) 0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position) 0:39 indirect index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant: 0:? 'cpid' ( in uint InvocationID)
0:39 0 (const int)
0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'cpid' ( temp uint) 0:? 'cpid' ( temp uint)
......
...@@ -2731,13 +2731,23 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op ...@@ -2731,13 +2731,23 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
// copy from interstage IO built-in if needed // copy from interstage IO built-in if needed
subTree = intermediate.addSymbol(*builtInVar); subTree = intermediate.addSymbol(*builtInVar);
// Arrayness of builtIn symbols isn't handled by the normal recursion: if (subTree->getType().isArray()) {
// it's been extracted and moved to the built-in. // Arrayness of builtIn symbols isn't handled by the normal recursion:
if (subTree->getType().isArray() && !arrayElement.empty()) { // it's been extracted and moved to the built-in.
const TType splitDerefType(subTree->getType(), arrayElement.back()); if (!arrayElement.empty()) {
subTree = intermediate.addIndex(EOpIndexDirect, subTree, const TType splitDerefType(subTree->getType(), arrayElement.back());
intermediate.addConstantUnion(arrayElement.back(), loc), loc); subTree = intermediate.addIndex(EOpIndexDirect, subTree,
subTree->setType(splitDerefType); intermediate.addConstantUnion(arrayElement.back(), loc), loc);
subTree->setType(splitDerefType);
} else if (splitNode->getAsOperator() != nullptr && (splitNode->getAsOperator()->getOp() == EOpIndexIndirect)) {
// This might also be a stage with arrayed outputs, in which case there's an index
// operation we should transfer to the output builtin.
const TType splitDerefType(subTree->getType(), 0);
subTree = intermediate.addIndex(splitNode->getAsOperator()->getOp(), subTree,
splitNode->getAsBinaryNode()->getRight(), loc);
subTree->setType(splitDerefType);
}
} }
} else if (flattened && !shouldFlatten(derefType, isLeft ? leftStorage : rightStorage, false)) { } else if (flattened && !shouldFlatten(derefType, isLeft ? leftStorage : rightStorage, false)) {
if (isLeft) if (isLeft)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment