feat(agc): 4 KiB standard color targets and color views of one array slice #377

Merged
MichonGoddijn231849 merged 1 commit from upstream-pr/377 into main 2026-10-04 22:40:45 +00:00
MichonGoddijn231849 commented 2026-10-02 16:15:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-02T16:15:51Z.


What

  • 4 KiB standard color targets: targets with the SW_4KB_S swizzle (CB_COLOR_ATTRIB3 tile mode 5) are laid out in 4 KiB blocks with the standard element order the texture detiler uses. They are resident through the same storage images as 64 KiB targets.
  • Views of one array slice: a CB_COLOR_VIEW that selects one slice (SLICE_START equal to SLICE_MAX) renders into that slice. The target starts one slice size per slice after the surface. The slice size is the surface's mip chain as a texture of the same tile mode lays it out. Views of several slices are still refused.

GTA V clears its 256x256 reflection cube (SW_4KB_S) face by face through one-slice views. All six face draws had been refused, so the cube kept whatever bytes the memory held, and the reflection map built from it was garbage. That garbage alone pushed the scene's luminance about ten times too high.

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), with #373: the six face draws render and the cube holds their results.
  • Dreaming Sarah (PPSA02929): the title menu, its text and the first scene render as on main.
  • Demon's Souls (PPSA01342), with #231 and #232: it reaches the main menu.
  • ctest: all tests pass. The color layout tests cover SW_4KB_S block offsets and the one-slice view address.

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:4718738009 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/377). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-02T16:15:51Z. --- ### What - **4 KiB standard color targets:** targets with the SW_4KB_S swizzle (`CB_COLOR_ATTRIB3` tile mode 5) are laid out in 4 KiB blocks with the standard element order the texture detiler uses. They are resident through the same storage images as 64 KiB targets. - **Views of one array slice:** a `CB_COLOR_VIEW` that selects one slice (SLICE_START equal to SLICE_MAX) renders into that slice. The target starts one slice size per slice after the surface. The slice size is the surface's mip chain as a texture of the same tile mode lays it out. Views of several slices are still refused. GTA V clears its 256x256 reflection cube (SW_4KB_S) face by face through one-slice views. All six face draws had been refused, so the cube kept whatever bytes the memory held, and the reflection map built from it was garbage. That garbage alone pushed the scene's luminance about ten times too high. ### 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), with #373: the six face draws render and the cube holds their results. - Dreaming Sarah (PPSA02929): the title menu, its text and the first scene render as on `main`. - Demon's Souls (PPSA01342), with #231 and #232: it reaches the main menu. - `ctest`: all tests pass. The color layout tests cover SW_4KB_S block offsets and the one-slice view address. ### 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-04 09:57:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T09:57:23Z.


This passed my PPSA21564 check, but it doesn't compile together with #404, which is now merged: #377 needs standardTables() per element size to match #404's tables. Could you rebase onto main and adapt it? #449 then follows. Both look ready to merge from my side after that.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5978752821 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/377#issuecomment-5978752821). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T09:57:23Z. --- This passed my PPSA21564 check, but it doesn't compile together with #404, which is now merged: #377 needs `standardTables()` per element size to match #404's tables. Could you rebase onto main and adapt it? #449 then follows. Both look ready to merge from my side after that.
MichonGoddijn231849 commented 2026-10-04 10:24:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-04T10:24:10Z.


Rebased after today's merges. #404 now builds the colour swizzle tables once per element size and shares them, so the 4 KiB standard layout here gets its own shared table (standardTables, built once per element size like renderTargetTables) instead of filling per-target vectors. Without this, the PR no longer compiled against main, even though GitHub showed no textual conflict. Build and ctest are clean apart from the failures main has locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5978998069 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/377#issuecomment-5978998069). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-04T10:24:10Z. --- Rebased after today's merges. #404 now builds the colour swizzle tables once per element size and shares them, so the 4 KiB standard layout here gets its own shared table (`standardTables`, built once per element size like `renderTargetTables`) instead of filling per-target vectors. Without this, the PR no longer compiled against `main`, even though GitHub showed no textual conflict. Build and ctest are clean apart from the failures `main` has locally.
oneandonlydean commented 2026-10-04 22:37:58 +00:00 (Migrated from github.com)

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


Thanks, the per-size standardTables() is the same adaptation I used to test it with #404, so this is exactly what passed my PPSA21564 check, and it builds and passes ctest here on current main. Ready to merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985218871 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/377#issuecomment-5985218871). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T22:37:58Z. --- Thanks, the per-size `standardTables()` is the same adaptation I used to test it with #404, so this is exactly what passed my PPSA21564 check, and it builds and passes ctest here on current main. Ready to merge.
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!377
No description provided.