feat(agc): render into depth mip levels #7927

Merged
whamre merged 2 commits from upstream-pr/7927 into main 2026-10-22 06:09:06 +00:00
whamre commented 2026-10-19 14:30:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by whamre on 2026-10-19T14:30:38Z.


What

decodeDepth threw on any depth view with DB_DEPTH_VIEW.MIPID or DB_Z_INFO.MAXMIP set. It now decodes both and renders into the selected level of a 64 KiB Z_X mip chain as a surface of its own, at the level's offset and extent from ComputeElementMipLayout, the same way color target mips are handled. Stencil gets its own 1-byte mip layout. Slices of a mip chain step by the size of the whole chain. Multisampled depth mips, other swizzles, levels in the packed mip tail and HTILE on a mip chain still throw, each with its own message, and are listed in the libSceAgcDriver debt file.

Tested

LEGO Builder's Journey (PPSA05496) stopped right after the logo on main with:

depth mips (DB_DEPTH_VIEW MIP_LEVEL) is unsupported (register 0x2 = 0x04000000)

It renders depth into mip 1 of a 64 KiB Z_X chain without HTILE. With this change (and #7652 for the earlier GC stop), it reaches the first playable scene and renders it correctly. agc_driver_graphics gets a new case: mip 0 and mip 1 offsets and extents, a slice of a mip chain, and the four rejected cases (mip past MAXMIP, packed mip tail, HTILE, other swizzle). check_conventions.py passes.

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: PPSA05496 LEGO® Builder's Journey #7926
  • GPUs tested: NVIDIA RTX 2080 SUPER (driver 616.92), Windows 11 26300
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4922580425 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7927). Originally posted by [whamre](https://github.com/whamre) on 2026-10-19T14:30:38Z. --- ### What `decodeDepth` threw on any depth view with `DB_DEPTH_VIEW.MIPID` or `DB_Z_INFO.MAXMIP` set. It now decodes both and renders into the selected level of a 64 KiB Z_X mip chain as a surface of its own, at the level's offset and extent from `ComputeElementMipLayout`, the same way color target mips are handled. Stencil gets its own 1-byte mip layout. Slices of a mip chain step by the size of the whole chain. Multisampled depth mips, other swizzles, levels in the packed mip tail and HTILE on a mip chain still throw, each with its own message, and are listed in the libSceAgcDriver debt file. ### Tested LEGO Builder's Journey (PPSA05496) stopped right after the logo on `main` with: ``` depth mips (DB_DEPTH_VIEW MIP_LEVEL) is unsupported (register 0x2 = 0x04000000) ``` It renders depth into mip 1 of a 64 KiB Z_X chain without HTILE. With this change (and #7652 for the earlier GC stop), it reaches the first playable scene and renders it correctly. `agc_driver_graphics` gets a new case: mip 0 and mip 1 offsets and extents, a slice of a mip chain, and the four rejected cases (mip past MAXMIP, packed mip tail, HTILE, other swizzle). `check_conventions.py` passes. ### 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 - [x] Fixes: none - [x] Unblocks: PPSA05496 LEGO® Builder's Journey #7926 - [x] GPUs tested: NVIDIA RTX 2080 SUPER (driver 616.92), Windows 11 26300 - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-19 14:45:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T14:45:26Z.


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
PR 6146 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L360-362
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L397-399
PR 8999 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L354-362
PR 9431 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L397-399
PR 9432 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L397-399

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6194 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6727 docs/dev/debt/libSceAgcDriver.md
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6868 docs/dev/debt/libSceAgcDriver.md
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7604 docs/dev/debt/libSceAgcDriver.md
PR 7642 docs/dev/debt/libSceAgcDriver.md
PR 7800 docs/dev/debt/libSceAgcDriver.md
PR 7910 docs/dev/debt/libSceAgcDriver.md
PR 8014 docs/dev/debt/libSceAgcDriver.md
PR 8246 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8527 docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 8672 docs/dev/debt/libSceAgcDriver.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6270000774 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7927#issuecomment-6270000774). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T14:45:26Z. --- <!-- pr-overlap --> 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 | |---|---|---|---| | [PR 6146](https://www.github.com/boykopovar/AnyPS5/pull/6146) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L360-362](https://github.com/boykopovar/AnyPS5/blob/110a18ba017df63c795aa78f2d03ed24a9d8e8b1/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L360-L362) | | | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L397-399](https://github.com/boykopovar/AnyPS5/blob/110a18ba017df63c795aa78f2d03ed24a9d8e8b1/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L397-L399) | | | | [PR 8999](https://www.github.com/boykopovar/AnyPS5/pull/8999) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L354-362](https://github.com/boykopovar/AnyPS5/blob/110a18ba017df63c795aa78f2d03ed24a9d8e8b1/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L354-L362) | | | | [PR 9431](https://www.github.com/boykopovar/AnyPS5/pull/9431) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L397-399](https://github.com/boykopovar/AnyPS5/blob/110a18ba017df63c795aa78f2d03ed24a9d8e8b1/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L397-L399) | | | | [PR 9432](https://www.github.com/boykopovar/AnyPS5/pull/9432) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L397-399](https://github.com/boykopovar/AnyPS5/blob/110a18ba017df63c795aa78f2d03ed24a9d8e8b1/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L397-L399) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 1191](https://www.github.com/boykopovar/AnyPS5/pull/1191) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 2434](https://www.github.com/boykopovar/AnyPS5/pull/2434) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4448](https://www.github.com/boykopovar/AnyPS5/pull/4448) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 4449](https://www.github.com/boykopovar/AnyPS5/pull/4449) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 5058](https://www.github.com/boykopovar/AnyPS5/pull/5058) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 5372](https://www.github.com/boykopovar/AnyPS5/pull/5372) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 6194](https://www.github.com/boykopovar/AnyPS5/pull/6194) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6223](https://www.github.com/boykopovar/AnyPS5/pull/6223) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6280](https://www.github.com/boykopovar/AnyPS5/pull/6280) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6300](https://www.github.com/boykopovar/AnyPS5/pull/6300) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6548](https://www.github.com/boykopovar/AnyPS5/pull/6548) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6549](https://www.github.com/boykopovar/AnyPS5/pull/6549) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6727](https://www.github.com/boykopovar/AnyPS5/pull/6727) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6867](https://www.github.com/boykopovar/AnyPS5/pull/6867) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6868](https://www.github.com/boykopovar/AnyPS5/pull/6868) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 7256](https://www.github.com/boykopovar/AnyPS5/pull/7256) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 7604](https://www.github.com/boykopovar/AnyPS5/pull/7604) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 7800](https://www.github.com/boykopovar/AnyPS5/pull/7800) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 7910](https://www.github.com/boykopovar/AnyPS5/pull/7910) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 8014](https://www.github.com/boykopovar/AnyPS5/pull/8014) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 8246](https://www.github.com/boykopovar/AnyPS5/pull/8246) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 8395](https://www.github.com/boykopovar/AnyPS5/pull/8395) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 8527](https://www.github.com/boykopovar/AnyPS5/pull/8527) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 8592](https://www.github.com/boykopovar/AnyPS5/pull/8592) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 8672](https://www.github.com/boykopovar/AnyPS5/pull/8672) | `docs/dev/debt/libSceAgcDriver.md` |
DavidAmsellem commented 2026-10-20 19:00:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-20T19:00:52Z.


First AMD run of this PR, on Linux with RADV. Head cd1efc9fc merged onto main 2fee39f1b (clean merge), built in full and compared with the same main, on the same machine.

AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.

Full suite (ANYPS5_REQUIRE_VULKAN=1 ctest -j8) at 5d12e6e0f: 1715/1716 with this PR, against 1715/1716 on main. The one failure is the same on both, so this PR adds none: agc_driver_guest_memory_lifetime (#7784, which #7849 addresses).

Comparing the JUnit output with main: this PR adds no ctest entry, and none is skipped or removed. The test it extends, agc_driver_graphics, runs and passes.

GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6298827085 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7927#issuecomment-6298827085). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-20T19:00:52Z. --- First AMD run of this PR, on Linux with RADV. Head `cd1efc9fc` merged onto `main` `2fee39f1b` (clean merge), built in full and compared with the same `main`, on the same machine. AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Full suite (`ANYPS5_REQUIRE_VULKAN=1 ctest -j8`) at `5d12e6e0f`: **1715/1716 with this PR**, against 1715/1716 on `main`. The one failure is the same on both, so this PR adds none: `agc_driver_guest_memory_lifetime` (#7784, which #7849 addresses). Comparing the JUnit output with `main`: this PR adds no ctest entry, and none is skipped or removed. The test it extends, `agc_driver_graphics`, runs and passes. GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38 AI-assisted: yes
oneandonlydean commented 2026-10-20 22:04:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T22:04:06Z.


@whamre one case the change opens that main refused: a DB_DEPTH_VIEW.MIPID other than 0 on a surface with DB_Z_INFO.MAXMIP 0. The zero(cx, 0x002, 0x3c000000u, ...) check is gone, and viewMip <= maxMip is only checked inside if (maxMip != 0), so such a view now renders into mip 0 instead of throwing. Could you add a Require for viewMip == 0 when maxMip == 0, plus a row in the agc_driver_graphics case?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302771361 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7927#issuecomment-6302771361). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T22:04:06Z. --- @whamre one case the change opens that `main` refused: a `DB_DEPTH_VIEW.MIPID` other than 0 on a surface with `DB_Z_INFO.MAXMIP` 0. The `zero(cx, 0x002, 0x3c000000u, ...)` check is gone, and `viewMip <= maxMip` is only checked inside `if (maxMip != 0)`, so such a view now renders into mip 0 instead of throwing. Could you add a `Require` for `viewMip == 0` when `maxMip == 0`, plus a row in the `agc_driver_graphics` case?
whamre commented 2026-10-22 05:43:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by whamre on 2026-10-22T05:43:23Z.


Thanks, good catch. Added in 74f2fcb61: when DB_Z_INFO.MAXMIP is 0, a non-zero DB_DEPTH_VIEW.MIPID now throws ("depth view mip N on a surface without mips") instead of rendering into mip 0. The COLOR_INVALID depth-only case in agc_driver_graphics has a new row for MIPID 1 with MAXMIP 0. agc_driver_graphics passes and check_conventions.py is clean.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6333686609 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7927#issuecomment-6333686609). Originally posted by [whamre](https://github.com/whamre) on 2026-10-22T05:43:23Z. --- Thanks, good catch. Added in 74f2fcb61: when `DB_Z_INFO.MAXMIP` is 0, a non-zero `DB_DEPTH_VIEW.MIPID` now throws ("depth view mip N on a surface without mips") instead of rendering into mip 0. The COLOR_INVALID depth-only case in `agc_driver_graphics` has a new row for MIPID 1 with MAXMIP 0. `agc_driver_graphics` passes and `check_conventions.py` is clean. AI-assisted: yes
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!7927
No description provided.