HLSL: Fix #903: Don't short-circuit && or ||.
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 3597c0a..4937f9c 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -5361,8 +5361,7 @@
}
// A node is trivial if it is a single operation with no side effects.
-// Vector results seem ill-defined, currently classifying them as trivial too,
-// to avoid scalar bool-based control-flow logic.
+// HLSL (and/or vectors) are always trivial, as it does not short circuit.
// Otherwise, error on the side of saying non-trivial.
// Return true if trivial.
bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
@@ -5370,8 +5369,8 @@
if (node == nullptr)
return false;
- // count vectors as trivial
- if (node->getType().isVector())
+ // count non scalars as trivial, as well as anything coming from HLSL
+ if (! node->getType().isScalarOrVec1() || glslangIntermediate->getSource() == glslang::EShSourceHlsl)
return true;
// symbols and constants are trivial