summaryrefslogtreecommitdiffstats
path: root/src/video_core/buffer_cache/map_interval.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/buffer_cache/map_interval.h')
-rw-r--r--src/video_core/buffer_cache/map_interval.h32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/video_core/buffer_cache/map_interval.h b/src/video_core/buffer_cache/map_interval.h
index ad4db0135..45705cccf 100644
--- a/src/video_core/buffer_cache/map_interval.h
+++ b/src/video_core/buffer_cache/map_interval.h
@@ -4,38 +4,36 @@
#pragma once
+#include <boost/intrusive/set_hook.hpp>
+
#include "common/common_types.h"
#include "video_core/gpu.h"
namespace VideoCommon {
-struct MapInterval {
- constexpr explicit MapInterval() noexcept = default;
-
- constexpr explicit MapInterval(VAddr start, VAddr end, GPUVAddr gpu_addr) noexcept
- : start{start}, end{end}, gpu_addr{gpu_addr} {}
+struct MapInterval : public boost::intrusive::set_base_hook<boost::intrusive::optimize_size<true>> {
+ /*implicit*/ MapInterval(VAddr start_) noexcept : start{start_} {}
- constexpr bool IsInside(VAddr other_start, VAddr other_end) const noexcept {
- return (start <= other_start && other_end <= end);
- }
+ explicit MapInterval(VAddr start_, VAddr end_, GPUVAddr gpu_addr_) noexcept
+ : start{start_}, end{end_}, gpu_addr{gpu_addr_} {}
- constexpr bool operator==(const MapInterval& rhs) const noexcept {
- return start == rhs.start && end == rhs.end;
+ bool IsInside(VAddr other_start, VAddr other_end) const noexcept {
+ return start <= other_start && other_end <= end;
}
- constexpr bool operator!=(const MapInterval& rhs) const noexcept {
- return !operator==(rhs);
+ bool Overlaps(VAddr other_start, VAddr other_end) const noexcept {
+ return start < other_end && other_start < end;
}
- constexpr void MarkAsModified(bool is_modified_, u64 ticks_) noexcept {
+ void MarkAsModified(bool is_modified_, u64 ticks_) noexcept {
is_modified = is_modified_;
ticks = ticks_;
}
+ boost::intrusive::set_member_hook<> member_hook_;
VAddr start = 0;
VAddr end = 0;
GPUVAddr gpu_addr = 0;
- VAddr cpu_addr = 0;
u64 ticks = 0;
bool is_written = false;
bool is_modified = false;
@@ -44,4 +42,10 @@ struct MapInterval {
bool is_sync_pending = false;
};
+struct MapIntervalCompare {
+ constexpr bool operator()(const MapInterval& lhs, const MapInterval& rhs) const noexcept {
+ return lhs.start < rhs.start;
+ }
+};
+
} // namespace VideoCommon