Add the 6 hyperbolic trig functions.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22149 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-06-24 22:40:19 +00:00
parent eebed6f60b
commit ebf0825ec4
5 changed files with 60 additions and 0 deletions

View File

@ -90,6 +90,11 @@ void main()
sc = s2.c;
sf = s2.f;
sinh(c1D) +
cosh(c1D) * tanh(c2D);
asinh(c4D) + acosh(c4D);
atanh(c3D);
}
float imageBuffer; // ERROR, reserved

View File

@ -149,6 +149,12 @@ enum TOperator {
EOpAsin,
EOpAcos,
EOpAtan,
EOpSinh,
EOpCosh,
EOpTanh,
EOpAsinh,
EOpAcosh,
EOpAtanh,
EOpPow,
EOpExp,

View File

@ -541,6 +541,13 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType,
// TODO: Functionality: constant folding: the rest of the ops have to be fleshed out
case EOpSinh:
case EOpCosh:
case EOpTanh:
case EOpAsinh:
case EOpAcosh:
case EOpAtanh:
case EOpIsNan:
case EOpIsInf:

View File

@ -140,6 +140,36 @@ void TBuiltIns::initialize(int version, EProfile profile)
s.append(TString("vec3 atan(vec3 y_over_x);"));
s.append(TString("vec4 atan(vec4 y_over_x);"));
s.append(TString("float sinh(float angle);"));
s.append(TString("vec2 sinh(vec2 angle);"));
s.append(TString("vec3 sinh(vec3 angle);"));
s.append(TString("vec4 sinh(vec4 angle);"));
s.append(TString("float cosh(float angle);"));
s.append(TString("vec2 cosh(vec2 angle);"));
s.append(TString("vec3 cosh(vec3 angle);"));
s.append(TString("vec4 cosh(vec4 angle);"));
s.append(TString("float tanh(float angle);"));
s.append(TString("vec2 tanh(vec2 angle);"));
s.append(TString("vec3 tanh(vec3 angle);"));
s.append(TString("vec4 tanh(vec4 angle);"));
s.append(TString("float asinh(float x);"));
s.append(TString("vec2 asinh(vec2 x);"));
s.append(TString("vec3 asinh(vec3 x);"));
s.append(TString("vec4 asinh(vec4 x);"));
s.append(TString("float acosh(float x);"));
s.append(TString("vec2 acosh(vec2 x);"));
s.append(TString("vec3 acosh(vec3 x);"));
s.append(TString("vec4 acosh(vec4 x);"));
s.append(TString("float atanh(float y_over_x);"));
s.append(TString("vec2 atanh(vec2 y_over_x);"));
s.append(TString("vec3 atanh(vec3 y_over_x);"));
s.append(TString("vec4 atanh(vec4 y_over_x);"));
//
// Exponential Functions.
//
@ -1507,6 +1537,12 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
symbolTable.relateToOperator("asin", EOpAsin);
symbolTable.relateToOperator("acos", EOpAcos);
symbolTable.relateToOperator("atan", EOpAtan);
symbolTable.relateToOperator("sinh", EOpSinh);
symbolTable.relateToOperator("cosh", EOpCosh);
symbolTable.relateToOperator("tanh", EOpTanh);
symbolTable.relateToOperator("asinh", EOpAsinh);
symbolTable.relateToOperator("acosh", EOpAcosh);
symbolTable.relateToOperator("atanh", EOpAtanh);
symbolTable.relateToOperator("pow", EOpPow);
symbolTable.relateToOperator("exp2", EOpExp2);

View File

@ -207,6 +207,12 @@ bool OutputUnary(bool /* preVisit */, TIntermUnary* node, TIntermTraverser* it)
case EOpAsin: out.debug << "arc sine"; break;
case EOpAcos: out.debug << "arc cosine"; break;
case EOpAtan: out.debug << "arc tangent"; break;
case EOpSinh: out.debug << "hyp. sine"; break;
case EOpCosh: out.debug << "hyp. cosine"; break;
case EOpTanh: out.debug << "hyp. tangent"; break;
case EOpAsinh: out.debug << "arc hyp. sine"; break;
case EOpAcosh: out.debug << "arc hyp. cosine"; break;
case EOpAtanh: out.debug << "arc hyp. tangent"; break;
case EOpExp: out.debug << "exp"; break;
case EOpLog: out.debug << "log"; break;