r300: use nir lowering for sin and cos on R300 and R400
authorPavel Ondračka <pavel.ondracka@gmail.com>
Wed, 9 Feb 2022 09:36:08 +0000 (10:36 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 11 Feb 2022 16:09:45 +0000 (16:09 +0000)
commit1109381e0ebc11c1c31745e4f0f0383dc462493e
tree473ee8aaffd655f50e393561f025593123f66a30
parentaa3405e8123324b3d8173c709e6573d86570d99a
r300: use nir lowering for sin and cos on R300 and R400

The nir approximation is a bit more precise so there is one more
instruction for the scalar version but if the shader actually uses
vector one or some other stuff like sin(x) followed by cos(x) we
save more.

This nir approximation importantly seems to have better precision
so this should also fix some piglits/dEQPs.

With my shader-db and faked R300:
total instructions in shared programs: 67751 -> 65978 (-2.62%)
instructions in affected programs: 8637 -> 6864 (-20.53%)
total temps in shared programs: 9191 -> 9137 (-0.59%)
temps in affected programs: 486 -> 432 (-11.11%)
total consts in shared programs: 45427 -> 45412 (-0.03%)
consts in affected programs: 856 -> 841 (-1.75%)
total lits in shared programs: 2317 -> 2346 (1.25%)
lits in affected programs: 69 -> 98 (42.03%)

Reviewed-by: Emma Anholt <emma@anholt.net>
Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14957>
src/gallium/drivers/r300/r300_screen.c