HLSL: Fix #903: Don't short-circuit && or ||.

This commit is contained in:
John Kessenich
2017-05-24 16:44:47 -06:00
parent 6e2295d340
commit 84cc15f0d0
4 changed files with 256 additions and 294 deletions

View File

@@ -5361,8 +5361,7 @@ bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node)
}
// 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 @@ bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
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