r600/sfn: Add a mapping table for atomics
authorGert Wollny <gert.wollny@collabora.com>
Tue, 21 Jul 2020 09:52:41 +0000 (11:52 +0200)
committerGert Wollny <gw.fossdev@gmail.com>
Sun, 9 Aug 2020 13:45:34 +0000 (13:45 +0000)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6025>

src/gallium/drivers/r600/sfn/sfn_emitinstruction.cpp
src/gallium/drivers/r600/sfn/sfn_emitinstruction.h
src/gallium/drivers/r600/sfn/sfn_shader_base.h

index 62212b911c507150ffa9c3fb3afd378ed9cba38d..20e573e1f9c706270fc02bc36d80776ac3b282c8 100644 (file)
@@ -174,6 +174,10 @@ bool EmitInstruction::inject_register(unsigned sel, unsigned swizzle,
    return m_proc.inject_register(sel, swizzle, reg, map);
 }
 
+int EmitInstruction::remap_atomic_base(int base)
+{
+       return m_proc.remap_atomic_base(base);
+}
 
 
 const std::set<AluModifiers> EmitInstruction::empty = {};
index 1629571351177e143f13e4efde2518c1bc3ffc21..a905c3c88e71bdd6d6c6d77a1ad48f4250de950b 100644 (file)
@@ -93,6 +93,8 @@ protected:
    bool inject_register(unsigned sel, unsigned swizzle,
                         const PValue& reg, bool map);
 
+   int remap_atomic_base(int base);
+
 private:
 
    ShaderFromNirProcessor& m_proc;
index 13c9477577869677d674783e2bdbf72a96d3b5da..e6e89c68180aac574d230db8330f3c27d63e2de1 100644 (file)
@@ -46,6 +46,7 @@
 #include <vector>
 #include <set>
 #include <stack>
+#include <unordered_map>
 
 struct nir_instr;
 
@@ -85,6 +86,11 @@ public:
    void evaluate_spi_sid(r600_shader_io &io);
 
    enum chip_class get_chip_class() const;
+
+   int remap_atomic_base(int base) {
+      return m_atomic_base_map[base];
+   }
+
 protected:
 
    void set_var_address(nir_deref_instr *instr);
@@ -210,6 +216,8 @@ private:
    r600_pipe_shader_selector& m_sel;
    int m_atomic_base ;
    int m_image_count;
+
+   std::unordered_map<int, int> m_atomic_base_map;
 };
 
 }