HLSL: Fix #884: Use promoted children, not pre-promoted, in completing binary nodes.

This commit is contained in:
John Kessenich 2017-05-12 15:25:41 -06:00
parent c48c8e76e1
commit c49b4efa91
3 changed files with 129 additions and 13 deletions

View file

@ -148,8 +148,8 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
// If they are both (non-specialization) constants, they must be folded.
// (Unless it's the sequence (comma) operator, but that's handled in addComma().)
//
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
TIntermConstantUnion *leftTempConstant = node->getLeft()->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = node->getRight()->getAsConstantUnion();
if (leftTempConstant && rightTempConstant) {
TIntermTyped* folded = leftTempConstant->fold(node->getOp(), rightTempConstant);
if (folded)
@ -158,7 +158,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
// If can propagate spec-constantness and if the operation is an allowed
// specialization-constant operation, make a spec-constant.
if (specConstantPropagates(*left, *right) && isSpecializationOperation(*node))
if (specConstantPropagates(*node->getLeft(), *node->getRight()) && isSpecializationOperation(*node))
node->getWritableType().getQualifier().makeSpecConstant();
return node;