fix(agc): track CPU writes in partly watched depth planes #11692

Merged
JJenkx merged 9 commits from upstream-pr/11692 into main 2026-10-28 14:54:52 +00:00
JJenkx commented 2026-10-27 03:18:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-27T03:18:32Z.


What

A depth plane can contain fully watched units, partly watched units and pages excluded from write tracking. A failed whole-plane scan previously left CPU-repurposed bytes vulnerable to a stale depth store. WrittenUnits now retries whole units first, then page-aligned fragments inside partly watched units. Writes in covered pages invalidate that depth unit; genuinely unwatched pages keep the existing behavior. Initial covered pages are collected before recording their generation, including for single-unit surfaces.

Regressions cover both a wholly unwatched neighboring unit and a 4 KiB hole inside the descriptor's own 64 KiB unit. They write CPU descriptors after a depth draw and check descriptor preservation plus GPU depth retained in an untouched unit. On Windows, where Unwatch excludes whole 64 KiB blocks, the within-unit case instead unwatches the unit and returns only the descriptor page with the page-granular Rewatch, so the unit is partly watched there too (c581723557, after maskym's Windows run).

Built on #11690; merge it first. Shared-fixture overlap with #11685 is the same argument/include addition discussed there; retain its --buffer-copy mode alongside all CPU-write modes. No dependency on its direct-copy implementation.

Tested

Current-main refresh, 2026-10-27 10:18 UTC pass: exact head 1646ca2842119411060c4db6304e47dd18a21fd8 on main 3fea2a937ba9fbab2f06c51691fe0c5763659aa3. Five child topic commits remain stacked on refreshed #11690. The existing within-unit page-coverage correction and its regression are preserved exactly; no genuinely unwatched page is falsely marked written. All submodule pointers match that main.

Linux Release, RX 6650 XT/RADV Mesa 26.2.4, required Vulkan and shader caches disabled. Matched main passes all three existing controls three times (9 passes). Candidate passes six groups × three repetitions (18 passes), then 18 after restoration. The exact within-unit page-hole case additionally passes three times with APS5_NO_DIRECT_DEPTH_COPY=1. Replacing only production with its pre-page-correction parent fails exactly that page-hole case; the other five controls pass. That negative control uses normal mode; the forced-buffer variant is a positive qualification, not a separate negative control. The within-unit regression places a 4 KiB unwatched hole and CPU descriptors in an adjacent watched page of the same 64 KiB unit, checking descriptor preservation and retained GPU depth.

Every individual physical execution proves RX 6650 XT selection and actual Khronos instance/device-layer insertion; zero skips, VUIDs or missing-layer failures. Restored production source matches the candidate, and the rebuilt AGC driver is byte-identical to its initial candidate. The forced-buffer setting is recorded in the executed harness/process environment and linked to the startup flag; CTest does not print every inherited variable. Conventions and whitespace pass. This is synthetic GPU regression evidence, without a new title, console, Windows or performance run. Earlier contributor results retain their original exact pins.

Exact source/dependency pins, initial/negative/restored raw logs and JUnit, forced-buffer receipt, independent reviews, hashes and service-owned FIFO/PTY receipts. SHA-256: 4787a341e92b9f1764de6e6bc11f7ae5af8d8e21ff5c75f8f71483c60742d798; downloaded copy verified.

Independent validation by jotitadev of the earlier head 949306303c on main b986c11a34: RTX 3070 / NVIDIA 595.99.02 and lavapipe / Mesa 26.0.3. The four-test main/test-only arm passes 2/4, adding #11690 passes 3/4, and the full earlier head passes 4/4 on both devices. This confirms the original per-unit fallback; it does not validate the subsequent within-unit page-hole revision f3e7f47391c, whose author-run RADV evidence is reported above.

