diff options
Diffstat (limited to 'src/video_core/rasterizer_accelerated.h')
| -rw-r--r-- | src/video_core/rasterizer_accelerated.h | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/video_core/rasterizer_accelerated.h b/src/video_core/rasterizer_accelerated.h index e6c0ea87a..cd1c706de 100644 --- a/src/video_core/rasterizer_accelerated.h +++ b/src/video_core/rasterizer_accelerated.h | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <array> | 6 | #include <boost/icl/interval_map.hpp> |
| 7 | #include <atomic> | ||
| 8 | 7 | ||
| 9 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 10 | #include "video_core/rasterizer_interface.h" | 9 | #include "video_core/rasterizer_interface.h" |
| @@ -21,28 +20,16 @@ public: | |||
| 21 | explicit RasterizerAccelerated(Core::Memory::Memory& cpu_memory_); | 20 | explicit RasterizerAccelerated(Core::Memory::Memory& cpu_memory_); |
| 22 | ~RasterizerAccelerated() override; | 21 | ~RasterizerAccelerated() override; |
| 23 | 22 | ||
| 24 | void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) override; | 23 | void UpdatePagesCachedCount(VAddr addr, u64 size, bool cache) override; |
| 25 | 24 | ||
| 26 | private: | 25 | private: |
| 27 | class CacheEntry final { | 26 | using PageIndex = VAddr; |
| 28 | public: | 27 | using PageReferenceCount = u16; |
| 29 | CacheEntry() = default; | ||
| 30 | 28 | ||
| 31 | std::atomic_uint16_t& Count(std::size_t page) { | 29 | using IntervalMap = boost::icl::interval_map<PageIndex, PageReferenceCount>; |
| 32 | return values[page & 3]; | 30 | using IntervalType = IntervalMap::interval_type; |
| 33 | } | ||
| 34 | 31 | ||
| 35 | const std::atomic_uint16_t& Count(std::size_t page) const { | 32 | IntervalMap map; |
| 36 | return values[page & 3]; | ||
| 37 | } | ||
| 38 | |||
| 39 | private: | ||
| 40 | std::array<std::atomic_uint16_t, 4> values{}; | ||
| 41 | }; | ||
| 42 | static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!"); | ||
| 43 | |||
| 44 | using CachedPages = std::array<CacheEntry, 0x2000000>; | ||
| 45 | std::unique_ptr<CachedPages> cached_pages; | ||
| 46 | Core::Memory::Memory& cpu_memory; | 33 | Core::Memory::Memory& cpu_memory; |
| 47 | }; | 34 | }; |
| 48 | 35 | ||