r600/sfn: Prepare StreamOut instruction for pre EG opcodes
authorGert Wollny <gert.wollny@collabora.com>
Mon, 1 Aug 2022 06:52:09 +0000 (08:52 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 1 Aug 2022 08:44:27 +0000 (08:44 +0000)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17822>

src/gallium/drivers/r600/sfn/sfn_assembler.cpp
src/gallium/drivers/r600/sfn/sfn_instr_export.cpp
src/gallium/drivers/r600/sfn/sfn_instr_export.h

index 0093e3e..0bb6e16 100644 (file)
@@ -586,9 +586,8 @@ void AssamblerVisitor::visit(const StreamOutInstr& instr)
    output.burst_count = instr.burst_count();
    output.array_size = instr.array_size();
    output.comp_mask = instr.comp_mask();
-   output.op = instr.op();
+   output.op = instr.op(m_shader->bc.gfx_level);
 
-   assert(output.op >= CF_OP_MEM_STREAM0_BUF0 && output.op <= CF_OP_MEM_STREAM3_BUF3);
 
    if (r600_bytecode_add_output(m_bc, &output))  {
       R600_ERR("shader_from_nir: Error creating stream output instruction\n");
index 660de99..3d40ea1 100644 (file)
@@ -280,16 +280,21 @@ StreamOutInstr::StreamOutInstr(const RegisterVec4& value, int num_components,
 {
 }
 
-unsigned StreamOutInstr::op() const
+unsigned StreamOutInstr::op(amd_gfx_level gfx_level) const
 {
    int op = 0;
-   switch (m_output_buffer) {
-   case 0: op = CF_OP_MEM_STREAM0_BUF0; break;
-   case 1: op = CF_OP_MEM_STREAM0_BUF1; break;
-   case 2: op = CF_OP_MEM_STREAM0_BUF2; break;
-   case 3: op = CF_OP_MEM_STREAM0_BUF3; break;
+   if (gfx_level >= EVERGREEN) {
+      switch (m_output_buffer) {
+      case 0: op = CF_OP_MEM_STREAM0_BUF0; break;
+      case 1: op = CF_OP_MEM_STREAM0_BUF1; break;
+      case 2: op = CF_OP_MEM_STREAM0_BUF2; break;
+      case 3: op = CF_OP_MEM_STREAM0_BUF3; break;
+      }
+      return 4 * m_stream + op;
+   } else {
+      assert(m_stream == 0);
+      return CF_OP_MEM_STREAM0 + m_output_buffer;
    }
-   return 4 * m_stream + op;
 }
 
 bool StreamOutInstr::is_equal_to(const StreamOutInstr& oth) const
index b7b03cc..c88a4e3 100644 (file)
@@ -132,7 +132,7 @@ public:
    int array_base() const { return m_array_base;}
    int array_size() const { return m_array_size;}
    int comp_mask() const { return m_writemask;}
-   unsigned op() const;
+   unsigned op(amd_gfx_level gfx_level) const;
 
    bool is_equal_to(const StreamOutInstr& lhs) const;