diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-12-18 00:59:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-18 00:59:49 +0100 |
commit | 65e646eeba53fe1067b7d69044ddabaee18d868f (patch) | |
tree | 9cd2c5d264e623060186bd51e9c07433e9629234 /src/video_core/rasterizer_accelerated.h | |
parent | Merge pull request #12378 from liamwhite/offsetof (diff) | |
download | yuzu-65e646eeba53fe1067b7d69044ddabaee18d868f.tar yuzu-65e646eeba53fe1067b7d69044ddabaee18d868f.tar.gz yuzu-65e646eeba53fe1067b7d69044ddabaee18d868f.tar.bz2 yuzu-65e646eeba53fe1067b7d69044ddabaee18d868f.tar.lz yuzu-65e646eeba53fe1067b7d69044ddabaee18d868f.tar.xz yuzu-65e646eeba53fe1067b7d69044ddabaee18d868f.tar.zst yuzu-65e646eeba53fe1067b7d69044ddabaee18d868f.zip |
Diffstat (limited to '')
-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 @@ #pragma once -#include <mutex> -#include <boost/icl/interval_map.hpp> +#include <array> +#include <atomic> #include "common/common_types.h" #include "video_core/rasterizer_interface.h" @@ -21,17 +21,28 @@ public: explicit RasterizerAccelerated(Core::Memory::Memory& cpu_memory_); ~RasterizerAccelerated() override; - void UpdatePagesCachedCount(VAddr addr, u64 size, bool cache) override; + void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) override; private: - using PageIndex = VAddr; - using PageReferenceCount = u16; + class CacheEntry final { + public: + CacheEntry() = default; - using IntervalMap = boost::icl::interval_map<PageIndex, PageReferenceCount>; - using IntervalType = IntervalMap::interval_type; + std::atomic_uint16_t& Count(std::size_t page) { + return values[page & 3]; + } - IntervalMap map; - std::mutex map_lock; + const std::atomic_uint16_t& Count(std::size_t page) const { + return values[page & 3]; + } + + private: + std::array<std::atomic_uint16_t, 4> values{}; + }; + static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!"); + + using CachedPages = std::array<CacheEntry, 0x2000000>; + std::unique_ptr<CachedPages> cached_pages; Core::Memory::Memory& cpu_memory; }; |