Skip to content

Commit

Permalink
GCC: Define MemoryAllocInfoMapKey's hash before using in unordered_map
Browse files Browse the repository at this point in the history
GCC complains that std::hash specialization for
MemoryAllocInfoMapKey type should be positioned before it is
used in std::unordered_map.

Bug: chromium:40565911
Change-Id: Ia3dd2a699431720b030839d94ea796894ba8b822
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5642294
Auto-Submit: DongHwan Yu <[email protected]>
Commit-Queue: Shahbaz Youssefi <[email protected]>
Reviewed-by: Shahbaz Youssefi <[email protected]>
  • Loading branch information
donghwan.yu authored and Angle LUCI CQ committed Jun 20, 2024
1 parent 0d6869c commit 54c4817
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/libANGLE/renderer/vulkan/MemoryTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,20 @@ class MemoryReport final : angle::NonCopyable
angle::HashMap<uint64_t, int> mUniqueIDCounts;
};
} // namespace vk
} // namespace rx

// Introduce std::hash for MemoryAllocInfoMapKey.
namespace std
{
template <>
struct hash<rx::vk::MemoryAllocInfoMapKey>
{
size_t operator()(const rx::vk::MemoryAllocInfoMapKey &key) const { return key.hash(); }
};
} // namespace std

namespace rx
{

// Memory tracker for allocations and deallocations, which is used in vk::Renderer.
class MemoryAllocationTracker : angle::NonCopyable
Expand Down Expand Up @@ -208,14 +222,4 @@ class MemoryAllocationTracker : angle::NonCopyable
};
} // namespace rx

// Introduce std::hash for MemoryAllocInfoMapKey.
namespace std
{
template <>
struct hash<rx::vk::MemoryAllocInfoMapKey>
{
size_t operator()(const rx::vk::MemoryAllocInfoMapKey &key) const { return key.hash(); }
};
} // namespace std

#endif // LIBANGLE_RENDERER_VULKAN_MEMORYTRACKING_H_

0 comments on commit 54c4817

Please sign in to comment.