[common, gpu_thread] Exchanging command queue + adjusting Subtract in the OverlapRangeSetImpl

This commit is contained in:
CamilleLaVey 2026-02-07 17:50:27 -04:00 committed by crueter
parent 19e2dba35a
commit 28bf78db3a
2 changed files with 16 additions and 19 deletions

View File

@ -116,28 +116,25 @@ struct OverlapRangeSet<AddressType>::OverlapRangeSetImpl {
} }
AddressType end_address = base_address + static_cast<AddressType>(size); AddressType end_address = base_address + static_cast<AddressType>(size);
IntervalType interval{base_address, end_address}; IntervalType interval{base_address, end_address};
bool any_removals = false;
m_split_ranges_set += std::make_pair(interval, -amount); m_split_ranges_set += std::make_pair(interval, -amount);
do { auto it = m_split_ranges_set.lower_bound(interval);
any_removals = false; if (it == m_split_ranges_set.end()) {
auto it = m_split_ranges_set.lower_bound(interval); return;
if (it == m_split_ranges_set.end()) { }
return; auto end_it = m_split_ranges_set.upper_bound(interval);
} while (it != end_it) {
auto end_it = m_split_ranges_set.upper_bound(interval); if (it->second <= 0) {
for (; it != end_it; it++) { if constexpr (has_on_delete) {
if (it->second <= 0) { if (it->second == 0) {
if constexpr (has_on_delete) { on_delete(it->first.lower(), it->first.upper());
if (it->second == 0) {
on_delete(it->first.lower(), it->first.upper());
}
} }
any_removals = true;
m_split_ranges_set.erase(it);
break;
} }
auto to_erase = it++;
m_split_ranges_set.erase(to_erase);
continue;
} }
} while (any_removals); ++it;
}
} }
template <typename Func> template <typename Func>

View File

@ -89,7 +89,7 @@ struct CommandDataContainer {
/// Struct used to synchronize the GPU thread /// Struct used to synchronize the GPU thread
struct SynchState final { struct SynchState final {
using CommandQueue = Common::MPSCQueue<CommandDataContainer>; using CommandQueue = Common::SPSCQueue<CommandDataContainer>;
std::mutex write_lock; std::mutex write_lock;
CommandQueue queue; CommandQueue queue;
u64 last_fence{}; u64 last_fence{};