diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2022-08-21 18:59:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-21 18:59:01 +0200 |
commit | 064f836d1c4f6de7d7c100b4aff700bf66448e22 (patch) | |
tree | 7f087cacbde745c7d64f205618b80624c8599074 /src/video_core/texture_cache | |
parent | Merge pull request #8790 from liamwhite/too-many-ways-to-name-a-byte-string (diff) | |
parent | code: dodge PAGE_SIZE #define (diff) | |
download | yuzu-064f836d1c4f6de7d7c100b4aff700bf66448e22.tar yuzu-064f836d1c4f6de7d7c100b4aff700bf66448e22.tar.gz yuzu-064f836d1c4f6de7d7c100b4aff700bf66448e22.tar.bz2 yuzu-064f836d1c4f6de7d7c100b4aff700bf66448e22.tar.lz yuzu-064f836d1c4f6de7d7c100b4aff700bf66448e22.tar.xz yuzu-064f836d1c4f6de7d7c100b4aff700bf66448e22.tar.zst yuzu-064f836d1c4f6de7d7c100b4aff700bf66448e22.zip |
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 12 | ||||
-rw-r--r-- | src/video_core/texture_cache/texture_cache_base.h | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index cf3ca06a6..1dbe01bc0 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -589,7 +589,7 @@ void TextureCache<P>::BlitImage(const Tegra::Engines::Fermi2D::Surface& dst, template <class P> typename P::ImageView* TextureCache<P>::TryFindFramebufferImageView(VAddr cpu_addr) { // TODO: Properly implement this - const auto it = page_table.find(cpu_addr >> PAGE_BITS); + const auto it = page_table.find(cpu_addr >> YUZU_PAGEBITS); if (it == page_table.end()) { return nullptr; } @@ -1485,14 +1485,14 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) { std::unordered_map<u64, std::vector<ImageId>, IdentityHash<u64>>& selected_page_table) { const auto page_it = selected_page_table.find(page); if (page_it == selected_page_table.end()) { - ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << PAGE_BITS); + ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS); return; } std::vector<ImageId>& image_ids = page_it->second; const auto vector_it = std::ranges::find(image_ids, image_id); if (vector_it == image_ids.end()) { ASSERT_MSG(false, "Unregistering unregistered image in page=0x{:x}", - page << PAGE_BITS); + page << YUZU_PAGEBITS); return; } image_ids.erase(vector_it); @@ -1504,14 +1504,14 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) { ForEachCPUPage(image.cpu_addr, image.guest_size_bytes, [this, map_id](u64 page) { const auto page_it = page_table.find(page); if (page_it == page_table.end()) { - ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << PAGE_BITS); + ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS); return; } std::vector<ImageMapId>& image_map_ids = page_it->second; const auto vector_it = std::ranges::find(image_map_ids, map_id); if (vector_it == image_map_ids.end()) { ASSERT_MSG(false, "Unregistering unregistered image in page=0x{:x}", - page << PAGE_BITS); + page << YUZU_PAGEBITS); return; } image_map_ids.erase(vector_it); @@ -1532,7 +1532,7 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) { ForEachCPUPage(cpu_addr, size, [this, image_id](u64 page) { const auto page_it = page_table.find(page); if (page_it == page_table.end()) { - ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << PAGE_BITS); + ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS); return; } std::vector<ImageMapId>& image_map_ids = page_it->second; diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index e2f8f84c9..7e6c6cef2 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h @@ -47,7 +47,7 @@ struct ImageViewInOut { template <class P> class TextureCache { /// Address shift for caching images into a hash table - static constexpr u64 PAGE_BITS = 20; + static constexpr u64 YUZU_PAGEBITS = 20; /// Enables debugging features to the texture cache static constexpr bool ENABLE_VALIDATION = P::ENABLE_VALIDATION; @@ -178,8 +178,8 @@ private: template <typename Func> static void ForEachCPUPage(VAddr addr, size_t size, Func&& func) { static constexpr bool RETURNS_BOOL = std::is_same_v<std::invoke_result<Func, u64>, bool>; - const u64 page_end = (addr + size - 1) >> PAGE_BITS; - for (u64 page = addr >> PAGE_BITS; page <= page_end; ++page) { + const u64 page_end = (addr + size - 1) >> YUZU_PAGEBITS; + for (u64 page = addr >> YUZU_PAGEBITS; page <= page_end; ++page) { if constexpr (RETURNS_BOOL) { if (func(page)) { break; @@ -193,8 +193,8 @@ private: template <typename Func> static void ForEachGPUPage(GPUVAddr addr, size_t size, Func&& func) { static constexpr bool RETURNS_BOOL = std::is_same_v<std::invoke_result<Func, u64>, bool>; - const u64 page_end = (addr + size - 1) >> PAGE_BITS; - for (u64 page = addr >> PAGE_BITS; page <= page_end; ++page) { + const u64 page_end = (addr + size - 1) >> YUZU_PAGEBITS; + for (u64 page = addr >> YUZU_PAGEBITS; page <= page_end; ++page) { if constexpr (RETURNS_BOOL) { if (func(page)) { break; |