From: Eric Anholt Date: Mon, 3 Jun 2019 23:12:14 +0000 (-0700) Subject: freedreno: Improve the pi approximations in trig lowering. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fb872748ec63f26213ca2021846c4c3a1c6ab1a8;p=mesa.git freedreno: Improve the pi approximations in trig lowering. When comparing our sin/cos behavior to the closed source driver, I noticed that we were off by a bit (or, in the case of 1/2pi, 3 bits). Fixes: dEQP-GLES3.functional.shaders.random.trigonometric.vertex.52 dEQP-GLES3.functional.shaders.random.all_features.vertex.0 Reviewed-by: Kristian H. Kristensen Reviewed-by: Rob Clark --- diff --git a/src/freedreno/ir3/ir3_nir_trig.py b/src/freedreno/ir3/ir3_nir_trig.py index 3968aea543c..7e2d554b0d0 100644 --- a/src/freedreno/ir3/ir3_nir_trig.py +++ b/src/freedreno/ir3/ir3_nir_trig.py @@ -26,8 +26,8 @@ import argparse import sys trig_workarounds = [ - (('fsin', 'x'), ('fsin', ('fsub', ('fmul', 6.283185, ('ffract', ('fadd', ('fmul', 0.159155, 'x'), 0.5))), 3.141593))), - (('fcos', 'x'), ('fcos', ('fsub', ('fmul', 6.283185, ('ffract', ('fadd', ('fmul', 0.159155, 'x'), 0.5))), 3.141593))), + (('fsin', 'x'), ('fsin', ('fsub', ('fmul', 6.2831853, ('ffract', ('fadd', ('fmul', 0.15915494, 'x'), 0.5))), 3.14159265))), + (('fcos', 'x'), ('fcos', ('fsub', ('fmul', 6.2831853, ('ffract', ('fadd', ('fmul', 0.15915494, 'x'), 0.5))), 3.14159265))), ]