fix(agc): stop false texture eviction notices during PPSA38500 story rendering on Windows #28620

Open
lgqdaxia wants to merge 2 commits from upstream-pr/28620 into main
lgqdaxia commented 2026-12-02 04:14:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by lgqdaxia on 2026-12-02T04:14:00Z.


What

PPSA38500 story rendering on Windows brought a stream of texture-release notifications to our attention. At the sampled texture cache budget, each lookup rejected by admission notified subscribers for the surface address. A freshly created wrapper has never been in the cache. A subscriber checking the same surface can therefore invalidate its own result.

Send the address notification when removing a byte-accounted entry that another owner still holds. A rejected wrapper keeps its released mark and still requests the resource-cache sweep. Guest writes and surface invalidation on a real eviction keep their existing behavior.

Related work in #12575 retains some rejected textures in a transient cache. Its full-cache fallback still emits the address notification. This change also preserves the eviction helper used by #25534.

Tested

Windows 11, NVIDIA GeForce RTX 3080 Laptop GPU, driver 621.14, Vulkan validation enabled. Both builds used the same test executable and a 1 MiB sampled-cache budget.

Case Main 68d65e6b14a0 Tested fix 874ce0a3fa90
Two rejected lookups against one subscribed surface 2 false release notices 0 false release notices
Evict a subsequently admitted texture with another owner Earlier assertion stopped the test Wrapper marked released and the subscriber notified
Existing resource-cache replacement test Passed Passed

Main reproduced the new assertion. Both focused tests passed on the candidate with zero skips and zero Vulkan validation errors. The final commit c34e8c01b4ea retains the existing two-argument eviction helper. Expanding its single call yields the tested production source. The tests are identical. The test exercises notification semantics. The effect on title frame times remains unmeasured.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: PPSA38500 #27523
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, driver 621.14, Windows 11
  • AI-assisted: yes

