Commit d1e9a0f4 by Jamie Madill

Revert "Support constant folding of common built-ins"

Part of a chain causing compile errors on Mac. Example: ../../third_party/angle/src/compiler/translator/IntermNode.cpp:1216:89: error: no member named 'sin' in namespace 'std'; did you mean 'sinf'? http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Linux%20Builder/builds/33747 This reverts commit 2b1da6ed. Change-Id: I5d48932a6254d6d1e78966bb3891913d9450e08e Reviewed-on: https://chromium-review.googlesource.com/265612Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent b775778a
...@@ -1330,106 +1330,6 @@ TIntermTyped *TIntermConstantUnion::fold( ...@@ -1330,106 +1330,6 @@ TIntermTyped *TIntermConstantUnion::fold(
tempConstArray[i].setFConst(1.0f / tempConstArray[i].getFConst()); tempConstArray[i].setFConst(1.0f / tempConstArray[i].getFConst());
break; break;
case EOpAbs:
switch (getType().getBasicType())
{
case EbtFloat:
tempConstArray[i].setFConst(std::abs(unionArray[i].getFConst()));
break;
case EbtInt:
tempConstArray[i].setIConst(std::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.0f;
if (fConst > 0.0f)
fResult = 1.0f;
else if (fConst < 0.0f)
fResult = -1.0f;
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>(&std::floor), infoSink, &tempConstArray[i]))
return nullptr;
break;
case EOpTrunc:
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&std::trunc), infoSink, &tempConstArray[i]))
return nullptr;
break;
case EOpRound:
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&std::round), infoSink, &tempConstArray[i]))
return nullptr;
break;
case EOpRoundEven:
if (getType().getBasicType() == EbtFloat)
{
float x = unionArray[i].getFConst();
float result;
float fractPart = std::modf(x, &result);
if (std::abs(fractPart) == 0.5f)
result = 2.0f * std::round(x / 2.0f);
else
result = std::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>(&std::ceil), infoSink, &tempConstArray[i]))
return nullptr;
break;
case EOpFract:
if (getType().getBasicType() == EbtFloat)
{
float x = unionArray[i].getFConst();
tempConstArray[i].setFConst(x - std::floor(x));
break;
}
infoSink.info.message(
EPrefixInternalError, getLine(),
"Unary operation not folded into constant");
return nullptr;
default: default:
return NULL; 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