r300: use nir_lower_alu_width to lower vector compare

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40197>
This commit is contained in:
Georg Lehmann 2026-03-03 15:39:58 +01:00 committed by Marge Bot
parent 35746f64ea
commit f628cd0333
2 changed files with 29 additions and 1 deletions

View file

@ -137,6 +137,34 @@ remove_clip_vertex(nir_builder *b, nir_instr *instr, UNUSED void *_)
return false;
}
static bool
r300_alu_to_scalar_filter_cb(const nir_instr *instr, const void *data)
{
if (instr->type != nir_instr_type_alu)
return false;
nir_alu_instr *alu = nir_instr_as_alu(instr);
switch (alu->op) {
case nir_op_ball_fequal2:
case nir_op_ball_fequal3:
case nir_op_ball_fequal4:
case nir_op_bany_fnequal2:
case nir_op_bany_fnequal3:
case nir_op_bany_fnequal4:
case nir_op_ball_iequal2:
case nir_op_ball_iequal3:
case nir_op_ball_iequal4:
case nir_op_bany_inequal2:
case nir_op_bany_inequal3:
case nir_op_bany_inequal4:
return true;
default:
break;
}
return false;
}
void
r300_optimize_nir(struct nir_shader *s, struct r300_screen *screen)
{
@ -168,6 +196,7 @@ r300_optimize_nir(struct nir_shader *s, struct r300_screen *screen)
progress = false;
NIR_PASS(_, s, nir_lower_vars_to_ssa);
NIR_PASS(progress, s, nir_lower_alu_to_scalar, r300_alu_to_scalar_filter_cb, NULL);
NIR_PASS(progress, s, nir_opt_copy_prop);
NIR_PASS(progress, s, r300_nir_lower_flrp);
NIR_PASS(progress, s, nir_opt_algebraic);

View file

@ -123,7 +123,6 @@ static struct disk_cache* r300_get_disk_shader_cache(struct pipe_screen* pscreen
.lower_insert_byte = true, \
.lower_insert_word = true, \
.lower_uniforms_to_ubo = true, \
.lower_vector_cmp = true, \
.no_integers = true
static const nir_shader_compiler_options r500_vs_compiler_options = {