fix(agc): keep BGRA color targets resident between draws #65

Merged
SamG-Coder merged 1 commit from upstream-pr/65 into main 2026-09-28 07:07:16 +00:00
SamG-Coder commented 2026-09-28 06:27:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SamG-Coder on 2026-09-28T06:27:21Z.


BGRA color targets fail the exact guest-texture-format lookup and fall back to a synchronous framebuffer round-trip for every draw. This keeps them resident using compatible RGBA storage with the original BGRA attachment view. Presentation checks the actual display channel order, attachment views request only attachment usage, and host-write barriers include the host stage.

This follows the existing linked PRX/Vulkan path. It adds no interpreter, separate runtime process, or new shader compilation path.

Validation

  • Rebased onto upstream c368817; Windows Release build and four focused CTest tests pass at fa787cf.
  • Post-rebase converted PS5 SDK demo: 48 draws / 49,152 triangles at 1080p, 60.49 FPS; independent checks of frames 68 and 69 pass with maximum channel error 1/255.
  • Before rebase, all nine stress configurations, both image negative controls, the external SDK demo suite (00–10), and a separate sRGB fixture passed. A separate trace recorded 3,360 draws with zero synchronous draws.
  • The full CTest run before rebase was 44/47: the previously failing agc_driver, agc_driver_flip, and agc_driver_pm4 remain. The full suite was not rerun after rebase; the relevant focused tests and rendered stress case were.
Workload at 1080p Draws Triangles/frame Before FPS After FPS
Lit 48 49,152 5.69 59.94
Dense lit 48 786,432 5.49 58.15
Lit 192 196,608 1.44 60.13
Textured 12 12,288 23.91 54.49
Textured 48 49,152 6.02 58.99

These original measurements compare e424b6b with 966c324 (upstream ce6ac25 plus this patch), on Windows / RTX 5080 / Ryzen 7 9800X3D. They use 10 warmup and 60 measured frames, host flip-completion timing, and captures after measurement. They are not physical PS5 results, GPU-only throughput, or a claim of consistently paced 60 FPS. A same-build control with resident targets disabled reproduced the slowdown. BGRA presentation still uses the existing once-per-frame transfer when storage/display channel order differs. Depth testing and full-game compatibility are outside this change.

Separate known issue

We independently reproduced VUID-vkDestroyDevice-device-05137 during headless-to-windowed device replacement, including with resident targets disabled. This is the same lifetime error described in #59. It is recorded here but deliberately left out of this PR; #59 has not been incorporated or validated by these tests.

