fix(agc): view cleared surfaces without flushing handed-over results #9999

Merged
camezaro-intc merged 1 commit from upstream-pr/9999 into main 2026-11-14 03:35:44 +00:00
camezaro-intc commented 2026-10-23 03:35:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by camezaro-intc on 2026-10-23T03:35:08Z.


What

Preserve texture A's pending GPU results when texture B is sampled through matching DCC clear keys; sampling B does not overwrite A's backing memory. The regression test now reads A's backing memory after B is sampled but before B writes, and verifies that A's results remain visible. B's subsequent write is the point where its overlapping units may be superseded. Removed the untested unconditional refresh upload for every handed-over clear-key refresh.

Tested

Windows 11 (build 26300), AMD Radeon RX 5700 XT, driver 32.0.21045.16010. Baseline main (2960e9a6e7e1fc99c4ed180c71495b5eb83464c7) and PR head (d72cc8ca6a70205a4e1fe96eb1c107d540a73f95) were tested on the same machine and GPU.

For both baseline and PR:

  • cmake --build C:\a5-pr11727-full --target agc_driver_recorder_tests agc_driver_staged_clear_sampled_read_tests --parallel 8 — passed.
  • With ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: ctest --test-dir C:\a5-pr11727-full --output-on-failure -V -R '^(agc_storage_clear_hand_over|agc_driver_staged_clear_sampled_read)$' — passed, 2/2.
  • Khronos validation layer was loaded; no missing-layer warning and no VUID- messages were present in either captured run.

Additional checks:

  • python tools/check_conventions.py --base upstream/main — passed.
  • git diff --check upstream/main...HEAD — passed.
  • python tools/check_conventions.py --base origin/main — reports an unrelated non-Conventional-Commit revert already in that stale fork base (97f1d41a2c) and existing debt-length warnings; checking against the actual upstream PR base passes.

