Module: Mesa
Branch: main
Commit: 0cb6437f4f56bb995321aa91b7fe197dd5bce746
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0cb6437f4f56bb995321aa91b7fe197dd5bce746

Author: Gert Wollny <[email protected]>
Date:   Tue Apr  4 15:58:27 2023 +0200

r600/sfn: fix container allocators

This fixes leaks in TexInstr and in Shader.

Thanks to Patrick Lerda for pointing out the bug.

Fixes: 79ca456b4837b3bc21cf9ef3c03c505c4b4909f6
    r600/sfn: rewrite NIR backend

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22300>

---

 src/gallium/drivers/r600/sfn/sfn_instr_tex.h | 2 +-
 src/gallium/drivers/r600/sfn/sfn_shader.h    | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_tex.h 
b/src/gallium/drivers/r600/sfn/sfn_instr_tex.h
index 777e0383212..9c97537d704 100644
--- a/src/gallium/drivers/r600/sfn/sfn_instr_tex.h
+++ b/src/gallium/drivers/r600/sfn/sfn_instr_tex.h
@@ -198,7 +198,7 @@ private:
    unsigned m_resource_id;
 
    static const std::map<Opcode, std::string> s_opcode_map;
-   std::list<TexInstr *> m_prepare_instr;
+   std::list<TexInstr *, Allocator<TexInstr *>> m_prepare_instr;
 };
 
 bool
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader.h 
b/src/gallium/drivers/r600/sfn/sfn_shader.h
index 326315568c7..6197a4112a0 100644
--- a/src/gallium/drivers/r600/sfn/sfn_shader.h
+++ b/src/gallium/drivers/r600/sfn/sfn_shader.h
@@ -340,12 +340,14 @@ private:
    uint32_t m_indirect_files{0};
    std::bitset<sh_flags_count> m_flags;
    uint32_t nhwatomic_ranges{0};
-   std::vector<r600_shader_atomic> m_atomics;
+   std::vector<r600_shader_atomic, Allocator<r600_shader_atomic>> m_atomics;
 
    uint32_t m_nhwatomic{0};
    uint32_t m_atomic_base{0};
    uint32_t m_next_hwatomic_loc{0};
-   std::unordered_map<int, int> m_atomic_base_map;
+   std::unordered_map<int, int,
+                      std::hash<int>,  std::equal_to<int>,
+                      Allocator<std::pair<const int, int>>> m_atomic_base_map;
    uint32_t m_atomic_file_count{0};
    PRegister m_atomic_update{nullptr};
    PRegister m_rat_return_address{nullptr};

Reply via email to