Mesa (master): freedreno: Improve the pi approximations in trig lowering.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 4 23:35:55 UTC 2019


Module: Mesa
Branch: master
Commit: fb872748ec63f26213ca2021846c4c3a1c6ab1a8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb872748ec63f26213ca2021846c4c3a1c6ab1a8

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jun  3 16:12:14 2019 -0700

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 <hoegsberg at google.com>
Reviewed-by: Rob Clark <robdclark at gmail.com>

---

 src/freedreno/ir3/ir3_nir_trig.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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))),
 ]
 
 




More information about the mesa-commit mailing list