Mesa (main): radeonsi: preserve derivatives after discards for ARB shaders

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 28 09:13:14 UTC 2021


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

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Fri Jul 16 11:45:56 2021 +0200

radeonsi: preserve derivatives after discards for ARB shaders

Contrary to the GLSL spec, the ARB fp spec doesn't explicitely
states that derivatives are undefined after discards.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5018
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11972>

---

 src/gallium/drivers/radeonsi/si_shader_nir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index fefac183026..5573cc7065c 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -837,7 +837,8 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir)
    NIR_PASS_V(nir, nir_lower_subgroups, &subgroups_options);
 
    NIR_PASS_V(nir, nir_lower_discard_or_demote,
-              sscreen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL));
+              (sscreen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL)) ||
+               nir->info.is_arb_asm);
 
    /* Lower load constants to scalar and then clean up the mess */
    NIR_PASS_V(nir, nir_lower_load_const_to_scalar);



More information about the mesa-commit mailing list