Exp and LogΒΆ
On PowerVR Rogue and Volcanic architectures, the 2^n
operation is directly supported by an instruction (EXP
):
fragColor.x = exp2(t.x); // one cycle
{fexp}
// Instructions on Volcanic:
fragColor.x = exp2(t.x);
{exp2}
The same is true with the log2()
function (LOG
):
fragColor.x = log2(t.x); // one cycle
{flog}
// Instructions on Volcanic:
fragColor.x = log2(t.x);
{log2f}
exp
is implemented as:
float exp2( float x )
{
return exp2(x * 1.442695); // two cycles
{sop, sop}
{fexp}
}
// Instructions on Volcanic:
float exp2( float x )
{
return exp2(x * 1.442695);
{mul}
{exp2}
}
log
is implemented as:
float log2( float x )
{
return log2(x * 0.693147); // two cycles
{sop, sop}
{flog}
}
// Instructions on Volcanic:
float log2( float x )
{
return log2(x * 0.693147);
{mul}
{log2f}
}
pow(x, y)
is implemented as:
float pow( float x, float y )
{
return exp2(log2(x) * y); // three cycles
{flog}
{sop, sop}
{fexp}
}
// Instructions on Volcanic:
float pow( float x, float y )
{
return exp2(log2(x) * y); // three cycles
{log2f}
{mul}
{exp2}
}