fix(agc): accept integer tessellation partitioning #5234

Merged
AnthonyClemens merged 1 commit from upstream-pr/5234 into main 2026-10-14 02:55:50 +00:00
AnthonyClemens commented 2026-10-13 15:19:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AnthonyClemens on 2026-10-13T15:19:53Z.


What

Resident Evil 2, PPSA04288 (and presumably other RE engine titles) tessellates with integer partitioning, and right now any draw that does is thrown out. The state decoder stops with only triangle and quad domains with fractional-odd partitioning and triangle output are supported by the reference path, and the hull and domain programs stop with ShaderInputInfoBuilder: unsupported tessellation configuration.

This lets VGT_TF_PARAM.PARTITIONING = 0 through for triangle and quad patches and draws it with Vulkan's equal spacing.

Where the mapping comes from: PARTITIONING is bits 2-4 of VGT_TF_PARAM and 0 is PART_INTEGER in Mesa's gfx10.json, and radeonsi writes PART_INTEGER for TESS_SPACING_EQUAL in si_state_shaders.cpp. I have not measured anything on a console.

What changed:

  • The three places that checked for fractional-odd now also take integer.
  • The domain module gets SpacingEqual instead of SpacingFractionalOdd, and the pipeline's module check expects the same.
  • The hull's factor clamp tops out at 64 for integer. It stays at 63 for fractional-odd, which is what Vulkan allows each mode when the maximum level is 64.

Fractional-odd draws go through the same code as before. Partitioning was already in the shader cache key, the request serializer and the draw and pipeline keys, so none of that needed touching.

Power-of-two (1) and fractional-even (3) still throw. Vulkan has no power-of-two mode, and fractional-even needs a different clamp range, so I left it for its own PR. I added a line to docs/dev/debt/shader.md saying the console's rounding of a clamped factor is unmeasured.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, Radeon RX 9070 XT.

  • agc_driver_tessellation and agc_driver_graphics both fail if I revert the source change and pass with it. The new checks cover: integer triangle patches decode, compile to SpacingEqual with a bound of 64, and draw; fractional-odd still compiles to SpacingFractionalOdd with a bound of 63; power-of-two is still refused.
  • Full ctest: 1082 of 1083 pass, 8 expected skips. The one failure is agc_driver_layered_volume_vertex_no_gpl (slice 1 texel (0, 0) channel 0 is 64, expected 255). It fails the same way on this card without my change.
  • PPSA04288, with #4949 applied locally so it gets as far as its first tessellated draw (VGT_TF_PARAM=0x40042, quad domain, integer): the partitioning refusal is gone. It then stops a bit later in the hull lowering with the hull shader reads no LDS per control point, so the local stride is unknown, which is a separate problem this PR doesn't touch. So I don't have a screenshot of an integer-tessellated patch from a real game, only the test's draw.

