Added bx::sinCosApprox bench.

This commit is contained in:
Бранимир Караџић
2024-05-01 09:15:03 -07:00
parent 92241cc8d5
commit 226d52f240
4 changed files with 95 additions and 40 deletions

View File

@@ -162,7 +162,7 @@ namespace bx
return _a * _a;
}
inline void sinCosApprox(float _a, float* _outSinApprox, float* _outCos)
inline void sinCosApprox(float& _outSinApprox, float& _outCos, float _a)
{
const float aa = _a - floor(_a*kInvPi2)*kPi2;
const float absA = abs(aa);
@@ -172,8 +172,8 @@ namespace bx
const float tmp1 = aa > 0.0f && aa < kPi ? 1.0f : -1.0f;
const float sinA = mul(tmp0, tmp1);
*_outSinApprox = sinA;
*_outCos = cosA;
_outSinApprox = sinA;
_outCos = cosA;
}
inline BX_CONST_FUNC float sin(float _a)

View File

@@ -208,7 +208,7 @@ namespace bx
/// @remarks The function calculates cosine, and then approximates sine based on the cosine
/// result. Therefore calculation of sine is less accurate than calling `bx::sin` function.
///
void sinCosApprox(float _a, float* _outSinApprox, float* _outCos);
void sinCosApprox(float& _outSinApprox, float& _outCos, float _a);
/// Returns the sine of the argument _a.
///