mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-25 07:46:01 +03:00
[PR #3211] [MERGED] buffer_cache: Bring back upload batching and temporary buffer #3307
Labels
No labels
Bloodborne
bug
contributor wanted
documentation
enhancement
frontend
good first issue
help wanted
linux
pull-request
question
release
verification progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shadPS4#3307
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/shadps4-emu/shadPS4/pull/3211
Author: @raphaelthegreat
Created: 7/8/2025
Status: ✅ Merged
Merged: 7/8/2025
Merged by: @georgemoralis
Base:
main← Head:staging-fix📝 Commits (2)
4abffb2buffer_cache: Bring back upload batching and temporary bufferfaee44abuffer_cache: Move buffer barriers and copy outside of lock range📊 Changes
6 files changed (+96 additions, -35 deletions)
View changed files
📝
src/video_core/buffer_cache/buffer.cpp(+23 -7)📝
src/video_core/buffer_cache/buffer.h(+2 -6)📝
src/video_core/buffer_cache/buffer_cache.cpp(+44 -12)📝
src/video_core/buffer_cache/buffer_cache.h(+3 -0)📝
src/video_core/buffer_cache/memory_tracker.h(+19 -9)📝
src/video_core/renderer_vulkan/vk_scheduler.h(+5 -1)📄 Description
This should fix regressions reported from https://github.com/shadps4-emu/shadPS4/pull/3186
Because that PR fused the write and read protections under a single function call, it was a requirement to move the actual memory copy part inside the lambda to perform it before the read protection kicks in. However on certain large data transfers it had potential for data corruption. If, for example, an upload had two copies, a 400MB and a 300MB one, the first one would fit in the staging buffer, very likely with an induced stall. However the second one wouldn't have space to fit alongside the other data, but it's also small enough for the buffer to fit it, so the staging buffer would cause a flush and wait to copy it, overwriting the previous transfer.
To address this the upload function has been reworked to allow for batching like previously but with the new locking behavior. Also the condition to use temporary buffers has been expanded to also include cases when staging buffer will stall, which should increase performance a little in some cases.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.