d600/sfn: write stream outputs to correct mem ring

Fixes: arb_gpu_shader5-xfb-streams
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5963>
This commit is contained in:
Gert Wollny
2020-07-18 22:42:54 +02:00
committed by Marge Bot
parent 21d296a481
commit 1fa36c1d3d
4 changed files with 21 additions and 1 deletions
@@ -329,4 +329,12 @@ void MemRingOutIntruction::remap_registers_child(std::vector<rename_reg_pair>& m
map[m_index->sel()].used = true;
}
void MemRingOutIntruction::patch_ring(int stream)
{
const ECFOpCode ring_op[4] = {cf_mem_ring, cf_mem_ring2, cf_mem_ring3, cf_mem_ring3};
assert(stream < 4);
m_ring_op = ring_op[stream];
}
}
@@ -152,6 +152,7 @@ public:
void replace_values_child(const ValueSet& candiates, PValue new_value) override;
void remap_registers_child(std::vector<rename_reg_pair>& map,
ValueMap& values) override;
void patch_ring(int stream);
private:
bool is_equal_to(const Instruction& lhs) const override;
void do_print(std::ostream& os) const override;
@@ -66,7 +66,8 @@ bool GeometryShaderFromNir::do_emit_store_deref(const nir_variable *out_var, nir
auto ir = new MemRingOutIntruction(cf_mem_ring, mem_write_ind, out_value,
4 * out_var->data.driver_location,
instr->num_components, m_export_base);
emit_instruction(ir);
streamout_data[out_var->data.location] = ir;
return true;
}
@@ -267,6 +268,14 @@ bool GeometryShaderFromNir::emit_vertex(nir_intrinsic_instr* instr, bool cut)
int stream = nir_intrinsic_stream_id(instr);
assert(stream < 4);
for(auto v: streamout_data) {
if (stream == 0 || v.first != VARYING_SLOT_POS) {
v.second->patch_ring(stream);
emit_instruction(v.second);
} else
delete v.second;
}
streamout_data.clear();
emit_instruction(new EmitVertex(stream, cut));
if (!cut)
@@ -74,6 +74,8 @@ private:
int m_num_clip_dist;
unsigned m_cur_ring_output;
bool m_gs_tri_strip_adj_fix;
std::map<int, MemRingOutIntruction *> streamout_data;
};
}