Commit c955058b by Olli Etuaho Committed by Commit Bot

Constant-qualify nodes in a consistent way

Rely on that constant qualification of binary and unary nodes comes from promote(). BUG=angleproject:1490 TEST=angle_unittests Change-Id: Ie8d1d4df3c82ae5a2de8cc536e47016d13a4fd3d Reviewed-on: https://chromium-review.googlesource.com/377960Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 588e2085
...@@ -722,7 +722,7 @@ void TIntermBinary::promote() ...@@ -722,7 +722,7 @@ void TIntermBinary::promote()
case EOpGreaterThan: case EOpGreaterThan:
case EOpLessThanEqual: case EOpLessThanEqual:
case EOpGreaterThanEqual: case EOpGreaterThanEqual:
setType(TType(EbtBool, EbpUndefined)); setType(TType(EbtBool, EbpUndefined, resultQualifier));
break; break;
// //
...@@ -732,7 +732,7 @@ void TIntermBinary::promote() ...@@ -732,7 +732,7 @@ void TIntermBinary::promote()
case EOpLogicalXor: case EOpLogicalXor:
case EOpLogicalOr: case EOpLogicalOr:
ASSERT(mLeft->getBasicType() == EbtBool && mRight->getBasicType() == EbtBool); ASSERT(mLeft->getBasicType() == EbtBool && mRight->getBasicType() == EbtBool);
setType(TType(EbtBool, EbpUndefined)); setType(TType(EbtBool, EbpUndefined, resultQualifier));
break; break;
default: default:
...@@ -849,12 +849,7 @@ TIntermTyped *TIntermBinary::fold(TDiagnostics *diagnostics) ...@@ -849,12 +849,7 @@ TIntermTyped *TIntermBinary::fold(TDiagnostics *diagnostics)
TConstantUnion *constArray = leftConstant->foldBinary(mOp, rightConstant, diagnostics); TConstantUnion *constArray = leftConstant->foldBinary(mOp, rightConstant, diagnostics);
// Nodes may be constant folded without being qualified as constant. // Nodes may be constant folded without being qualified as constant.
TQualifier resultQualifier = EvqConst; return CreateFoldedNode(constArray, this, mType.getQualifier());
if (mLeft->getQualifier() != EvqConst || mRight->getQualifier() != EvqConst)
{
resultQualifier = EvqTemporary;
}
return CreateFoldedNode(constArray, this, resultQualifier);
} }
TIntermTyped *TIntermUnary::fold(TDiagnostics *diagnostics) TIntermTyped *TIntermUnary::fold(TDiagnostics *diagnostics)
...@@ -888,8 +883,7 @@ TIntermTyped *TIntermUnary::fold(TDiagnostics *diagnostics) ...@@ -888,8 +883,7 @@ TIntermTyped *TIntermUnary::fold(TDiagnostics *diagnostics)
} }
// Nodes may be constant folded without being qualified as constant. // Nodes may be constant folded without being qualified as constant.
TQualifier resultQualifier = mOperand->getQualifier() == EvqConst ? EvqConst : EvqTemporary; return CreateFoldedNode(constArray, this, mType.getQualifier());
return CreateFoldedNode(constArray, this, resultQualifier);
} }
TIntermTyped *TIntermAggregate::fold(TDiagnostics *diagnostics) TIntermTyped *TIntermAggregate::fold(TDiagnostics *diagnostics)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment