early-access version 2613
This commit is contained in:
parent
7770034e0c
commit
3d1cf7b28e
3 changed files with 18 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 2612.
|
This is the source code for early-access 2613.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,22 @@ GPUVAddr MemoryManager::UpdateRange(GPUVAddr gpu_addr, PageEntry page_entry, std
|
||||||
return gpu_addr;
|
return gpu_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MemoryManager::UnmapSubmappedRanges(GPUVAddr gpu_addr, std::size_t size) {
|
||||||
|
const auto submapped_ranges = GetSubmappedRange(gpu_addr, size);
|
||||||
|
for (const auto& [map_addr, map_size] : submapped_ranges) {
|
||||||
|
// Flush and invalidate through the GPU interface, to be asynchronous if possible.
|
||||||
|
const std::optional<VAddr> cpu_vaddr = GpuToCpuAddress(map_addr);
|
||||||
|
if (!cpu_vaddr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rasterizer->UnmapMemory(*cpu_vaddr, map_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GPUVAddr MemoryManager::Map(VAddr cpu_addr, GPUVAddr gpu_addr, std::size_t size) {
|
GPUVAddr MemoryManager::Map(VAddr cpu_addr, GPUVAddr gpu_addr, std::size_t size) {
|
||||||
|
// Unmap any pre-existing rasterizer memory in this range
|
||||||
|
UnmapSubmappedRanges(gpu_addr, size);
|
||||||
|
|
||||||
const auto it = std::ranges::lower_bound(map_ranges, gpu_addr, {}, &MapRange::first);
|
const auto it = std::ranges::lower_bound(map_ranges, gpu_addr, {}, &MapRange::first);
|
||||||
if (it != map_ranges.end() && it->first == gpu_addr) {
|
if (it != map_ranges.end() && it->first == gpu_addr) {
|
||||||
it->second = size;
|
it->second = size;
|
||||||
|
@ -70,16 +85,8 @@ void MemoryManager::Unmap(GPUVAddr gpu_addr, std::size_t size) {
|
||||||
} else {
|
} else {
|
||||||
UNREACHABLE_MSG("Unmapping non-existent GPU address=0x{:x}", gpu_addr);
|
UNREACHABLE_MSG("Unmapping non-existent GPU address=0x{:x}", gpu_addr);
|
||||||
}
|
}
|
||||||
const auto submapped_ranges = GetSubmappedRange(gpu_addr, size);
|
|
||||||
|
|
||||||
for (const auto& [map_addr, map_size] : submapped_ranges) {
|
|
||||||
// Flush and invalidate through the GPU interface, to be asynchronous if possible.
|
|
||||||
const std::optional<VAddr> cpu_addr = GpuToCpuAddress(map_addr);
|
|
||||||
ASSERT(cpu_addr);
|
|
||||||
|
|
||||||
rasterizer->UnmapMemory(*cpu_addr, map_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
UnmapSubmappedRanges(gpu_addr, size);
|
||||||
UpdateRange(gpu_addr, PageEntry::State::Unmapped, size);
|
UpdateRange(gpu_addr, PageEntry::State::Unmapped, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@ private:
|
||||||
[[nodiscard]] PageEntry GetPageEntry(GPUVAddr gpu_addr) const;
|
[[nodiscard]] PageEntry GetPageEntry(GPUVAddr gpu_addr) const;
|
||||||
void SetPageEntry(GPUVAddr gpu_addr, PageEntry page_entry, std::size_t size = page_size);
|
void SetPageEntry(GPUVAddr gpu_addr, PageEntry page_entry, std::size_t size = page_size);
|
||||||
GPUVAddr UpdateRange(GPUVAddr gpu_addr, PageEntry page_entry, std::size_t size);
|
GPUVAddr UpdateRange(GPUVAddr gpu_addr, PageEntry page_entry, std::size_t size);
|
||||||
|
void UnmapSubmappedRanges(GPUVAddr gpu_addr, std::size_t size);
|
||||||
[[nodiscard]] std::optional<GPUVAddr> FindFreeRange(std::size_t size, std::size_t align,
|
[[nodiscard]] std::optional<GPUVAddr> FindFreeRange(std::size_t size, std::size_t align,
|
||||||
bool start_32bit_address = false) const;
|
bool start_32bit_address = false) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue