Core: ClampRangeSize fixes (#3555)

* Swap !IsFree() for IsMapped()

IsFree only checks if the VMAType == Free. As is, that means ClampRangeSize will include memory that is Reserved or PoolReserved, and neither of those types are GPU mapped.

This fixes this bug, may help with some non-GPU memory asserts.

* Apply ClampRangeSize to vertex buffers

Helps with some cases encountered by UE and Minecraft.
This commit is contained in:
Stephen Miller
2025-09-07 22:27:40 -05:00
committed by GitHub
parent eb9a7e8fbd
commit 133f4b9187
2 changed files with 3 additions and 2 deletions

View File

@@ -82,7 +82,7 @@ u64 MemoryManager::ClampRangeSize(VAddr virtual_addr, u64 size) {
++vma;
// Keep adding to the size while there is contigious virtual address space.
while (!vma->second.IsFree() && clamped_size < size) {
while (vma->second.IsMapped() && clamped_size < size) {
clamped_size += vma->second.size;
++vma;
}

View File

@@ -283,7 +283,8 @@ void BufferCache::BindVertexBuffers(const Vulkan::GraphicsPipeline& pipeline) {
// Map buffers for merged ranges
for (auto& range : ranges_merged) {
const auto [buffer, offset] = ObtainBuffer(range.base_address, range.GetSize(), false);
const u64 size = memory->ClampRangeSize(range.base_address, range.GetSize());
const auto [buffer, offset] = ObtainBuffer(range.base_address, size, false);
range.vk_buffer = buffer->buffer;
range.offset = offset;
}