fix(agc): materialise cold DCC colour before tracking #20534

Merged
VicRaster merged 2 commits from upstream-pr/20534 into main 2026-11-28 04:03:29 +00:00
VicRaster commented 2026-11-15 09:00:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by VicRaster on 2026-11-15T09:00:20Z.


What

An overlapping ImportWatched window can first-touch demand-zero colour pages after a resident multisample DCC owner has captured its write generation. On Windows those page faults appear in write-watch reports, so the later reuse refuses the unchanged colour range as a guest write.

Materialise known-zero DCC planes before collecting their initial generations. The regression creates a native owner over untouched colour pages, checks its samples across an overlapping import and an adjacent store, and verifies that real zero and nonzero stores still refuse, at 2, 4 and 8 samples.

Tested

  • Windows 11, WinLibs GCC 15.2, Release; NVIDIA RTX 3080 Ti, driver 610.88. Khronos validation 1.4.363, Vulkan-Headers 1.4.335.
  • Upstream base 324dc5aae57113ce9ed9fa707eb2ef0814eb76dc with only the regression: 17 passed, 3 existing Windows compared-import skips, and exactly the 3 new cold-colour cases fail at the resident-DCC colour refusal.
  • With the fix: 20 passed, the same 3 skips, no failures. Both runs use ctest --test-dir build -R 'fmask|msaa_dcc|cold_texture_dcc|native_color_initial' -V with required Vulkan, disabled shader cache and the validation layer. Both logs contain 22 actual layer insertions, no missing-layer warning, zero VUIDs and zero validation errors. The Windows test-directory driver copy was selected explicitly.
  • Publication parent: cb54da2875cfb2159085ecf5d73a6ffdae94b96a. The three changed file blobs match the tested candidate; the AGC, shader and third-party sources are unchanged since the tested base above.
  • Separate local integration stack: all 16 focused cases pass; repeated offline launches pass the former refusal and stop later in HTTP/2 after 2 frames. This does not establish menus or gameplay. Not run on Linux or macOS.
  • The conventions, test-registration and debt checks are recorded with the local evidence. Function and branch overlap CLI queries could not reach the GitHub API; connected searches and actual diff/dependency review covered the relevant existing work, including #8172, #9940, #9941, #16483, #13963, #10049 and #20084. No suitable existing fix was found for this first-touch sequence in the sources checked.

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: none
  • GPUs tested: NVIDIA RTX 3080 Ti, driver 610.88, Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5321184575 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20534). Originally posted by [VicRaster](https://github.com/VicRaster) on 2026-11-15T09:00:20Z. --- ### What An overlapping `ImportWatched` window can first-touch demand-zero colour pages after a resident multisample DCC owner has captured its write generation. On Windows those page faults appear in write-watch reports, so the later reuse refuses the unchanged colour range as a guest write. Materialise known-zero DCC planes before collecting their initial generations. The regression creates a native owner over untouched colour pages, checks its samples across an overlapping import and an adjacent store, and verifies that real zero and nonzero stores still refuse, at 2, 4 and 8 samples. ### 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, WinLibs GCC 15.2, Release; NVIDIA RTX 3080 Ti, driver 610.88. Khronos validation 1.4.363, Vulkan-Headers 1.4.335. - Upstream base `324dc5aae57113ce9ed9fa707eb2ef0814eb76dc` with only the regression: 17 passed, 3 existing Windows compared-import skips, and exactly the 3 new cold-colour cases fail at the resident-DCC colour refusal. - With the fix: 20 passed, the same 3 skips, no failures. Both runs use `ctest --test-dir build -R 'fmask|msaa_dcc|cold_texture_dcc|native_color_initial' -V` with required Vulkan, disabled shader cache and the validation layer. Both logs contain 22 actual layer insertions, no missing-layer warning, zero VUIDs and zero validation errors. The Windows test-directory driver copy was selected explicitly. - Publication parent: `cb54da2875cfb2159085ecf5d73a6ffdae94b96a`. The three changed file blobs match the tested candidate; the AGC, shader and third-party sources are unchanged since the tested base above. - Separate local integration stack: all 16 focused cases pass; repeated offline launches pass the former refusal and stop later in HTTP/2 after 2 frames. This does not establish menus or gameplay. Not run on Linux or macOS. - The conventions, test-registration and debt checks are recorded with the local evidence. Function and branch overlap CLI queries could not reach the GitHub API; connected searches and actual diff/dependency review covered the relevant existing work, including #8172, #9940, #9941, #16483, #13963, #10049 and #20084. No suitable existing fix was found for this first-touch sequence in the sources checked. ### 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: none - [x] GPUs tested: NVIDIA RTX 3080 Ti, driver 610.88, Windows 11 - [x] AI-assisted: yes
MarcZX10 commented 2026-11-15 10:01:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T10:01:09Z.

Review: COMMENTED


Reviewed — no blocking findings

The changed code addresses the stated cold DCC initialization case, but I did not run the tests, so a formal approval is not justified.

What I ran

Reviewed head 62e9dbca4635c448781f605a5646259149180c53. I read the diff, manifest, description, and changed code around the implementation and regression test. No commands or tests were run.

Results

Check Result Note
Diff and changed code review passed Three changed files inspected
Test execution not run Windows results are author-reported
Negative control not run Could not run the regression without the fix

Findings

Blocking

None.

Non-blocking

None.

Not verified

The reported Windows test runs and Vulkan validation results were not independently verified. I did not read every line of the two large C++ files; I read the changed hunks and relevant implementation context. files.json was not available through the reader; the manifest lists three changed files, all included, and the file listing reports no excluded changed files.

To get this to a good state

Nothing is required. Optional: independently run the focused CTest cases on the stated Windows setup.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5910160996 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20534#pullrequestreview-5910160996). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-15T10:01:09Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The changed code addresses the stated cold DCC initialization case, but I did not run the tests, so a formal approval is not justified. ## What I ran Reviewed head `62e9dbca4635c448781f605a5646259149180c53`. I read the diff, manifest, description, and changed code around the implementation and regression test. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed code review | passed | Three changed files inspected | | Test execution | not run | Windows results are author-reported | | Negative control | not run | Could not run the regression without the fix | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The reported Windows test runs and Vulkan validation results were not independently verified. I did not read every line of the two large C++ files; I read the changed hunks and relevant implementation context. `files.json` was not available through the reader; the manifest lists three changed files, all included, and the file listing reports no excluded changed files. ## To get this to a good state Nothing is required. Optional: independently run the focused CTest cases on the stated Windows setup.
MarcZX10 commented 2026-11-26 00:10:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T00:10:18Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the inspected code and regression coverage support merging.

What I ran

Reviewed head d7bac96865dd849ecb6fb516544822d1cdedf306 using repo_read.py to inspect the prepared description, commits, manifest, diff, changed files and targeted repository context. No tests were run in this review; the Windows test results below are author-reported.

Read all four changed files listed as reviewed in manifest.json, along with targeted GuestMemory.cpp context. No files were excluded by the manifest.

Results

Check Result Note
Diff and changed files passed Four reviewed files
Targeted code context passed DCC materialization and write tracking
Tests in this review not run Author reports 20 passed, 3 skipped

Findings

Blocking

None.

Non-blocking

None.

Not verified

Did not run the tests or independently verify the author-reported Windows runs, GPU behavior, or other operating systems. Did not inspect unrelated repository files beyond targeted context.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6066780450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20534#pullrequestreview-6066780450). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-26T00:10:18Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the inspected code and regression coverage support merging. ## What I ran Reviewed head `d7bac96865dd849ecb6fb516544822d1cdedf306` using `repo_read.py` to inspect the prepared description, commits, manifest, diff, changed files and targeted repository context. No tests were run in this review; the Windows test results below are author-reported. Read all four changed files listed as reviewed in `manifest.json`, along with targeted `GuestMemory.cpp` context. No files were excluded by the manifest. ## Results | Check | Result | Note | |---|---|---| | Diff and changed files | passed | Four reviewed files | | Targeted code context | passed | DCC materialization and write tracking | | Tests in this review | not run | Author reports 20 passed, 3 skipped | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Did not run the tests or independently verify the author-reported Windows runs, GPU behavior, or other operating systems. Did not inspect unrelated repository files beyond targeted context. ## To get this to a good state Nothing is required.
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!20534
No description provided.