gpu: stage oversized image readbacks in a private buffer instead of exiting #845
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!845
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/845/head"
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?
@theantipopau on GitHub · 2026-09-26 05:24 UTC · original
theantipopau:image-readback-chunk→main· +25 −5 · 1 files · 3 commits · closed without mergingWhat
TextureCache::DownloadImageMemorystages whole-image readbacks through the shared 64 MiB download utility buffer and exits whenStreamBuffer::Mapcannot fit the image's full data range:Any image whose data range is at or above the buffer capacity (a 64 MiB render target being read back for a save or a present-path copy) hits this. The fix mirrors the staging approach used for buffer downloads (#842) and oversized image uploads (#844): when the shared buffer cannot map the range, stage the readback in a private
MemoryUsage::Downloadbuffer of exactly the needed size.Details
AllFlags, the same usage flags the shared download buffer carries, so every copy shapeDownloadImageemits (linear regions, tiling passes, BGRA16 swap, depth readback) stays legal.range.sizeback, not just the copied regions.Invalidate→WriteBackingpublish as the shared path and then retires the buffer, so the private allocation lives exactly until the GPU copy has been read on the priority thread.Commit()still runs immediately on successfulMap); only thenullptrbranch changed behavior.Testing
kyty_emulatorbuilds clean with clang-cl/Ninja.VK_EXT_attachment_feedback_loop_dynamic_state, so production rasterization/readback paths cannot run. The oversized branch itself needs a title that reads back such an image; behavior is unchanged for every image that fits the 64 MiB buffer.Related: #829 / #842 (buffer-download batching) and #844 (oversized image uploads), which together cover the other sides of the same staging ceilings.
@coderabbitai[bot] on GitHub · 2026-09-26 05:33 UTC · original · edited 2026-10-06 04:44 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
01235527-01e2-4190-a4e0-729b2a7d2e97📥 Commits
Reviewing files that changed from the base of the PR and between
b0cb9d6fdfandfcb234d831.📒 Files selected for processing (1)
src/graphics/host_gpu/renderer/cache/textureCache.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.
📝 Walkthrough
Walkthrough
DownloadImageMemorynow allocates a private buffer sized to the image when the reusable download buffer cannot map the range. Both buffer paths perform image readback and issue a host-read barrier. The private-buffer path defers buffer invalidation and guest-memory write-back, then releases the buffer. A failed guest-backing read still returnsfalse.Suggested reviewers:
defektuPriority: ⬇️ Low
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
fcb23No actionable merge-blocking issue was established. The oversized-readback path remains untested on a GPU, so validate it when suitable hardware is available.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
fcb23The inspected paths preserve completion ordering, temporary-resource ownership, and guest-memory unmap synchronization. No introduced security vulnerability was established, but peak memory usage under overlapping large readbacks remains uncertain.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@theantipopau on GitHub · 2026-09-26 06:11 UTC · original
Game-tested this branch locally: Terminator 2D No Fate (PPSA25872), clang-cl/Ninja Release build of this exact commit.
VS 5 | PS 3 | CS 6, no errors, no fatals.upstream/main(fd2e15ee) build, so the shared 64 MiB download-buffer fast path is behavior-neutral for images that fit it.Same caveat as #844: this title never triggers the oversized readback branch (nothing near 64 MiB is read back whole), so this validates no-regression, not the new path itself.
Pull request closed