HLSL: allow component-wise operations for logical || and &&.

HLSL || and && can operate component-wise.
This commit is contained in:
steve-lunarg 2016-10-26 12:42:49 -06:00
parent 0d628c179d
commit 27939caa86
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;
@ -1911,13 +1914,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: