HLSL: Fix result type of passing a flattened-aggregate to a function.

This commit is contained in:
John Kessenich 2016-09-21 17:50:12 -06:00
parent 6873f3d898
commit 6714bcc2ca
3 changed files with 13 additions and 5 deletions

View File

@ -54,7 +54,7 @@ gl_FragCoord origin is upper left
0:17 move second child to first child (temp float)
0:17 'ret2' (temp float)
0:17 Function Call: fun(struct-InParam-vf2-vf4-vi21; (global float)
0:? Comma (temp float)
0:? Comma (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:? Sequence
0:? move second child to first child (temp 2-component vector of float)
0:? v: direct index for structure (temp 2-component vector of float)
@ -152,7 +152,7 @@ gl_FragCoord origin is upper left
0:17 move second child to first child (temp float)
0:17 'ret2' (temp float)
0:17 Function Call: fun(struct-InParam-vf2-vf4-vi21; (global float)
0:? Comma (temp float)
0:? Comma (temp structure{temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:? Sequence
0:? move second child to first child (temp 2-component vector of float)
0:? v: direct index for structure (temp 2-component vector of float)
@ -256,7 +256,7 @@ gl_FragCoord origin is upper left
48(param): 12(ptr) Variable Function
51(ret2): 20(ptr) Variable Function
52(aggShadow): 12(ptr) Variable Function
59(param): 20(ptr) Variable Function
59(param): 12(ptr) Variable Function
33: 7(fvec2) Load 32(v)
35: 34(ptr) AccessChain 30(local) 17
Store 35 33

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1503"
#define GLSLANG_DATE "20-Sep-2016"
#define GLSLANG_REVISION "Overload400-PrecQual.1506"
#define GLSLANG_DATE "21-Sep-2016"

View File

@ -2277,6 +2277,10 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
}
} else {
if (shouldFlatten(arg->getType())) {
// Will make a two-level subtree.
// The deepest will copy member-by-member to build the structure to pass.
// The level above that will be an two-operand EOpComma sequence that follows the copy by the
// object itself.
TSourceLoc dummyLoc;
dummyLoc.init();
TVariable* internalAggregate = makeInternalVariable("aggShadow", *function[i].type);
@ -2284,9 +2288,13 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
TIntermSymbol* internalSymbolNode = new TIntermSymbol(internalAggregate->getUniqueId(),
internalAggregate->getName(),
internalAggregate->getType());
// This makes the deepest level, the member-wise copy
TIntermAggregate* assignAgg = handleAssign(dummyLoc, EOpAssign, internalSymbolNode, arg)->getAsAggregate();
// Now, pair that with the resulting aggregate.
assignAgg = intermediate.growAggregate(assignAgg, internalSymbolNode);
assignAgg->setOperator(EOpComma);
assignAgg->setType(internalAggregate->getType());
setArg(i, assignAgg);
}
}