зеркало из https://github.com/AvaloniaUI/angle.git
Revert "Support constant folding of trigonometry 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 af930db150
.
Change-Id: Ic0bf09b4088a1ee285fed0fbd77dfc4c682fcd12
Reviewed-on: https://chromium-review.googlesource.com/265144
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
50b7178d38
Коммит
b4a058bb6a
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "compiler/translator/HashNames.h"
|
||||
|
@ -20,10 +19,6 @@
|
|||
namespace
|
||||
{
|
||||
|
||||
const float kPi = 3.14159265358979323846f;
|
||||
const float kDegreesToRadiansMultiplier = kPi / 180.0f;
|
||||
const float kRadiansToDegreesMultiplier = 180.0f / kPi;
|
||||
|
||||
TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
|
||||
{
|
||||
return left > right ? left : right;
|
||||
|
@ -1190,100 +1185,6 @@ TIntermTyped *TIntermConstantUnion::fold(
|
|||
}
|
||||
break;
|
||||
|
||||
case EOpRadians:
|
||||
if (getType().getBasicType() == EbtFloat)
|
||||
{
|
||||
tempConstArray[i].setFConst(kDegreesToRadiansMultiplier * unionArray[i].getFConst());
|
||||
break;
|
||||
}
|
||||
infoSink.info.message(
|
||||
EPrefixInternalError, getLine(),
|
||||
"Unary operation not folded into constant");
|
||||
return nullptr;
|
||||
|
||||
case EOpDegrees:
|
||||
if (getType().getBasicType() == EbtFloat)
|
||||
{
|
||||
tempConstArray[i].setFConst(kRadiansToDegreesMultiplier * unionArray[i].getFConst());
|
||||
break;
|
||||
}
|
||||
infoSink.info.message(
|
||||
EPrefixInternalError, getLine(),
|
||||
"Unary operation not folded into constant");
|
||||
return nullptr;
|
||||
|
||||
case EOpSin:
|
||||
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&sin), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpCos:
|
||||
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&cos), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpTan:
|
||||
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&tan), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpAsin:
|
||||
// For asin(x), results are undefined if |x| > 1, we are choosing to set result to 0.
|
||||
if (getType().getBasicType() == EbtFloat && abs(unionArray[i].getFConst()) > 1.0)
|
||||
tempConstArray[i].setFConst(0.0);
|
||||
else if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&asin), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpAcos:
|
||||
// For acos(x), results are undefined if |x| > 1, we are choosing to set result to 0.
|
||||
if (getType().getBasicType() == EbtFloat && abs(unionArray[i].getFConst()) > 1.0)
|
||||
tempConstArray[i].setFConst(0.0);
|
||||
else if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&acos), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpAtan:
|
||||
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&atan), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpSinh:
|
||||
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&sinh), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpCosh:
|
||||
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&cosh), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpTanh:
|
||||
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&tanh), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpAsinh:
|
||||
if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&asinh), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpAcosh:
|
||||
// For acosh(x), results are undefined if x < 1, we are choosing to set result to 0.
|
||||
if (getType().getBasicType() == EbtFloat && unionArray[i].getFConst() < 1.0)
|
||||
tempConstArray[i].setFConst(0.0);
|
||||
else if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&acosh), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
case EOpAtanh:
|
||||
// For atanh(x), results are undefined if |x| >= 1, we are choosing to set result to 0.
|
||||
if (getType().getBasicType() == EbtFloat && abs(unionArray[i].getFConst()) >= 1.0)
|
||||
tempConstArray[i].setFConst(0.0);
|
||||
else if (!foldFloatTypeUnary(unionArray[i], static_cast<FloatTypeUnaryFunc>(&atanh), infoSink, &tempConstArray[i]))
|
||||
return nullptr;
|
||||
break;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1294,23 +1195,6 @@ TIntermTyped *TIntermConstantUnion::fold(
|
|||
}
|
||||
}
|
||||
|
||||
bool TIntermConstantUnion::foldFloatTypeUnary(const ConstantUnion ¶meter, FloatTypeUnaryFunc builtinFunc,
|
||||
TInfoSink &infoSink, ConstantUnion *result) const
|
||||
{
|
||||
ASSERT(builtinFunc);
|
||||
|
||||
if (getType().getBasicType() == EbtFloat)
|
||||
{
|
||||
result->setFConst(builtinFunc(parameter.getFConst()));
|
||||
return true;
|
||||
}
|
||||
|
||||
infoSink.info.message(
|
||||
EPrefixInternalError, getLine(),
|
||||
"Unary operation not folded into constant");
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
TString TIntermTraverser::hash(const TString &name, ShHashFunction64 hashFunction)
|
||||
{
|
||||
|
|
|
@ -292,10 +292,6 @@ class TIntermConstantUnion : public TIntermTyped
|
|||
|
||||
protected:
|
||||
ConstantUnion *mUnionArrayPointer;
|
||||
|
||||
private:
|
||||
typedef float(*FloatTypeUnaryFunc) (float);
|
||||
bool foldFloatTypeUnary(const ConstantUnion ¶meter, FloatTypeUnaryFunc builtinFunc, TInfoSink &infoSink, ConstantUnion *result) const;
|
||||
};
|
||||
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче