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