Mesa (master): d600/sfn: write stream outputs to correct mem ring

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 20 09:42:30 UTC 2020


Module: Mesa
Branch: master
Commit: 1fa36c1d3d6af3faa0b647b345acfaaa4b4ce34b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1fa36c1d3d6af3faa0b647b345acfaaa4b4ce34b

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Sat Jul 18 22:42:54 2020 +0200

d600/sfn: write stream outputs to correct mem ring

Fixes: arb_gpu_shader5-xfb-streams
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5963>

---

 src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp |  8 ++++++++
 src/gallium/drivers/r600/sfn/sfn_instruction_export.h   |  1 +
 src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp    | 11 ++++++++++-
 src/gallium/drivers/r600/sfn/sfn_shader_geometry.h      |  2 ++
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp b/src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp
index db24b1d7562..b19c029c3b6 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_instruction_export.cpp
@@ -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];
+}
+
 }
diff --git a/src/gallium/drivers/r600/sfn/sfn_instruction_export.h b/src/gallium/drivers/r600/sfn/sfn_instruction_export.h
index 8ab827e71b2..a2c74e8b67e 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instruction_export.h
+++ b/src/gallium/drivers/r600/sfn/sfn_instruction_export.h
@@ -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;
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp
index 5155488541d..5ebeec6d6f1 100644
--- a/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp
@@ -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)
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_geometry.h b/src/gallium/drivers/r600/sfn/sfn_shader_geometry.h
index 08df47e559f..3a66b9d750a 100644
--- a/src/gallium/drivers/r600/sfn/sfn_shader_geometry.h
+++ b/src/gallium/drivers/r600/sfn/sfn_shader_geometry.h
@@ -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;
 };
 
 }



More information about the mesa-commit mailing list