mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 13:50:09 +01:00
r600/sfn: Fix FS inputs when reading from the same position
Don't add another varying in this case. Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8800>
This commit is contained in:
parent
374bc76706
commit
576da40a73
3 changed files with 35 additions and 17 deletions
|
|
@ -195,11 +195,22 @@ bool FragmentShaderFromNir::process_load_input(nir_intrinsic_instr *instr,
|
|||
|
||||
switch (name) {
|
||||
case TGSI_SEMANTIC_COLOR: {
|
||||
m_shaderio.add_input(new ShaderInputColor(name, sid,
|
||||
nir_intrinsic_base(instr) + index->u32,
|
||||
nir_intrinsic_component(instr),
|
||||
nir_dest_num_components(instr->dest),
|
||||
tgsi_interpolate, tgsi_loc));
|
||||
auto input = m_shaderio.find_varying(name, sid);
|
||||
if (!input) {
|
||||
m_shaderio.add_input(new ShaderInputColor(name, sid,
|
||||
nir_intrinsic_base(instr) + index->u32,
|
||||
nir_intrinsic_component(instr),
|
||||
nir_dest_num_components(instr->dest),
|
||||
tgsi_interpolate, tgsi_loc));
|
||||
} else {
|
||||
if (uses_interpol_at_centroid)
|
||||
input->set_uses_interpolate_at_centroid();
|
||||
|
||||
auto varying = static_cast<ShaderInputVarying&>(*input);
|
||||
varying.update_mask(nir_dest_num_components(instr->dest),
|
||||
nir_intrinsic_component(instr));
|
||||
}
|
||||
|
||||
m_need_back_color = m_two_sided_color;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -214,14 +225,20 @@ bool FragmentShaderFromNir::process_load_input(nir_intrinsic_instr *instr,
|
|||
case TGSI_SEMANTIC_PCOORD:
|
||||
case TGSI_SEMANTIC_VIEWPORT_INDEX:
|
||||
case TGSI_SEMANTIC_CLIPDIST: {
|
||||
auto varying = m_shaderio.find_varying(name, sid, nir_intrinsic_component(instr));
|
||||
if (!varying) {
|
||||
auto input = m_shaderio.find_varying(name, sid);
|
||||
if (!input) {
|
||||
m_shaderio.add_input(new ShaderInputVarying(name, sid, nir_intrinsic_base(instr) + index->u32,
|
||||
nir_intrinsic_component(instr),
|
||||
nir_dest_num_components(instr->dest),
|
||||
tgsi_interpolate, tgsi_loc));
|
||||
} else if (uses_interpol_at_centroid)
|
||||
varying->set_uses_interpolate_at_centroid();
|
||||
} else {
|
||||
if (uses_interpol_at_centroid)
|
||||
input->set_uses_interpolate_at_centroid();
|
||||
|
||||
auto varying = static_cast<ShaderInputVarying&>(*input);
|
||||
varying.update_mask(nir_dest_num_components(instr->dest),
|
||||
nir_intrinsic_component(instr));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ ShaderInputVarying::ShaderInputVarying(tgsi_semantic _name, int sid, unsigned dr
|
|||
m_interpolate_loc(interp_loc),
|
||||
m_ij_index(-10),
|
||||
m_lds_pos(0),
|
||||
m_mask((1 << components) - 1)
|
||||
m_mask(((1 << components) - 1) << frac)
|
||||
{
|
||||
evaluate_spi_sid();
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ ShaderInputVarying::ShaderInputVarying(tgsi_semantic _name, int sid, nir_variabl
|
|||
m_sid(sid),
|
||||
m_ij_index(-10),
|
||||
m_lds_pos(0),
|
||||
m_mask((1 << input->type->components()) - 1)
|
||||
m_mask(((1 << input->type->components()) - 1) << input->data.location_frac)
|
||||
{
|
||||
sfn_log << SfnLog::io << __func__
|
||||
<< "name:" << _name
|
||||
|
|
@ -210,9 +210,9 @@ bool ShaderInputVarying::is_varying() const
|
|||
return true;
|
||||
}
|
||||
|
||||
void ShaderInputVarying::update_mask(int additional_comps)
|
||||
void ShaderInputVarying::update_mask(int additional_comps, int frac)
|
||||
{
|
||||
m_mask |= additional_comps;
|
||||
m_mask |= ((1 << additional_comps) - 1) << frac;
|
||||
}
|
||||
|
||||
void ShaderInputVarying::evaluate_spi_sid()
|
||||
|
|
@ -226,6 +226,7 @@ void ShaderInputVarying::evaluate_spi_sid()
|
|||
break;
|
||||
case TGSI_SEMANTIC_POSITION:
|
||||
m_spi_sid = 0;
|
||||
break;
|
||||
case TGSI_SEMANTIC_GENERIC:
|
||||
case TGSI_SEMANTIC_TEXCOORD:
|
||||
case TGSI_SEMANTIC_PCOORD:
|
||||
|
|
@ -322,13 +323,13 @@ size_t ShaderIO::add_input(ShaderInput *input)
|
|||
return m_inputs.size() - 1;
|
||||
}
|
||||
|
||||
PShaderInput ShaderIO::find_varying(tgsi_semantic name, int sid, int frac)
|
||||
PShaderInput ShaderIO::find_varying(tgsi_semantic name, int sid)
|
||||
{
|
||||
for (auto& a : m_inputs) {
|
||||
if (a->name() == name) {
|
||||
assert(a->is_varying());
|
||||
auto& v = static_cast<ShaderInputVarying&>(*a);
|
||||
if (v.sid() == sid && (v.location_frac() == frac))
|
||||
if (v.sid() == sid)
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public:
|
|||
|
||||
int sid() const {return m_sid;}
|
||||
|
||||
void update_mask(int additional_comps);
|
||||
void update_mask(int additional_comps, int frac);
|
||||
|
||||
size_t location() const {return m_driver_location;}
|
||||
int location_frac() const {return m_location_frac;}
|
||||
|
|
@ -155,7 +155,7 @@ public:
|
|||
|
||||
size_t size() const {return m_inputs.size();}
|
||||
|
||||
PShaderInput find_varying(tgsi_semantic name, int sid, int frac);
|
||||
PShaderInput find_varying(tgsi_semantic name, int sid);
|
||||
|
||||
void update_lds_pos();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue