mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-09 21:31:04 +00:00
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:
@@ -82,7 +82,7 @@ u64 MemoryManager::ClampRangeSize(VAddr virtual_addr, u64 size) {
|
|||||||
++vma;
|
++vma;
|
||||||
|
|
||||||
// Keep adding to the size while there is contigious virtual address space.
|
// 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;
|
clamped_size += vma->second.size;
|
||||||
++vma;
|
++vma;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,7 +283,8 @@ void BufferCache::BindVertexBuffers(const Vulkan::GraphicsPipeline& pipeline) {
|
|||||||
|
|
||||||
// Map buffers for merged ranges
|
// Map buffers for merged ranges
|
||||||
for (auto& range : ranges_merged) {
|
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.vk_buffer = buffer->buffer;
|
||||||
range.offset = offset;
|
range.offset = offset;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user