fix(agc): color targets with gaps between written MRT slots, depth array slices #294

Merged
MichonGoddijn231849 merged 1 commit from upstream-pr/294 into main 2026-10-04 09:55:41 +00:00
MichonGoddijn231849 commented 2026-10-01 21:58:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-01T21:58:15Z.


What

Split out of #167.

  • MRT gaps: a slot below the highest written one that the draw does not write (a CB_TARGET_MASK gap) used to be rejected. It is now a VK_ATTACHMENT_UNUSED color reference with a disabled blend. Color targets keep their slot (ColorTarget::slot) for export mappings and pipeline and pass keys.
  • Depth array slices: DB_DEPTH_VIEW SLICE_START moves the depth and stencil planes by whole slices, so each slice of a depth array is its own depth surface. Mips are still rejected.

GTA V's G-buffer pass writes MRT slots with gaps.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.

  • GTA V (PPSA04264): the G-buffer draws with gapped targets and the depth-slice draws are no longer rejected.
  • Dreaming Sarah (PPSA02929): the title menu renders as on main.
  • ctest: all tests pass.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4710120481 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/294). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-01T21:58:15Z. --- ### What Split out of #167. - **MRT gaps:** a slot below the highest written one that the draw does not write (a `CB_TARGET_MASK` gap) used to be rejected. It is now a `VK_ATTACHMENT_UNUSED` color reference with a disabled blend. Color targets keep their slot (`ColorTarget::slot`) for export mappings and pipeline and pass keys. - **Depth array slices:** `DB_DEPTH_VIEW` SLICE_START moves the depth and stencil planes by whole slices, so each slice of a depth array is its own depth surface. Mips are still rejected. GTA V's G-buffer pass writes MRT slots with gaps. ### Tested Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0. - GTA V (PPSA04264): the G-buffer draws with gapped targets and the depth-slice draws are no longer rejected. - Dreaming Sarah (PPSA02929): the title menu renders as on `main`. - `ctest`: all tests pass. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
oneandonlydean commented 2026-10-03 06:28:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-03T06:28:25Z.


One case this doesn't cover yet: colour exports are compacted. Export i goes to the i-th slot with a non-zero CB_SHADER_MASK nibble and uses the i-th SPI_SHADER_COL_FORMAT field, not slot i's. PPSA21564's glass material has CB_SHADER_MASK 0xf000f with SPI_SHADER_COL_FORMAT 0x44 (colour to slot 0, velocity to slot 4). With this PR, slot 4 reads export format 0 and the draw is still refused, so the glass floor and windows show the interior behind them. My integration branch has this as a small change to the export mapping plus a test; I can send it as a follow-up once this lands.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5966361695 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/294#issuecomment-5966361695). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-03T06:28:25Z. --- One case this doesn't cover yet: colour exports are compacted. Export i goes to the i-th slot with a non-zero CB_SHADER_MASK nibble and uses the i-th SPI_SHADER_COL_FORMAT field, not slot i's. PPSA21564's glass material has CB_SHADER_MASK 0xf000f with SPI_SHADER_COL_FORMAT 0x44 (colour to slot 0, velocity to slot 4). With this PR, slot 4 reads export format 0 and the draw is still refused, so the glass floor and windows show the interior behind them. My integration branch has this as a small change to the export mapping plus a test; I can send it as a follow-up once this lands.
MichonGoddijn231849 commented 2026-10-03 08:43:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-03T08:43:25Z.


Thanks, that's a real gap: this PR still reads slot i's own SPI_SHADER_COL_FORMAT field, so compacted exports like your glass material's 0xf000f / 0x44 stay refused. Since your branch already has the export mapping with a test checked on PPSA21564, please send it as a follow-up once this lands; I'll test it on GTA V too.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5967289140 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/294#issuecomment-5967289140). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-03T08:43:25Z. --- Thanks, that's a real gap: this PR still reads slot i's own SPI_SHADER_COL_FORMAT field, so compacted exports like your glass material's 0xf000f / 0x44 stay refused. Since your branch already has the export mapping with a test checked on PPSA21564, please send it as a follow-up once this lands; I'll test it on GTA V too.
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!294
No description provided.