Skip to content

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

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
MichonGoddijn231849:split/color-target-gaps
Oct 4, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
MichonGoddijn231849:split/color-target-gaps

Conversation

@MichonGoddijn231849

Copy link
Copy Markdown
Contributor

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

…ray slices

An MRT slot below the highest written one that the draw does not write is a VK_ATTACHMENT_UNUSED
reference with a disabled blend; color targets keep their slot for export mappings, pipeline and
pass keys. 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.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@oneandonlydean

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor Author

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.

@oneandonlydean
oneandonlydean merged commit bd75390 into boykopovar:main Oct 4, 2026
3 checks passed
SP4C3B4R-8 pushed a commit to SP4C3B4R-8/AnyPS5 that referenced this pull request Oct 6, 2026
Takes the 13 gate-batch PRs that merged upstream (boykopovar#319 boykopovar#329 boykopovar#330 boykopovar#331 boykopovar#325
boykopovar#435 boykopovar#471 boykopovar#294 boykopovar#376 boykopovar#404 boykopovar#394 boykopovar#401 boykopovar#446) in place of astrobot's local
versions, as integ/gate-batch cab0eab had them: boykopovar#294 and boykopovar#376 in
astrobot's depth model (DepthTarget, state.depth), boykopovar#394 with the thick mip
tails, boykopovar#401 over astrobot's slab pool, boykopovar#471 keeping the settled single-lane
path. Also takes the rest of main since a818bee (boykopovar#532 boykopovar#340 boykopovar#486 boykopovar#484 boykopovar#316
boykopovar#243 boykopovar#334 boykopovar#434 boykopovar#437 boykopovar#470 boykopovar#373 boykopovar#452 boykopovar#455 and our upstreamed PRs, where
astrobot keeps its later revisions and env switches).

Resolution notes: relinker converter/matcher/tests are upstream's (boykopovar#432
decoder covers VEX RIP-relative followers); RecompileResult gains boykopovar#316's
hostSubgroupSize (set from request.target.subgroupSize); shader disk cache
format 9; boykopovar#452's scissor message; upstream's later live-stack and
memory-copy decode tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mgp3oZvembQziVNE2xARQK
@MichonGoddijn231849
MichonGoddijn231849 deleted the split/color-target-gaps branch October 9, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants