glsl: Improve the accuracy of the acos() approximation.
authorFrancisco Jerez <currojerez@riseup.net>
Thu, 3 Mar 2016 07:50:04 +0000 (23:50 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 4 Mar 2016 05:31:22 +0000 (21:31 -0800)
commita6046d217d14130a46f6ffe42992fd745551a928
tree0c58db5ec1f9bfd2c99ebc10e27afb9ec6537f5e
parent2795fbcae302cd8821b23821ebf8a2b256ff10d5
glsl: Improve the accuracy of the acos() approximation.

The adjusted polynomial coefficients come from the numerical
minimization of the L2 norm of the relative error.  The old
coefficients would give a maximum relative error of about 15000 ULP in
the neighborhood around acos(x) = 0, the new ones give a relative
error bounded by less than 2000 ULP in the same neighborhood.

Fixes four dEQP subtests:
dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.
highp_compute.{scalar,vec2,vec3,vec4}

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/compiler/glsl/builtin_functions.cpp