fix(agc): render into 1D color targets as one-row 2D targets #2095

Merged
Raghav314 merged 1 commit from upstream-pr/2095 into main 2026-10-10 04:44:01 +00:00
Raghav314 commented 2026-10-09 08:19:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-09T08:19:40Z.


What

DecodeColorTileMode accepted only 2D (RESOURCE_TYPE 1, depth 0) and 3D (RESOURCE_TYPE 2) color targets. A 1D target (RESOURCE_TYPE 0) threw "unsupported color depth, dimension, resource level or metadata mode".

In addrlib, RESOURCE_TYPE 0 is ADDR_RSRC_TEX_1D. On GFX10 a 1D surface may use the linear and render swizzle modes (Gfx10Rsrc1dSwModeMask), and it gets its swizzle pattern the same way as a 2D surface: GetSwizzlePatternInfo only tells 3D apart. So a 1D color target one row high is laid out exactly like a 2D target one row tall.

  • DecodeColorTileMode accepts RESOURCE_TYPE 0 with depth 0, like 2D. It rejects a 1D target with a standard swizzle mode (SW_4KB_S, SW_64KB_S), which addrlib does not allow for 1D.
  • DecodeColorBuffer decodes a 1D target as that one-row 2D target. One taller than a row (CB_COLOR_ATTRIB2.MIP0_HEIGHT not 0) is rejected as unsupported: addrlib only limits 1D to one row on its linear paths (HwlComputeSurfaceInfoLinear, ComputeSurfaceAddrFromCoordLinear), so a tiled one is not modeled.

PPSA36082

Hades II renders into a 512x1 sRGB 8_8_8_8 target with CB_COLOR_ATTRIB3 = 0x4cc6c000 (RESOURCE_TYPE 0, SW_64KB_R_X, resource level 1) while it loads a level. Plain main stops earlier than that. On main f1451396 (where I tested the game; this branch is rebased on current main) with the fixes it needs to get there (#861, #1367, #1249, #1905, #1961, #1959, #1960, #1928 and a fix for the null pixel program miss from #1901), it threw at that draw; with this change it renders it and goes on to the next problem (MSAA, #419).

Tested

Linux (CachyOS), x86-64, GCC, 7800X3D / RTX 4090.

  • agc_driver_graphics (new checks):
    • The game's descriptor decodes as a render target. A linear 1D target decodes. A 1D target with depth, RESOURCE_TYPE 3, or SW_4KB_S / SW_64KB_S is rejected.
    • A 1D target decodes to a one-row extent at its base address. One with a taller CB_COLOR_ATTRIB2 is rejected.
  • Mutations, each failing a check: 1D still rejected; no height check; 1D arrays accepted; standard swizzles accepted.
  • ctest: 494/494.

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 (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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4797928187 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2095). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-09T08:19:40Z. --- ### What `DecodeColorTileMode` accepted only 2D (`RESOURCE_TYPE` 1, depth 0) and 3D (`RESOURCE_TYPE` 2) color targets. A 1D target (`RESOURCE_TYPE` 0) threw "unsupported color depth, dimension, resource level or metadata mode". In addrlib, `RESOURCE_TYPE` 0 is `ADDR_RSRC_TEX_1D`. On GFX10 a 1D surface may use the linear and render swizzle modes (`Gfx10Rsrc1dSwModeMask`), and it gets its swizzle pattern the same way as a 2D surface: `GetSwizzlePatternInfo` only tells 3D apart. So a 1D color target one row high is laid out exactly like a 2D target one row tall. - `DecodeColorTileMode` accepts `RESOURCE_TYPE` 0 with depth 0, like 2D. It rejects a 1D target with a standard swizzle mode (`SW_4KB_S`, `SW_64KB_S`), which addrlib does not allow for 1D. - `DecodeColorBuffer` decodes a 1D target as that one-row 2D target. One taller than a row (`CB_COLOR_ATTRIB2.MIP0_HEIGHT` not 0) is rejected as unsupported: addrlib only limits 1D to one row on its linear paths (`HwlComputeSurfaceInfoLinear`, `ComputeSurfaceAddrFromCoordLinear`), so a tiled one is not modeled. ### PPSA36082 Hades II renders into a 512x1 sRGB 8_8_8_8 target with `CB_COLOR_ATTRIB3` = `0x4cc6c000` (`RESOURCE_TYPE` 0, `SW_64KB_R_X`, resource level 1) while it loads a level. Plain main stops earlier than that. On main f1451396 (where I tested the game; this branch is rebased on current main) with the fixes it needs to get there (#861, #1367, #1249, #1905, #1961, #1959, #1960, #1928 and a fix for the null pixel program miss from #1901), it threw at that draw; with this change it renders it and goes on to the next problem (MSAA, #419). ### Tested Linux (CachyOS), x86-64, GCC, 7800X3D / RTX 4090. - `agc_driver_graphics` (new checks): - The game's descriptor decodes as a render target. A linear 1D target decodes. A 1D target with depth, `RESOURCE_TYPE` 3, or `SW_4KB_S` / `SW_64KB_S` is rejected. - A 1D target decodes to a one-row extent at its base address. One with a taller `CB_COLOR_ATTRIB2` is rejected. - Mutations, each failing a check: 1D still rejected; no height check; 1D arrays accepted; standard swizzles accepted. - ctest: 494/494. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
Raghav314 commented 2026-10-09 08:58:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-09T08:58:03Z.


Heads up: main's CI is currently broken by ShaderFusion.cpp not finding spirv/unified1/spirv.hpp (missing SPIRV-Headers include, fails on main 6cc0503d too), so linux/windows will likely fail here for that reason, not this change. #2093 / #2099 fix it, and I'll rebase once one of them lands.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077754915 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2095#issuecomment-6077754915). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-09T08:58:03Z. --- Heads up: main's CI is currently broken by `ShaderFusion.cpp` not finding `spirv/unified1/spirv.hpp` (missing SPIRV-Headers include, fails on main 6cc0503d too), so linux/windows will likely fail here for that reason, not this change. #2093 / #2099 fix it, and I'll rebase once one of them lands.
Raghav314 commented 2026-10-09 09:15:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-09T09:15:28Z.


Rebased on main d9484c71 (with #2099). Ran the linux job from build.yml locally on the new head (SPIRV tools on, test registration check, build, libs): ctest 504/504 pass.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078018194 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2095#issuecomment-6078018194). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-09T09:15:28Z. --- Rebased on main d9484c71 (with #2099). Ran the linux job from build.yml locally on the new head (SPIRV tools on, test registration check, build, libs): ctest 504/504 pass.
github-actions[bot] commented 2026-10-09 12:39:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T12:39:18Z.


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
#2229 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L824, L2963
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081061589 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2095#issuecomment-6081061589). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T12:39:18Z. --- <!-- 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 | |---|---|---|---| | #2229 | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L824](https://github.com/boykopovar/AnyPS5/blob/80d539abcbd0f90a7b6e64f7ab4868556671f241/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L824), [L2963](https://github.com/boykopovar/AnyPS5/blob/80d539abcbd0f90a7b6e64f7ab4868556671f241/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L2963) | | |
rmz-24 commented 2026-10-09 13:30:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T13:30:59Z.


Windows run: Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON, full build plus libs. 7638ade7 cherry-picked onto current main d70b8998 (applies cleanly).

  • agc_driver_graphics (with the new 1D target checks) passes.
  • Full ctest: 510/510.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081916747 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2095#issuecomment-6081916747). Originally posted by [rmz-24](https://github.com/rmz-24) on 2026-10-09T13:30:59Z. --- Windows run: Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, `-DANYPS5_ENABLE_SPIRV_TOOLS=ON`, full build plus `libs`. 7638ade7 cherry-picked onto current `main` d70b8998 (applies cleanly). - `agc_driver_graphics` (with the new 1D target checks) passes. - Full ctest: 510/510. 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!2095
No description provided.