mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-28 00:10:30 +01:00
radeonsi: lower discard to demote when FS_CORRECT_DERIVS_AFTER_KILL is enabled
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4047>
This commit is contained in:
parent
de57ea2a3d
commit
9d64ad2fe7
5 changed files with 7 additions and 26 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 &&
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue