Merge pull request #568 from steve-lunarg/logicalop-fix

HLSL: allow component-wise operations for logical || and &&.
This commit is contained in:
John Kessenich 2016-10-26 23:01:16 -06:00 committed by GitHub
commit 51634468da
4 changed files with 445 additions and 4 deletions

View file

@ -797,6 +797,9 @@ TIntermTyped* TIntermediate::addShapeConversion(TOperator op, const TType& type,
case EOpNotEqual:
case EOpFunctionCall:
case EOpReturn:
case EOpLogicalAnd:
case EOpLogicalOr:
case EOpLogicalXor:
break;
default:
return node;
@ -1924,13 +1927,14 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
return false;
node.setLeft(left = convertedL); // also updates stack variable
node.setRight(right = convertedR); // also updates stack variable
} else {
// logical ops operate only on scalar Booleans and will promote to scalar Boolean.
if (left->getBasicType() != EbtBool || left->isVector() || left->isMatrix())
return false;
}
// logical ops operate only on scalar Booleans and will promote to scalar Boolean.
if (left->getBasicType() != EbtBool || left->isVector() || left->isMatrix())
return false;
node.setType(TType(EbtBool, EvqTemporary, left->getVectorSize()));
node.setType(TType(EbtBool));
break;
case EOpRightShift: