This commit is contained in:
Branimir Karadžić 2016-01-10 21:18:46 -08:00
parent 03f0c33cf4
commit 2df65f4e25

View file

@ -1118,6 +1118,8 @@ namespace bgfx
template<int32_t MantissaBits, int32_t ExpBits> template<int32_t MantissaBits, int32_t ExpBits>
void encodeRgbE(float* _dst, const float* _src) void encodeRgbE(float* _dst, const float* _src)
{ {
// Reference:
// https://www.opengl.org/registry/specs/EXT/texture_shared_exponent.txt
const int32_t expMax = (1<<ExpBits) - 1; const int32_t expMax = (1<<ExpBits) - 1;
const int32_t expBias = (1<<(ExpBits - 1) ) - 1; const int32_t expBias = (1<<(ExpBits - 1) ) - 1;
const float sharedExpMax = float( (1 << MantissaBits) - 1) / (1 << MantissaBits) * (1 << (expMax-expBias)); const float sharedExpMax = float( (1 << MantissaBits) - 1) / (1 << MantissaBits) * (1 << (expMax-expBias));