No title run or AMD/Intel comparison beyond this RX 5700 XT was performed.

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: Fixes #9860
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 5700 XT, driver 32.0.21045.16010, Windows 11 build 26300
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4977416735 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9999). Originally posted by [camezaro-intc](https://github.com/camezaro-intc) on 2026-10-23T03:35:08Z. --- ### What Preserve texture A's pending GPU results when texture B is sampled through matching DCC clear keys; sampling B does not overwrite A's backing memory. The regression test now reads A's backing memory after B is sampled but before B writes, and verifies that A's results remain visible. B's subsequent write is the point where its overlapping units may be superseded. Removed the untested unconditional refresh upload for every handed-over clear-key refresh. ### Tested Windows 11 (build 26300), AMD Radeon RX 5700 XT, driver 32.0.21045.16010. Baseline `main` (`2960e9a6e7e1fc99c4ed180c71495b5eb83464c7`) and PR head (`d72cc8ca6a70205a4e1fe96eb1c107d540a73f95`) were tested on the same machine and GPU. For both baseline and PR: - `cmake --build C:\a5-pr11727-full --target agc_driver_recorder_tests agc_driver_staged_clear_sampled_read_tests --parallel 8` — passed. - With `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: `ctest --test-dir C:\a5-pr11727-full --output-on-failure -V -R '^(agc_storage_clear_hand_over|agc_driver_staged_clear_sampled_read)$'` — passed, 2/2. - Khronos validation layer was loaded; no missing-layer warning and no `VUID-` messages were present in either captured run. Additional checks: - `python tools/check_conventions.py --base upstream/main` — passed. - `git diff --check upstream/main...HEAD` — passed. - `python tools/check_conventions.py --base origin/main` — reports an unrelated non-Conventional-Commit revert already in that stale fork base (`97f1d41a2c`) and existing debt-length warnings; checking against the actual upstream PR base passes. No title run or AMD/Intel comparison beyond this RX 5700 XT was performed. ### 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: Fixes #9860 - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 5700 XT, driver 32.0.21045.16010, Windows 11 build 26300 - [x] AI-assisted: yes
MarcZX10 commented 2026-10-23 04:37:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T04:37:26Z.

Review: APPROVED


Reviewed the exact diff and manually compared the Texture.hpp/Texture.cpp hunks against the #9431 stack and its open follow-ups (#9891/#9892/#9893/#9895). Those PRs alter independent mip/layout/copy regions; they will need textual rebases where files overlap, but this change does not depend on their behavior. The candidate-source selection now rejects clear-key aliases at another DCC address, staged-clear flushes are limited to matching pending layers, and the refreshed cached storage image supersedes handed-over writes before it becomes the sampled source. The new SampledClear case exercises the supersession path. Current-main diff check is clean; CI conventions, eligibility, intake, labels and report pass while product jobs skip by path policy. I cannot run Vulkan on this host; the PR reports both focused Windows tests passing with the Khronos layer and no VUIDs. No blocking issue found in the reviewed scope.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5623946693 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9999#pullrequestreview-5623946693). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T04:37:26Z. **Review:** APPROVED --- Reviewed the exact diff and manually compared the Texture.hpp/Texture.cpp hunks against the #9431 stack and its open follow-ups (#9891/#9892/#9893/#9895). Those PRs alter independent mip/layout/copy regions; they will need textual rebases where files overlap, but this change does not depend on their behavior. The candidate-source selection now rejects clear-key aliases at another DCC address, staged-clear flushes are limited to matching pending layers, and the refreshed cached storage image supersedes handed-over writes before it becomes the sampled source. The new SampledClear case exercises the supersession path. Current-main diff check is clean; CI conventions, eligibility, intake, labels and report pass while product jobs skip by path policy. I cannot run Vulkan on this host; the PR reports both focused Windows tests passing with the Khronos layer and no VUIDs. No blocking issue found in the reviewed scope.
MarcZX10 commented 2026-10-28 22:17:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T22:17:55Z.

Review: CHANGES_REQUESTED


I re-reviewed the current head cc1d50526dff8c4dffcba9b44a604e7a1e96477e, including the clear-key source selection, staged-clear restriction, handed-over unit supersession, and the SampledClear regression. The Windows validation-layer runs and the Linux/Windows broader test results described in the thread are useful evidence, but I did not run them locally. The current hosted PR checks shown here are from the earlier run; product jobs are path-skipped.

This head is based on d7948b09f95ea8e302590c09dbb3c0c0b714b84a and is 5,752 commits behind current main (319621ba2e578bd053b0baba2877fe70520e0737). Current main has also changed Texture.hpp, ShaderResources.cpp, and Texture.cpp, the same production files this PR changes. Please rebase/merge current main, rerun agc_storage_clear_hand_over and agc_driver_staged_clear_sampled_read on the resulting tree (including the Vulkan validation layer where available), and refresh the hosted build checks before merge. The existing merge-order agreement with #7085 should remain in place. I cannot approve until that integration is verified.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5690426998 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9999#pullrequestreview-5690426998). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T22:17:55Z. **Review:** CHANGES_REQUESTED --- I re-reviewed the current head `cc1d50526dff8c4dffcba9b44a604e7a1e96477e`, including the clear-key source selection, staged-clear restriction, handed-over unit supersession, and the `SampledClear` regression. The Windows validation-layer runs and the Linux/Windows broader test results described in the thread are useful evidence, but I did not run them locally. The current hosted PR checks shown here are from the earlier run; product jobs are path-skipped. This head is based on `d7948b09f95ea8e302590c09dbb3c0c0b714b84a` and is 5,752 commits behind current `main` (`319621ba2e578bd053b0baba2877fe70520e0737`). Current `main` has also changed `Texture.hpp`, `ShaderResources.cpp`, and `Texture.cpp`, the same production files this PR changes. Please rebase/merge current `main`, rerun `agc_storage_clear_hand_over` and `agc_driver_staged_clear_sampled_read` on the resulting tree (including the Vulkan validation layer where available), and refresh the hosted build checks before merge. The existing merge-order agreement with #7085 should remain in place. I cannot approve until that integration is verified.
MarcZX10 commented 2026-10-29 05:01:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T05:01:45Z.

Review: APPROVED


Reviewed — looks good

The exact current head includes the requested mainline integration and focused validation evidence; the change and its regression test are consistent, with no blocking issue found.

What I ran

  • PR head: f555ebfc360e48f3a35b51179f053c1a79a30e7f.
  • Test baseline reported by the author: upstream/main b433c40f2f.
  • Current main: 52c09d567d. The merge preview is clean; the intervening main commit does not touch any of this PR's four changed paths.
  • Environment: Linux x86_64 for Git integration/diff checks; Windows 11 with AMD Radeon RX 5700 XT for the author-reported Vulkan test.
  • Commands:
git merge-tree --write-tree --name-only upstream/main upstream/pr/9999
git diff --check upstream/main...upstream/pr/9999
  • I also reviewed the exact-head changes in Texture.hpp, ShaderResources.cpp, Texture.cpp, and Recorder.cpp.

Results

Check Result
Current-main merge preview Clean, tree 8f4a6758f4af0de474d93d55cb4b37fc75203157
Diff check Pass; no output
Focused tests on baseline and PR head Author reports 2/2 pass on each revision with Vulkan validation enabled and no VUIDs
Hosted Windows Pass
Hosted conventions, eligibility, labels, report Pass
Hosted Linux and specialized jobs Skipped
Raw integration and CI output
git merge-tree --write-tree --name-only upstream/main upstream/pr/9999
8f4a6758f4af0de474d93d55cb4b37fc75203157

git diff --check upstream/main...upstream/pr/9999
(exit 0; no output)

windows          pass
conventions      pass
eligibility      pass
labels           pass
report           pass
linux            skipping
register-context skipping
relinker         skipping
relinker-asan    skipping
write-watch      skipping

The test command and per-test output are in the author's exact-head test report.

Negative control

Assertion Change made Result
Sampling a cleared surface does not flush unrelated handed-over writes, and superseded units are discarded None; I did not mutate the implementation Not independently exercised

Findings

Blocking

None.

Non-blocking

The focused Vulkan tests were run by the PR author, not locally in this review environment. Linux and specialized hosted jobs are skipped for this PR.

Sources

Not verified

  • I did not run the GPU/Vulkan tests locally.
  • Console rendering behavior was not tested in this review.

To get this to a good state

No further action is needed for approval. If the head changes, I will rerun the same merge, diff, and focused-test checks on the new revision.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693072147 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9999#pullrequestreview-5693072147). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T05:01:45Z. **Review:** APPROVED --- # Reviewed — looks good The exact current head includes the requested mainline integration and focused validation evidence; the change and its regression test are consistent, with no blocking issue found. ## What I ran - PR head: f555ebfc360e48f3a35b51179f053c1a79a30e7f. - Test baseline reported by the author: upstream/main b433c40f2f46aa2e59e19806010a839ac8572d64. - Current main: 52c09d567d2fa453494dd720fcf53a98149468e4. The merge preview is clean; the intervening main commit does not touch any of this PR's four changed paths. - Environment: Linux x86_64 for Git integration/diff checks; Windows 11 with AMD Radeon RX 5700 XT for the author-reported Vulkan test. - Commands: ~~~sh git merge-tree --write-tree --name-only upstream/main upstream/pr/9999 git diff --check upstream/main...upstream/pr/9999 ~~~ - I also reviewed the exact-head changes in Texture.hpp, ShaderResources.cpp, Texture.cpp, and Recorder.cpp. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean, tree 8f4a6758f4af0de474d93d55cb4b37fc75203157 | | Diff check | Pass; no output | | Focused tests on baseline and PR head | Author reports 2/2 pass on each revision with Vulkan validation enabled and no VUIDs | | Hosted Windows | Pass | | Hosted conventions, eligibility, labels, report | Pass | | Hosted Linux and specialized jobs | Skipped | <details> <summary>Raw integration and CI output</summary> ~~~text git merge-tree --write-tree --name-only upstream/main upstream/pr/9999 8f4a6758f4af0de474d93d55cb4b37fc75203157 git diff --check upstream/main...upstream/pr/9999 (exit 0; no output) windows pass conventions pass eligibility pass labels pass report pass linux skipping register-context skipping relinker skipping relinker-asan skipping write-watch skipping ~~~ The test command and per-test output are in the [author's exact-head test report](https://github.com/boykopovar/AnyPS5/pull/9999#issuecomment-6487997915). </details> ## Negative control | Assertion | Change made | Result | |---|---|---| | Sampling a cleared surface does not flush unrelated handed-over writes, and superseded units are discarded | None; I did not mutate the implementation | Not independently exercised | ## Findings ### Blocking None. ### Non-blocking The focused Vulkan tests were run by the PR author, not locally in this review environment. Linux and specialized hosted jobs are skipped for this PR. ## Sources - [PR-head clear-key selection and sampled-surface handling, pinned to f555ebfc360e48f3a35b51179f053c1a79a30e7f](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp) - [PR-head storage refresh and handed-over writes, pinned to f555ebfc360e48f3a35b51179f053c1a79a30e7f](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp) - [PR-head regression test, pinned to f555ebfc360e48f3a35b51179f053c1a79a30e7f](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp) - [Author's baseline and candidate Vulkan test report](https://github.com/boykopovar/AnyPS5/pull/9999#issuecomment-6487997915) ## Not verified - I did not run the GPU/Vulkan tests locally. - Console rendering behavior was not tested in this review. ## To get this to a good state No further action is needed for approval. If the head changes, I will rerun the same merge, diff, and focused-test checks on the new revision.
XairRrR commented 2026-10-29 05:17:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T05:17:11Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The merged tree builds and the focused tests pass under the Khronos validation layer with no VUID- lines, but the new SupersedeHandedOver() call on the sampled path drops A's pending results before anything overwrites them, which a scratch test shows as lost data that main keeps.

What I ran

  • PR head: f555ebfc360e48f3a35b51179f053c1a79a30e7f
  • main: 52c09d567d2fa453494dd720fcf53a98149468e4
  • Merge of the head into main: clean (merge commit 1a03fce653e45016ece9f2cd30b822e9f23b4f18)
  • Machine: Arch Linux 7.2.11-zen, GCC 16.2.1, Release, Ninja, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08). Builds and tests ran in a sandbox without network, in a clean worktree.
git fetch origin main pull/9999/head:refs/review/9999
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/9999
git diff --check origin/main...refs/review/9999
python3 tools/check_conventions.py --base origin/main
cmake --build build -j10 --target agc_driver_recorder_tests agc_driver_staged_clear_sampled_read_tests libs

# merged tree, then the same on origin/main
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
  ctest --test-dir build -R '^(agc_storage_clear_hand_over|agc_driver_staged_clear_sampled_read|agc_driver_staged_clear_sampled_read_draw_pipeline)$' -V -j4 --output-on-failure

# merged tree, wider set using the same test binary
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build -R '^agc_storage_' -j4 --timeout 120 --output-on-failure

# negative and partial controls (each rebuilds agc_driver_recorder_tests, then runs agc_storage_clear_hand_over)
git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics      # all production files from main
sed -i '/candidate->SupersedeHandedOver();/d' .../ShaderResources.cpp     # only the new call removed
sed -i 's/keys != uploadedKeys || handOverKeys.has_value()/keys != uploadedKeys/' .../Texture.cpp  # only the refresh change removed

Results

Check Result
Merge into current main Clean
git diff --check No output
tools/check_conventions.py --base origin/main All conventions checks passed.
Build (agc_driver_recorder_tests, agc_driver_staged_clear_sampled_read_tests, libs) OK
Focused tests, merged tree, validation layer 3/3 passed, 0 VUID- lines
Focused tests, main, validation layer 3/3 passed, 0 VUID- lines
Layer loaded Insert instance layer "VK_LAYER_KHRONOS_validation" in all 3 tests on both trees; no was not found but was requested by env var VK_INSTANCE_LAYERS
agc_storage_*, merged tree 11/11 passed
Negative control (all production files from main) agc_storage_clear_hand_over fails, as intended
Only SupersedeHandedOver() call removed agc_storage_clear_hand_over passes
Only || handOverKeys.has_value() removed agc_storage_clear_hand_over passes
Scratch read of A after B is sampled (see Blocking) Fails with this PR; A's results are seen on main and with the call removed
Focused tests, merged tree
790: clear-key hand-over: ok
790: clear-key hand-over (watched): ok
1/3 Test  #790: agc_storage_clear_hand_over ..........................   Passed    0.40 sec
2/3 Test #1525: agc_driver_staged_clear_sampled_read_draw_pipeline ...   Passed    0.58 sec
3/3 Test #1411: agc_driver_staged_clear_sampled_read .................   Passed    0.59 sec
100% tests passed out of 3
grep -c "VUID-"                          -> 0
grep -c "was not found but was requested" -> 0
Focused tests, main
1/3 Test  #790: agc_storage_clear_hand_over ..........................   Passed    0.38 sec
2/3 Test #1525: agc_driver_staged_clear_sampled_read_draw_pipeline ...   Passed    0.55 sec
3/3 Test #1411: agc_driver_staged_clear_sampled_read .................   Passed    0.57 sec
grep -c "VUID-"                          -> 0
grep -c "was not found but was requested" -> 0

Negative control

I restored Texture.hpp, ShaderResources.cpp and Texture.cpp from main and kept the PR's Recorder.cpp. agc_storage_clear_hand_over fails:

AGC graphics: clear-key hand-over (watched), B sampled under clear keys, on: B sampled under clear keys did not view B's cleared storage image

The new case does test the stagedClear restriction. It does not test two other production changes: with either one removed alone, the test still passes (see Non-blocking 1).

Findings

Blocking

  1. Sampling B now drops A's pending results that nothing has overwritten yet.
    ShaderResources.cpp:840 calls candidate->SupersedeHandedOver(), which runs supersedeHandedOver(0, trackedLayers). That clears layerPending on every handed-over unit of A under B. Until now, only a write by B dropped those units (Texture.cpp:3885, in the mark-pending path). That rule is correct: only B's write replaces the bytes A rendered. Sampling B through its clear keys reads the keys' clear value but leaves the memory unchanged, so a later read of that memory through A's descriptor, or by the CPU, must still see A's results. The existing ReadFirst case checks the same rule for the refresh path.

    Scratch check: in the SampledClear case, right after the CachedSampledTexture call and before draw(imageB, ...), I added:

    if (on && watched) Require(filled(readMemory(address, 65536), red), where + ": SCRATCH a read of A's memory after B was sampled, before B wrote, did not see A's results");
    
    • With this PR it fails: clear-key hand-over (watched), B sampled under clear keys, on: SCRATCH a read of A's memory after B was sampled, before B wrote, did not see A's results.
    • With only the SupersedeHandedOver() call removed, the read sees red. The only later failure is superseded == 2 (dropped 1), which is expected, because the read stored one unit, as in ReadFirst.
    • On main's production files (the PR's two sampled-view Requires removed, since they fail there by design), the read also sees red. The only later failure is the PR's supersede count (dropped 0).

    So the PR introduces this loss. main keeps A's results here.

    Suggested fix: drop the SupersedeHandedOver() call, and with it the public wrapper if nothing else uses it. The AnyLayerPending() condition on stagedClear already keeps the sample from storing A's results over B. With the call removed, all of agc_storage_clear_hand_over still passes: B's following draw drops the same two units at Texture.cpp:3885. Please also add a SampledClear variant that reads A's memory after the sample, like the scratch line above. It would catch this regression.

    Earlier reviews here approved this path; this check is new evidence against it.

Non-blocking

  1. Two production changes have no test coverage. With the SupersedeHandedOver() call removed, or with only the || handOverKeys.has_value() in Texture.cpp:2271 removed, agc_storage_clear_hand_over still passes. For the first, the on.superseded == 2 check for SampledClear at Recorder.cpp:11370 cannot tell a drop at the sample from the drop at the following draw(imageB, ...) (Recorder.cpp:11342). The test therefore does not support the description's claim that it "drops superseded units". For the refresh() change, please add a case that fails without it: B taken from the cache with clear keys equal to uploadedKeys, while newer results from A are handed over. Otherwise, remove the change.
  2. Every refresh re-uploads while a hand-over holds. || handOverKeys.has_value() marks every tracked layer changed on each refresh that hands over, including repeated refreshes with the same keys and the same handed-over writes. That costs a full GPU clear each time. If this is intended, the case that needs it (item 1) would show why a narrower condition is not enough, for example comparing the handed-over writes with the previous hand-over.
  3. Unblocks line. The template asks for the title ID and its Game bring-up discussion (for example PPSA01325 #3232). PPSA26344 Ghost of Yōtei has no discussion number.

Not verified

  • Behaviour on AMD or Intel GPUs, and on Windows. I ran only on the NVIDIA host above.
  • Tests outside agc_storage_*, agc_driver_staged_clear_sampled_read and its _draw_pipeline variant. cachedTexture is on every sampled-texture path, and I did not run the wider AGC suite.
  • The title results reported in the thread (Palworld, RESIDENT EVIL requiem, Ghost of Yōtei). I launched no title.

To get this to a good state

  1. Remove the SupersedeHandedOver() call at ShaderResources.cpp:840, or show why dropping A's units at sample time is correct when A's memory is read before B writes. Then add the read-after-sample check above to SampledClear.
  2. Cover the refresh() change with a case that fails without it, or remove it.
  3. Add the discussion number to the Unblocks line.
  4. Rerun agc_storage_clear_hand_over and agc_driver_staged_clear_sampled_read on main and on the change with the validation layer, as before.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693182691 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9999#pullrequestreview-5693182691). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T05:17:11Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The merged tree builds and the focused tests pass under the Khronos validation layer with no `VUID-` lines, but the new `SupersedeHandedOver()` call on the sampled path drops A's pending results before anything overwrites them, which a scratch test shows as lost data that `main` keeps. ## What I ran - PR head: `f555ebfc360e48f3a35b51179f053c1a79a30e7f` - `main`: `52c09d567d2fa453494dd720fcf53a98149468e4` - Merge of the head into `main`: clean (merge commit `1a03fce653e45016ece9f2cd30b822e9f23b4f18`) - Machine: Arch Linux 7.2.11-zen, GCC 16.2.1, Release, Ninja, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08). Builds and tests ran in a sandbox without network, in a clean worktree. ```sh git fetch origin main pull/9999/head:refs/review/9999 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/9999 git diff --check origin/main...refs/review/9999 python3 tools/check_conventions.py --base origin/main cmake --build build -j10 --target agc_driver_recorder_tests agc_driver_staged_clear_sampled_read_tests libs # merged tree, then the same on origin/main VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \ ctest --test-dir build -R '^(agc_storage_clear_hand_over|agc_driver_staged_clear_sampled_read|agc_driver_staged_clear_sampled_read_draw_pipeline)$' -V -j4 --output-on-failure # merged tree, wider set using the same test binary ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build -R '^agc_storage_' -j4 --timeout 120 --output-on-failure # negative and partial controls (each rebuilds agc_driver_recorder_tests, then runs agc_storage_clear_hand_over) git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics # all production files from main sed -i '/candidate->SupersedeHandedOver();/d' .../ShaderResources.cpp # only the new call removed sed -i 's/keys != uploadedKeys || handOverKeys.has_value()/keys != uploadedKeys/' .../Texture.cpp # only the refresh change removed ``` ## Results | Check | Result | |---|---| | Merge into current `main` | Clean | | `git diff --check` | No output | | `tools/check_conventions.py --base origin/main` | `All conventions checks passed.` | | Build (`agc_driver_recorder_tests`, `agc_driver_staged_clear_sampled_read_tests`, `libs`) | OK | | Focused tests, merged tree, validation layer | 3/3 passed, 0 `VUID-` lines | | Focused tests, `main`, validation layer | 3/3 passed, 0 `VUID-` lines | | Layer loaded | `Insert instance layer "VK_LAYER_KHRONOS_validation"` in all 3 tests on both trees; no `was not found but was requested by env var VK_INSTANCE_LAYERS` | | `agc_storage_*`, merged tree | 11/11 passed | | Negative control (all production files from `main`) | `agc_storage_clear_hand_over` fails, as intended | | Only `SupersedeHandedOver()` call removed | `agc_storage_clear_hand_over` **passes** | | Only `\|\| handOverKeys.has_value()` removed | `agc_storage_clear_hand_over` **passes** | | Scratch read of A after B is sampled (see Blocking) | Fails with this PR; A's results are seen on `main` and with the call removed | <details> <summary>Focused tests, merged tree</summary> ```text 790: clear-key hand-over: ok 790: clear-key hand-over (watched): ok 1/3 Test #790: agc_storage_clear_hand_over .......................... Passed 0.40 sec 2/3 Test #1525: agc_driver_staged_clear_sampled_read_draw_pipeline ... Passed 0.58 sec 3/3 Test #1411: agc_driver_staged_clear_sampled_read ................. Passed 0.59 sec 100% tests passed out of 3 grep -c "VUID-" -> 0 grep -c "was not found but was requested" -> 0 ``` </details> <details> <summary>Focused tests, main</summary> ```text 1/3 Test #790: agc_storage_clear_hand_over .......................... Passed 0.38 sec 2/3 Test #1525: agc_driver_staged_clear_sampled_read_draw_pipeline ... Passed 0.55 sec 3/3 Test #1411: agc_driver_staged_clear_sampled_read ................. Passed 0.57 sec grep -c "VUID-" -> 0 grep -c "was not found but was requested" -> 0 ``` </details> ## Negative control I restored `Texture.hpp`, `ShaderResources.cpp` and `Texture.cpp` from `main` and kept the PR's `Recorder.cpp`. `agc_storage_clear_hand_over` fails: ```text AGC graphics: clear-key hand-over (watched), B sampled under clear keys, on: B sampled under clear keys did not view B's cleared storage image ``` The new case does test the `stagedClear` restriction. It does not test two other production changes: with either one removed alone, the test still passes (see Non-blocking 1). ## Findings ### Blocking 1. **Sampling B now drops A's pending results that nothing has overwritten yet.** [`ShaderResources.cpp:840`](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L838-L842) calls `candidate->SupersedeHandedOver()`, which runs [`supersedeHandedOver(0, trackedLayers)`](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L5765-L5767). That clears `layerPending` on every handed-over unit of A under B. Until now, only a write by B dropped those units ([`Texture.cpp:3885`](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L3885), in the mark-pending path). That rule is correct: only B's write replaces the bytes A rendered. Sampling B through its clear keys reads the keys' clear value but leaves the memory unchanged, so a later read of that memory through A's descriptor, or by the CPU, must still see A's results. The existing `ReadFirst` case checks the same rule for the refresh path. Scratch check: in the `SampledClear` case, right after the `CachedSampledTexture` call and before `draw(imageB, ...)`, I added: ```cpp if (on && watched) Require(filled(readMemory(address, 65536), red), where + ": SCRATCH a read of A's memory after B was sampled, before B wrote, did not see A's results"); ``` - With this PR it fails: `clear-key hand-over (watched), B sampled under clear keys, on: SCRATCH a read of A's memory after B was sampled, before B wrote, did not see A's results`. - With only the `SupersedeHandedOver()` call removed, the read sees red. The only later failure is `superseded == 2` (`dropped 1`), which is expected, because the read stored one unit, as in `ReadFirst`. - On `main`'s production files (the PR's two sampled-view `Require`s removed, since they fail there by design), the read also sees red. The only later failure is the PR's supersede count (`dropped 0`). So the PR introduces this loss. `main` keeps A's results here. Suggested fix: drop the `SupersedeHandedOver()` call, and with it the public wrapper if nothing else uses it. The `AnyLayerPending()` condition on `stagedClear` already keeps the sample from storing A's results over B. With the call removed, all of `agc_storage_clear_hand_over` still passes: B's following draw drops the same two units at `Texture.cpp:3885`. Please also add a `SampledClear` variant that reads A's memory after the sample, like the scratch line above. It would catch this regression. Earlier reviews here approved this path; this check is new evidence against it. ### Non-blocking 1. **Two production changes have no test coverage.** With the `SupersedeHandedOver()` call removed, or with only the `|| handOverKeys.has_value()` in [`Texture.cpp:2271`](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L2271) removed, `agc_storage_clear_hand_over` still passes. For the first, the `on.superseded == 2` check for `SampledClear` at [`Recorder.cpp:11370`](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp#L11370) cannot tell a drop at the sample from the drop at the following `draw(imageB, ...)` ([`Recorder.cpp:11342`](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp#L11342)). The test therefore does not support the description's claim that it "drops superseded units". For the `refresh()` change, please add a case that fails without it: B taken from the cache with clear keys equal to `uploadedKeys`, while newer results from A are handed over. Otherwise, remove the change. 2. **Every refresh re-uploads while a hand-over holds.** `|| handOverKeys.has_value()` marks every tracked layer changed on each refresh that hands over, including repeated refreshes with the same keys and the same handed-over writes. That costs a full GPU clear each time. If this is intended, the case that needs it (item 1) would show why a narrower condition is not enough, for example comparing the handed-over `writes` with the previous hand-over. 3. **Unblocks line.** The template asks for the title ID and its Game bring-up discussion (for example `PPSA01325 #3232`). `PPSA26344 Ghost of Yōtei` has no discussion number. ## Not verified - Behaviour on AMD or Intel GPUs, and on Windows. I ran only on the NVIDIA host above. - Tests outside `agc_storage_*`, `agc_driver_staged_clear_sampled_read` and its `_draw_pipeline` variant. `cachedTexture` is on every sampled-texture path, and I did not run the wider AGC suite. - The title results reported in the thread (Palworld, RESIDENT EVIL requiem, Ghost of Yōtei). I launched no title. ## To get this to a good state 1. Remove the `SupersedeHandedOver()` call at `ShaderResources.cpp:840`, or show why dropping A's units at sample time is correct when A's memory is read before B writes. Then add the read-after-sample check above to `SampledClear`. 2. Cover the `refresh()` change with a case that fails without it, or remove it. 3. Add the discussion number to the Unblocks line. 4. Rerun `agc_storage_clear_hand_over` and `agc_driver_staged_clear_sampled_read` on `main` and on the change with the validation layer, as before.
MarcZX10 commented 2026-10-29 05:28:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T05:28:13Z.

Review: CHANGES_REQUESTED


Re-reviewed — changes requested

New exact-head evidence identifies a data-loss case that my earlier approval did not cover. That approval is superseded by this review.

What I ran

  • Reviewed exact head f555ebfc360e48f3a35b51179f053c1a79a30e7f against current main 52c09d567d.
  • Inspected the sampled-texture path, handed-over pending-state transitions, and SampledClear regression.
  • Ran git merge-tree --write-tree and git diff --check against current main.
  • I checked local GPU/test availability: this environment has no /dev/dri device, nvidia-smi, or existing AGC recorder test binary, so I could not reproduce the Vulkan case locally.

Results

Check Result
Current-main merge preview Clean
git diff --check Pass
Exact-head focused Vulkan tests Independent reviewer reports 3/3 with Khronos validation and no VUID messages
Wider AGC storage tests Independent reviewer reports 11/11 on the merged tree
Negative control Reviewer reports the data remains visible on main and when the new SupersedeHandedOver call is removed
Hosted CI Product jobs are path-skipped; the exact-head test evidence is reviewer-run locally

Negative control

The reviewer’s scratch readback after sampling B but before B writes sees A’s red results on main and when only the new SupersedeHandedOver call is removed, but fails with this PR. That isolates the newly added sample-time supersession as the source of the lost pending data.

Findings

Blocking

  1. Sampling B discards A’s pending results before a write replaces them. In cachedTexture, the new candidate->SupersedeHandedOver() call clears A’s handed-over pending state as soon as B is selected for sampling. The scratch readback described above shows that a subsequent read of A’s backing memory, before B writes, no longer sees A’s results, whereas main preserves them. Please remove this call or demonstrate why this sequence is semantically allowed; add the read-after-sample assertion to SampledClear so this data-preservation case remains covered.

  2. The Unblocks entry lacks the required game bring-up discussion number. It names PPSA26344 / Ghost of Yōtei but does not give the discussion reference required by the contribution template. Please add that discussion number or use Unblocks: none if this change does not directly unblock that title.

Non-blocking

  • The added refresh condition makes every refresh with handOverKeys mark all tracked layers changed. A focused test should show why a repeated refresh with unchanged keys and unchanged handed-over writes requires another full GPU clear; otherwise consider narrowing or removing this behavior.
  • The SampledClear superseded-count assertion currently cannot distinguish supersession during sampling from the later write by B. The read-after-sample check above provides that missing distinction.
  • The report says a refresh may trigger a full GPU clear repeatedly while hand-over state persists. That cost is not benchmarked.

Sources

Not verified

  • I did not run the Vulkan tests or reproduce the scratch readback locally; that evidence is from the independent reviewer and is reported above as such.
  • Behavior on AMD/Intel GPUs, Windows, or console hardware was not verified here.

To get this to a good state

Remove or justify sample-time supersession, add the read-after-sample backing-memory assertion, and correct the Unblocks reference. Then rerun the focused storage/hand-over tests with validation enabled on the updated exact head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693263865 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9999#pullrequestreview-5693263865). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T05:28:13Z. **Review:** CHANGES_REQUESTED --- # Re-reviewed — changes requested New exact-head evidence identifies a data-loss case that my earlier approval did not cover. That approval is superseded by this review. ## What I ran - Reviewed exact head f555ebfc360e48f3a35b51179f053c1a79a30e7f against current main 52c09d567d2fa453494dd720fcf53a98149468e4. - Inspected the sampled-texture path, handed-over pending-state transitions, and SampledClear regression. - Ran git merge-tree --write-tree and git diff --check against current main. - I checked local GPU/test availability: this environment has no /dev/dri device, nvidia-smi, or existing AGC recorder test binary, so I could not reproduce the Vulkan case locally. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean | | git diff --check | Pass | | Exact-head focused Vulkan tests | Independent reviewer reports 3/3 with Khronos validation and no VUID messages | | Wider AGC storage tests | Independent reviewer reports 11/11 on the merged tree | | Negative control | Reviewer reports the data remains visible on main and when the new SupersedeHandedOver call is removed | | Hosted CI | Product jobs are path-skipped; the exact-head test evidence is reviewer-run locally | ## Negative control The reviewer’s scratch readback after sampling B but before B writes sees A’s red results on main and when only the new SupersedeHandedOver call is removed, but fails with this PR. That isolates the newly added sample-time supersession as the source of the lost pending data. ## Findings ### Blocking 1. **Sampling B discards A’s pending results before a write replaces them.** In cachedTexture, the new candidate->SupersedeHandedOver() call clears A’s handed-over pending state as soon as B is selected for sampling. The scratch readback described above shows that a subsequent read of A’s backing memory, before B writes, no longer sees A’s results, whereas main preserves them. Please remove this call or demonstrate why this sequence is semantically allowed; add the read-after-sample assertion to SampledClear so this data-preservation case remains covered. 2. **The Unblocks entry lacks the required game bring-up discussion number.** It names PPSA26344 / Ghost of Yōtei but does not give the discussion reference required by the contribution template. Please add that discussion number or use Unblocks: none if this change does not directly unblock that title. ### Non-blocking - The added refresh condition makes every refresh with handOverKeys mark all tracked layers changed. A focused test should show why a repeated refresh with unchanged keys and unchanged handed-over writes requires another full GPU clear; otherwise consider narrowing or removing this behavior. - The SampledClear superseded-count assertion currently cannot distinguish supersession during sampling from the later write by B. The read-after-sample check above provides that missing distinction. - The report says a refresh may trigger a full GPU clear repeatedly while hand-over state persists. That cost is not benchmarked. ## Sources - [Sampled-texture path at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L835-L841) - [Handed-over supersession logic at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b51179f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L5758-L5774) - [SampledClear regression at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/f555ebfc360e48f3a35b511f053c1a79a30e7f/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp#L11325-L11375) - [Independent exact-head review and scratch evidence](https://github.com/boykopovar/AnyPS5/pull/9999#pullrequestreview-5692631616) - [Repository Unblocks checklist rule](https://github.com/boykopovar/AnyPS5/blob/52c09d567d2fa453494dd720fcf53a98149468e4/CONTRIBUTING.md#L60-L65) ## Not verified - I did not run the Vulkan tests or reproduce the scratch readback locally; that evidence is from the independent reviewer and is reported above as such. - Behavior on AMD/Intel GPUs, Windows, or console hardware was not verified here. ## To get this to a good state Remove or justify sample-time supersession, add the read-after-sample backing-memory assertion, and correct the Unblocks reference. Then rerun the focused storage/hand-over tests with validation enabled on the updated exact head.
XairRrR commented 2026-10-29 06:19:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T06:19:49Z.

Review: APPROVED


Re-checked — approved

The new commit d72cc8ca6a removes the sample-time SupersedeHandedOver() call and the || handOverKeys.has_value() refresh condition, and adds a read-after-sample check to SampledClear. That check fails when the old call is put back, and the focused tests pass under the Khronos validation layer with no VUID- lines.

What changed since my last review

  • The branch is rebased onto main 2960e9a6e7. git range-diff shows the first commit (112cb54942) is unchanged from the f555ebfc36 I reviewed.
  • New commit d72cc8ca6a "fix(agc): preserve pending results when sampling clears":
    • removes StorageTexture::SupersedeHandedOver() and its call in cachedTexture;
    • changes refresh() back to if (keys != uploadedKeys);
    • in SampledClear, reads A's memory after B is sampled and before B writes, and expects red;
    • changes the SampledClear supersede count from == 2 to == 1.
  • Description: Unblocks: none. Tested now reports Windows 11 / RX 5700 XT runs on main and on the head.
  • The author's reply on 2026-10-29 06:13 UTC lists these changes.

What I ran

  • PR head: d72cc8ca6a70205a4e1fe96eb1c107d540a73f95
  • main: 2960e9a6e7e1fc99c4ed180c71495b5eb83464c7
  • Merge of the head into main: clean (merge commit d76c1e8e9c469d2b623a516cead71bca408ad993)
  • Machine: Arch Linux 7.2.11-zen, GCC 16.2.1, Release, Ninja, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08). Builds and tests ran in a sandbox without network, in a clean worktree.
git fetch origin main pull/9999/head:refs/review/9999
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/9999
git range-diff 52c09d567d..f555ebfc36 origin/main..refs/review/9999
git diff --check origin/main...refs/review/9999
python3 tools/check_conventions.py --base origin/main
cmake --build build -j10 --target agc_driver_recorder_tests agc_driver_staged_clear_sampled_read_tests libs

# merged tree, then the same on origin/main (rebuilt there)
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
  ctest --test-dir build -R '^(agc_storage_clear_hand_over|agc_driver_staged_clear_sampled_read|agc_driver_staged_clear_sampled_read_draw_pipeline)$' -V -j4 --output-on-failure

# merged tree, wider set using the same test binary
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build -R '^agc_storage_' -j4 --timeout 120 --output-on-failure

# controls: each one rebuilds agc_driver_recorder_tests, runs agc_storage_clear_hand_over, then restores the merged files
git show d72cc8ca6a -- core/libs/prx/libSceAgcDriver/Graphics | git apply -R      # put back the sample-time supersede and the refresh condition
git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics                  # all production files from main
# ShaderResources.cpp, one change at a time:
#   drop `source->AnyLayerPending() &&` and the dccAddress equality from stagedClear
#   drop only `source->AnyLayerPending() &&` from stagedClear
#   delete the new source.reset() line at :818

