summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar MerryMage2021-01-07 16:51:34 +0000
committerGravatar MerryMage2021-01-07 16:51:34 +0000
commitaace20afc73d4d51ec91cdb2e71eb76a425df9a0 (patch)
treed2e9e33c256ea8c6940dbd042408ea0408735677 /src
parentMerge pull request #5288 from ReinUsesLisp/workaround-garbage (diff)
downloadyuzu-aace20afc73d4d51ec91cdb2e71eb76a425df9a0.tar.gz
yuzu-aace20afc73d4d51ec91cdb2e71eb76a425df9a0.tar.xz
yuzu-aace20afc73d4d51ec91cdb2e71eb76a425df9a0.zip
texture_cache: Replace PAGE_SHIFT with PAGE_BITS
PAGE_SHIFT is a #define in system headers that leaks into user code on some systems
Diffstat (limited to 'src')
-rw-r--r--src/video_core/texture_cache/texture_cache.h12
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;
61template <class P> 61template <class P>
62class TextureCache { 62class 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() {
708template <class P> 708template <class P>
709typename P::ImageView* TextureCache<P>::TryFindFramebufferImageView(VAddr cpu_addr) { 709typename 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);