diff options
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_llvm_ps.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_nir.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 11 |
5 files changed, 7 insertions, 26 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 01911cc8b54..8c8f90b80e2 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1599,13 +1599,6 @@ static bool si_build_main_function(struct si_shader_context *ctx, } } - if (sel->force_correct_derivs_after_kill) { - ctx->postponed_kill = ac_build_alloca_undef(&ctx->ac, ctx->ac.i1, ""); - /* true = don't kill. */ - LLVMBuildStore(ctx->ac.builder, ctx->ac.i1true, - ctx->postponed_kill); - } - bool success = si_nir_build_llvm(ctx, nir); if (free_nir) ralloc_free(nir); diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 0109f68a9ed..1ee9aba9faf 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -435,7 +435,6 @@ struct si_shader_selector { /* PIPE_SHADER_[VERTEX|FRAGMENT|...] */ enum pipe_shader_type type; bool vs_needs_prolog; - bool force_correct_derivs_after_kill; bool prim_discard_cs_allowed; bool ngg_culling_allowed; unsigned num_vs_inputs; diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm_ps.c b/src/gallium/drivers/radeonsi/si_shader_llvm_ps.c index 493eb2cf908..ea8077dcc28 100644 --- a/src/gallium/drivers/radeonsi/si_shader_llvm_ps.c +++ b/src/gallium/drivers/radeonsi/si_shader_llvm_ps.c @@ -621,17 +621,6 @@ static void si_llvm_emit_kill(struct ac_shader_abi *abi, LLVMValueRef visible) struct si_shader_context *ctx = si_shader_context_from_abi(abi); LLVMBuilderRef builder = ctx->ac.builder; - if (ctx->shader->selector->force_correct_derivs_after_kill) { - /* Kill immediately while maintaining WQM. */ - ac_build_kill_if_false(&ctx->ac, - ac_build_wqm_vote(&ctx->ac, visible)); - - LLVMValueRef mask = LLVMBuildLoad(builder, ctx->postponed_kill, ""); - mask = LLVMBuildAnd(builder, mask, visible, ""); - LLVMBuildStore(builder, mask, ctx->postponed_kill); - return; - } - ac_build_kill_if_false(&ctx->ac, visible); } diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 812683e2881..da97b738c40 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -985,6 +985,9 @@ static void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir) NIR_PASS_V(nir, nir_lower_bool_to_int32); NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp); + + if (sscreen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL)) + NIR_PASS_V(nir, nir_lower_discard_to_demote); } void si_finalize_nir(struct pipe_screen *screen, void *nirptr, bool optimize) diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index fcf99088164..ebb3fa30b88 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -73,7 +73,10 @@ void si_get_ir_cache_key(struct si_shader_selector *sel, bool ngg, bool es, shader_variant_flags |= 1 << 1; if (si_get_wave_size(sel->screen, sel->type, ngg, es) == 32) shader_variant_flags |= 1 << 2; - if (sel->force_correct_derivs_after_kill) + if (sel->type == PIPE_SHADER_FRAGMENT && + sel->info.uses_derivatives && + sel->info.uses_kill && + sel->screen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL)) shader_variant_flags |= 1 << 3; struct mesa_sha1 ctx; @@ -2822,12 +2825,6 @@ static void *si_create_shader_selector(struct pipe_context *ctx, sel->info.num_inputs && !sel->info.properties[TGSI_PROPERTY_VS_BLIT_SGPRS_AMD]; - sel->force_correct_derivs_after_kill = - sel->type == PIPE_SHADER_FRAGMENT && - sel->info.uses_derivatives && - sel->info.uses_kill && - sctx->screen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL); - sel->prim_discard_cs_allowed = sel->type == PIPE_SHADER_VERTEX && !sel->info.uses_bindless_images && |