summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-04-06 02:25:25 +0200
committerLioncash <mathew1800@gmail.com>2019-04-06 02:25:28 +0200
commit34510bcda84aa0d3acc6af543eb4b38e76e6ab84 (patch)
tree7bd38c18f4afc932fb3601030f79b560c47434f4 /src/video_core
parentvideo_core/memory_manager: Make FindFreeRegion() a const member function (diff)
downloadyuzu-34510bcda84aa0d3acc6af543eb4b38e76e6ab84.tar
yuzu-34510bcda84aa0d3acc6af543eb4b38e76e6ab84.tar.gz
yuzu-34510bcda84aa0d3acc6af543eb4b38e76e6ab84.tar.bz2
yuzu-34510bcda84aa0d3acc6af543eb4b38e76e6ab84.tar.lz
yuzu-34510bcda84aa0d3acc6af543eb4b38e76e6ab84.tar.xz
yuzu-34510bcda84aa0d3acc6af543eb4b38e76e6ab84.tar.zst
yuzu-34510bcda84aa0d3acc6af543eb4b38e76e6ab84.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/memory_manager.cpp18
-rw-r--r--src/video_core/memory_manager.h1
2 files changed, 17 insertions, 2 deletions
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp
index 11b1d022a..bb7e21e7d 100644
--- a/src/video_core/memory_manager.cpp
+++ b/src/video_core/memory_manager.cpp
@@ -180,8 +180,22 @@ u8* MemoryManager::GetPointer(GPUVAddr addr) {
return {};
}
- u8* page_pointer{page_table.pointers[addr >> page_bits]};
- if (page_pointer) {
+ u8* const page_pointer{page_table.pointers[addr >> page_bits]};
+ if (page_pointer != nullptr) {
+ return page_pointer + (addr & page_mask);
+ }
+
+ LOG_ERROR(HW_GPU, "Unknown GetPointer @ 0x{:016X}", addr);
+ return {};
+}
+
+const u8* MemoryManager::GetPointer(GPUVAddr addr) const {
+ if (!IsAddressValid(addr)) {
+ return {};
+ }
+
+ const u8* const page_pointer{page_table.pointers[addr >> page_bits]};
+ if (page_pointer != nullptr) {
return page_pointer + (addr & page_mask);
}
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h
index d75c1c5c0..4309bfce7 100644
--- a/src/video_core/memory_manager.h
+++ b/src/video_core/memory_manager.h
@@ -59,6 +59,7 @@ public:
void Write(GPUVAddr addr, T data);
u8* GetPointer(GPUVAddr addr);
+ const u8* GetPointer(GPUVAddr addr) const;
void ReadBlock(GPUVAddr src_addr, void* dest_buffer, std::size_t size);
void WriteBlock(GPUVAddr dest_addr, const void* src_buffer, std::size_t size);