mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
nir: Only rematerialize comparisons with all SSA sources
Otherwise, you may end up moving a register read and that could result
in an incorrect shader. This commit fixes a rendering issue in Elite:
Dangerous.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111152
Fixes: 3ee2e84c60 "nir: Rematerialize compare instructions"
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
e352b4d650
commit
6301f80b84
1 changed files with 15 additions and 0 deletions
|
|
@ -57,6 +57,18 @@ is_two_src_comparison(const nir_alu_instr *instr)
|
|||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
all_srcs_are_ssa(const nir_alu_instr *instr)
|
||||
{
|
||||
for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
|
||||
if (!instr->src[i].src.is_ssa)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
all_uses_are_bcsel(const nir_alu_instr *instr)
|
||||
{
|
||||
|
|
@ -96,6 +108,9 @@ nir_opt_rematerialize_compares_impl(nir_shader *shader, nir_function_impl *impl)
|
|||
if (!is_two_src_comparison(alu))
|
||||
continue;
|
||||
|
||||
if (!all_srcs_are_ssa(alu))
|
||||
continue;
|
||||
|
||||
if (!all_uses_are_bcsel(alu))
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue