Changed the minimum value of a float when converting it to half float. It was 5.96046E-8f and it's now 3.054738E-5f. This values seems to be the lowest one before 0 when converting back half to float.

This issue has been revealed in this post https://hub.jmonkeyengine.org/t/pbr-nan-to-half-conversion-errors/37219
The bad minimum was causing erratic data being wrote to the texture when the value was very close to 0, and causing the glitches and even crashes when color values were given as Float.Infinity or Float.NaN.
This commit is contained in:
Nehon 2016-11-04 20:08:44 +01:00
parent 3205b8be35
commit 78fa00bedf

View File

@ -981,9 +981,9 @@ final public class FastMath {
return 0x7bff;
} else if (flt < -65504f) {
return (short) (0x7bff | 0x8000);
} else if (flt > 0f && flt < 5.96046E-8f) {
} else if (flt > 0f && flt < 3.054738E-5f) {
return 0x0001;
} else if (flt < 0f && flt > -5.96046E-8f) {
} else if (flt < 0f && flt > -3.054738E-5f) {
return (short) 0x8001;
}