ir3: Make trig replacement expression exact

This prevents other optimizations from associating the inner multiply,
which can add inaccuracies that can lead to discontinuities around the
boundary of the ffract. We should use exactly the sequence that the blob
uses to avoid problems.

Since fadd + fmul cannot be combined to ffma when exact is specified, we
have to use ffma ourselves.

Fixes artifacts in PixMark Volplosion with !7458.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12912>
This commit is contained in:
Connor Abbott 2021-09-17 15:37:49 +02:00 committed by Marge Bot
parent 6ed18749de
commit dfe432d829
2 changed files with 6 additions and 6 deletions

View File

@ -413,14 +413,14 @@ traces:
# - device: freedreno-a306
# checksum: 751e0e784ba2f003cfc456fe8699f1fa
- device: freedreno-a530
checksum: a8580a2a85f37600c15fb897cd874432
checksum: ba53d1ffbe911171546a93259fb2e57c
- device: freedreno-a630
checksum: 66d7cfb1aedfe40048fe2cdf8032071c
checksum: 313ef615f0f5a11eeaf95a2a87769a32
# Note: Requires GL3.3
- path: gputest/gimark.trace
expectations:
- device: freedreno-a630
checksum: 286cab0d6d6562d5dcc969d778cfa666
checksum: e58167bd8eeb8952facbc00ff0449135
- path: gputest/pixmark-julia-fp32.trace
expectations:
- device: freedreno-a630
@ -459,7 +459,7 @@ traces:
- path: gputest/tessmark.trace
expectations:
- device: freedreno-a630
checksum: 93d7cb8c775a7b60c499695045edc07f
checksum: af356a98c4d55fb10613a11fbe687adb
- path: gputest/triangle.trace
expectations:
- device: freedreno-a306

View File

@ -24,8 +24,8 @@ import argparse
import sys
trig_workarounds = [
(('fsin', 'x@32'), ('fsin', ('fsub', ('fmul', 6.2831853, ('ffract', ('fadd', ('fmul', 0.15915494, 'x'), 0.5))), 3.14159265))),
(('fcos', 'x@32'), ('fcos', ('fsub', ('fmul', 6.2831853, ('ffract', ('fadd', ('fmul', 0.15915494, 'x'), 0.5))), 3.14159265))),
(('fsin', 'x@32'), ('fsin', ('!ffma', 6.2831853, ('ffract', ('!ffma', 0.15915494, 'x', 0.5)), -3.14159265))),
(('fcos', 'x@32'), ('fcos', ('!ffma', 6.2831853, ('ffract', ('!ffma', 0.15915494, 'x', 0.5)), -3.14159265))),
]