From bdcefb8ec4a1d19c625ce9aefa1be4cc074e78bd Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 16 Jul 2021 11:45:56 +0200 Subject: [PATCH] radeonsi: preserve derivatives after discards for ARB shaders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- 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);