rsx: Fix invalid iterator comparison (asserts on debug builds)

Also make ranged_map::count const
This commit is contained in:
Megamouse 2024-03-10 21:03:53 +01:00
parent b176085e14
commit d8d0af2bb3
2 changed files with 11 additions and 10 deletions

View file

@ -128,7 +128,7 @@ namespace rsx
public: public:
bool operator == (const iterator& other) const bool operator == (const iterator& other) const
{ {
return m_it == other.m_it; return m_current == other.m_current && m_it == other.m_it;
} }
auto* operator -> () auto* operator -> ()
@ -183,10 +183,10 @@ namespace rsx
m_data[block_for(range.start)].insert_or_assign(range.start, std::forward<T>(value)); m_data[block_for(range.start)].insert_or_assign(range.start, std::forward<T>(value));
} }
usz count(const u32 key) usz count(const u32 key) const
{ {
auto& block = m_data[block_for(key)]; const auto& block = m_data[block_for(key)];
if (auto found = block.find(key); if (const auto found = block.find(key);
found != block.end()) found != block.end())
{ {
return 1; return 1;

View file

@ -353,7 +353,7 @@ namespace rsx
// If this surface has already been added via another descendant, just ignore it // If this surface has already been added via another descendant, just ignore it
bool ignore = false; bool ignore = false;
for (auto &slice : new_surface->old_contents) for (const auto& slice : new_surface->old_contents)
{ {
if (slice.source == surface) if (slice.source == surface)
{ {
@ -412,7 +412,8 @@ namespace rsx
u64 new_content_tag = 0; u64 new_content_tag = 0;
address_range* storage_bounds; address_range* storage_bounds;
surface_ranged_map *primary_storage, *secondary_storage; surface_ranged_map* primary_storage;
surface_ranged_map* secondary_storage;
if constexpr (depth) if constexpr (depth)
{ {
primary_storage = &m_depth_stencil_storage; primary_storage = &m_depth_stencil_storage;