Latest reviewer follow-up: exact final head f3e7f47391c passes all five depth-plane tests on Linux / Radeon RX6650XT / RADV Mesa26.2.4 with real Khronos validation in every process, zero VUIDs, no missing layer and no skips. Before the fix, the new within-unit page-hole regression failed while the four existing controls passed; that baseline's production DepthSurface.cpp is identical to reviewed head 949306303cd. Paired logs, full commit IDs and follow-up patch. Native follow-up: main fe2b52c7e43 plus this page fix and the published Bendy prerequisites (#11690, #11704, #6782, #6913), private head d53a4b60cc1, passes16 focused gates and reloads the standing room with camera input into the doorway view; ordinary native exit0, no VUIDs, all writable state restored. Native evidence and reproducible composition. No FPS gain, later-gameplay or audio claim.

Earlier qualification:

Arch Linux; AMD Radeon RX 6650 XT, Mesa RADV 26.2.4-1. Four identical focused GPU tests on the same GPU/build setup, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and ctest -V:

  • Main abed0354680 plus the two new regressions (e96256dade0): existing default/unimported controls pass; memo and partial-watch regressions fail (2/4 pass).
  • #11690 plus the regressions (5325ea8e726): memo and existing controls pass; partial-watch regression still fails (3/4 pass).
  • This branch (949306303cd): all4 pass, including preservation of untouched GPU depth.

Every arm has four actual Khronos insertions, zero VUIDs, no missing layer and no skipped tests. Selection:

ctest --test-dir build -R '^(agc_driver_depth_plane_partial_store|agc_driver_depth_plane_partial_store_unimported|agc_driver_depth_plane_cpu_write_after_memo|agc_driver_depth_plane_cpu_write_after_partial_unwatch)$' -V

tools/check_conventions.py --base origin/main --head codex/depth-partial-watch-20261027 passes; tools/pr_overlap.py --branch codex/depth-partial-watch-20261027 was run and shared depth-source changes were checked for duplicates. Windows/other GPU vendors not tested. No FPS or loading-speed claim.

Bendy and the Dark Revival PPSA27624 v01.000.003: the frozen diagnostic integration at 6e6be0d8c4d still exited134 after a fresh whole-plane collect returned0 and a watched unit was overwritten. With this fallback, the same integration becomes e40e6a67284: the probe confirms planeWatch=0 and rangeWatch=1, observes a newer stamp after the per-unit scan, drops that unit from stale depth stores, and preserves its bytes unchanged. The game reaches the rendered opening desk cutscene (screenshot at140s), then closes normally at150s with native exit0; native Khronos active, zero VUIDs, all saves/config/kernel state restored, no remaining processes. Four GPU prerequisite tests also pass with no skips/VUIDs. This native comparison uses the earlier e2d457be345 base, #6782, #6913 and bounded private diagnostics on both arms; the focused four-test comparison above uses current fetched main abed0354680. Gameplay, audio and console-reference graphics equivalence are unverified.

Paired GPU logs, patch, native source pins and cutscene screenshot, SHA256 933e6f14ac3d3249ca96c96187e3a3c0c0d3d3ff2a628af243238938900e764f. Raw memory, game requests, shaders and saves excluded.

Latest-main native qualification: main abed0354680 plus #11690/#11692/#6782/#6913 (26cde7116e2), with no private source diagnostics and fresh eboot/seven-module conversion, passes8/8 GPU checks (five actual Khronos insertions, no skips/VUIDs). The native game renders the intro, shows the Square Stand prompt, accepts Square and reaches the standing first-person view. A later camera/movement input reaches a different guard, AGC graphics: multisampled DCC fast clear has no exact host value, and exits134 at459.73s. This is not a complete gameplay pass; displacement after that input was not visually verified. Native validation remains clean and all state is restored with no leftover processes.

Current-main native pins, GPU log, input actions and standing screenshot, SHA256 55c85a1ae1769d7337ac0210e085218bb97d01d51f3c0baf683ac4f4108bbc8c. No FPS/audio/console-reference graphics claim.

