mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 15:40:11 +01:00
nir/lower_bool: Rewrite dest_type for boolean destinations
This happens with nir_texop_samples_identical, and we need to keep things consistent and (soon) keep the validator happy when expanding booleans once we switch that to having a dest_type of bool1. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989>
This commit is contained in:
parent
3d6fe93382
commit
3d803893da
3 changed files with 48 additions and 3 deletions
|
|
@ -389,6 +389,18 @@ lower_phi_instr(nir_builder *b, nir_phi_instr *phi)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
lower_tex_instr(nir_tex_instr *tex)
|
||||
{
|
||||
bool progress = false;
|
||||
rewrite_1bit_ssa_def_to_32bit(&tex->dest.ssa, &progress);
|
||||
if (tex->dest_type == nir_type_bool1) {
|
||||
tex->dest_type = nir_type_bool32;
|
||||
progress = true;
|
||||
}
|
||||
return progress;
|
||||
}
|
||||
|
||||
static bool
|
||||
nir_lower_bool_to_bitsize_impl(nir_builder *b, nir_function_impl *impl)
|
||||
{
|
||||
|
|
@ -411,11 +423,14 @@ nir_lower_bool_to_bitsize_impl(nir_builder *b, nir_function_impl *impl)
|
|||
|
||||
case nir_instr_type_ssa_undef:
|
||||
case nir_instr_type_intrinsic:
|
||||
case nir_instr_type_tex:
|
||||
nir_foreach_ssa_def(instr, rewrite_1bit_ssa_def_to_32bit,
|
||||
&progress);
|
||||
break;
|
||||
|
||||
case nir_instr_type_tex:
|
||||
progress |= lower_tex_instr(nir_instr_as_tex(instr));
|
||||
break;
|
||||
|
||||
default:
|
||||
nir_foreach_ssa_def(instr, assert_ssa_def_is_not_1bit, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,18 @@ lower_alu_instr(nir_builder *b, nir_alu_instr *alu)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
lower_tex_instr(nir_tex_instr *tex)
|
||||
{
|
||||
bool progress = false;
|
||||
rewrite_1bit_ssa_def_to_32bit(&tex->dest.ssa, &progress);
|
||||
if (tex->dest_type == nir_type_bool1) {
|
||||
tex->dest_type = nir_type_bool32;
|
||||
progress = true;
|
||||
}
|
||||
return progress;
|
||||
}
|
||||
|
||||
static bool
|
||||
nir_lower_bool_to_float_impl(nir_function_impl *impl)
|
||||
{
|
||||
|
|
@ -157,11 +169,14 @@ nir_lower_bool_to_float_impl(nir_function_impl *impl)
|
|||
case nir_instr_type_intrinsic:
|
||||
case nir_instr_type_ssa_undef:
|
||||
case nir_instr_type_phi:
|
||||
case nir_instr_type_tex:
|
||||
nir_foreach_ssa_def(instr, rewrite_1bit_ssa_def_to_32bit,
|
||||
&progress);
|
||||
break;
|
||||
|
||||
case nir_instr_type_tex:
|
||||
progress |= lower_tex_instr(nir_instr_as_tex(instr));
|
||||
break;
|
||||
|
||||
default:
|
||||
nir_foreach_ssa_def(instr, assert_ssa_def_is_not_1bit, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,18 @@ lower_alu_instr(nir_alu_instr *alu)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
lower_tex_instr(nir_tex_instr *tex)
|
||||
{
|
||||
bool progress = false;
|
||||
rewrite_1bit_ssa_def_to_32bit(&tex->dest.ssa, &progress);
|
||||
if (tex->dest_type == nir_type_bool1) {
|
||||
tex->dest_type = nir_type_bool32;
|
||||
progress = true;
|
||||
}
|
||||
return progress;
|
||||
}
|
||||
|
||||
static bool
|
||||
nir_lower_bool_to_int32_impl(nir_function_impl *impl)
|
||||
{
|
||||
|
|
@ -143,11 +155,14 @@ nir_lower_bool_to_int32_impl(nir_function_impl *impl)
|
|||
case nir_instr_type_intrinsic:
|
||||
case nir_instr_type_ssa_undef:
|
||||
case nir_instr_type_phi:
|
||||
case nir_instr_type_tex:
|
||||
nir_foreach_ssa_def(instr, rewrite_1bit_ssa_def_to_32bit,
|
||||
&progress);
|
||||
break;
|
||||
|
||||
case nir_instr_type_tex:
|
||||
progress |= lower_tex_instr(nir_instr_as_tex(instr));
|
||||
break;
|
||||
|
||||
default:
|
||||
nir_foreach_ssa_def(instr, assert_ssa_def_is_not_1bit, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue