diff options
Diffstat (limited to 'src/video_core/buffer_cache')
-rw-r--r-- | src/video_core/buffer_cache/buffer_base.h | 9 | ||||
-rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/video_core/buffer_cache/buffer_base.h b/src/video_core/buffer_cache/buffer_base.h index 4b696a60f..18a3390c0 100644 --- a/src/video_core/buffer_cache/buffer_base.h +++ b/src/video_core/buffer_cache/buffer_base.h @@ -297,7 +297,13 @@ public: return words.size_bytes; } - size_t lru_id; + size_t getLRUID() const noexcept { + return lru_id; + } + + void setLRUID(size_t lru_id_) { + lru_id = lru_id_; + } private: template <Type type> @@ -597,6 +603,7 @@ private: Words words; BufferFlagBits flags{}; int stream_score = 0; + size_t lru_id = SIZE_MAX; }; } // namespace VideoCommon diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index e40aa7fe6..617435968 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -1539,10 +1539,10 @@ void BufferCache<P>::ChangeRegister(BufferId buffer_id) { const auto size = buffer.SizeBytes(); if (insert) { total_used_memory += Common::AlignUp(size, 1024); - buffer.lru_id = lru_cache.Insert(buffer_id, frame_tick); + buffer.setLRUID(lru_cache.Insert(buffer_id, frame_tick)); } else { total_used_memory -= Common::AlignUp(size, 1024); - lru_cache.Free(buffer.lru_id); + lru_cache.Free(buffer.getLRUID()); } const VAddr cpu_addr_begin = buffer.CpuAddr(); const VAddr cpu_addr_end = cpu_addr_begin + size; @@ -1560,7 +1560,7 @@ void BufferCache<P>::ChangeRegister(BufferId buffer_id) { template <class P> void BufferCache<P>::TouchBuffer(Buffer& buffer, BufferId buffer_id) noexcept { if (buffer_id != NULL_BUFFER_ID) { - lru_cache.Touch(buffer.lru_id, frame_tick); + lru_cache.Touch(buffer.getLRUID(), frame_tick); } } |