Independent current-head Windows/NVIDIA verification from maskym: 771dbdfec2 plus #11948 merged onto main a13ee2ddd1, Windows 11 26300, RTX 2070 SUPER (NVIDIA 621.01), WinLibs GCC 15.2/UCRT Release. All 11 depth-plane tests passed twice, including page/partial-unwatch and memoized-collect cases; the loader confirmed Khronos validation on every run, with no missing-layer message or VUID. This is contributor-reported evidence for that composition, not a new local or PS5 run.

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 (#11690 merged at a00e826a277a; included in main snapshot 2227f136618)
  • Fixes: none
  • Unblocks: PPSA27624 #10154
  • GPUs tested: AMD Radeon RX 6650 XT, Mesa RADV 26.2.4-1, Arch Linux
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5028044179 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11692). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-27T03:18:32Z. --- ### What A depth plane can contain fully watched units, partly watched units and pages excluded from write tracking. A failed whole-plane scan previously left CPU-repurposed bytes vulnerable to a stale depth store. `WrittenUnits` now retries whole units first, then page-aligned fragments inside partly watched units. Writes in covered pages invalidate that depth unit; genuinely unwatched pages keep the existing behavior. Initial covered pages are collected before recording their generation, including for single-unit surfaces. Regressions cover both a wholly unwatched neighboring unit and a 4 KiB hole inside the descriptor's own 64 KiB unit. They write CPU descriptors after a depth draw and check descriptor preservation plus GPU depth retained in an untouched unit. On Windows, where `Unwatch` excludes whole 64 KiB blocks, the within-unit case instead unwatches the unit and returns only the descriptor page with the page-granular `Rewatch`, so the unit is partly watched there too (`c581723557`, after maskym's Windows run). Built on #11690; merge it first. Shared-fixture overlap with #11685 is the same argument/include addition discussed there; retain its `--buffer-copy` mode alongside all CPU-write modes. No dependency on its direct-copy implementation. ### Tested <!-- codex-main-refresh-20261027-1018-pr11692 --> **Current-main refresh, 2026-10-27 10:18 UTC pass:** exact head `1646ca2842119411060c4db6304e47dd18a21fd8` on main `3fea2a937ba9fbab2f06c51691fe0c5763659aa3`. Five child topic commits remain stacked on refreshed #11690. The existing within-unit page-coverage correction and its regression are preserved exactly; no genuinely unwatched page is falsely marked written. All submodule pointers match that main. Linux Release, RX 6650 XT/RADV Mesa 26.2.4, required Vulkan and shader caches disabled. Matched main passes all three existing controls three times (9 passes). Candidate passes six groups × three repetitions (18 passes), then 18 after restoration. The exact within-unit page-hole case additionally passes three times with APS5_NO_DIRECT_DEPTH_COPY=1. Replacing only production with its pre-page-correction parent fails exactly that page-hole case; the other five controls pass. That negative control uses normal mode; the forced-buffer variant is a positive qualification, not a separate negative control. The within-unit regression places a 4 KiB unwatched hole and CPU descriptors in an adjacent watched page of the same 64 KiB unit, checking descriptor preservation and retained GPU depth. Every individual physical execution proves RX 6650 XT selection and actual Khronos instance/device-layer insertion; zero skips, VUIDs or missing-layer failures. Restored production source matches the candidate, and the rebuilt AGC driver is byte-identical to its initial candidate. The forced-buffer setting is recorded in the executed harness/process environment and linked to the startup flag; CTest does not print every inherited variable. Conventions and whitespace pass. This is synthetic GPU regression evidence, without a new title, console, Windows or performance run. Earlier contributor results retain their original exact pins. [Exact source/dependency pins, initial/negative/restored raw logs and JUnit, forced-buffer receipt, independent reviews, hashes and service-owned FIFO/PTY receipts](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/pr11690-74866179-pr11692-1646ca28-main3fea-linux-20261027-1018.tar.gz). SHA-256: `4787a341e92b9f1764de6e6bc11f7ae5af8d8e21ff5c75f8f71483c60742d798`; downloaded copy verified. Independent validation by [jotitadev](https://github.com/boykopovar/AnyPS5/pull/11692#pullrequestreview-5662475626) of the earlier head `949306303c` on main `b986c11a34`: RTX 3070 / NVIDIA 595.99.02 and lavapipe / Mesa 26.0.3. The four-test main/test-only arm passes 2/4, adding #11690 passes 3/4, and the full earlier head passes 4/4 on both devices. This confirms the original per-unit fallback; it does not validate the subsequent within-unit page-hole revision `f3e7f47391c`, whose author-run RADV evidence is reported above. Latest reviewer follow-up: exact final head `f3e7f47391c` passes all five depth-plane tests on Linux / Radeon RX6650XT / RADV Mesa26.2.4 with real Khronos validation in every process, zero VUIDs, no missing layer and no skips. Before the fix, the new within-unit page-hole regression failed while the four existing controls passed; that baseline's production `DepthSurface.cpp` is identical to reviewed head `949306303cd`. [Paired logs, full commit IDs and follow-up patch](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/depth-partial-page-linux-20261027.tar.gz). Native follow-up: main `fe2b52c7e43` plus this page fix and the published Bendy prerequisites (#11690, #11704, #6782, #6913), private head `d53a4b60cc1`, passes16 focused gates and reloads the standing room with camera input into the doorway view; ordinary native exit0, no VUIDs, all writable state restored. [Native evidence and reproducible composition](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/bendy-page-native-fe2b-linux-20261027.tar.gz). No FPS gain, later-gameplay or audio claim. Earlier qualification: Arch Linux; AMD Radeon RX 6650 XT, Mesa RADV 26.2.4-1. Four identical focused GPU tests on the same GPU/build setup, with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `ctest -V`: - Main `abed0354680` plus the two new regressions (`e96256dade0`): existing default/unimported controls pass; memo and partial-watch regressions fail (2/4 pass). - #11690 plus the regressions (`5325ea8e726`): memo and existing controls pass; partial-watch regression still fails (3/4 pass). - This branch (`949306303cd`): all4 pass, including preservation of untouched GPU depth. Every arm has four actual Khronos insertions, zero VUIDs, no missing layer and no skipped tests. Selection: ```sh ctest --test-dir build -R '^(agc_driver_depth_plane_partial_store|agc_driver_depth_plane_partial_store_unimported|agc_driver_depth_plane_cpu_write_after_memo|agc_driver_depth_plane_cpu_write_after_partial_unwatch)$' -V ``` `tools/check_conventions.py --base origin/main --head codex/depth-partial-watch-20261027` passes; `tools/pr_overlap.py --branch codex/depth-partial-watch-20261027` was run and shared depth-source changes were checked for duplicates. Windows/other GPU vendors not tested. No FPS or loading-speed claim. Bendy and the Dark Revival PPSA27624 v01.000.003: the frozen diagnostic integration at `6e6be0d8c4d` still exited134 after a fresh whole-plane collect returned0 and a watched unit was overwritten. With this fallback, the same integration becomes `e40e6a67284`: the probe confirms `planeWatch=0` and `rangeWatch=1`, observes a newer stamp after the per-unit scan, drops that unit from stale depth stores, and preserves its bytes unchanged. The game reaches the rendered opening desk cutscene (screenshot at140s), then closes normally at150s with native exit0; native Khronos active, zero VUIDs, all saves/config/kernel state restored, no remaining processes. Four GPU prerequisite tests also pass with no skips/VUIDs. This native comparison uses the earlier `e2d457be345` base, #6782, #6913 and bounded private diagnostics on both arms; the focused four-test comparison above uses current fetched main `abed0354680`. Gameplay, audio and console-reference graphics equivalence are unverified. [Paired GPU logs, patch, native source pins and cutscene screenshot](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/depth-partial-watch-linux-20261027.tar.gz), SHA256 `933e6f14ac3d3249ca96c96187e3a3c0c0d3d3ff2a628af243238938900e764f`. Raw memory, game requests, shaders and saves excluded. <!-- 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. --> **Latest-main native qualification:** main `abed0354680` plus #11690/#11692/#6782/#6913 (`26cde7116e2`), with no private source diagnostics and fresh eboot/seven-module conversion, passes8/8 GPU checks (five actual Khronos insertions, no skips/VUIDs). The native game renders the intro, shows the Square **Stand** prompt, accepts Square and reaches the standing first-person view. A later camera/movement input reaches a different guard, `AGC graphics: multisampled DCC fast clear has no exact host value`, and exits134 at459.73s. This is not a complete gameplay pass; displacement after that input was not visually verified. Native validation remains clean and all state is restored with no leftover processes. [Current-main native pins, GPU log, input actions and standing screenshot](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/bendy-main-stand-linux-20261027.tar.gz), SHA256 `55c85a1ae1769d7337ac0210e085218bb97d01d51f3c0baf683ac4f4108bbc8c`. No FPS/audio/console-reference graphics claim. Independent current-head Windows/NVIDIA verification from [maskym](https://github.com/boykopovar/AnyPS5/pull/11692#issuecomment-6464587464): `771dbdfec2` plus #11948 merged onto main `a13ee2ddd1`, Windows 11 26300, RTX 2070 SUPER (NVIDIA 621.01), WinLibs GCC 15.2/UCRT Release. All 11 depth-plane tests passed twice, including page/partial-unwatch and memoized-collect cases; the loader confirmed Khronos validation on every run, with no missing-layer message or VUID. This is contributor-reported evidence for that composition, not a new local or PS5 run. ### 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 (#11690 merged at `a00e826a277a`; included in main snapshot `2227f136618`) - [x] Fixes: none - [x] Unblocks: PPSA27624 #10154 - [x] GPUs tested: AMD Radeon RX 6650 XT, Mesa RADV 26.2.4-1, Arch Linux - [x] AI-assisted: yes
jotitadev commented 2026-10-27 05:08:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T05:08:48Z.

Review: COMMENTED


Linux run on NVIDIA and lavapipe, since the description covers RADV only. Head 949306303c on main b986c11a34 (patch applies cleanly). Ubuntu 26.04, GCC 15.2, Release. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, -j1. lavapipe selected with VK_ICD_FILENAMES=.../lvp_icd.json.

The four tests from the description, in the same three arms:

RTX 3070 (NVIDIA 595.99.02) lavapipe (Mesa 26.0.3)
main + the two new tests only 2/4: cpu_write_after_memo and cpu_write_after_partial_unwatch fail (a depth flush overwrote CPU descriptors written after a memoized collect) 2/4, same two
+ #11690's DepthSurface.cpp line 3/4: cpu_write_after_partial_unwatch still fails 3/4, same
this head 4/4 4/4

This matches the RADV result: the per-unit fallback is what fixes the partial-watch case, and #11690 alone does not.

Full ^agc suite (without agc_display_buffer_dcc, agc_driver_flip, agc_driver_lds_atomics64, --timeout 30) with #11692 and #11691 applied together on main: 1041/1042 on both devices. The one failure on each also fails on unmodified main on this machine, with the same message: agc_driver_pipeline_journal on the 3070 (the oversized record was not counted as a write failure; it passes when only the NVIDIA ICD is visible), and agc_driver_multisample_retirement on lavapipe (MSAA storage promotion did not retain its source image).

GPUs tested: NVIDIA GeForce RTX 3070 (proprietary 595.99.02, Linux), lavapipe (Mesa 26.0.3, LLVM 21).

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5662475626 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11692#pullrequestreview-5662475626). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-27T05:08:48Z. **Review:** COMMENTED --- Linux run on NVIDIA and lavapipe, since the description covers RADV only. Head `949306303c` on `main` `b986c11a34` (patch applies cleanly). Ubuntu 26.04, GCC 15.2, Release. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, `-j1`. lavapipe selected with `VK_ICD_FILENAMES=.../lvp_icd.json`. The four tests from the description, in the same three arms: | | RTX 3070 (NVIDIA 595.99.02) | lavapipe (Mesa 26.0.3) | |---|---|---| | `main` + the two new tests only | 2/4: `cpu_write_after_memo` and `cpu_write_after_partial_unwatch` fail (`a depth flush overwrote CPU descriptors written after a memoized collect`) | 2/4, same two | | + #11690's `DepthSurface.cpp` line | 3/4: `cpu_write_after_partial_unwatch` still fails | 3/4, same | | this head | 4/4 | 4/4 | This matches the RADV result: the per-unit fallback is what fixes the partial-watch case, and #11690 alone does not. Full `^agc` suite (without `agc_display_buffer_dcc`, `agc_driver_flip`, `agc_driver_lds_atomics64`, `--timeout 30`) with #11692 and #11691 applied together on `main`: 1041/1042 on both devices. The one failure on each also fails on unmodified `main` on this machine, with the same message: `agc_driver_pipeline_journal` on the 3070 (`the oversized record was not counted as a write failure`; it passes when only the NVIDIA ICD is visible), and `agc_driver_multisample_retirement` on lavapipe (`MSAA storage promotion did not retain its source image`). GPUs tested: NVIDIA GeForce RTX 3070 (proprietary 595.99.02, Linux), lavapipe (Mesa 26.0.3, LLVM 21). Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-27 05:27:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T05:27:05Z.

