summaryrefslogtreecommitdiffstats
path: root/src/video_core/buffer_cache/map_interval.h
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-05-17 21:56:08 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-05-21 21:44:00 +0200
commit891236124caaed34cdefac61cf90896a5b66b267 (patch)
tree68c53427967586052ef6e39eab2a48beba58f1e4 /src/video_core/buffer_cache/map_interval.h
parentbuffer_cache: Remove shared pointers (diff)
downloadyuzu-891236124caaed34cdefac61cf90896a5b66b267.tar
yuzu-891236124caaed34cdefac61cf90896a5b66b267.tar.gz
yuzu-891236124caaed34cdefac61cf90896a5b66b267.tar.bz2
yuzu-891236124caaed34cdefac61cf90896a5b66b267.tar.lz
yuzu-891236124caaed34cdefac61cf90896a5b66b267.tar.xz
yuzu-891236124caaed34cdefac61cf90896a5b66b267.tar.zst
yuzu-891236124caaed34cdefac61cf90896a5b66b267.zip
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