I only have this one title to test with.

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 under Silent stubs in their library's technical debt file
  • 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
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4845456448 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5234). Originally posted by [AnthonyClemens](https://github.com/AnthonyClemens) on 2026-10-13T15:19:53Z. --- ### What Resident Evil 2, PPSA04288 (and presumably other RE engine titles) tessellates with integer partitioning, and right now any draw that does is thrown out. The state decoder stops with `only triangle and quad domains with fractional-odd partitioning and triangle output are supported by the reference path`, and the hull and domain programs stop with `ShaderInputInfoBuilder: unsupported tessellation configuration`. This lets `VGT_TF_PARAM.PARTITIONING` = 0 through for triangle and quad patches and draws it with Vulkan's equal spacing. Where the mapping comes from: `PARTITIONING` is bits 2-4 of `VGT_TF_PARAM` and 0 is `PART_INTEGER` in Mesa's [`gfx10.json`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-24.0.0/src/amd/registers/gfx10.json), and radeonsi writes `PART_INTEGER` for `TESS_SPACING_EQUAL` in [`si_state_shaders.cpp`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-24.0.0/src/gallium/drivers/radeonsi/si_state_shaders.cpp#L539-540). I have not measured anything on a console. What changed: - The three places that checked for fractional-odd now also take integer. - The domain module gets `SpacingEqual` instead of `SpacingFractionalOdd`, and the pipeline's module check expects the same. - The hull's factor clamp tops out at 64 for integer. It stays at 63 for fractional-odd, which is what Vulkan allows each mode when the maximum level is 64. Fractional-odd draws go through the same code as before. Partitioning was already in the shader cache key, the request serializer and the draw and pipeline keys, so none of that needed touching. Power-of-two (1) and fractional-even (3) still throw. Vulkan has no power-of-two mode, and fractional-even needs a different clamp range, so I left it for its own PR. I added a line to `docs/dev/debt/shader.md` saying the console's rounding of a clamped factor is unmeasured. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, Radeon RX 9070 XT. - `agc_driver_tessellation` and `agc_driver_graphics` both fail if I revert the source change and pass with it. The new checks cover: integer triangle patches decode, compile to `SpacingEqual` with a bound of 64, and draw; fractional-odd still compiles to `SpacingFractionalOdd` with a bound of 63; power-of-two is still refused. - Full `ctest`: 1082 of 1083 pass, 8 expected skips. The one failure is `agc_driver_layered_volume_vertex_no_gpl` (`slice 1 texel (0, 0) channel 0 is 64, expected 255`). It fails the same way on this card without my change. - PPSA04288, with #4949 applied locally so it gets as far as its first tessellated draw (`VGT_TF_PARAM=0x40042`, quad domain, integer): the partitioning refusal is gone. It then stops a bit later in the hull lowering with `the hull shader reads no LDS per control point, so the local stride is unknown`, which is a separate problem this PR doesn't touch. So I don't have a screenshot of an integer-tessellated patch from a real game, only the test's draw. I only have this one title to test with. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Unblocks: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-13 15:29:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T15:29:39Z.


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
#4201 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L768-769
core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp L420
docs/dev/debt/shader.md L90
#4222 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L768-769
core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp L5, L420
docs/dev/debt/shader.md L90
#5457 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L768-769
core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp L5, L420
docs/dev/debt/shader.md L90
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149100572 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5234#issuecomment-6149100572). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T15:29:39Z. --- <!-- 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 | |---|---|---|---| | #4201 | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L768-769](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L768-L769)<br>`core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp` [L420](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp#L420)<br>`docs/dev/debt/shader.md` [L90](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/docs/dev/debt/shader.md#L90) | | | | #4222 | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L768-769](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L768-L769)<br>`core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp` [L5](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp#L5), [L420](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp#L420)<br>`docs/dev/debt/shader.md` [L90](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/docs/dev/debt/shader.md#L90) | | | | #5457 | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L768-769](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L768-L769)<br>`core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp` [L5](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp#L5), [L420](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp#L420)<br>`docs/dev/debt/shader.md` [L90](https://github.com/boykopovar/AnyPS5/blob/0a56aaaf47c6e99633c710a524e7834eed4b450e/docs/dev/debt/shader.md#L90) | | |
AnthonyClemens commented 2026-10-13 15:37:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AnthonyClemens on 2026-10-13T15:37:59Z.


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
#4201 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L602-603
core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp L420
docs/dev/debt/shader.md L90
#4222 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L602-603
core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp L5, L420
docs/dev/debt/shader.md L90

Note: The overlap with #4201 and #4222 is only in tests and docs: we each add a test in Tessellation.cpp, a line in shader.md, and touch neighboring lines in Graphics.cpp. None of the source files overlap and this doesn't build on them. Not depended on.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149264422 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5234#issuecomment-6149264422). Originally posted by [AnthonyClemens](https://github.com/AnthonyClemens) on 2026-10-13T15:37:59Z. --- > 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 > #4201 `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L602-603](https://github.com/boykopovar/AnyPS5/blob/c35bc4b92c50e774ba1221eccd284a8f81c1ae39/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L602-L603) > `core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp` [L420](https://github.com/boykopovar/AnyPS5/blob/c35bc4b92c50e774ba1221eccd284a8f81c1ae39/core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp#L420) > `docs/dev/debt/shader.md` [L90](https://github.com/boykopovar/AnyPS5/blob/c35bc4b92c50e774ba1221eccd284a8f81c1ae39/docs/dev/debt/shader.md#L90) > #4222 `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L602-603](https://github.com/boykopovar/AnyPS5/blob/c35bc4b92c50e774ba1221eccd284a8f81c1ae39/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L602-L603) > `core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp` [L5](https://github.com/boykopovar/AnyPS5/blob/c35bc4b92c50e774ba1221eccd284a8f81c1ae39/core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp#L5), [L420](https://github.com/boykopovar/AnyPS5/blob/c35bc4b92c50e774ba1221eccd284a8f81c1ae39/core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cpp#L420) > `docs/dev/debt/shader.md` [L90](https://github.com/boykopovar/AnyPS5/blob/c35bc4b92c50e774ba1221eccd284a8f81c1ae39/docs/dev/debt/shader.md#L90) Note: The overlap with #4201 and #4222 is only in tests and docs: we each add a test in Tessellation.cpp, a line in shader.md, and touch neighboring lines in Graphics.cpp. None of the source files overlap and this doesn't build on them. Not depended on.
coltken95 commented 2026-10-13 18:47:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-13T18:47:28Z.


Tested on Linux x86-64 (Release build, lavapipe / llvmpipe LLVM 20.1.2), with d7818c9e5 merged into main 9d0a41d5a:

  • With the PR: all six tests in the PR's targets pass (agc_driver_graphics, agc_driver_tessellation, agc_sparse_buffer_holes, agc_descriptor_pool_reset_failure, agc_compute_descriptor_layout_flags, agc_driver_covered_centroid_state).
  • With main's sources and the PR's tests: agc_driver_graphics and agc_driver_tessellation fail; the other four pass.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152723931 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5234#issuecomment-6152723931). Originally posted by [coltken95](https://github.com/coltken95) on 2026-10-13T18:47:28Z. --- Tested on Linux x86-64 (Release build, lavapipe / llvmpipe LLVM 20.1.2), with d7818c9e5 merged into main 9d0a41d5a: - With the PR: all six tests in the PR's targets pass (`agc_driver_graphics`, `agc_driver_tessellation`, `agc_sparse_buffer_holes`, `agc_descriptor_pool_reset_failure`, `agc_compute_descriptor_layout_flags`, `agc_driver_covered_centroid_state`). - With main's sources and the PR's tests: `agc_driver_graphics` and `agc_driver_tessellation` fail; the other four pass. AI-assisted: yes (Claude Code)
EagleBearerYS commented 2026-10-13 19:37:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-13T19:37:07Z.


Resident Evil Village (PPSA01556, 01.210.000), another RE Engine title, needs this too. It draws quad patches with integer partitioning (VGT_TF_PARAM 0x40042: quads of one control point, integer, CW, max level 15), and on main they stop with:

VGT_SHADER_STAGES_EN=0x200210d: only triangle and quad domains with fractional-odd partitioning and triangle output are supported by the reference path

I had the same change locally, line for line in the production files, so I won't open mine. I replayed 21 tessellation requests dumped from Village with agc_shader_control_flow_tests, built on #4222's head (3a72fa3fa). Without integer partitioning, 5 compile and 15 stop at ShaderInputInfoBuilder: unsupported tessellation configuration. With it, 15 compile. The rest need other hull changes. That was on Windows 11 with WinLibs GCC 15.2.0.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153634737 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5234#issuecomment-6153634737). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-13T19:37:07Z. --- Resident Evil Village (PPSA01556, 01.210.000), another RE Engine title, needs this too. It draws quad patches with integer partitioning (`VGT_TF_PARAM` 0x40042: quads of one control point, integer, CW, max level 15), and on `main` they stop with: ``` VGT_SHADER_STAGES_EN=0x200210d: only triangle and quad domains with fractional-odd partitioning and triangle output are supported by the reference path ``` I had the same change locally, line for line in the production files, so I won't open mine. I replayed 21 tessellation requests dumped from Village with `agc_shader_control_flow_tests`, built on #4222's head (3a72fa3fa). Without integer partitioning, 5 compile and 15 stop at `ShaderInputInfoBuilder: unsupported tessellation configuration`. With it, 15 compile. The rest need other hull changes. That was on Windows 11 with WinLibs GCC 15.2.0.
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!5234
No description provided.