fix(agc): preserve inputs for deferred buffer copies #94

Merged
boykopovar merged 2 commits from upstream-pr/94 into main 2026-09-28 15:35:41 +00:00
boykopovar commented 2026-09-28 15:21:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-09-28T15:21:09Z.


Summary

Fixed black frames caused by guest input buffers being overwritten before deferred GPU copies executed.

Cause

The previous fix preserved directly bound draw inputs but did not cover deferred GPU copies, which still read mutable guest memory.

Detection

Instrumentation found 12 changed bytes in the final draw's 32-byte input buffer on a black frame. Equivalent copies in adjacent correct frames had no mismatches.

Changes

Deferred GPU copies now read from preserved CPU input snapshots kept alive until GPU completion.
Buffers with pending GPU writes or shader writes remain on the existing path.
Closing the display window now requests a normal exit instead of calling std::terminate(). Shutdown cancels queued work, wakes blocked waits, joins GPU workers and background helpers, and releases GPU resources before destroying the window on its owning thread. Shutdown cancellation is handled separately from runtime errors.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4665707653 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/94). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-09-28T15:21:09Z. --- ## Summary Fixed black frames caused by guest input buffers being overwritten before deferred GPU copies executed. ## Cause The previous fix preserved directly bound draw inputs but did not cover deferred GPU copies, which still read mutable guest memory. ## Detection Instrumentation found 12 changed bytes in the final draw's 32-byte input buffer on a black frame. Equivalent copies in adjacent correct frames had no mismatches. ## Changes Deferred GPU copies now read from preserved CPU input snapshots kept alive until GPU completion. Buffers with pending GPU writes or shader writes remain on the existing path. Closing the display window now requests a normal exit instead of calling std::terminate(). Shutdown cancels queued work, wakes blocked waits, joins GPU workers and background helpers, and releases GPU resources before destroying the window on its owning thread. Shutdown cancellation is handled separately from runtime errors.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!94
No description provided.