compiler/glsl: fix precision problem of tanh
authorHaixia Shi <hshi@chromium.org>
Fri, 9 Dec 2016 01:41:02 +0000 (17:41 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 9 Dec 2016 17:14:20 +0000 (09:14 -0800)
commitd4983390a869c3051929858a8b783be53d46b722
treec7c959e6a37183dc448915ad3a949d0fec4a9a0b
parent7aea08667c673713e1f419539e788eedeea047cb
compiler/glsl: fix precision problem of tanh

Clamp input scalar value to range [-10, +10] to avoid precision problems
when the absolute value of input is too large.

Fixes dEQP-GLES3.functional.shaders.builtin_functions.precision.tanh.* test
failures.

v2: added more explanation in the comment.
v3: fixed a typo in the comment.

Signed-off-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "13.0" <mesa-dev@lists.freedesktop.org>
src/compiler/glsl/builtin_functions.cpp