diff options
| author | 2021-01-08 00:55:34 +0800 | |
|---|---|---|
| committer | 2021-01-08 00:55:34 +0800 | |
| commit | 123568ef802dcf765680eb47e27d9442ba3a5cd4 (patch) | |
| tree | d2e9e33c256ea8c6940dbd042408ea0408735677 /src | |
| parent | Merge pull request #5288 from ReinUsesLisp/workaround-garbage (diff) | |
| parent | texture_cache: Replace PAGE_SHIFT with PAGE_BITS (diff) | |
| download | yuzu-123568ef802dcf765680eb47e27d9442ba3a5cd4.tar.gz yuzu-123568ef802dcf765680eb47e27d9442ba3a5cd4.tar.xz yuzu-123568ef802dcf765680eb47e27d9442ba3a5cd4.zip | |
Merge pull request #5305 from MerryMage/page_shift
texture_cache: Replace PAGE_SHIFT with PAGE_BITS
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index ad86c50b4..d1080300f 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -61,7 +61,7 @@ using VideoCore::Surface::SurfaceType; | |||
| 61 | template <class P> | 61 | template <class P> |
| 62 | class TextureCache { | 62 | class TextureCache { |
| 63 | /// Address shift for caching images into a hash table | 63 | /// Address shift for caching images into a hash table |
| 64 | static constexpr u64 PAGE_SHIFT = 20; | 64 | static constexpr u64 PAGE_BITS = 20; |
| 65 | 65 | ||
| 66 | /// Enables debugging features to the texture cache | 66 | /// Enables debugging features to the texture cache |
| 67 | static constexpr bool ENABLE_VALIDATION = P::ENABLE_VALIDATION; | 67 | static constexpr bool ENABLE_VALIDATION = P::ENABLE_VALIDATION; |
| @@ -184,8 +184,8 @@ private: | |||
| 184 | template <typename Func> | 184 | template <typename Func> |
| 185 | static void ForEachPage(VAddr addr, size_t size, Func&& func) { | 185 | static void ForEachPage(VAddr addr, size_t size, Func&& func) { |
| 186 | static constexpr bool RETURNS_BOOL = std::is_same_v<std::invoke_result<Func, u64>, bool>; | 186 | static constexpr bool RETURNS_BOOL = std::is_same_v<std::invoke_result<Func, u64>, bool>; |
| 187 | const u64 page_end = (addr + size - 1) >> PAGE_SHIFT; | 187 | const u64 page_end = (addr + size - 1) >> PAGE_BITS; |
| 188 | for (u64 page = addr >> PAGE_SHIFT; page <= page_end; ++page) { | 188 | for (u64 page = addr >> PAGE_BITS; page <= page_end; ++page) { |
| 189 | if constexpr (RETURNS_BOOL) { | 189 | if constexpr (RETURNS_BOOL) { |
| 190 | if (func(page)) { | 190 | if (func(page)) { |
| 191 | break; | 191 | break; |
| @@ -708,7 +708,7 @@ void TextureCache<P>::InvalidateDepthBuffer() { | |||
| 708 | template <class P> | 708 | template <class P> |
| 709 | typename P::ImageView* TextureCache<P>::TryFindFramebufferImageView(VAddr cpu_addr) { | 709 | typename P::ImageView* TextureCache<P>::TryFindFramebufferImageView(VAddr cpu_addr) { |
| 710 | // TODO: Properly implement this | 710 | // TODO: Properly implement this |
| 711 | const auto it = page_table.find(cpu_addr >> PAGE_SHIFT); | 711 | const auto it = page_table.find(cpu_addr >> PAGE_BITS); |
| 712 | if (it == page_table.end()) { | 712 | if (it == page_table.end()) { |
| 713 | return nullptr; | 713 | return nullptr; |
| 714 | } | 714 | } |
| @@ -1170,13 +1170,13 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) { | |||
| 1170 | ForEachPage(image.cpu_addr, image.guest_size_bytes, [this, image_id](u64 page) { | 1170 | ForEachPage(image.cpu_addr, image.guest_size_bytes, [this, image_id](u64 page) { |
| 1171 | const auto page_it = page_table.find(page); | 1171 | const auto page_it = page_table.find(page); |
| 1172 | if (page_it == page_table.end()) { | 1172 | if (page_it == page_table.end()) { |
| 1173 | UNREACHABLE_MSG("Unregistering unregistered page=0x{:x}", page << PAGE_SHIFT); | 1173 | UNREACHABLE_MSG("Unregistering unregistered page=0x{:x}", page << PAGE_BITS); |
| 1174 | return; | 1174 | return; |
| 1175 | } | 1175 | } |
| 1176 | std::vector<ImageId>& image_ids = page_it->second; | 1176 | std::vector<ImageId>& image_ids = page_it->second; |
| 1177 | const auto vector_it = std::ranges::find(image_ids, image_id); | 1177 | const auto vector_it = std::ranges::find(image_ids, image_id); |
| 1178 | if (vector_it == image_ids.end()) { | 1178 | if (vector_it == image_ids.end()) { |
| 1179 | UNREACHABLE_MSG("Unregistering unregistered image in page=0x{:x}", page << PAGE_SHIFT); | 1179 | UNREACHABLE_MSG("Unregistering unregistered image in page=0x{:x}", page << PAGE_BITS); |
| 1180 | return; | 1180 | return; |
| 1181 | } | 1181 | } |
| 1182 | image_ids.erase(vector_it); | 1182 | image_ids.erase(vector_it); |