diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-07-20 03:07:28 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-08-21 18:14:24 +0200 |
commit | 5f4b746a1ee27d2e5e532f4f13f660ff08453474 (patch) | |
tree | 80a292e39267ab4f38b5074ffb9ec4f1d29d693a /src/video_core/buffer_cache/map_interval.h | |
parent | Buffer_Cache: Fixes and optimizations. (diff) | |
download | yuzu-5f4b746a1ee27d2e5e532f4f13f660ff08453474.tar yuzu-5f4b746a1ee27d2e5e532f4f13f660ff08453474.tar.gz yuzu-5f4b746a1ee27d2e5e532f4f13f660ff08453474.tar.bz2 yuzu-5f4b746a1ee27d2e5e532f4f13f660ff08453474.tar.lz yuzu-5f4b746a1ee27d2e5e532f4f13f660ff08453474.tar.xz yuzu-5f4b746a1ee27d2e5e532f4f13f660ff08453474.tar.zst yuzu-5f4b746a1ee27d2e5e532f4f13f660ff08453474.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/buffer_cache/map_interval.h | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/src/video_core/buffer_cache/map_interval.h b/src/video_core/buffer_cache/map_interval.h index c1cd52ca4..a01eddf49 100644 --- a/src/video_core/buffer_cache/map_interval.h +++ b/src/video_core/buffer_cache/map_interval.h @@ -4,45 +4,65 @@ #pragma once -#include <boost/functional/hash.hpp> #include "common/common_types.h" #include "video_core/gpu.h" namespace VideoCommon { -struct MapInterval { - MapInterval(const CacheAddr start, const CacheAddr end) : start{start}, end{end} {} - CacheAddr start; - CacheAddr end; +class MapIntervalBase { +public: + MapIntervalBase(const CacheAddr start, const CacheAddr end, const GPUVAddr gpu_addr) + : 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 CacheAddr other_start, const CacheAddr other_end) const { return (start <= other_start && other_end <= end); } - bool operator==(const MapInterval& rhs) const { + bool operator==(const MapIntervalBase& rhs) const { return std::tie(start, end) == std::tie(rhs.start, rhs.end); } - bool operator!=(const MapInterval& rhs) const { + bool operator!=(const MapIntervalBase& rhs) const { return !operator==(rhs); } -}; -struct MapInfo { - GPUVAddr gpu_addr; - VAddr cpu_addr; -}; + void MarkAsRegistered(const bool registered) { + is_registered = registered; + } -} // namespace VideoCommon + bool IsRegistered() const { + return is_registered; + } -namespace std { + CacheAddr GetStart() const { + return start; + } -template <> -struct hash<VideoCommon::MapInterval> { - std::size_t operator()(const VideoCommon::MapInterval& k) const noexcept { - std::size_t a = std::hash<CacheAddr>()(k.start); - boost::hash_combine(a, std::hash<CacheAddr>()(k.end)); - return a; + CacheAddr GetEnd() const { + return end; } + +private: + CacheAddr start; + CacheAddr end; + GPUVAddr gpu_addr; + VAddr cpu_addr{}; + bool is_write{}; + bool is_modified{}; + bool is_registered{}; + u64 ticks{}; }; -} // namespace std +} // namespace VideoCommon |