diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-04-05 23:23:49 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-04-06 15:23:06 +0200 |
commit | 7fcd0fee6d580a381fdc4a4ec5b77687e4857b5b (patch) | |
tree | fc9c659ffa601aee77eeea2a11f16be98cefc902 /src/video_core/buffer_cache/buffer_block.h | |
parent | Texture Cache: Use vAddr instead of physical memory for caching. (diff) | |
download | yuzu-7fcd0fee6d580a381fdc4a4ec5b77687e4857b5b.tar yuzu-7fcd0fee6d580a381fdc4a4ec5b77687e4857b5b.tar.gz yuzu-7fcd0fee6d580a381fdc4a4ec5b77687e4857b5b.tar.bz2 yuzu-7fcd0fee6d580a381fdc4a4ec5b77687e4857b5b.tar.lz yuzu-7fcd0fee6d580a381fdc4a4ec5b77687e4857b5b.tar.xz yuzu-7fcd0fee6d580a381fdc4a4ec5b77687e4857b5b.tar.zst yuzu-7fcd0fee6d580a381fdc4a4ec5b77687e4857b5b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/buffer_cache/buffer_block.h | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/src/video_core/buffer_cache/buffer_block.h b/src/video_core/buffer_cache/buffer_block.h index 4b9193182..e35ee0b67 100644 --- a/src/video_core/buffer_cache/buffer_block.h +++ b/src/video_core/buffer_cache/buffer_block.h @@ -15,37 +15,29 @@ namespace VideoCommon { class BufferBlock { public: - bool Overlaps(const CacheAddr start, const CacheAddr end) const { - return (cache_addr < end) && (cache_addr_end > start); + bool Overlaps(const VAddr start, const VAddr end) const { + return (cpu_addr < end) && (cpu_addr_end > start); } - bool IsInside(const CacheAddr other_start, const CacheAddr other_end) const { - return cache_addr <= other_start && other_end <= cache_addr_end; + bool IsInside(const VAddr other_start, const VAddr other_end) const { + return cpu_addr <= other_start && other_end <= cpu_addr_end; } - u8* GetWritableHostPtr() const { - return FromCacheAddr(cache_addr); + std::size_t GetOffset(const VAddr in_addr) { + return static_cast<std::size_t>(in_addr - cpu_addr); } - u8* GetWritableHostPtr(std::size_t offset) const { - return FromCacheAddr(cache_addr + offset); + VAddr GetCpuAddr() const { + return cpu_addr; } - std::size_t GetOffset(const CacheAddr in_addr) { - return static_cast<std::size_t>(in_addr - cache_addr); + VAddr GetCpuAddrEnd() const { + return cpu_addr_end; } - CacheAddr GetCacheAddr() const { - return cache_addr; - } - - CacheAddr GetCacheAddrEnd() const { - return cache_addr_end; - } - - void SetCacheAddr(const CacheAddr new_addr) { - cache_addr = new_addr; - cache_addr_end = new_addr + size; + void SetCpuAddr(const VAddr new_addr) { + cpu_addr = new_addr; + cpu_addr_end = new_addr + size; } std::size_t GetSize() const { @@ -61,14 +53,14 @@ public: } protected: - explicit BufferBlock(CacheAddr cache_addr, const std::size_t size) : size{size} { - SetCacheAddr(cache_addr); + explicit BufferBlock(VAddr cpu_addr, const std::size_t size) : size{size} { + SetCpuAddr(cpu_addr); } ~BufferBlock() = default; private: - CacheAddr cache_addr{}; - CacheAddr cache_addr_end{}; + VAddr cpu_addr{}; + VAddr cpu_addr_end{}; std::size_t size{}; u64 epoch{}; }; |