diff options
author | Lioncash <mathew1800@gmail.com> | 2018-08-03 18:55:58 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-08-04 08:36:57 +0200 |
commit | 6030c5ce412e44ddcfe0a31c6747a017166bf33d (patch) | |
tree | 2b79fa019f07e601b5170e92e93b69788ffde949 /src/core/memory.cpp | |
parent | Merge pull request #911 from lioncash/prototype (diff) | |
download | yuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.tar yuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.tar.gz yuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.tar.bz2 yuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.tar.lz yuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.tar.xz yuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.tar.zst yuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/memory.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 4b3bb7b31..a8f08e1da 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -326,34 +326,36 @@ void RasterizerMarkRegionCached(Tegra::GPUVAddr gpu_addr, u64 size, bool cached) } void RasterizerFlushVirtualRegion(VAddr start, u64 size, FlushMode mode) { + auto& system_instance = Core::System::GetInstance(); + // Since pages are unmapped on shutdown after video core is shutdown, the renderer may be // null here - if (VideoCore::g_renderer == nullptr) { + if (!system_instance.IsPoweredOn()) { return; } VAddr end = start + size; - auto CheckRegion = [&](VAddr region_start, VAddr region_end) { + const auto CheckRegion = [&](VAddr region_start, VAddr region_end) { if (start >= region_end || end <= region_start) { // No overlap with region return; } - VAddr overlap_start = std::max(start, region_start); - VAddr overlap_end = std::min(end, region_end); + const VAddr overlap_start = std::max(start, region_start); + const VAddr overlap_end = std::min(end, region_end); - std::vector<Tegra::GPUVAddr> gpu_addresses = - Core::System::GetInstance().GPU().memory_manager->CpuToGpuAddress(overlap_start); + const std::vector<Tegra::GPUVAddr> gpu_addresses = + system_instance.GPU().memory_manager->CpuToGpuAddress(overlap_start); if (gpu_addresses.empty()) { return; } - u64 overlap_size = overlap_end - overlap_start; + const u64 overlap_size = overlap_end - overlap_start; for (const auto& gpu_address : gpu_addresses) { - auto* rasterizer = VideoCore::g_renderer->Rasterizer(); + auto* rasterizer = system_instance.Renderer().Rasterizer(); switch (mode) { case FlushMode::Flush: rasterizer->FlushRegion(gpu_address, overlap_size); |