diff options
author | Pavel Ondračka <pavel.ondracka@gmail.com> | 2022-02-09 10:36:08 +0100 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-02-11 16:09:45 +0000 |
commit | 1109381e0ebc11c1c31745e4f0f0383dc462493e (patch) | |
tree | 473ee8aaffd655f50e393561f025593123f66a30 | |
parent | aa3405e8123324b3d8173c709e6573d86570d99a (diff) |
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>
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 06be9f0d78d..4b176fe8de8 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -571,6 +571,7 @@ static const nir_shader_compiler_options r300_vs_compiler_options = { .lower_rotate = true, .lower_uniforms_to_ubo = true, .lower_vector_cmp = true, + .lower_sincos = true, /* Note: has HW loops support, but only 256 ALU instructions. */ .max_unroll_iterations = 32, @@ -596,6 +597,7 @@ static const nir_shader_compiler_options r300_fs_compiler_options = { .lower_rotate = true, .lower_uniforms_to_ubo = true, .lower_vector_cmp = true, + .lower_sincos = true, /* No HW loops support, so set it equal to ALU instr max */ .max_unroll_iterations = 64, |