fix(agc): accept a table border colour when no axis uses a border mode #941

Merged
ThisIsAkill merged 1 commit from upstream-pr/941 into main 2026-10-07 02:20:25 +00:00
ThisIsAkill commented 2026-10-06 18:50:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ThisIsAkill on 2026-10-06T18:50:05Z.


What

Refs #665.

A sampler descriptor with BORDER_COLOR_TYPE 3 names an entry of the border colour table. That entry can only be read through an axis that addresses the border, meaning clamp modes 4 to 7 (half-border and border, mirrored or not). DecodeSamplerResource threw for every table border colour, so it also stopped samplers that never read one.

With this change it throws only when an axis uses one of the border modes. Otherwise it creates the sampler with a fixed Vulkan border colour, which no axis samples. The colour compare emulation already applies the same rule (ResourceMaterializer.cpp, a border colour table with a border mode throws).

The border colour table itself is still not implemented, and a table border with a border mode still throws, so #665 stays open.

Tested

Linux, NVIDIA RTX 3070, PPSA21567.

  • The sampler. The S# that stopped Armadillo Challenge 2 (compute shader 0x5005ae200, the same words in 2 of 2 earlier runs) is 00007092 00fff000 05000000 c0000000. It has CLAMP_X/Y/Z = 2 (clamp to the last texel), BORDER_COLOR_TYPE 3 and BORDER_COLOR_PTR 0, so no axis uses a border mode. Decoded on #665.

  • The game. With this change on oneandonlydean/astrobot 6703b781 (with -Bsymbolic libc and a local scripted pad, virtual display), Armadillo Challenge 2 runs the full 300 s test into gameplay instead of stopping at the throw. A local log showed exactly this one table-border sampler being accepted.

  • Unit test (agc_driver_graphics_tests). It covers:

    • a table border with clamp modes 0 to 3, which is now accepted;
    • modes 4 to 7 on each of the three axes, which are still rejected;
    • the captured sampler above, which is accepted.

    Non-table border types are unchanged. Two broken versions of the check (border modes starting at 6, and the check removed) both fail it.

  • Full ctest on this branch (default build): 359 of 359.

Limits:

  • One sampler was decoded, one level confirmed, and both game runs lasted 300 s.
  • Armadillo Challenge 1 also stopped at the same shader on an earlier day. In this run it never decoded a table-border sampler, so I can't say whether this change matters for it, and its earlier failure may have had another cause.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4763239971 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/941). Originally posted by [ThisIsAkill](https://github.com/ThisIsAkill) on 2026-10-06T18:50:05Z. --- ### What Refs #665. A sampler descriptor with `BORDER_COLOR_TYPE` 3 names an entry of the border colour table. That entry can only be read through an axis that addresses the border, meaning clamp modes 4 to 7 (half-border and border, mirrored or not). `DecodeSamplerResource` threw for every table border colour, so it also stopped samplers that never read one. With this change it throws only when an axis uses one of the border modes. Otherwise it creates the sampler with a fixed Vulkan border colour, which no axis samples. The colour compare emulation already applies the same rule (`ResourceMaterializer.cpp`, a border colour table with a border mode throws). The border colour table itself is still not implemented, and a table border with a border mode still throws, so #665 stays open. ### Tested Linux, NVIDIA RTX 3070, PPSA21567. - **The sampler.** The S# that stopped Armadillo Challenge 2 (compute shader `0x5005ae200`, the same words in 2 of 2 earlier runs) is `00007092 00fff000 05000000 c0000000`. It has CLAMP_X/Y/Z = 2 (clamp to the last texel), BORDER_COLOR_TYPE 3 and BORDER_COLOR_PTR 0, so no axis uses a border mode. Decoded on #665. - **The game.** With this change on `oneandonlydean/astrobot` `6703b781` (with `-Bsymbolic` libc and a local scripted pad, virtual display), Armadillo Challenge 2 runs the full 300 s test into gameplay instead of stopping at the throw. A local log showed exactly this one table-border sampler being accepted. - **Unit test** (`agc_driver_graphics_tests`). It covers: - a table border with clamp modes 0 to 3, which is now accepted; - modes 4 to 7 on each of the three axes, which are still rejected; - the captured sampler above, which is accepted. Non-table border types are unchanged. Two broken versions of the check (border modes starting at 6, and the check removed) both fail it. - Full `ctest` on this branch (default build): 359 of 359. Limits: - One sampler was decoded, one level confirmed, and both game runs lasted 300 s. - Armadillo Challenge 1 also stopped at the same shader on an earlier day. In this run it never decoded a table-border sampler, so I can't say whether this change matters for it, and its earlier failure may have had another cause. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ThisIsAkill commented 2026-10-06 23:41:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ThisIsAkill on 2026-10-06T23:41:12Z.


Update on the limits above: Armadillo Challenge 1 does reach the same sampler. In a second run with this change, it decoded and accepted 00007092 00fff000 05000000 c0000000, the same words as Armadillo Challenge 2, and ran the full 300 s test. So this change covers both Armadillo challenges on PPSA21567, one run each.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6027501490 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/941#issuecomment-6027501490). Originally posted by [ThisIsAkill](https://github.com/ThisIsAkill) on 2026-10-06T23:41:12Z. --- Update on the limits above: Armadillo Challenge 1 does reach the same sampler. In a second run with this change, it decoded and accepted `00007092 00fff000 05000000 c0000000`, the same words as Armadillo Challenge 2, and ran the full 300 s test. So this change covers both Armadillo challenges on PPSA21567, one run each.
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!941
No description provided.