Builtin math function execution cost: Issues with accuracy of builtins

Inspired by your question about the precision of the implemented transcendental function, I have carried out some experiments. The results are really amazing!

Although I prefer NVIDIA cards, I have to admit that AMD has the most precise implementation. When I carried out similar experiments 5 or more years ago, the results were different.
In the tests, AMD is represented by R280, while NV and Intel are represented by GTX850 and HD4600, respectively. The same results are retrieved for all NV cards (from the Fermi to Maxwell).

The figure speaks more than words. AMD has got absolutely the best precision. I’m not speaking about a percentage or a dozen. The difference is for the orders of magnitude!
In the figure, it is shown the precision (relative error) of the sine function used in GLSL. The top chart shows errors for small arguments (x<1e-5). The middle chart shows errors for arguments in the range 1e-5 to 1e-2 radians, while the bottom chart is for large arguments.

The conclusions are the following:

  1. The relative error of the GLSL sine function on R280 is always less than or equal to 5.3e-7. Absolutely amazing! Even for the infinitesimally small arguments (e.g. 1e-18). For the others, the error is 100% for arguments less than 1e-7.

  2. For small arguments, Intel has slightly better precision than NVIDIA.

  3. For larger arguments, Intel’s implementation is a disaster.

You shouldn’t use “standard” projection/reprojection function for all scales. I had the same problem 5-6 years ago. That’s why I have introduced the topocentric coordinate system and use linear interpolation for shorter distances. This enabled a subpixel-precise visualization of the whole Earth.

Just measure a frame drawing time using timer_query.