fix(agc): accept disabled conservative rasterization with uncertainty-region bits #2226

Merged
EdouardSence merged 4 commits from upstream-pr/2226 into main 2026-10-10 06:20:09 +00:00
EdouardSence commented 2026-10-09 12:16:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-09T12:16:11Z.


Depends on #1915. Only the last commit, ab09a0a9, is this PR; the first three are #1915's (its head af9e60b6).

What

Ratchet & Clank: Rift Apart (PPSA01474) writes PA_SC_CONSERVATIVE_RASTERIZATION_CNTL = 0xe6000 on its first draws. Decoded with the field shifts in the kernel's gc_10_3_0_sh_mask.h:

Bits Field Value
0 OVER_RAST_ENABLE 0
5 UNDER_RAST_ENABLE 0
13, 14 OVERRIDE_{OVER,UNDER}_RAST_INNER_TO_NORMAL 1, 1
17:16 UNCERTAINTY_REGION_MODE 2
18, 19 OUTER_ / INNER_UNCERTAINTY_EDGERULE_OVERRIDE 1, 1

Both rasterization enables are clear, as in libSceAgc's 0x6000. On top of #1915's disabled mask (0x00106000), this also accepts bits 19:16, the uncertainty-region mode and its two edge-rule overrides:

  • With either enable set, anything other than 0x6001 is still rejected. 0xe6001 and 0xe6020 are rejected.
  • It is the narrow shape discussed on #1915.

I have no source that says these fields do nothing when both enables are clear. RADV never writes them; it sets PBB_UNCERTAINTY_REGION_ENABLE only for overestimation. So the TechnicalDebt entry records it as an assumption from the field names, not a measurement.

Tested

Linux (CachyOS, GCC), RX 9070 XT, RADV / Mesa 26.2.4.

  • agc_driver_graphics: 0xe6000 decodes as disabled and is not rejected; 0xe6001 and 0xe6020 are still rejected. #1915's cases are unchanged.
  • tools/check_conventions.py passes.
  • Ratchet & Clank: Rift Apart on main 43972e69, with #1673, #1339, #1836, #1837, #1893, #2105 and #2184, plus a local placeholder for munlock:
    • Before this change, the run stops about 19 s in on PA_SC_CONSERVATIVE_RASTERIZATION_CNTL=0xe6000: only 0x6000 (off) and 0x6001 (overestimation) are supported.
    • After it, the same draws go through. The run stops a moment later on depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000001).
    • No frame has been presented yet, so I can't show a visual comparison. With both enables clear, the host pipeline is the same as for 0x6000: no conservative rasterization.

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: #1915
  • AI-assisted: yes. The investigation, code, tests and this description were written by Claude (Claude Code) on my machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4800276423 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2226). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-09T12:16:11Z. --- Depends on #1915. Only the last commit, ab09a0a9, is this PR; the first three are #1915's (its head af9e60b6). ### What Ratchet & Clank: Rift Apart (PPSA01474) writes `PA_SC_CONSERVATIVE_RASTERIZATION_CNTL = 0xe6000` on its first draws. Decoded with the field shifts in the kernel's `gc_10_3_0_sh_mask.h`: | Bits | Field | Value | |---|---|---| | 0 | `OVER_RAST_ENABLE` | 0 | | 5 | `UNDER_RAST_ENABLE` | 0 | | 13, 14 | `OVERRIDE_{OVER,UNDER}_RAST_INNER_TO_NORMAL` | 1, 1 | | 17:16 | `UNCERTAINTY_REGION_MODE` | 2 | | 18, 19 | `OUTER_` / `INNER_UNCERTAINTY_EDGERULE_OVERRIDE` | 1, 1 | Both rasterization enables are clear, as in libSceAgc's `0x6000`. On top of #1915's disabled mask (`0x00106000`), this also accepts bits 19:16, the uncertainty-region mode and its two edge-rule overrides: - With either enable set, anything other than `0x6001` is still rejected. `0xe6001` and `0xe6020` are rejected. - It is the narrow shape discussed on #1915. I have no source that says these fields do nothing when both enables are clear. RADV never writes them; it sets `PBB_UNCERTAINTY_REGION_ENABLE` only for overestimation. So the TechnicalDebt entry records it as an assumption from the field names, not a measurement. ### Tested Linux (CachyOS, GCC), RX 9070 XT, RADV / Mesa 26.2.4. - `agc_driver_graphics`: `0xe6000` decodes as disabled and is not rejected; `0xe6001` and `0xe6020` are still rejected. #1915's cases are unchanged. - `tools/check_conventions.py` passes. - **Ratchet & Clank: Rift Apart** on `main` 43972e69, with #1673, #1339, #1836, #1837, #1893, #2105 and #2184, plus a local placeholder for `munlock`: - Before this change, the run stops about 19 s in on `PA_SC_CONSERVATIVE_RASTERIZATION_CNTL=0xe6000: only 0x6000 (off) and 0x6001 (overestimation) are supported`. - After it, the same draws go through. The run stops a moment later on `depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000001)`. - No frame has been presented yet, so I can't show a visual comparison. With both enables clear, the host pipeline is the same as for `0x6000`: no conservative rasterization. ### 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: #1915 - [x] AI-assisted: yes. The investigation, code, tests and this description were written by Claude (Claude Code) on my machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
rmz-24 commented 2026-10-09 13:07:38 +00:00 (Migrated from github.com)

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


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. 11cd1dc4 cherry-picked onto current main d70b8998 (applies cleanly).

  • agc_driver_graphics passes on NVIDIA, in addition to the RADV run in the description.
  • Full ctest: 510/510.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081505474 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2226#issuecomment-6081505474). Originally posted by [rmz-24](https://github.com/rmz-24) on 2026-10-09T13:07:38Z. --- 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`. 11cd1dc4 cherry-picked onto current `main` d70b8998 (applies cleanly). - `agc_driver_graphics` passes on NVIDIA, in addition to the RADV run in the description. - Full ctest: 510/510. AI-assisted: yes
adriadam10 commented 2026-10-10 06:20:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:20:06Z.


Checked on Linux, main + this head: agc_driver_graphics and agc_driver_prepared_graphics pass, and the new rows fail without the change. 0xe6000 decodes as disabled; 0xe6001 and 0xe6020 are still rejected. The mask change is applied in both DecodeState and DrawRejection, and the TechnicalDebt entry states the assumption honestly. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094592959 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2226#issuecomment-6094592959). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T06:20:06Z. --- Checked on Linux, `main` + this head: `agc_driver_graphics` and `agc_driver_prepared_graphics` pass, and the new rows fail without the change. `0xe6000` decodes as disabled; `0xe6001` and `0xe6020` are still rejected. The mask change is applied in both `DecodeState` and `DrawRejection`, and the TechnicalDebt entry states the assumption honestly. Merging.
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!2226
No description provided.