Reuse loads generated for repeated function arguments
This commit is contained in:
parent
0e311906b9
commit
6a8b2b2439
11 changed files with 9106 additions and 9441 deletions
|
|
@ -5787,8 +5787,16 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
|
|||
lvalueCoherentFlags = builder.getAccessChain().coherentFlags;
|
||||
builder.addDecoration(lvalue_id, TranslateNonUniformDecoration(lvalueCoherentFlags));
|
||||
lvalueCoherentFlags |= TranslateCoherent(glslangArguments[i]->getAsTyped()->getType());
|
||||
} else
|
||||
arguments.push_back(accessChainLoad(glslangArguments[i]->getAsTyped()->getType()));
|
||||
} else {
|
||||
if (i > 0 &&
|
||||
glslangArguments[i]->getAsSymbolNode() && glslangArguments[i-1]->getAsSymbolNode() &&
|
||||
glslangArguments[i]->getAsSymbolNode()->getId() == glslangArguments[i-1]->getAsSymbolNode()->getId()) {
|
||||
// Reuse the id if possible
|
||||
arguments.push_back(arguments[i-1]);
|
||||
} else {
|
||||
arguments.push_back(accessChainLoad(glslangArguments[i]->getAsTyped()->getType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue