diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-05-16 22:08:33 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-05-21 21:02:20 +0200 |
commit | 599274e3f0d97c36b31016ba63dcc300d0cf8f6a (patch) | |
tree | 47f761bdbca2b95b8c48e926c50b4ceb97f44048 /src/video_core/buffer_cache/map_interval.h | |
parent | Merge pull request #3926 from ogniK5377/keyboard-states (diff) | |
download | yuzu-599274e3f0d97c36b31016ba63dcc300d0cf8f6a.tar yuzu-599274e3f0d97c36b31016ba63dcc300d0cf8f6a.tar.gz yuzu-599274e3f0d97c36b31016ba63dcc300d0cf8f6a.tar.bz2 yuzu-599274e3f0d97c36b31016ba63dcc300d0cf8f6a.tar.lz yuzu-599274e3f0d97c36b31016ba63dcc300d0cf8f6a.tar.xz yuzu-599274e3f0d97c36b31016ba63dcc300d0cf8f6a.tar.zst yuzu-599274e3f0d97c36b31016ba63dcc300d0cf8f6a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/buffer_cache/map_interval.h | 94 |
1 files changed, 16 insertions, 78 deletions
diff --git a/src/video_core/buffer_cache/map_interval.h b/src/video_core/buffer_cache/map_interval.h index 29d8b26f3..1e77012d9 100644 --- a/src/video_core/buffer_cache/map_interval.h +++ b/src/video_core/buffer_cache/map_interval.h @@ -9,99 +9,37 @@ namespace VideoCommon { -class MapIntervalBase { -public: - MapIntervalBase(const VAddr start, const VAddr end, const GPUVAddr gpu_addr) +struct MapIntervalBase { + constexpr explicit MapIntervalBase(VAddr start, VAddr end, GPUVAddr gpu_addr) noexcept : start{start}, end{end}, gpu_addr{gpu_addr} {} - void SetCpuAddress(VAddr new_cpu_addr) { - cpu_addr = new_cpu_addr; - } - - VAddr GetCpuAddress() const { - return cpu_addr; - } - - GPUVAddr GetGpuAddress() const { - return gpu_addr; - } - - bool IsInside(const VAddr other_start, const VAddr other_end) const { + constexpr bool IsInside(const VAddr other_start, const VAddr other_end) const noexcept { return (start <= other_start && other_end <= end); } - bool operator==(const MapIntervalBase& rhs) const { - return std::tie(start, end) == std::tie(rhs.start, rhs.end); - } - - bool operator!=(const MapIntervalBase& rhs) const { - return !operator==(rhs); - } - - void MarkAsRegistered(const bool registered) { - is_registered = registered; - } - - bool IsRegistered() const { - return is_registered; - } - - void SetMemoryMarked(bool is_memory_marked_) { - is_memory_marked = is_memory_marked_; - } - - bool IsMemoryMarked() const { - return is_memory_marked; - } - - void SetSyncPending(bool is_sync_pending_) { - is_sync_pending = is_sync_pending_; - } - - bool IsSyncPending() const { - return is_sync_pending; - } - - VAddr GetStart() const { - return start; - } - - VAddr GetEnd() const { - return end; - } - - void MarkAsModified(const bool is_modified_, const u64 tick) { + constexpr void MarkAsModified(bool is_modified_, u64 ticks_) noexcept { is_modified = is_modified_; - ticks = tick; - } - - bool IsModified() const { - return is_modified; - } - - u64 GetModificationTick() const { - return ticks; + ticks = ticks_; } - void MarkAsWritten(const bool is_written_) { - is_written = is_written_; + constexpr bool operator==(const MapIntervalBase& rhs) const noexcept { + return start == rhs.start && end == rhs.end; } - bool IsWritten() const { - return is_written; + constexpr bool operator!=(const MapIntervalBase& rhs) const noexcept { + return !operator==(rhs); } -private: VAddr start; VAddr end; GPUVAddr gpu_addr; - VAddr cpu_addr{}; - bool is_written{}; - bool is_modified{}; - bool is_registered{}; - bool is_memory_marked{}; - bool is_sync_pending{}; - u64 ticks{}; + VAddr cpu_addr = 0; + u64 ticks = 0; + bool is_written = false; + bool is_modified = false; + bool is_registered = false; + bool is_memory_marked = false; + bool is_sync_pending = false; }; } // namespace VideoCommon |