Commit bd0ea9c7 by Nicolas Capens

Don't attempt to perform constant folding with an uninitialized constant variable.

BUG=348205 Change-Id: I9be17832b1a35d2995725ab147977992c2732274 Reviewed-on: https://chromium-review.googlesource.com/188711Tested-by: 's avatarNicolas Capens <nicolascapens@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189471
parent 3f9e7eae
......@@ -222,11 +222,10 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
//
// See if we can fold constants.
//
TIntermTyped* typedReturnNode = 0;
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
if (leftTempConstant && rightTempConstant) {
typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
TIntermTyped *typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
if (typedReturnNode)
return typedReturnNode;
......@@ -1251,6 +1250,10 @@ bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray,
TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink& infoSink)
{
ConstantUnion *unionArray = getUnionArrayPointer();
if (!unionArray)
return 0;
size_t objectSize = getType().getObjectSize();
if (constantNode)
......@@ -1260,6 +1263,9 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
TType returnType = getType();
if (!rightUnionArray)
return 0;
// for a case like float f = 1.2 + vec4(2,3,4,5);
if (constantNode->getType().getObjectSize() == 1 && objectSize > 1)
{
......
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