r600/sfn: Add the position input as varying

Like this it will be handled correctly in the shader IO structure

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:
Gert Wollny 2021-01-30 19:09:42 +01:00 committed by Marge Bot
parent fd6c95a1b1
commit 374bc76706
3 changed files with 18 additions and 5 deletions

View file

@ -122,6 +122,11 @@ bool FragmentShaderFromNir::process_load_input(nir_intrinsic_instr *instr,
if (location == VARYING_SLOT_POS) {
m_sv_values.set(es_pos);
m_pos_input = new ShaderInputVarying(name, sid, nir_intrinsic_base(instr) + index->u32,
nir_intrinsic_component(instr),
nir_dest_num_components(instr->dest),
TGSI_INTERPOLATE_LINEAR, TGSI_INTERPOLATE_LOC_CENTER);
m_shaderio.add_input(m_pos_input);
return true;
}
@ -308,7 +313,8 @@ bool FragmentShaderFromNir::do_allocate_reserved_registers()
if (m_sv_values.test(es_pos)) {
m_frag_pos_index = m_reserved_registers++;
m_shaderio.add_input(new ShaderInputSystemValue(TGSI_SEMANTIC_POSITION, m_frag_pos_index));
assert(m_pos_input);
m_pos_input->set_gpr(m_frag_pos_index);
}
// handle system values
@ -961,9 +967,10 @@ void FragmentShaderFromNir::do_finalize()
sfn_log << SfnLog::io << "Have " << sh_info().ninput << " inputs\n";
for (size_t i = 0; i < sh_info().ninput; ++i) {
int ij_idx = (m_shaderio.input(i).ij_index() < 6 &&
m_shaderio.input(i).ij_index() >= 0) ? m_shaderio.input(i).ij_index() : 0;
m_shaderio.input(i).set_ioinfo(sh_info().input[i], m_interpolator[ij_idx].ij_index);
ShaderInput& input = m_shaderio.input(i);
int ij_idx = (input.ij_index() < 6 &&
input.ij_index() >= 0) ? input.ij_index() : 0;
input.set_ioinfo(sh_info().input[i], m_interpolator[ij_idx].ij_index);
}
sh_info().two_side = m_shaderio.two_sided();

View file

@ -107,6 +107,8 @@ private:
unsigned m_apply_sample_mask;
bool m_dual_source_blend;
ShaderInput *m_pos_input;
};
}

View file

@ -218,13 +218,14 @@ void ShaderInputVarying::update_mask(int additional_comps)
void ShaderInputVarying::evaluate_spi_sid()
{
switch (name()) {
case TGSI_SEMANTIC_POSITION:
case TGSI_SEMANTIC_PSIZE:
case TGSI_SEMANTIC_EDGEFLAG:
case TGSI_SEMANTIC_FACE:
case TGSI_SEMANTIC_SAMPLEMASK:
assert(0 && "System value used as varying");
break;
case TGSI_SEMANTIC_POSITION:
m_spi_sid = 0;
case TGSI_SEMANTIC_GENERIC:
case TGSI_SEMANTIC_TEXCOORD:
case TGSI_SEMANTIC_PCOORD:
@ -384,6 +385,9 @@ void ShaderIO::update_lds_pos()
continue;
auto& v = static_cast<ShaderInputVarying&>(*i);
if (v.name() == TGSI_SEMANTIC_POSITION)
continue;
if (m_ldspos[v.location()] < 0) {
++m_lds_pos;
m_ldspos[v.location()] = m_lds_pos;