Screenshots and the downloadable benchmark/validation report are attached in the PR conversation. Demo sources, images, logs, and reports remain outside the repository.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4660086051 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/65). Originally posted by [SamG-Coder](https://github.com/SamG-Coder) on 2026-09-28T06:27:21Z. --- BGRA color targets fail the exact guest-texture-format lookup and fall back to a synchronous framebuffer round-trip for every draw. This keeps them resident using compatible RGBA storage with the original BGRA attachment view. Presentation checks the actual display channel order, attachment views request only attachment usage, and host-write barriers include the host stage. This follows the existing linked PRX/Vulkan path. It adds no interpreter, separate runtime process, or new shader compilation path. ### Validation - Rebased onto upstream `c368817`; Windows Release build and four focused CTest tests pass at `fa787cf`. - Post-rebase converted PS5 SDK demo: 48 draws / 49,152 triangles at 1080p, 60.49 FPS; independent checks of frames 68 and 69 pass with maximum channel error 1/255. - Before rebase, all nine stress configurations, both image negative controls, the external SDK demo suite (00–10), and a separate sRGB fixture passed. A separate trace recorded 3,360 draws with zero synchronous draws. - The full CTest run before rebase was 44/47: the previously failing `agc_driver`, `agc_driver_flip`, and `agc_driver_pm4` remain. The full suite was not rerun after rebase; the relevant focused tests and rendered stress case were. | Workload at 1080p | Draws | Triangles/frame | Before FPS | After FPS | |---|---:|---:|---:|---:| | Lit | 48 | 49,152 | 5.69 | 59.94 | | Dense lit | 48 | 786,432 | 5.49 | 58.15 | | Lit | 192 | 196,608 | 1.44 | 60.13 | | Textured | 12 | 12,288 | 23.91 | 54.49 | | Textured | 48 | 49,152 | 6.02 | 58.99 | These original measurements compare `e424b6b` with `966c324` (upstream `ce6ac25` plus this patch), on Windows / RTX 5080 / Ryzen 7 9800X3D. They use 10 warmup and 60 measured frames, host flip-completion timing, and captures after measurement. They are not physical PS5 results, GPU-only throughput, or a claim of consistently paced 60 FPS. A same-build control with resident targets disabled reproduced the slowdown. BGRA presentation still uses the existing once-per-frame transfer when storage/display channel order differs. Depth testing and full-game compatibility are outside this change. ### Separate known issue We independently reproduced `VUID-vkDestroyDevice-device-05137` during headless-to-windowed device replacement, including with resident targets disabled. This is the same lifetime error described in #59. It is recorded here but deliberately left out of this PR; #59 has not been incorporated or validated by these tests. Screenshots and the downloadable benchmark/validation report are attached in the PR conversation. Demo sources, images, logs, and reports remain outside the repository.
SamG-Coder commented 2026-09-28 06:28:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SamG-Coder on 2026-09-28T06:28:35Z.


Test screenshots and report

These are captures from PS5 SDK demos converted to Windows executables with AnyPS5. They are not physical-console captures.

48 lit draws, 49,152 triangles, 1920×1080 — post-rebase commit fa787cf. The fresh run measured 60.49 FPS; both checked frames matched the independent pixel reference within 1/255. Full-resolution framebuffer capture, frame 68:

48 lit draws after rebase

48 textured draws — original validated patch 966c324. Full-resolution framebuffer capture, frame 68; 58.99 FPS in the reported run and maximum sampled channel error 1/255:

48 textured draws

Actual GPU presentation capture, 12 textured draws. Frame 68 from the original patch validation; the existing capture utility downsamples to 480×270:

GPU presentation capture

Download benchmark and validation report. Includes the standalone HTML report, all nine before/after measurements in JSON, screenshots, post-rebase stress log, and PR validation notes. The original report retains its measured commit IDs; the post-rebase notes and log identify the later check separately.

We also independently observed the device-lifetime validation error covered by #59, including with resident targets disabled. It remains outside this patch. All evidence files stay outside the Git repository.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5864662738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/65#issuecomment-5864662738). Originally posted by [SamG-Coder](https://github.com/SamG-Coder) on 2026-09-28T06:28:35Z. --- ### Test screenshots and report These are captures from PS5 SDK demos converted to Windows executables with AnyPS5. They are not physical-console captures. **48 lit draws, 49,152 triangles, 1920×1080 — post-rebase commit `fa787cf`.** The fresh run measured 60.49 FPS; both checked frames matched the independent pixel reference within 1/255. Full-resolution framebuffer capture, frame 68: <img width="960" alt="48 lit draws after rebase" src="https://github.com/user-attachments/assets/7c95ebc1-787c-4524-9ca2-59725011e2f1" /> **48 textured draws — original validated patch `966c324`.** Full-resolution framebuffer capture, frame 68; 58.99 FPS in the reported run and maximum sampled channel error 1/255: <img width="960" alt="48 textured draws" src="https://github.com/user-attachments/assets/db5eaa07-cbea-461b-954b-08226c043ed6" /> **Actual GPU presentation capture, 12 textured draws.** Frame 68 from the original patch validation; the existing capture utility downsamples to 480×270: <img width="480" alt="GPU presentation capture" src="https://github.com/user-attachments/assets/f5f42ee1-03d9-4fb0-9498-5dd1efa7a184" /> [Download benchmark and validation report](https://github.com/user-attachments/files/32729122/pr65-evidence.zip). Includes the standalone HTML report, all nine before/after measurements in JSON, screenshots, post-rebase stress log, and PR validation notes. The original report retains its measured commit IDs; the post-rebase notes and log identify the later check separately. We also independently observed the device-lifetime validation error covered by #59, including with resident targets disabled. It remains outside this patch. All evidence files stay outside the Git repository.
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!65
No description provided.