SPV: Fix #739: OpSelect can only operate on scalars and vectors.

This commit is contained in:
John Kessenich
2017-03-01 13:49:11 -07:00
parent 173c0c01a6
commit 0479437a5c
4 changed files with 55 additions and 17 deletions

View File

@@ -1789,7 +1789,8 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
// Crucially, side effects must be avoided, and there are performance trade-offs.
// Return true if good idea (and safe) for OpSelect, false otherwise.
const auto selectPolicy = [&]() -> bool {
if (node->getBasicType() == glslang::EbtVoid)
if ((!node->getType().isScalar() && !node->getType().isVector()) ||
node->getBasicType() == glslang::EbtVoid)
return false;
if (node->getTrueBlock() == nullptr ||