imageworks/OpenShadingLanguage — pull request #413 by fpsunflower (2014-09-09 16:25:56+00:00)
Title: Add faster, lower precision variants of the standard math routines

This adds a set of `fast_*` math routines that are much faster than both the system libraries as well as some optimized variants (like Intel's libimf) at the expense of a bit of precision. I have tried to document the precision caveats in the code -- but these should mostly be oblivious to reasonable shaders.

I have provided a fallback via a `#define` so that its easy to use the system math library if desired.

On some test shaders that make heavy use of these functions, I am seeing a 5-10% speedup over Intel's optimized library (with minute image differences, but nothing objectionable).

I have also simplified the lookup from the blackbody table to avoid calls to `powf` altogether as this is a very costly function.