fix(agc): verify refreshed draw stage data #8372

Merged
JJenkx merged 1 commit from upstream-pr/8372 into main 2026-10-23 17:59:10 +00:00
JJenkx commented 2026-10-20 11:30:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-20T11:30:47Z.


What

With APS5_VERIFY_DRAW_ENTRIES=1, a draw-cache hit whose constant data changes can report a stage mismatch even when the refreshed data is correct. lookupDraw puts the refreshed words and compiled result in StageDataHit, but the verifier compares the original cached variant against a fresh capture.

Pass the effective stage data to the verifier and compare the refreshed words and compilation when present. Keep both content and forwarded-word comparisons. The ordinary rendering path is unchanged.

Add a Vulkan regression that caches a constant-color draw, changes the constant from 0.25 to 1.0, requires a verified stage-data hit with no new mismatch, and checks the rendered bytes change from 64 to 255.

Overlap review: this is independent of #5609 and #6539, whose relocation work also edits the verification condition; those branches will need to retain this effective-data selection when rebasing. #6188 changes cache admission and verification too. None implements this refreshed-stage-data regression/fix. The test's Windows PATH setup is separate from the list edited by #5656.

Tested

Linux, AMD Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1, Arch Linux. Built agc_driver_draw_cache_reuse_tests in Release with BUILD_TESTING=ON and ANYPS5_AGC_EXECUTION_TESTS=DrawCacheReuse.

Matched main b9a097353cc387d643a810594ed8dd60601109bb with this PR's test/CMake changes only, against main plus the implementation change, on the same machine/GPU:

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 \
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
ctest --test-dir build-full -R '^agc_driver_draw_cache_reuse' -V --timeout 60

Both runs explicitly selected the RADV ICD and the installed validation-layer paths. Main: four existing tests pass; the new agc_driver_draw_cache_reuse_entry_verify fails with draw-entry verification: refreshed stage data differed from a fresh capture. Candidate: all five pass (2.90 seconds total), including refreshed-color GPU readback. Neither log has VUID-, a missing-layer warning, or a skipped test. python3 tools/check_conventions.py --base origin/main passes.

No performance or title-bring-up claim. Windows was not tested locally; the new test has the same DLL PATH setup as the existing Vulkan tests.

Independent Windows validation by @xXPBSXx (report), at this exact head bd017bc3ab, on Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, NVIDIA RTX 4080 SUPER, WinLibs GCC 15.2.0 (MinGW-w64 UCRT), Release: all five agc_driver_draw_cache_reuse tests pass three times each. With only the three production driver files restored from merge base b9a097353c, retaining this PR's test/CMake changes, the new _entry_verify test fails three times with the refreshed-stage-data mismatch; the other four pass. The contributor restored the PR sources afterward. This is attributed contributor evidence: no title, full-suite or other-GPU coverage was reported, and the report does not establish Khronos validation-layer coverage on Windows.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6650 XT; RADV Mesa 26.2.4-arch1.1; Arch Linux. Independent contributor @xXPBSXx: NVIDIA RTX 4080 SUPER, Windows 10 Pro, exact head bd017bc3ab; see attributed limitations above.
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4935080547 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8372). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-20T11:30:47Z. --- ### What With `APS5_VERIFY_DRAW_ENTRIES=1`, a draw-cache hit whose constant data changes can report a stage mismatch even when the refreshed data is correct. `lookupDraw` puts the refreshed words and compiled result in `StageDataHit`, but the verifier compares the original cached variant against a fresh capture. Pass the effective stage data to the verifier and compare the refreshed words and compilation when present. Keep both content and forwarded-word comparisons. The ordinary rendering path is unchanged. Add a Vulkan regression that caches a constant-color draw, changes the constant from 0.25 to 1.0, requires a verified stage-data hit with no new mismatch, and checks the rendered bytes change from 64 to 255. Overlap review: this is independent of #5609 and #6539, whose relocation work also edits the verification condition; those branches will need to retain this effective-data selection when rebasing. #6188 changes cache admission and verification too. None implements this refreshed-stage-data regression/fix. The test's Windows PATH setup is separate from the list edited by #5656. ### Tested Linux, AMD Radeon RX 6650 XT, RADV Mesa 26.2.4-arch1.1, Arch Linux. Built `agc_driver_draw_cache_reuse_tests` in Release with `BUILD_TESTING=ON` and `ANYPS5_AGC_EXECUTION_TESTS=DrawCacheReuse`. Matched main `b9a097353cc387d643a810594ed8dd60601109bb` with this PR's test/CMake changes only, against main plus the implementation change, on the same machine/GPU: ```sh ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 \ VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \ ctest --test-dir build-full -R '^agc_driver_draw_cache_reuse' -V --timeout 60 ``` Both runs explicitly selected the RADV ICD and the installed validation-layer paths. Main: four existing tests pass; the new `agc_driver_draw_cache_reuse_entry_verify` fails with `draw-entry verification: refreshed stage data differed from a fresh capture`. Candidate: all five pass (2.90 seconds total), including refreshed-color GPU readback. Neither log has `VUID-`, a missing-layer warning, or a skipped test. `python3 tools/check_conventions.py --base origin/main` passes. No performance or title-bring-up claim. Windows was not tested locally; the new test has the same DLL PATH setup as the existing Vulkan tests. Independent Windows validation by @xXPBSXx ([report](https://github.com/boykopovar/AnyPS5/pull/8372#issuecomment-6309830925)), at this exact head `bd017bc3ab`, on Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, NVIDIA RTX 4080 SUPER, WinLibs GCC 15.2.0 (MinGW-w64 UCRT), Release: all five `agc_driver_draw_cache_reuse` tests pass three times each. With only the three production driver files restored from merge base `b9a097353c`, retaining this PR's test/CMake changes, the new `_entry_verify` test fails three times with the refreshed-stage-data mismatch; the other four pass. The contributor restored the PR sources afterward. This is attributed contributor evidence: no title, full-suite or other-GPU coverage was reported, and the report does not establish Khronos validation-layer coverage on Windows. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 6650 XT; RADV Mesa 26.2.4-arch1.1; Arch Linux. Independent contributor @xXPBSXx: NVIDIA RTX 4080 SUPER, Windows 10 Pro, exact head `bd017bc3ab`; see attributed limitations above. - [x] AI-assisted: yes
xXPBSXx commented 2026-10-21 06:43:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T06:43:18Z.


