fix(agc): draw the complete rectangles of a rect-list draw with a partial last one #3835

Merged
queeeef merged 2 commits from upstream-pr/3835 into main 2026-10-11 22:09:05 +00:00
queeeef commented 2026-10-11 17:28:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by queeeef on 2026-10-11T17:28:44Z.


What

Fixes #3832.

A rect-list draw whose vertex or index count is not a multiple of 3 threw incomplete rect-list primitive in prepareDrawInputs. Palworld (PPSA23126) issues a direct draw of 4 vertices × 9 instances as a rect list when character creation opens, and terminates on it.

Rect lists are recorded as VK_PRIMITIVE_TOPOLOGY_PATCH_LIST with 3 control points, and Vulkan generates ⌊vertexCount/3⌋ patches. The check is removed, so the complete rectangles are drawn and the trailing 1 or 2 vertices form no rectangle. All three draw forms reach this rule:

  • direct non-indexed: vkCmdDraw with the count;
  • direct indexed: vkCmdDrawIndexed on the same patch list;
  • indirect: ClassifyIndirectDraw sends every rect-list indirect draw to the CPU path (NonVertexPath), and each record becomes a direct draw through the same prepareDrawInputs.

What the console rasterizes for the incomplete rectangle is not measured: the hardware oracle runs compute kernels only, and I have no AMD GPU. That is recorded in TechnicalDebt.

The existing test that expected the throw now checks that 4- and 5-vertex rect-list draws, non-indexed and indexed, take the same path as a 3-vertex one.

Tested

Windows 11 Pro 26300, i5-13600K, RTX 2080 Ti (NVIDIA 610.74), MinGW-w64 GCC 15.2.0 (WinLibs r7). Configured like the Windows CI job (-G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON, without ccache), at 78030304:

  • check_test_registration.py: 637 test executables, none unregistered. cmake --build build and --target libs succeed.
  • ctest --output-on-failure --timeout 120 --parallel 4: 836 tests, 827 passed, 5 skipped (all expected per check_skips.py --job windows), 4 failed. None took over 30 s.
  • The 4 failures fail the same way on unmodified main a11c8f7f7 in the same build directory, so they are local to this machine, not this change:
    • guest_kernel_sys (symlink: Function not implemented) and guest_filesystem (line 286, Win32 error 5): this account cannot create symbolic links;
    • windows_exceptions: #3411;
    • agc_driver_emulated_color_compare: samples or gathers an sRGB image the device cannot sample on this NVIDIA device.
  • agc_driver_graphics passes. With the removed check restored, it fails on the non-indexed case, and also on the indexed case run alone.
  • tools/check_conventions.py --base upstream/main and git diff --check pass.
  • Linux not tested.
  • Title: Palworld (PPSA23126, 01.102.999), with the other fixes it needs to reach character creation (#2648). The title ran with a local equivalent that lowered the count to a multiple of 3 before recording; with it the draw goes through and character creation renders. This exact commit has not been run with the title.

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 (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4820940883 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3835). Originally posted by [queeeef](https://github.com/queeeef) on 2026-10-11T17:28:44Z. --- ### What Fixes #3832. A rect-list draw whose vertex or index count is not a multiple of 3 threw `incomplete rect-list primitive` in `prepareDrawInputs`. Palworld (PPSA23126) issues a direct draw of 4 vertices × 9 instances as a rect list when character creation opens, and terminates on it. Rect lists are recorded as `VK_PRIMITIVE_TOPOLOGY_PATCH_LIST` with 3 control points, and Vulkan generates [⌊vertexCount/3⌋ patches](https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#drawing-patch-lists). The check is removed, so the complete rectangles are drawn and the trailing 1 or 2 vertices form no rectangle. All three draw forms reach this rule: - direct non-indexed: `vkCmdDraw` with the count; - direct indexed: `vkCmdDrawIndexed` on the same patch list; - indirect: `ClassifyIndirectDraw` sends every rect-list indirect draw to the CPU path (`NonVertexPath`), and each record becomes a direct draw through the same `prepareDrawInputs`. What the console rasterizes for the incomplete rectangle is not measured: the hardware oracle runs compute kernels only, and I have no AMD GPU. That is recorded in TechnicalDebt. The existing test that expected the throw now checks that 4- and 5-vertex rect-list draws, non-indexed and indexed, take the same path as a 3-vertex one. ### Tested Windows 11 Pro 26300, i5-13600K, RTX 2080 Ti (NVIDIA 610.74), MinGW-w64 GCC 15.2.0 (WinLibs r7). Configured like the Windows CI job (`-G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON`, without ccache), at `78030304`: - `check_test_registration.py`: 637 test executables, none unregistered. `cmake --build build` and `--target libs` succeed. - `ctest --output-on-failure --timeout 120 --parallel 4`: 836 tests, 827 passed, 5 skipped (all expected per `check_skips.py --job windows`), 4 failed. None took over 30 s. - The 4 failures fail the same way on unmodified `main` `a11c8f7f7` in the same build directory, so they are local to this machine, not this change: - `guest_kernel_sys` (`symlink: Function not implemented`) and `guest_filesystem` (line 286, Win32 error 5): this account cannot create symbolic links; - `windows_exceptions`: #3411; - `agc_driver_emulated_color_compare`: `samples or gathers an sRGB image the device cannot sample` on this NVIDIA device. - `agc_driver_graphics` passes. With the removed check restored, it fails on the non-indexed case, and also on the indexed case run alone. - `tools/check_conventions.py --base upstream/main` and `git diff --check` pass. - Linux not tested. - Title: Palworld (PPSA23126, 01.102.999), with the other fixes it needs to reach character creation (#2648). The title ran with a local equivalent that lowered the count to a multiple of 3 before recording; with it the draw goes through and character creation renders. This exact commit has not been run with the title. ### 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 (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
adriadam10 commented 2026-10-11 22:09:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T22:09:01Z.


Checked on Linux (build + ctest of libSceAgcDriver, 384 tests green; agc_driver_graphics fails with the check restored). The unmeasured console behaviour for the incomplete rectangle is recorded in TechnicalDebt. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114393287 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3835#issuecomment-6114393287). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T22:09:01Z. --- Checked on Linux (build + ctest of libSceAgcDriver, 384 tests green; `agc_driver_graphics` fails with the check restored). The unmeasured console behaviour for the incomplete rectangle is recorded in TechnicalDebt. 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!3835
No description provided.