From 2a3cf25cce2ad05dabed717f58b9a94998d73fae Mon Sep 17 00:00:00 2001 From: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Sat, 15 Feb 2025 14:39:18 +0200 Subject: [PATCH] memory: Consider flexible mappings as gpu accessible Multiple guest apps do this with perfectly valid sharps in simple shaders. This needs some hw testing to see how it is handled but for now doesnt hurt to handle it --- src/core/memory.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 4717b3a74..164f4c397 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -314,11 +314,11 @@ int MemoryManager::MapMemory(void** out_addr, VAddr virtual_addr, size_t size, M if (type == VMAType::Direct) { new_vma.phys_base = phys_addr; - rasterizer->MapMemory(mapped_addr, size); } if (type == VMAType::Flexible) { flexible_usage += size; } + rasterizer->MapMemory(mapped_addr, size); return ORBIS_OK; } @@ -406,12 +406,10 @@ u64 MemoryManager::UnmapBytesFromEntry(VAddr virtual_addr, VirtualMemoryArea vma if (type == VMAType::Free) { return adjusted_size; } - if (type == VMAType::Direct || type == VMAType::Pooled) { - rasterizer->UnmapMemory(virtual_addr, adjusted_size); - } if (type == VMAType::Flexible) { flexible_usage -= adjusted_size; } + rasterizer->UnmapMemory(virtual_addr, adjusted_size); // Mark region as free and attempt to coalesce it with neighbours. const auto new_it = CarveVMA(virtual_addr, adjusted_size);