Results

Check Result
Merge into current main Clean
git diff --check No output
tools/check_conventions.py --base origin/main All conventions checks passed.
Build (agc_driver_recorder_tests, agc_driver_staged_clear_sampled_read_tests, libs) OK
Focused tests, merged tree, validation layer 3/3 passed, 0 VUID- lines
Focused tests, main, validation layer 3/3 passed, 0 VUID- lines
Layer loaded Insert instance layer "VK_LAYER_KHRONOS_validation" in all 3 tests on both trees; no was not found but was requested by env var VK_INSTANCE_LAYERS
agc_storage_*, merged tree 11/11 passed
Sample-time supersede and refresh condition put back agc_storage_clear_hand_over fails on the new read-after-sample check
All production files from main agc_storage_clear_hand_over fails
stagedClear restriction removed, or only AnyLayerPending() removed agc_storage_clear_hand_over fails
Only ShaderResources.cpp:818 removed agc_storage_clear_hand_over passes (see Non-blocking 1)
Focused tests, merged tree
790: clear-key hand-over: ok
790: clear-key hand-over (watched): ok
1/3 Test  #790: agc_storage_clear_hand_over ..........................   Passed    0.39 sec
2/3 Test #1411: agc_driver_staged_clear_sampled_read .................   Passed    0.56 sec
3/3 Test #1525: agc_driver_staged_clear_sampled_read_draw_pipeline ...   Passed    0.56 sec
100% tests passed out of 3
grep -c "VUID-"                          -> 0
grep -c "was not found but was requested" -> 0
Focused tests, main
1/3 Test  #790: agc_storage_clear_hand_over ..........................   Passed    0.40 sec
2/3 Test #1411: agc_driver_staged_clear_sampled_read .................   Passed    0.57 sec
3/3 Test #1525: agc_driver_staged_clear_sampled_read_draw_pipeline ...   Passed    0.57 sec
100% tests passed out of 3
grep -c "VUID-"                          -> 0
grep -c "was not found but was requested" -> 0
Controls
# sample-time supersede and refresh condition put back
AGC graphics: clear-key hand-over (watched), B sampled under clear keys, on: reading A's memory after B was sampled, before B wrote, did not see A's results

# all production files from main
AGC graphics: clear-key hand-over (watched), B sampled under clear keys, on: B sampled under clear keys did not view B's cleared storage image

# stagedClear restriction removed / only AnyLayerPending() removed
AGC graphics: clear-key hand-over (watched), B sampled under clear keys, on: B sampled under clear keys did not view B's cleared storage image

# only ShaderResources.cpp:818 removed
1/1 Test #790: agc_storage_clear_hand_over ......   Passed    0.28 sec

Previous findings

  • Blocking 1, sampling B dropped A's pending results: Resolved. The call and the wrapper are gone. The new Recorder.cpp:11342 check passes on the merged tree. It fails when only this commit's production changes are reverted, so it catches the regression I reported.
  • Non-blocking 1, untested production changes: Resolved for both items. The supersede call and the refresh condition were removed. SampledClear now expects superseded == 1, which separates a drop at the sample from the drop at B's write.
  • Non-blocking 2, re-upload on every hand-over refresh: Resolved. The condition is removed, and the refresh() hunk is gone from the PR diff.
  • Non-blocking 3, Unblocks line: Resolved. It now reads Unblocks: none, which the template allows.

