Commit 3cf271fe by Jamie Madill

Revert "Support constant folding of common built-ins"

Part of a chain breaking the clang build: http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33588 This reverts commit 0273c68c. Change-Id: I00d7617a7c380f2a5ea3f38ec14948a598aa5c1a Reviewed-on: https://chromium-review.googlesource.com/265184Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 7c9e8c96
......@@ -1330,106 +1330,6 @@ TIntermTyped *TIntermConstantUnion::fold(
tempConstArray[i].setFConst(1 / tempConstArray[i].getFConst());
break;
case EOpAbs:
switch (getType().getBasicType())
{
case EbtFloat:
tempConstArray[i].setFConst(abs(unionArray[i].getFConst()));
break;
case EbtInt:
tempConstArray[i].setIConst(abs(unionArray[i].getIConst()));
break;
default:
infoSink.info.message(
EPrefixInternalError, getLine(),
"Unary operation not folded into constant");
return nullptr;
}
break;
case EOpSign:
switch (getType().getBasicType())
{
case EbtFloat:
{
float fConst = unionArray[i].getFConst();
float fResult = 0.0;
if (fConst > 0.0)
fResult = 1.0;
else if (fConst < 0.0)
fResult = -1.0;
tempConstArray[i].setFConst(fResult);
}
break;
case EbtInt:
{
int iConst = unionArray[i].getIConst();
int iResult = 0;
if (iConst > 0)
iResult = 1;
else if (iConst < 0)
iResult = -1;
tempConstArray[i].setIConst(iResult);
}
break;
default:
infoSink.info.message(
EPrefixInternalError, getLine(),
"Unary operation not folded into constant");
return nullptr;
}
break;
case EOpFloor:
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&floor), infoSink, &tempConstArray[i]))
return nullptr;
break;
case EOpTrunc:
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&trunc), infoSink, &tempConstArray[i]))
return nullptr;
break;
case EOpRound:
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&round), infoSink, &tempConstArray[i]))
return nullptr;
break;
case EOpRoundEven:
if (getType().getBasicType() == EbtFloat)
{
float x = unionArray[i].getFConst();
float result;
float fractPart = modf(x, &result);
if (abs(fractPart) == 0.5f)
result = 2.0f * round(x / 2.0f);
else
result = round(x);
tempConstArray[i].setFConst(result);
break;
}
infoSink.info.message(
EPrefixInternalError, getLine(),
"Unary operation not folded into constant");
return nullptr;
case EOpCeil:
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&ceil), infoSink, &tempConstArray[i]))
return nullptr;
break;
case EOpFract:
if (getType().getBasicType() == EbtFloat)
{
float x = unionArray[i].getFConst();
tempConstArray[i].setFConst(x - floor(x));
break;
}
infoSink.info.message(
EPrefixInternalError, getLine(),
"Unary operation not folded into constant");
return nullptr;
default:
return NULL;
}
......
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