Independent Windows run of this PR with a baseline (data only).

Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, NVIDIA GeForce RTX 4080 SUPER (the log shows Selected GPU name=NVIDIA GeForce RTX 4080 SUPER vendor=0x10de device=0x2702 subgroup=32, picked with ANYPS5_GPU=4080), WinLibs GCC 15.2.0 (MinGW-w64 UCRT), Release. PR head bd017bc3ab; merge-tree against main is clean. I built agc_driver_draw_cache_reuse_tests; ctest -R '^agc_driver_draw_cache_reuse' lists five tests (agc_driver_draw_cache_reuse, _off, _verify, _entry_verify, _inline).

Results (3 runs each):

  • PR head: all five tests pass 3/3.
  • Baseline: I kept the PR's tests/execution/DrawCacheReuse.cpp and CMakeLists.txt and replaced only Execution/include/Driver/Driver.hpp, Execution/src/Driver/Draw/Draw.cpp and Execution/src/Driver/Draw/DrawCapture.cpp with their versions from the merge base b9a097353c, then rebuilt. agc_driver_draw_cache_reuse_entry_verify fails 3/3 with [draw-cache] verify: stage 1 (...) of a hit captured differently: 1 runs / 1 words matched, 1 / 1 fresh and AGC graphics: draw-entry verification: refreshed stage data differed from a fresh capture; the other four pass. I restored the PR's sources afterwards.

Not run: other GPUs (I did not run an AMD card for this PR), other platforms, the other tests, the full repository CTest, and any title or console run.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309830925 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8372#issuecomment-6309830925). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-21T06:43:18Z. --- Independent Windows run of this PR with a baseline (data only). **Environment:** Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, NVIDIA GeForce RTX 4080 SUPER (the log shows `Selected GPU name=NVIDIA GeForce RTX 4080 SUPER vendor=0x10de device=0x2702 subgroup=32`, picked with `ANYPS5_GPU=4080`), WinLibs GCC 15.2.0 (MinGW-w64 UCRT), Release. PR head `bd017bc3ab`; merge-tree against `main` is clean. I built `agc_driver_draw_cache_reuse_tests`; `ctest -R '^agc_driver_draw_cache_reuse'` lists five tests (`agc_driver_draw_cache_reuse`, `_off`, `_verify`, `_entry_verify`, `_inline`). **Results (3 runs each):** - PR head: all five tests pass 3/3. - Baseline: I kept the PR's `tests/execution/DrawCacheReuse.cpp` and `CMakeLists.txt` and replaced only `Execution/include/Driver/Driver.hpp`, `Execution/src/Driver/Draw/Draw.cpp` and `Execution/src/Driver/Draw/DrawCapture.cpp` with their versions from the merge base `b9a097353c`, then rebuilt. `agc_driver_draw_cache_reuse_entry_verify` fails 3/3 with `[draw-cache] verify: stage 1 (...) of a hit captured differently: 1 runs / 1 words matched, 1 / 1 fresh` and `AGC graphics: draw-entry verification: refreshed stage data differed from a fresh capture`; the other four pass. I restored the PR's sources afterwards. **Not run:** other GPUs (I did not run an AMD card for this PR), other platforms, the other tests, the full repository CTest, and any title or console run. AI-assisted (Claude Code).
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!8372
No description provided.