diff options
| author | 2019-04-05 20:22:53 -0400 | |
|---|---|---|
| committer | 2019-04-05 20:22:55 -0400 | |
| commit | 085b388a7aaa37663cec84d06a0c2cb674bee73a (patch) | |
| tree | e32df29678742088d648acf71e3f314b9a47555b /src | |
| parent | video_core/memory_manager: Make GpuToCpuAddress() a const member function (diff) | |
| download | yuzu-085b388a7aaa37663cec84d06a0c2cb674bee73a.tar.gz yuzu-085b388a7aaa37663cec84d06a0c2cb674bee73a.tar.xz yuzu-085b388a7aaa37663cec84d06a0c2cb674bee73a.zip | |
video_core/memory_manager: Make FindFreeRegion() a const member function
This doesn't modify internal state, so it can be made a const member
function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/memory_manager.cpp | 19 | ||||
| -rw-r--r-- | src/video_core/memory_manager.h | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index 124a3c6d2..11b1d022a 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp | |||
| @@ -77,16 +77,17 @@ GPUVAddr MemoryManager::UnmapBuffer(GPUVAddr gpu_addr, u64 size) { | |||
| 77 | return gpu_addr; | 77 | return gpu_addr; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | GPUVAddr MemoryManager::FindFreeRegion(GPUVAddr region_start, u64 size) { | 80 | GPUVAddr MemoryManager::FindFreeRegion(GPUVAddr region_start, u64 size) const { |
| 81 | // Find the first Free VMA. | 81 | // Find the first Free VMA. |
| 82 | const VMAHandle vma_handle{std::find_if(vma_map.begin(), vma_map.end(), [&](const auto& vma) { | 82 | const VMAHandle vma_handle{ |
| 83 | if (vma.second.type != VirtualMemoryArea::Type::Unmapped) { | 83 | std::find_if(vma_map.begin(), vma_map.end(), [region_start, size](const auto& vma) { |
| 84 | return false; | 84 | if (vma.second.type != VirtualMemoryArea::Type::Unmapped) { |
| 85 | } | 85 | return false; |
| 86 | 86 | } | |
| 87 | const VAddr vma_end{vma.second.base + vma.second.size}; | 87 | |
| 88 | return vma_end > region_start && vma_end >= region_start + size; | 88 | const VAddr vma_end{vma.second.base + vma.second.size}; |
| 89 | })}; | 89 | return vma_end > region_start && vma_end >= region_start + size; |
| 90 | })}; | ||
| 90 | 91 | ||
| 91 | if (vma_handle == vma_map.end()) { | 92 | if (vma_handle == vma_map.end()) { |
| 92 | return {}; | 93 | return {}; |
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index c3b4d7ae7..d75c1c5c0 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h | |||
| @@ -127,7 +127,7 @@ private: | |||
| 127 | void UpdatePageTableForVMA(const VirtualMemoryArea& vma); | 127 | void UpdatePageTableForVMA(const VirtualMemoryArea& vma); |
| 128 | 128 | ||
| 129 | /// Finds a free (unmapped region) of the specified size starting at the specified address. | 129 | /// Finds a free (unmapped region) of the specified size starting at the specified address. |
| 130 | GPUVAddr FindFreeRegion(GPUVAddr region_start, u64 size); | 130 | GPUVAddr FindFreeRegion(GPUVAddr region_start, u64 size) const; |
| 131 | 131 | ||
| 132 | private: | 132 | private: |
| 133 | static constexpr u64 page_bits{16}; | 133 | static constexpr u64 page_bits{16}; |