HLSL: Don't do logical short-circuits when the operands are bool-vectors.

This seems a bit ill-defined, and was generating code that made OpPhi of two
operands that were Boolean vectors result in a scalar bool.
This commit is contained in:
John Kessenich
2017-05-19 20:19:00 -06:00
parent ab0847ef01
commit 0d2b4713c5
3 changed files with 91 additions and 106 deletions

View File

@@ -5356,13 +5356,19 @@ bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node)
}
// A node is trivial if it is a single operation with no side effects.
// Error on the side of saying non-trivial.
// Vector results seem ill-defined, currently classifying them as trivial too,
// to avoid scalar bool-based control-flow logic.
// Otherwise, error on the side of saying non-trivial.
// Return true if trivial.
bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
{
if (node == nullptr)
return false;
// count vectors as trivial
if (node->getType().isVector())
return true;
// symbols and constants are trivial
if (isTrivialLeaf(node))
return true;