New findings

Blocking

None.

Non-blocking

  1. ShaderResources.cpp:818 has no test that fails without it. This line drops a pending source whose own DCC address differs from the sampled descriptor's when the keys read as a clear. The line is from the first commit and is not new in this push, but I had not tested it on its own before. With only this line deleted, agc_storage_clear_hand_over still passes. The other cachedTexture changes are covered (see Results). Please add a case in which FindPending returns an image with a different DCC address for a descriptor whose keys read as a clear, for example a SampledClear variant in which A is still pending over B's memory when B is sampled, and confirm that it fails with the line removed. Otherwise, explain in the description why the line is needed.
  2. Redundant condition. At Recorder.cpp:11374, && watched is always true, because the !watched branch above it ends in continue. You can drop it.

Not verified

  • Behaviour on AMD or Intel GPUs, and on Windows. I ran only on the NVIDIA host above. The RX 5700 XT runs in the description are author-reported.
  • Tests outside agc_storage_*, agc_driver_staged_clear_sampled_read and its _draw_pipeline variant. cachedTexture is on every sampled-texture path, and I did not run the wider AGC suite.
  • Whether this fixes #9860 in Ghost of Yōtei. I launched no title.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693644577 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9999#pullrequestreview-5693644577). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T06:19:49Z. **Review:** APPROVED --- # Re-checked — approved The new commit `d72cc8ca6a` removes the sample-time `SupersedeHandedOver()` call and the `|| handOverKeys.has_value()` refresh condition, and adds a read-after-sample check to `SampledClear`. That check fails when the old call is put back, and the focused tests pass under the Khronos validation layer with no `VUID-` lines. ## What changed since my last review - The branch is rebased onto `main` `2960e9a6e7`. `git range-diff` shows the first commit (`112cb54942`) is unchanged from the `f555ebfc36` I reviewed. - New commit `d72cc8ca6a` "fix(agc): preserve pending results when sampling clears": - removes `StorageTexture::SupersedeHandedOver()` and its call in `cachedTexture`; - changes `refresh()` back to `if (keys != uploadedKeys)`; - in `SampledClear`, reads A's memory after B is sampled and before B writes, and expects red; - changes the `SampledClear` supersede count from `== 2` to `== 1`. - Description: `Unblocks: none`. `Tested` now reports Windows 11 / RX 5700 XT runs on `main` and on the head. - The author's reply on 2026-10-29 06:13 UTC lists these changes. ## What I ran - PR head: `d72cc8ca6a70205a4e1fe96eb1c107d540a73f95` - `main`: `2960e9a6e7e1fc99c4ed180c71495b5eb83464c7` - Merge of the head into `main`: clean (merge commit `d76c1e8e9c469d2b623a516cead71bca408ad993`) - Machine: Arch Linux 7.2.11-zen, GCC 16.2.1, Release, Ninja, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08). Builds and tests ran in a sandbox without network, in a clean worktree. ```sh git fetch origin main pull/9999/head:refs/review/9999 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/9999 git range-diff 52c09d567d..f555ebfc36 origin/main..refs/review/9999 git diff --check origin/main...refs/review/9999 python3 tools/check_conventions.py --base origin/main cmake --build build -j10 --target agc_driver_recorder_tests agc_driver_staged_clear_sampled_read_tests libs # merged tree, then the same on origin/main (rebuilt there) VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \ ctest --test-dir build -R '^(agc_storage_clear_hand_over|agc_driver_staged_clear_sampled_read|agc_driver_staged_clear_sampled_read_draw_pipeline)$' -V -j4 --output-on-failure # merged tree, wider set using the same test binary ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build -R '^agc_storage_' -j4 --timeout 120 --output-on-failure # controls: each one rebuilds agc_driver_recorder_tests, runs agc_storage_clear_hand_over, then restores the merged files git show d72cc8ca6a -- core/libs/prx/libSceAgcDriver/Graphics | git apply -R # put back the sample-time supersede and the refresh condition git checkout origin/main -- core/libs/prx/libSceAgcDriver/Graphics # all production files from main # ShaderResources.cpp, one change at a time: # drop `source->AnyLayerPending() &&` and the dccAddress equality from stagedClear # drop only `source->AnyLayerPending() &&` from stagedClear # delete the new source.reset() line at :818 ``` ## Results | Check | Result | |---|---| | Merge into current `main` | Clean | | `git diff --check` | No output | | `tools/check_conventions.py --base origin/main` | `All conventions checks passed.` | | Build (`agc_driver_recorder_tests`, `agc_driver_staged_clear_sampled_read_tests`, `libs`) | OK | | Focused tests, merged tree, validation layer | 3/3 passed, 0 `VUID-` lines | | Focused tests, `main`, validation layer | 3/3 passed, 0 `VUID-` lines | | Layer loaded | `Insert instance layer "VK_LAYER_KHRONOS_validation"` in all 3 tests on both trees; no `was not found but was requested by env var VK_INSTANCE_LAYERS` | | `agc_storage_*`, merged tree | 11/11 passed | | Sample-time supersede and refresh condition put back | `agc_storage_clear_hand_over` **fails** on the new read-after-sample check | | All production files from `main` | `agc_storage_clear_hand_over` **fails** | | `stagedClear` restriction removed, or only `AnyLayerPending()` removed | `agc_storage_clear_hand_over` **fails** | | Only `ShaderResources.cpp:818` removed | `agc_storage_clear_hand_over` **passes** (see Non-blocking 1) | <details> <summary>Focused tests, merged tree</summary> ```text 790: clear-key hand-over: ok 790: clear-key hand-over (watched): ok 1/3 Test #790: agc_storage_clear_hand_over .......................... Passed 0.39 sec 2/3 Test #1411: agc_driver_staged_clear_sampled_read ................. Passed 0.56 sec 3/3 Test #1525: agc_driver_staged_clear_sampled_read_draw_pipeline ... Passed 0.56 sec 100% tests passed out of 3 grep -c "VUID-" -> 0 grep -c "was not found but was requested" -> 0 ``` </details> <details> <summary>Focused tests, main</summary> ```text 1/3 Test #790: agc_storage_clear_hand_over .......................... Passed 0.40 sec 2/3 Test #1411: agc_driver_staged_clear_sampled_read ................. Passed 0.57 sec 3/3 Test #1525: agc_driver_staged_clear_sampled_read_draw_pipeline ... Passed 0.57 sec 100% tests passed out of 3 grep -c "VUID-" -> 0 grep -c "was not found but was requested" -> 0 ``` </details> <details> <summary>Controls</summary> ```text # sample-time supersede and refresh condition put back AGC graphics: clear-key hand-over (watched), B sampled under clear keys, on: reading A's memory after B was sampled, before B wrote, did not see A's results # all production files from main AGC graphics: clear-key hand-over (watched), B sampled under clear keys, on: B sampled under clear keys did not view B's cleared storage image # stagedClear restriction removed / only AnyLayerPending() removed AGC graphics: clear-key hand-over (watched), B sampled under clear keys, on: B sampled under clear keys did not view B's cleared storage image # only ShaderResources.cpp:818 removed 1/1 Test #790: agc_storage_clear_hand_over ...... Passed 0.28 sec ``` </details> ## Previous findings - **Blocking 1, sampling B dropped A's pending results:** Resolved. The call and the wrapper are gone. The new [`Recorder.cpp:11342`](https://github.com/boykopovar/AnyPS5/blob/d72cc8ca6a70205a4e1fe96eb1c107d540a73f95/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp#L11340-L11343) check passes on the merged tree. It fails when only this commit's production changes are reverted, so it catches the regression I reported. - **Non-blocking 1, untested production changes:** Resolved for both items. The supersede call and the refresh condition were removed. `SampledClear` now expects `superseded == 1`, which separates a drop at the sample from the drop at B's write. - **Non-blocking 2, re-upload on every hand-over refresh:** Resolved. The condition is removed, and the `refresh()` hunk is gone from the PR diff. - **Non-blocking 3, Unblocks line:** Resolved. It now reads `Unblocks: none`, which the template allows. ## New findings ### Blocking None. ### Non-blocking 1. **`ShaderResources.cpp:818` has no test that fails without it.** [This line](https://github.com/boykopovar/AnyPS5/blob/d72cc8ca6a70205a4e1fe96eb1c107d540a73f95/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L818) drops a pending source whose own DCC address differs from the sampled descriptor's when the keys read as a clear. The line is from the first commit and is not new in this push, but I had not tested it on its own before. With only this line deleted, `agc_storage_clear_hand_over` still passes. The other `cachedTexture` changes are covered (see Results). Please add a case in which `FindPending` returns an image with a different DCC address for a descriptor whose keys read as a clear, for example a `SampledClear` variant in which A is still pending over B's memory when B is sampled, and confirm that it fails with the line removed. Otherwise, explain in the description why the line is needed. 2. **Redundant condition.** At [`Recorder.cpp:11374`](https://github.com/boykopovar/AnyPS5/blob/d72cc8ca6a70205a4e1fe96eb1c107d540a73f95/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp#L11369-L11374), `&& watched` is always true, because the `!watched` branch above it ends in `continue`. You can drop it. ## Not verified - Behaviour on AMD or Intel GPUs, and on Windows. I ran only on the NVIDIA host above. The RX 5700 XT runs in the description are author-reported. - Tests outside `agc_storage_*`, `agc_driver_staged_clear_sampled_read` and its `_draw_pipeline` variant. `cachedTexture` is on every sampled-texture path, and I did not run the wider AGC suite. - Whether this fixes #9860 in Ghost of Yōtei. I launched no title.
