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.
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 95ad7f9..f8722fc 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -5356,13 +5356,19 @@
}
// 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;