Fix #809: smear scalar condition in OpSelect for selecting vector operands.
This commit is contained in:
parent
4dc835c369
commit
e434ad923e
6 changed files with 72 additions and 56 deletions
|
|
@ -1823,7 +1823,15 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
|
|||
node->getFalseBlock()->traverse(this);
|
||||
spv::Id falseValue = accessChainLoad(node->getTrueBlock()->getAsTyped()->getType());
|
||||
|
||||
spv::Id select = builder.createTriOp(spv::OpSelect, convertGlslangToSpvType(node->getType()), condition, trueValue, falseValue);
|
||||
// smear condition to vector, if necessary (AST is always scalar)
|
||||
if (builder.isVector(trueValue))
|
||||
condition = builder.smearScalar(spv::NoPrecision, condition,
|
||||
builder.makeVectorType(builder.makeBoolType(),
|
||||
builder.getNumComponents(trueValue)));
|
||||
|
||||
spv::Id select = builder.createTriOp(spv::OpSelect,
|
||||
convertGlslangToSpvType(node->getType()), condition,
|
||||
trueValue, falseValue);
|
||||
builder.clearAccessChain();
|
||||
builder.setAccessChainRValue(select);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue