From: Marek Olšák Date: Sun, 6 Sep 2020 15:31:18 +0000 (-0400) Subject: radeonsi: remove redundant si_shader_info::uses_derivatives X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64349a60e17a03de4bb7e03d942bfc1679dfe8ab;p=mesa.git radeonsi: remove redundant si_shader_info::uses_derivatives Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 7b3c015e901..50b37fb40e1 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2133,7 +2133,7 @@ void si_get_ps_prolog_key(struct si_shader *shader, union si_shader_part_key *ke key->ps_prolog.num_input_sgprs = shader->info.num_input_sgprs; key->ps_prolog.num_input_vgprs = shader->info.num_input_vgprs; key->ps_prolog.wqm = - info->uses_derivatives && + info->base.fs.needs_helper_invocations && (key->ps_prolog.colors_read || key->ps_prolog.states.force_persp_sample_interp || key->ps_prolog.states.force_linear_sample_interp || key->ps_prolog.states.force_persp_center_interp || diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index b192617424e..1cfaab59979 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -371,7 +371,6 @@ struct si_shader_info { bool writes_primid; bool writes_viewport_index; bool writes_layer; - bool uses_derivatives; bool uses_bindless_samplers; bool uses_bindless_images; bool uses_fbfetch; diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 9b76b7b0671..46dd6e973fb 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -230,22 +230,7 @@ static void scan_io_usage(struct si_shader_info *info, nir_intrinsic_instr *intr static void scan_instruction(const struct nir_shader *nir, struct si_shader_info *info, nir_instr *instr) { - if (instr->type == nir_instr_type_alu) { - nir_alu_instr *alu = nir_instr_as_alu(instr); - - switch (alu->op) { - case nir_op_fddx: - case nir_op_fddy: - case nir_op_fddx_fine: - case nir_op_fddy_fine: - case nir_op_fddx_coarse: - case nir_op_fddy_coarse: - info->uses_derivatives = true; - break; - default: - break; - } - } else if (instr->type == nir_instr_type_tex) { + if (instr->type == nir_instr_type_tex) { nir_tex_instr *tex = nir_instr_as_tex(instr); const nir_deref_instr *deref = tex_get_texture_deref(tex); nir_variable *var = deref ? nir_deref_instr_get_variable(deref) : NULL; @@ -254,16 +239,6 @@ static void scan_instruction(const struct nir_shader *nir, struct si_shader_info if (deref->mode != nir_var_uniform || var->data.bindless) info->uses_bindless_samplers = true; } - - switch (tex->op) { - case nir_texop_tex: - case nir_texop_txb: - case nir_texop_lod: - info->uses_derivatives = true; - break; - default: - break; - } } else if (instr->type == nir_instr_type_intrinsic) { nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index bf5782171d4..ae430a3f504 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -72,7 +72,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->info.stage, ngg, es, false, false) == 32) shader_variant_flags |= 1 << 2; - if (sel->info.stage == MESA_SHADER_FRAGMENT && sel->info.uses_derivatives && sel->info.base.fs.uses_discard && + if (sel->info.stage == MESA_SHADER_FRAGMENT && + /* Derivatives imply helper invocations so check for needs_helper_invocations. */ + sel->info.base.fs.needs_helper_invocations && + sel->info.base.fs.uses_discard && sel->screen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL)) shader_variant_flags |= 1 << 3;