fix(agc): handle the fill kernel that reads its pattern from a buffer #4465

Merged
mrzacarias merged 1 commit from upstream-pr/4465 into main 2026-10-14 00:30:42 +00:00
mrzacarias commented 2026-10-12 12:35:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrzacarias on 2026-10-12T12:35:03Z.


What

The fill HLE knows the 16-byte fill kernel that takes its pattern from the user SGPRs s[4:7]. Some titles use a variant that loads the pattern with s_buffer_load_dwordx4 through the V# in s[4:7] instead:

d7460004 04010c08 f4280302 fa000000 bf8cc07f 7e00020c 7e02020d 7e04020e 7e06020f e01c2000 80000004 bf810000

That variant ran as a shader, so a uniform fill over an HTILE was never seen as a depth fast clear. Vampire Crawlers clears its 1080p UI canvas HTILE this way every frame. The depth surface kept old depth, every UI draw (reverse-Z, GEQUAL) failed its depth test, and the screen stayed black while the 3D scene rendered into its own target.

matchesFillKernel now accepts the variant, and fillBuffer reads the 16-byte pattern from the V# base address, so the existing HTILE and DCC key handling applies. The descriptor's size and stride are not checked. depth_fast_clear_submit gets a case that fills with the buffer pattern 0xffffffff (no clear) and 0 (clear).

Context: https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6114613325

Tested

macOS arm64 (M1 Pro, MoltenVK), on main plus a local macOS arm64 port, FEXCore runner. Vampire Crawlers: black screen before, renders and plays after. depth_fast_clear_submit: the new case fails without the fix and passes with it. agc_driver_graphics_tests, dword_pattern_fill, pattern_buffer_fill, fill_cover_keys, vertex_fetch pass. Linux and Windows not tested.

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
  • Unblocks: PPSA30703 (Vampire Crawlers; no Game bring-up discussion yet)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4829483400 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4465). Originally posted by [mrzacarias](https://github.com/mrzacarias) on 2026-10-12T12:35:03Z. --- ### What The fill HLE knows the 16-byte fill kernel that takes its pattern from the user SGPRs s[4:7]. Some titles use a variant that loads the pattern with `s_buffer_load_dwordx4` through the V# in s[4:7] instead: ``` d7460004 04010c08 f4280302 fa000000 bf8cc07f 7e00020c 7e02020d 7e04020e 7e06020f e01c2000 80000004 bf810000 ``` That variant ran as a shader, so a uniform fill over an HTILE was never seen as a depth fast clear. Vampire Crawlers clears its 1080p UI canvas HTILE this way every frame. The depth surface kept old depth, every UI draw (reverse-Z, `GEQUAL`) failed its depth test, and the screen stayed black while the 3D scene rendered into its own target. `matchesFillKernel` now accepts the variant, and `fillBuffer` reads the 16-byte pattern from the V# base address, so the existing HTILE and DCC key handling applies. The descriptor's size and stride are not checked. `depth_fast_clear_submit` gets a case that fills with the buffer pattern 0xffffffff (no clear) and 0 (clear). Context: https://github.com/boykopovar/AnyPS5/issues/1#issuecomment-6114613325 ### Tested macOS arm64 (M1 Pro, MoltenVK), on `main` plus a local macOS arm64 port, FEXCore runner. Vampire Crawlers: black screen before, renders and plays after. `depth_fast_clear_submit`: the new case fails without the fix and passes with it. `agc_driver_graphics_tests`, `dword_pattern_fill`, `pattern_buffer_fill`, `fill_cover_keys`, `vertex_fetch` pass. Linux and Windows not tested. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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] Unblocks: PPSA30703 (Vampire Crawlers; no Game bring-up discussion yet) - [x] AI-assisted: yes
kr4y4 commented 2026-10-12 16:09:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-12T16:09:34Z.


Windows run, since the description lists Linux and Windows as not tested.

Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head 3bc3e35a0 merged into main 2a5eca11c.

  • agc_driver_depth_fast_clear_submit, depth_fast_clear, dword_pattern_fill, pattern_buffer_fill, fill_cover_keys, vertex_fetch and graphics pass on both GPUs with --repeat until-fail:3.
  • The new case runs on both: they store compute fills into imported guest memory, and the test ends with depth fast clear submit tests passed, not the without the compute fill line.
  • With main's BufferFill.cpp and the new test, agc_driver_depth_fast_clear_submit fails on both GPUs: a compute fill with the buffer pattern 0 over the HTILE did not clear the depth to DB_DEPTH_CLEAR (1.0).
  • Full suite (ctest --timeout 120 --parallel 4): 973 of 973 on the RTX 4070. On the iGPU 972 of 973; the one failure, agc_driver_f32_dot2_rounding, fails the same way on main (no shaderFloat64, #4528).

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128034022 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4465#issuecomment-6128034022). Originally posted by [kr4y4](https://github.com/kr4y4) on 2026-10-12T16:09:34Z. --- Windows run, since the description lists Linux and Windows as not tested. Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head 3bc3e35a0 merged into `main` 2a5eca11c. - `agc_driver_depth_fast_clear_submit`, `depth_fast_clear`, `dword_pattern_fill`, `pattern_buffer_fill`, `fill_cover_keys`, `vertex_fetch` and `graphics` pass on both GPUs with `--repeat until-fail:3`. - The new case runs on both: they store compute fills into imported guest memory, and the test ends with `depth fast clear submit tests passed`, not the `without the compute fill` line. - With `main`'s `BufferFill.cpp` and the new test, `agc_driver_depth_fast_clear_submit` fails on both GPUs: `a compute fill with the buffer pattern 0 over the HTILE did not clear the depth to DB_DEPTH_CLEAR (1.0)`. - Full suite (`ctest --timeout 120 --parallel 4`): 973 of 973 on the RTX 4070. On the iGPU 972 of 973; the one failure, `agc_driver_f32_dot2_rounding`, fails the same way on `main` (no `shaderFloat64`, #4528). Written with AI assistance.
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!4465
No description provided.