fix(agc): read a one-fragment multisampled T# as a 2D image #18660

Merged
DealPotato merged 2 commits from upstream-pr/18660 into main 2026-11-16 06:32:02 +00:00
DealPotato commented 2026-11-12 00:18:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DealPotato on 2026-11-12T00:18:30Z.


What

A 2D MSAA T# holds log2 of its fragment count in LAST_LEVEL (RDNA2 ISA, image resource descriptor: "for MSAA, set to log2(num_samples)"), so LAST_LEVEL 0 describes one fragment, a single-sample surface. Both the recompiler's descriptor check and the driver's decoder required 2 to 16 fragments. WWE 2K26 (PPSA34299) reads such a T# (148e2800 c1400000 010dc1df e1800204 00000000 00700000 00000000 00000000, 32-bit UINT, 1920 wide) with a 2D instruction in a compute shader and stopped with runtime image descriptor is invalid.

A one-fragment 2D MSAA T# (base level 0, LAST_LEVEL 0, MAX_MIP 0) now decodes as the single-sample 2D image it describes: in the driver's DecodeTextureResource, and in the recompiler for 2D and 2D-array reads. A multisample instruction on such a T# is still refused (poisoned with the multisampled reason), since its fragment coordinate has no counterpart in a 2D image.

Tested

Windows 11 Pro (build 26300), NVIDIA GeForce RTX 4070, driver 610.88, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1 and ctest -V; the loader inserted the validation layer.

  • agc_driver_graphics: passes on main (3a0a54bbd8) and on the change. Its GuestTextureResource case that expected the one-fragment T# to be rejected now expects it to decode as a 297x297 single-sample 2D image.
  • agc_shader_memory and shader_memory_decoder_tolerance: pass on the change (not run on main). The new verifyOneFragmentMultisampleRead case takes the title's T#: a 2D read selects the 2D runtime mode, with or without cube-face compatibility, and a multisample read is refused.
  • No VUID- message in the logs.
  • WWE 2K26 on main plus #18654 and the other fixes it needs: without this change it stops at the T# above about 90 s after boot; with it, it runs past that point to the next, unrelated stop (a native multisample stencil plane import).

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: none
  • Unblocks: PPSA34299 (WWE 2K26; no Game bring-up discussion yet)
  • GPUs tested: NVIDIA GeForce RTX 4070, driver 610.88, Windows 11 Pro (build 26300)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5268891216 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18660). Originally posted by [DealPotato](https://github.com/DealPotato) on 2026-11-12T00:18:30Z. --- ### What A 2D MSAA T# holds log2 of its fragment count in LAST_LEVEL (RDNA2 ISA, image resource descriptor: "for MSAA, set to log2(num_samples)"), so LAST_LEVEL 0 describes one fragment, a single-sample surface. Both the recompiler's descriptor check and the driver's decoder required 2 to 16 fragments. WWE 2K26 (PPSA34299) reads such a T# (`148e2800 c1400000 010dc1df e1800204 00000000 00700000 00000000 00000000`, 32-bit UINT, 1920 wide) with a 2D instruction in a compute shader and stopped with `runtime image descriptor is invalid`. A one-fragment 2D MSAA T# (base level 0, LAST_LEVEL 0, MAX_MIP 0) now decodes as the single-sample 2D image it describes: in the driver's `DecodeTextureResource`, and in the recompiler for 2D and 2D-array reads. A multisample instruction on such a T# is still refused (poisoned with the multisampled reason), since its fragment coordinate has no counterpart in a 2D image. ### Tested Windows 11 Pro (build 26300), NVIDIA GeForce RTX 4070, driver 610.88, with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1` and `ctest -V`; the loader inserted the validation layer. - `agc_driver_graphics`: passes on `main` (3a0a54bbd8) and on the change. Its GuestTextureResource case that expected the one-fragment T# to be rejected now expects it to decode as a 297x297 single-sample 2D image. - `agc_shader_memory` and `shader_memory_decoder_tolerance`: pass on the change (not run on `main`). The new `verifyOneFragmentMultisampleRead` case takes the title's T#: a 2D read selects the 2D runtime mode, with or without cube-face compatibility, and a multisample read is refused. - No `VUID-` message in the logs. - WWE 2K26 on `main` plus #18654 and the other fixes it needs: without this change it stops at the T# above about 90 s after boot; with it, it runs past that point to the next, unrelated stop (a native multisample stencil plane import). ### Checklist - [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: none - [x] Unblocks: PPSA34299 (WWE 2K26; no Game bring-up discussion yet) - [x] GPUs tested: NVIDIA GeForce RTX 4070, driver 610.88, Windows 11 Pro (build 26300) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-14 09:22:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T09:22:32Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the one-fragment descriptor is treated as 2D for 2D reads and multisample reads remain rejected.

What I ran

Reviewed head dfeb58b23e54163ebc8179ed08b65e402ff16224 using the prepared diff and repo_read.py for targeted source ranges. No tests or build commands were run.

Results

Check Result Note
Diff and targeted source review passed Descriptor decoding and runtime mode selection inspected
Tests and build not run Author reports test and title runs; not independently verified

Findings

Blocking

None.

Non-blocking

None.

Not verified

Read description.md, commits.md, manifest.json, diff.patch, and the complete changed files GuestTextureResource.cpp and ResourceMaterializer.cpp. Read the changed portions and surrounding test context in ShaderMemory.cpp and GuestTextureResource.cpp; the full text of ShaderMemory.cpp was excluded from the review folder as too large. Tests, build, and reported Windows/GPU/title behavior were not independently verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5903402577 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18660#pullrequestreview-5903402577). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T09:22:32Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the one-fragment descriptor is treated as 2D for 2D reads and multisample reads remain rejected. ## What I ran Reviewed head `dfeb58b23e54163ebc8179ed08b65e402ff16224` using the prepared diff and `repo_read.py` for targeted source ranges. No tests or build commands were run. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Descriptor decoding and runtime mode selection inspected | | Tests and build | not run | Author reports test and title runs; not independently verified | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Read `description.md`, `commits.md`, `manifest.json`, `diff.patch`, and the complete changed files `GuestTextureResource.cpp` and `ResourceMaterializer.cpp`. Read the changed portions and surrounding test context in `ShaderMemory.cpp` and `GuestTextureResource.cpp`; the full text of `ShaderMemory.cpp` was excluded from the review folder as too large. Tests, build, and reported Windows/GPU/title behavior were not independently verified. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-15 04:30:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T04:30:36Z.

Review: APPROVED


Reviewed — looks good

The changed code supports the stated one-fragment descriptor behavior, and I found no verified blocking defect; the changed ShaderMemory.cpp test code was read directly at the pinned head.

What I ran

Reviewed head 881d4a6752393c9e86086e242dcbae527a5aa1bd using the prepared diff and repo_read.py to inspect targeted source and test ranges. No test or build commands were run. The author reports Windows 11 and NVIDIA RTX 4070 testing in the PR description; those checks were not run by me.

Results

Check Result Note
Diff and changed lines passed All changed lines were inspected
Targeted source review passed Decoder and runtime mode selection inspected
Build and tests not run Author reports tests; not independently verified

Findings

Blocking

None.

Non-blocking

None.

Not verified

Builds, automated tests, Vulkan validation output, and WWE 2K26 behavior were not independently verified. ShaderMemory.cpp was excluded from the prepared files/ bundle because of its size; its changed lines were read through the repository reader. The other changed files were included in files/, and their changed lines were read.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5909049651 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18660#pullrequestreview-5909049651). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-15T04:30:36Z. **Review:** APPROVED --- # Reviewed — looks good The changed code supports the stated one-fragment descriptor behavior, and I found no verified blocking defect; the changed ShaderMemory.cpp test code was read directly at the pinned head. ## What I ran Reviewed head `881d4a6752393c9e86086e242dcbae527a5aa1bd` using the prepared diff and `repo_read.py` to inspect targeted source and test ranges. No test or build commands were run. The author reports Windows 11 and NVIDIA RTX 4070 testing in the PR description; those checks were not run by me. ## Results | Check | Result | Note | |---|---|---| | Diff and changed lines | passed | All changed lines were inspected | | Targeted source review | passed | Decoder and runtime mode selection inspected | | Build and tests | not run | Author reports tests; not independently verified | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Builds, automated tests, Vulkan validation output, and WWE 2K26 behavior were not independently verified. `ShaderMemory.cpp` was excluded from the prepared `files/` bundle because of its size; its changed lines were read through the repository reader. The other changed files were included in `files/`, and their changed lines were read. ## 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!18660
No description provided.