mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
radeonsi: gather uses_discard from shader variants
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34492>
This commit is contained in:
parent
de6ca8c7ec
commit
20e5c35cfe
4 changed files with 16 additions and 13 deletions
|
|
@ -2454,7 +2454,7 @@ static void run_late_optimization_and_lowering_passes(struct si_nir_shader_ctx *
|
|||
.use_aco = nir->info.use_aco_amd,
|
||||
.bc_optimize_for_persp = key->ps.part.prolog.bc_optimize_for_persp,
|
||||
.bc_optimize_for_linear = key->ps.part.prolog.bc_optimize_for_linear,
|
||||
.uses_discard = si_shader_uses_discard(shader),
|
||||
.uses_discard = shader->info.uses_discard,
|
||||
.alpha_to_coverage_via_mrtz = key->ps.part.epilog.alpha_to_coverage_via_mrtz,
|
||||
.dual_src_blend_swizzle = key->ps.part.epilog.dual_src_blend_swizzle,
|
||||
.spi_shader_col_format = key->ps.part.epilog.spi_shader_col_format,
|
||||
|
|
@ -2869,6 +2869,13 @@ si_get_shader_variant_info(struct si_shader *shader, nir_shader *nir)
|
|||
shader->info.writes_sample_mask = true;
|
||||
}
|
||||
break;
|
||||
case nir_intrinsic_demote:
|
||||
case nir_intrinsic_demote_if:
|
||||
case nir_intrinsic_terminate:
|
||||
case nir_intrinsic_terminate_if:
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT)
|
||||
shader->info.uses_discard = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -3588,7 +3595,9 @@ static void si_get_ps_epilog_key(struct si_shader *shader, union si_shader_part_
|
|||
memset(key, 0, sizeof(*key));
|
||||
key->ps_epilog.use_aco = info->base.use_aco_amd;
|
||||
key->ps_epilog.wave32 = shader->wave_size == 32;
|
||||
key->ps_epilog.uses_discard = si_shader_uses_discard(shader);
|
||||
key->ps_epilog.uses_discard = shader->info.uses_discard ||
|
||||
shader->key.ps.part.prolog.poly_stipple ||
|
||||
shader->key.ps.part.epilog.alpha_func != PIPE_FUNC_ALWAYS;
|
||||
key->ps_epilog.colors_written = info->colors_written;
|
||||
key->ps_epilog.color_types = info->output_color_types;
|
||||
key->ps_epilog.writes_all_cbufs = info->color0_writes_all_cbufs &&
|
||||
|
|
@ -3758,6 +3767,8 @@ bool si_create_shader_variant(struct si_screen *sscreen, struct ac_llvm_compiler
|
|||
shader->info.writes_z &= !shader->key.ps.part.epilog.kill_z;
|
||||
shader->info.writes_stencil &= !shader->key.ps.part.epilog.kill_stencil;
|
||||
shader->info.writes_sample_mask &= !shader->key.ps.part.epilog.kill_samplemask;
|
||||
shader->info.uses_discard |= shader->key.ps.part.prolog.poly_stipple ||
|
||||
shader->key.ps.part.epilog.alpha_func != PIPE_FUNC_ALWAYS;
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -881,6 +881,7 @@ struct si_shader_binary_info {
|
|||
bool writes_z : 1;
|
||||
bool writes_stencil : 1;
|
||||
bool writes_sample_mask : 1;
|
||||
bool uses_discard : 1;
|
||||
uint8_t nr_pos_exports;
|
||||
uint8_t nr_param_exports;
|
||||
unsigned private_mem_vgprs;
|
||||
|
|
@ -1141,15 +1142,6 @@ static inline bool si_shader_uses_streamout(const struct si_shader *shader)
|
|||
!shader->key.ge.mono.remove_streamout;
|
||||
}
|
||||
|
||||
static inline bool si_shader_uses_discard(struct si_shader *shader)
|
||||
{
|
||||
/* Changes to this should also update ps_modifies_zs. */
|
||||
return shader->selector->info.base.fs.uses_discard ||
|
||||
shader->key.ps.part.prolog.poly_stipple ||
|
||||
shader->key.ps.mono.point_smoothing ||
|
||||
shader->key.ps.part.epilog.alpha_func != PIPE_FUNC_ALWAYS;
|
||||
}
|
||||
|
||||
static inline bool si_shader_culling_enabled(struct si_shader *shader)
|
||||
{
|
||||
/* Legacy VS/TES/GS and ES don't cull in the shader. */
|
||||
|
|
|
|||
|
|
@ -805,7 +805,7 @@ bool si_llvm_compile_shader(struct si_screen *sscreen, struct ac_llvm_compiler *
|
|||
shader->info.writes_sample_mask ||
|
||||
shader->key.ps.part.epilog.alpha_to_coverage_via_mrtz;
|
||||
if (!exports_mrtz && !exports_color_null)
|
||||
exports_color_null = si_shader_uses_discard(shader) || sscreen->info.gfx_level < GFX10;
|
||||
exports_color_null = shader->info.uses_discard || sscreen->info.gfx_level < GFX10;
|
||||
}
|
||||
|
||||
si_llvm_context_init(&ctx, sscreen, compiler, shader->wave_size, exports_color_null, exports_mrtz,
|
||||
|
|
|
|||
|
|
@ -2118,7 +2118,7 @@ static void si_shader_ps(struct si_screen *sscreen, struct si_shader *shader)
|
|||
S_02880C_MASK_EXPORT_ENABLE(shader->info.writes_sample_mask) |
|
||||
S_02880C_COVERAGE_TO_MASK_ENABLE(sscreen->info.gfx_level <= GFX10_3 &&
|
||||
shader->key.ps.part.epilog.alpha_to_coverage_via_mrtz) |
|
||||
S_02880C_KILL_ENABLE(si_shader_uses_discard(shader));
|
||||
S_02880C_KILL_ENABLE(shader->info.uses_discard);
|
||||
|
||||
if (sscreen->info.gfx_level >= GFX12)
|
||||
shader->ps.pa_sc_hisz_control = S_028BBC_ROUND(2); /* required minimum value */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue