Skip to content

fix(agc): size multisample guest guards by fragment blocks - #4199

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
sanxchep:fix/msaa-guest-guard
Oct 13, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
sanxchep:fix/msaa-guest-guard

Conversation

@sanxchep

@sanxchep sanxchep commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

Size the guest-memory guard for a multisampled RenderTarget using 64 KiB blocks whose pixel dimensions account for fragment count. The old max(single-sample CB bytes × samples, raw pixel bytes × samples) bound can cover a neighboring allocation. For example, a 1920×1080 RGBA8 4× target occupies 0x1fe0000 bytes with fragment-aware blocks, while the previous guard spans 0x21c0000 bytes.

Keep the conservative bound for other tile modes. Add guard regressions for tiled 2× and 8× targets, a layout check for the 1920×1080 case, and document that console layout equivalence has not been measured.

This is independent of custom sample-location support in #2169. PR #2132 computes the same block dimensions for color-memory fills; if it merges first, this guard can reuse its footprint helper during integration.

Tested

Linux, Release, GCC 13.3:

  • agc_driver_graphics — passed (3.40 s)
  • agc_multisample_guest_access — passed (1.20 s)
  • python3 tools/check_conventions.py --base origin/main — passed
  • git diff --check — passed

A title was run with the patch and reported working by the PR author. Console layout equivalence was not separately measured.

Checklist

  • Based on current main; no other open PR changes the guest-read guard
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source; none added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@MarcZX10

Copy link
Copy Markdown
Contributor

The conventions run (check 114622799227) fails because the PR template’s AI-assisted field is unanswered. Please mark AI-assisted: yes or no in the checklist/body so the required template check can pass.

@sanxchep
sanxchep marked this pull request as ready for review October 12, 2026 01:14
@sanxchep

Copy link
Copy Markdown
Contributor Author

The conventions run (check 114622799227) fails because the PR template’s AI-assisted field is unanswered. Please mark AI-assisted: yes or no in the checklist/body so the required template check can pass.

done

@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 12, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@blawesom

Copy link
Copy Markdown
Contributor

Rebase handoff — this branch was ~347 commits behind main (only a trivial TechnicalDebt.md union conflict). Rebased onto current main, authorship unchanged; both doc entries kept.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 949/949 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4199
git checkout <your branch>
git merge --ff-only FETCH_HEAD   # or reset to it

Head is 5ab79cd51. (This PR also passed an earlier independent pre-review at its previous base — full suite was green there too.)

@sanxchep
sanxchep force-pushed the fix/msaa-guest-guard branch from 0b44853 to cff1f68 Compare October 12, 2026 15:33
@sanxchep

Copy link
Copy Markdown
Contributor Author

Rebase handoff — this branch was ~347 commits behind main (only a trivial TechnicalDebt.md union conflict). Rebased onto current main, authorship unchanged; both doc entries kept.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 949/949 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4199
git checkout <your branch>
git merge --ff-only FETCH_HEAD   # or reset to it

Head is 5ab79cd51. (This PR also passed an earlier independent pre-review at its previous base — full suite was green there too.)

done

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@blawesom

Copy link
Copy Markdown
Contributor

Independent verification of your rebase — the new head builds and passes the full local suite on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV): 957/957, conventions green. From my side this is merge-ready.

@sanxchep

Copy link
Copy Markdown
Contributor Author

@MarcZX100 should be ready to merge

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed labels Oct 12, 2026
@kr4y4

kr4y4 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Windows run, to go with the Linux runs above.

Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head cff1f68 merged into main 2a5eca1, with no conflicts.

  • agc_multisample_guest_access and agc_driver_graphics (with the new ColorTargetLayout check) pass on both GPUs with --repeat until-fail:3.
  • With main's MultisampleTarget.cpp and the new tests, agc_multisample_guest_access fails on both GPUs: a CPU read of 0x…90000+0x40 overlaps multisampled color target 0x…80000+0x40000 (4 samples), whose samples are only on the host: guest access to it is not implemented.
  • Full suite (ctest --timeout 120 --parallel 4): 973 of 973 on the RTX 4070. On the iGPU 972 of 973; the one failure, agc_driver_f32_dot2_rounding, fails the same way on main (no shaderFloat64, test(agc): skip the f32 dot2 rounding test on devices without shaderFloat64 #4528).

This touches guard() in MultisampleTarget.cpp like #4474, so whichever lands second will need a rebase there.

Written with AI assistance.

@sanxchep
sanxchep force-pushed the fix/msaa-guest-guard branch from cff1f68 to 8bcf1cc Compare October 13, 2026 00:55
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4474 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L195-196
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp L4661-4662

@oneandonlydean oneandonlydean self-assigned this Oct 13, 2026
@oneandonlydean
oneandonlydean merged commit 834de1a into boykopovar:main Oct 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants