r600/sfn: use only one undef in tex lowering

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19729>
This commit is contained in:
Gert Wollny 2022-11-14 15:29:57 +01:00
parent df54aa7e33
commit e5646382ba

View file

@ -960,7 +960,10 @@ private:
nir_ssa_def *
finalize(nir_tex_instr *tex, nir_ssa_def *backend1, nir_ssa_def *backend2);
nir_ssa_def *get_undef();
amd_gfx_level m_chip_class;
nir_ssa_def *m_undef {nullptr};
};
bool
@ -999,6 +1002,13 @@ LowerTexToBackend::filter(const nir_instr *instr) const
return nir_tex_instr_src_index(tex, nir_tex_src_backend1) == -1;
}
nir_ssa_def *LowerTexToBackend::get_undef()
{
if (!m_undef)
m_undef = nir_ssa_undef(b, 1, 32);
return m_undef;
}
nir_ssa_def *
LowerTexToBackend::lower(nir_instr *instr)
{
@ -1160,7 +1170,7 @@ LowerTexToBackend::prep_src(std::array<nir_ssa_def *, 4>& coord, int& used_coord
if (coord[i])
used_coord_mask |= 1 << i;
else
coord[i] = nir_ssa_undef(b, 1, 32);
coord[i] = get_undef();
}
return nir_vec(b, coord.data(), 4);