gpu: stage oversized image uploads in a private buffer instead of exiting #844
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!844
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/844/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 03:36 UTC · original
theantipopau:image-upload-fallback→main· +18 −2 · 1 files · 1 commits · closed without mergingWhat
BufferCache::ObtainBufferForImagestaged image uploads through the shared 512 MiBm_staging_bufferand sharedUploadCopies' hard failure mode: whenStreamBuffer::Mapcannot satisfy a reservation, it returnsnullptrand the caller exited. UnlikeUploadCopies, there was no fallback, so an image whose whole data range is at or above the staging capacity (a 512 MiB image, or anything larger, including a reservation padded pastnonCoherentAtomSize) aborts the emulator at initialization withThis adds the same fallback
UploadCopiesalready uses for buffer uploads: copy the guest data into a privateMemoryUsage::Uploadbuffer of exactly the requested size, flush it, and retire it throughDeferOperationonce the upload has been recorded.Why this shape
Maprecords nothing before failing and the fallback returns a buffer that is already populated and flushed, so there is no ordering interaction with the command scheduler.UploadImage's use of theBuffer*/offset pair.EXITon an unreadable guest backing as the shared path, so the failure semantics for genuinely bad addresses do not change.Testing
kyty_emulatorbuilds clean with clang-cl/Ninja.VK_EXT_attachment_feedback_loop_dynamic_state, so production rasterization paths cannot run. The oversized path itself needs a title that uploads such an image; host-side behavior is unchanged for every image that fits the staging buffer.Related: #829 (the download-side twin of this ceiling, fixed by #842), which is what led me to check the upload path.
@coderabbitai[bot] on GitHub · 2026-09-26 03:43 UTC · original
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
90811297-e3c2-4adc-a71b-90c2ccca6b2a📥 Commits
Reviewing files that changed from the base of the PR and between
fd2e15ee73and8a4326cc5c.📒 Files selected for processing (1)
src/graphics/host_gpu/renderer/cache/bufferCache.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
Walkthrough
ObtainBufferForImagenow allocates and fills a private upload buffer when mapping the shared staging buffer fails. It reads guest backing memory, with PRT backing as a fallback. After a successful read, it flushes the buffer, defers its release, and returns it at offset zero. The shared-buffer read path remains unchanged when mapping succeeds.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
8a432The temporary upload buffer remains available until its GPU upload completes. No concrete merge-blocking behavior is established in the reviewed change.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
8a432No confirmed security regression was found. The new upload path retains the existing guest-memory reads and uses budget-checked allocations, but its behavior under repeated large uploads and shutdown was not fully established.
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)
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 apart from the usual dirty-build pipeline-cache line, so the shared-buffer fast path is byte-for-byte behavior-neutral for images that fit the staging buffer.This title does not reach the oversized branch (its largest image is far below 512 MiB), so it validates no-regression, not the fallback itself — that still needs a title that uploads a ≥512 MiB image.
@Nmzik on GitHub · 2026-09-29 18:20 UTC · original
in favour of
18a5f04d05Pull request closed