From 9dec087fca5944b6e4ee5f0f76c0716a93a9fe4d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 5 Apr 2019 20:18:27 -0400 Subject: video_core/memory_manager: Make GpuToCpuAddress() a const member function This doesn't modify any internal state, so it can be made a const member function to allow its use in const contexts. --- src/video_core/memory_manager.cpp | 4 ++-- src/video_core/memory_manager.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index e76b59842..124a3c6d2 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -99,12 +99,12 @@ bool MemoryManager::IsAddressValid(GPUVAddr addr) const { return (addr >> page_bits) < page_table.pointers.size(); } -std::optional MemoryManager::GpuToCpuAddress(GPUVAddr addr) { +std::optional MemoryManager::GpuToCpuAddress(GPUVAddr addr) const { if (!IsAddressValid(addr)) { return {}; } - VAddr cpu_addr{page_table.backing_addr[addr >> page_bits]}; + const VAddr cpu_addr{page_table.backing_addr[addr >> page_bits]}; if (cpu_addr) { return cpu_addr + (addr & page_mask); } diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index 34744bb27..c3b4d7ae7 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h @@ -50,7 +50,7 @@ public: GPUVAddr MapBufferEx(VAddr cpu_addr, u64 size); GPUVAddr MapBufferEx(VAddr cpu_addr, GPUVAddr addr, u64 size); GPUVAddr UnmapBuffer(GPUVAddr addr, u64 size); - std::optional GpuToCpuAddress(GPUVAddr addr); + std::optional GpuToCpuAddress(GPUVAddr addr) const; template T Read(GPUVAddr addr); -- cgit v1.2.3