Summary by CodeRabbit

  • Bug Fixes

    • Improved texture handling when the cache is full, preventing rejected textures from triggering release notifications. Cache admission can resume in a later frame, and clearing cached textures continues to report releases as expected. These changes improve consistency in texture lifecycle handling across cache-full and cache-clearing scenarios.
  • Tests

    • Added checks for cache-full behavior, later cache admission, and release notifications when the cache is cleared.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5599704246 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28620). Originally posted by [lgqdaxia](https://github.com/lgqdaxia) on 2026-12-02T04:14:00Z. --- ### What PPSA38500 story rendering on Windows brought a stream of texture-release notifications to our attention. At the sampled texture cache budget, each lookup rejected by admission notified subscribers for the surface address. A freshly created wrapper has never been in the cache. A subscriber checking the same surface can therefore invalidate its own result. Send the address notification when removing a byte-accounted entry that another owner still holds. A rejected wrapper keeps its released mark and still requests the resource-cache sweep. Guest writes and surface invalidation on a real eviction keep their existing behavior. Related work in #12575 retains some rejected textures in a transient cache. Its full-cache fallback still emits the address notification. This change also preserves the eviction helper used by #25534. ### Tested <!-- 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. --> Windows 11, NVIDIA GeForce RTX 3080 Laptop GPU, driver 621.14, Vulkan validation enabled. Both builds used the same test executable and a 1 MiB sampled-cache budget. | Case | Main `68d65e6b14a0` | Tested fix `874ce0a3fa90` | | --- | --- | --- | | Two rejected lookups against one subscribed surface | 2 false release notices | 0 false release notices | | Evict a subsequently admitted texture with another owner | Earlier assertion stopped the test | Wrapper marked released and the subscriber notified | | Existing resource-cache replacement test | Passed | Passed | Main reproduced the new assertion. Both focused tests passed on the candidate with zero skips and zero Vulkan validation errors. The final commit `c34e8c01b4ea` retains the existing two-argument eviction helper. Expanding its single call yields the tested production source. The tests are identical. The test exercises notification semantics. The effect on title frame times remains unmeasured. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: PPSA38500 #27523 - [x] GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, driver 621.14, Windows 11 - [x] AI-assisted: yes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved texture handling when the cache is full, preventing rejected textures from triggering release notifications. Cache admission can resume in a later frame, and clearing cached textures continues to report releases as expected. These changes improve consistency in texture lifecycle handling across cache-full and cache-clearing scenarios. * **Tests** * Added checks for cache-full behavior, later cache admission, and release notifications when the cache is cleared. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-12-02 04:32:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T04:32:44Z.

Review: APPROVED


Reviewed — looks good

The reviewed changes preserve release notifications for evicted cached textures while preventing rejected textures from notifying subscribers; no blocking defects were found.

What I ran

Reviewed head c34e8c01b4ea4b7b7435eec2def92c4c3c3ba5b3 using repo_read.py to inspect the changed hunks and relevant cache eviction, clearing, and subscription code. No tests or builds were run. The author reports focused tests passed on Windows 11 with an NVIDIA GeForce RTX 3080 Laptop GPU; I did not independently verify those results.

Results

Check Result Note
Changed code review passed Both changed files inspected in relevant sections
Tests not run Author-reported results only
Build not run Not needed for this review

Negative control

Not run; no test or code modification was made to verify that the added test fails against the old behavior.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

The full text of ShaderResources.cpp was not included in the review folder; I inspected the changed lines and relevant eviction and clearing code through repo_read.py. No files were excluded by the manifest rules. The reported Windows/Vulkan test results and title frame-time effect were not independently verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6144800277 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28620#pullrequestreview-6144800277). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-12-02T04:32:44Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed changes preserve release notifications for evicted cached textures while preventing rejected textures from notifying subscribers; no blocking defects were found. ## What I ran Reviewed head `c34e8c01b4ea4b7b7435eec2def92c4c3c3ba5b3` using `repo_read.py` to inspect the changed hunks and relevant cache eviction, clearing, and subscription code. No tests or builds were run. The author reports focused tests passed on Windows 11 with an NVIDIA GeForce RTX 3080 Laptop GPU; I did not independently verify those results. ## Results | Check | Result | Note | | --- | --- | --- | | Changed code review | passed | Both changed files inspected in relevant sections | | Tests | not run | Author-reported results only | | Build | not run | Not needed for this review | ## Negative control Not run; no test or code modification was made to verify that the added test fails against the old behavior. ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [ShaderResources.cpp at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/c34e8c01b4ea4b7b7435eec2def92c4c3c3ba5b3/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp) - [SampledCacheBudget.cpp at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/c34e8c01b4ea4b7b7435eec2def92c4c3c3ba5b3/core/libs/prx/libSceAgcDriver/tests/execution/SampledCacheBudget.cpp) ## Not verified The full text of `ShaderResources.cpp` was not included in the review folder; I inspected the changed lines and relevant eviction and clearing code through `repo_read.py`. No files were excluded by the manifest rules. The reported Windows/Vulkan test results and title frame-time effect were not independently verified. ## To get this to a good state Nothing is required.
Plyxen commented 2026-12-03 06:04:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T06:04:42Z.

Review: APPROVED


I read the diff at c34e8c01b4. Windows 11, GCC 15.2, merged into main at cf556db18c3 together with other open PRs (so not an isolated build), with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 and VK_LAYER_KHRONOS_validation on an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).

  • the 29 tests of agc_driver_sampled_cache_budget_tests: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has a VUID- or SYNC-HAZARD line.
  • Control (same tree and tests, the changed files of those PRs put back to main's): agc_driver_sampled_cache_budget, _no_snapshot_digest and _without_storage_image_multisample fail on both GPUs: "two refused texture lookups sent 2 release notices to the surface subscriber".

Not checked: PPSA38500 itself.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6164489114 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28620#pullrequestreview-6164489114). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-12-03T06:04:42Z. **Review:** APPROVED --- I read the diff at `c34e8c01b4`. Windows 11, GCC 15.2, merged into `main` at `cf556db18c3` together with other open PRs (so not an isolated build), with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1` and `VK_LAYER_KHRONOS_validation` on an RTX 5080 (621.24) and a Radeon iGPU (26.11.2). - the 29 tests of `agc_driver_sampled_cache_budget_tests`: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has a `VUID-` or `SYNC-HAZARD` line. - Control (same tree and tests, the changed files of those PRs put back to `main`'s): `agc_driver_sampled_cache_budget`, `_no_snapshot_digest` and `_without_storage_image_multisample` fail on both GPUs: "two refused texture lookups sent 2 release notices to the surface subscriber". Not checked: PPSA38500 itself. AI-assisted: yes (Claude Code)
ligmaSec commented 2026-12-03 19:12:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T19:12:52Z.

Review: COMMENTED


Source review at c34e8c01b4. An admission refusal still marks the wrapper released and requests the resource sweep. The change removes the address notification from that path, and the fixture checks that evicting an admitted entry still notifies the same subscriber. On Linux lavapipe, agc_driver_sampled_cache_budget, agc_driver_resource_cache_replaced_texture and the scalar-buffer control all passed on main a9cbd48cb0 and this head. Both logs show Khronos validation 1.4.369 inserted with zero missing-layer warnings and zero VUIDs.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6176664271 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28620#pullrequestreview-6176664271). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T19:12:52Z. **Review:** COMMENTED --- Source review at `c34e8c01b4`. An admission refusal still marks the wrapper released and requests the resource sweep. The change removes the address notification from that path, and the fixture checks that evicting an admitted entry still notifies the same subscriber. On Linux lavapipe, `agc_driver_sampled_cache_budget`, `agc_driver_resource_cache_replaced_texture` and the scalar-buffer control all passed on main `a9cbd48cb0` and this head. Both logs show Khronos validation 1.4.369 inserted with zero missing-layer warnings and zero VUIDs. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/28620:upstream-pr/28620'
git switch 'upstream-pr/28620'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/28620'
git switch 'upstream-pr/28620'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/28620'
git switch 'upstream-pr/28620'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/28620'
git switch 'main'
git merge --squash 'upstream-pr/28620'
git switch 'main'
git merge --ff-only 'upstream-pr/28620'
git switch 'main'
git merge 'upstream-pr/28620'
git push origin 'main'
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!28620
No description provided.