Review: DISMISSED


Reviewed 949306303cd7b7ed30e1ff62678d552dea941e4a. Changes requested for one remaining partial-coverage case.

[P2] Preserve writes in the watched pages of a partly watched unit — DepthSurface.cpp, DepthSurface::WrittenUnits. The fallback retries each unitBytes region as one collection. Write-watch coverage is page-granular: GuestMemory::Unwatch accepts page-sized ranges, and GuestWriteWatch::Watch::Collect rejects a range unless its entire span is covered (takeFresh(..., whole=true))). If a 4 KiB page is unwatched inside a 64 KiB depth unit, the plane scan fails and the retry for that unit also returns 0, even when the CPU-written descriptor is in an adjacent page that remains watched. Because the fallback only calls WrittenSince` when the retry returns nonzero, that CPU write is not marked changed and a subsequent stale depth store can overwrite it.

Please scan the covered page/runs within each unit (preserving the existing behavior for genuinely unwatched ranges) and add a regression that unwatches one page within a unit, writes CPU descriptors into a still-watched page in that same unit, then verifies both descriptor preservation and retained GPU depth. The current test excludes a whole unit, so it does not exercise this case.

This finding is based on the current write-watch coverage/collection implementation and the reviewed fallback path; I did not independently run the GPU reproduction in this environment.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5662608270 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11692#pullrequestreview-5662608270). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T05:27:05Z. **Review:** DISMISSED --- Reviewed `949306303cd7b7ed30e1ff62678d552dea941e4a`. Changes requested for one remaining partial-coverage case. **[P2] Preserve writes in the watched pages of a partly watched unit — `DepthSurface.cpp`, `DepthSurface::WrittenUnits`.** The fallback retries each `unitBytes` region as one collection. Write-watch coverage is page-granular: `GuestMemory::Unwatch` accepts page-sized ranges, and `GuestWriteWatch::Watch::Collect` rejects a range unless its entire span is covered (`takeFresh(..., whole=true))). If a 4 KiB page is unwatched inside a 64 KiB depth unit, the plane scan fails and the retry for that unit also returns 0, even when the CPU-written descriptor is in an adjacent page that remains watched. Because the fallback only calls `WrittenSince` when the retry returns nonzero, that CPU write is not marked changed and a subsequent stale depth store can overwrite it. Please scan the covered page/runs within each unit (preserving the existing behavior for genuinely unwatched ranges) and add a regression that unwatches one page within a unit, writes CPU descriptors into a still-watched page in that same unit, then verifies both descriptor preservation and retained GPU depth. The current test excludes a whole unit, so it does not exercise this case. This finding is based on the current write-watch coverage/collection implementation and the reviewed fallback path; I did not independently run the GPU reproduction in this environment.
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!11692
No description provided.