radeonsi: enable glsl_correct_derivatives_after_discard by default

Enabling this option by default allows the nir_opt_move_discards_to_top
to be used more often.

This is only done for LLVM13+ since doing this on LLVM11 hurts a lot of
shaders.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10522>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2021-05-17 15:52:49 +02:00 committed by Marge Bot
parent 7640479028
commit 17861aff96

View file

@ -1048,8 +1048,12 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
/* Set these flags in debug_flags early, so that the shader cache takes
* them into account.
*
* Enable FS_CORRECT_DERIVS_AFTER_KILL by default if LLVM is >= 13. This makes
* nir_opt_move_discards_to_top more effective.
*/
if (driQueryOptionb(config->options, "glsl_correct_derivatives_after_discard"))
if (driQueryOptionb(config->options, "glsl_correct_derivatives_after_discard") ||
LLVM_VERSION_MAJOR >= 13)
sscreen->debug_flags |= DBG(FS_CORRECT_DERIVS_AFTER_KILL);
if (sscreen->debug_flags & DBG(INFO))