MarcZX10 commented 2026-10-29 06:38:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T06:38:06Z.

Review: APPROVED


Re-reviewed — approved

I reviewed exact head d72cc8ca6a70205a4e1fe96eb1c107d540a73f95 against current main 2960e9a6e7e1fc99c4ed180c71495b5eb83464c7.

What I ran

  • Inspected the current net diff in ShaderResources.cpp, Texture.cpp, and Recorder.cpp, including the new SampledClear order.
  • Ran git merge-tree --write-tree refs/remotes/upstream/main refs/review/upstream-9999; it returned clean tree 4fcf67dfc3ac67f4add0e16d361fcee9e8dfdb85.
  • Ran git diff --check refs/remotes/upstream/main...refs/review/upstream-9999; exit 0, no output.
  • I did not run a local C++ build or Vulkan tests.

Results

Check Result
Current-main merge preview Clean
Diff check Pass
Focused Vulkan tests Author reports 2/2 on baseline and exact head on Windows 11 / RX 5700 XT with validation enabled and no VUID- messages
Negative control Independent reviewer reports the read-after-sample assertion fails when the sample-time supersession is restored
Hosted checks Windows, conventions, eligibility, labels and report pass; Linux and specialized jobs are skipped

Negative control

I did not run a local control. The negative control above is reported by the independent reviewer on the exact head.

Findings

Blocking

None. The added read-after-sample assertion covers the data-loss case from my previous review, the supersession call and repeated-refresh condition are removed, and the Unblocks checklist now says none.

Non-blocking

The existing source-selection guard in ShaderResources.cpp that drops a mismatched-DCC source when the keys are clear still lacks an isolated test that fails when that guard is removed. This does not block approval of the fixed data-loss regression, but a focused negative control would make that branch easier to maintain.

Sources

Not verified

I did not independently run the C++ tests, Vulkan validation, Linux behavior, or a game title. The reported Windows GPU runs and negative control are attributed above to the author and independent reviewer.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693788815 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9999#pullrequestreview-5693788815). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T06:38:06Z. **Review:** APPROVED --- # Re-reviewed — approved I reviewed exact head `d72cc8ca6a70205a4e1fe96eb1c107d540a73f95` against current `main` `2960e9a6e7e1fc99c4ed180c71495b5eb83464c7`. ## What I ran - Inspected the current net diff in `ShaderResources.cpp`, `Texture.cpp`, and `Recorder.cpp`, including the new `SampledClear` order. - Ran `git merge-tree --write-tree refs/remotes/upstream/main refs/review/upstream-9999`; it returned clean tree `4fcf67dfc3ac67f4add0e16d361fcee9e8dfdb85`. - Ran `git diff --check refs/remotes/upstream/main...refs/review/upstream-9999`; exit 0, no output. - I did not run a local C++ build or Vulkan tests. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean | | Diff check | Pass | | Focused Vulkan tests | Author reports 2/2 on baseline and exact head on Windows 11 / RX 5700 XT with validation enabled and no `VUID-` messages | | Negative control | Independent reviewer reports the read-after-sample assertion fails when the sample-time supersession is restored | | Hosted checks | Windows, conventions, eligibility, labels and report pass; Linux and specialized jobs are skipped | ## Negative control I did not run a local control. The negative control above is reported by the independent reviewer on the exact head. ## Findings ### Blocking None. The added read-after-sample assertion covers the data-loss case from my previous review, the supersession call and repeated-refresh condition are removed, and the `Unblocks` checklist now says `none`. ### Non-blocking The existing source-selection guard in `ShaderResources.cpp` that drops a mismatched-DCC source when the keys are clear still lacks an isolated test that fails when that guard is removed. This does not block approval of the fixed data-loss regression, but a focused negative control would make that branch easier to maintain. ## Sources - [Sampled-texture source selection at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/d72cc8ca6a70205a4e1fe96eb1c107d540a73f95/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp) - [Storage refresh at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/d72cc8ca6a70205a4e1fe96eb1c107d540a73f95/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp) - [Clear hand-over regression at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/d72cc8ca6a70205a4e1fe96eb1c107d540a73f95/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp) - [Author's exact-head test report](https://github.com/boykopovar/AnyPS5/pull/9999#issuecomment-6487997915) - [Current contribution rules](https://github.com/boykopovar/AnyPS5/blob/2960e9a6e7e1fc99c4ed180c71495b5eb83464c7/CONTRIBUTING.md) ## Not verified I did not independently run the C++ tests, Vulkan validation, Linux behavior, or a game title. The reported Windows GPU runs and negative control are attributed above to the author and independent reviewer.
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!9999
No description provided.