HLSL: Fix #802: Preserve promoted child under ! operator.

This commit is contained in:
John Kessenich 2017-03-30 23:32:21 -06:00
parent 7e997e2612
commit 18958f6cd2
4 changed files with 253 additions and 4 deletions

View file

@ -356,12 +356,12 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
node->updatePrecision();
// If it's a (non-specialization) constant, it must be folded.
if (child->getAsConstantUnion())
return child->getAsConstantUnion()->fold(op, node->getType());
if (node->getOperand()->getAsConstantUnion())
return node->getOperand()->getAsConstantUnion()->fold(op, node->getType());
// If it's a specialization constant, the result is too,
// if the operation is allowed for specialization constants.
if (child->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node))
if (node->getOperand()->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node))
node->getWritableType().getQualifier().makeSpecConstant();
return node;