fix(agc): handle Demon's Souls read-only depth resummarize #4049

Merged
Mouhand-Kaddo merged 1 commit from upstream-pr/4049 into main 2026-10-12 04:30:55 +00:00
Mouhand-Kaddo commented 2026-10-11 22:09:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T22:09:18Z.


What

Demon's Souls PPSA01342 v1.04 issues a pure DB_RENDER_CONTROL.RESUMMARIZE_ENABLE draw with DB_DEPTH_CONTROL=0x007007f3, D32 depth, no stencil plane, zero color writes and no pixel program. After the earlier Windows direct-memory stop is bypassed by #637, main rejects it with:

DB_RENDER_CONTROL depth copy, resummarize or decompress is unsupported (register 0x0 = 0x00000010)

Extend #2178's resident-depth model to this read-only pass. HTILE is not modeled, so recomputing its summary changes no modeled surface state. Accept only pure resummarization with enabled D16/D32 depth that always passes, no depth writes, bounds test or conditional color writes, no stencil plane, zero color writes, and no running pixel stage. Return DrawVerdict::Nothing before shader decoding or pipeline creation. Missing required registers and draws outside these constraints still reject. TechnicalDebt records the boundary.

This is generic register-driven behavior. There is no title check, retry or new environment switch. The PR contains only the resummarize change; #1395's clear/copy recognition and the closed stencil-clear PRs do not implement it.

Tested

Windows 11, i7-13700K, Radeon RX 6900 XT, MinGW-w64, Release, hardware Vulkan, ANYPS5_ENABLE_SPIRV_TOOLS=OFF (default). Based on main 974116d38b1b6ba3ca7e45846c704f2101ec2de3.

  • agc_driver_graphics: the captured register state fails before this change and passes with it. Depth writes, bounds tests, rejecting depth comparisons, a stencil plane, color writes, a running pixel stage, combined maintenance modes, unsupported depth format and missing required registers still reject.
  • agc_driver_readonly_resummarize: submits SET_CONTEXT_REG and DRAW_INDEX_AUTO through the real worker, then waits idle. The unchanged driver throws the exact maintenance rejection above; the changed driver completes. It requires no GPU and exercises the early verdict rather than only the state helper.
  • Full libs build, the two focused tests, and conventions checks pass on the new main. agc_driver passes with Khronos Vulkan validation enabled, without validation errors. Its normal run intermittently exits with Windows heap corruption (0xc0000374). A private baseline probe using the unchanged driver and original submit suite, adding only a zero-count draw (main's existing early no-op), reproduced the same exit on the third run. Thus that failure can occur without this resummarize change; it remains unresolved.
  • Real legal local PPSA01342 game run on the previous main snapshot 989146c3, with #4021 (Windows build guard), #4018 (loop shader) and #637 (direct-memory write tracking), reached the maintenance rejection at about 55–90 seconds without this change. With this change it progressed into further graphics work, then hit an access violation inside amdvlk64.dll (read of 0xffffffffffffffff) near the end of a 300-second observation. No menu or presented frame is claimed. Original game files were preserved.
  • Rebuilt all libraries and relinked the game and its two bundled modules on main 974116d38 with the same test stack. With this change and Khronos validation enabled, the game again advances past resummarization, then exits after 343 seconds with amdvlk64.dll+0x9e251f, read of 0xffffffffffffffff. Validation reports ten forward-compatibility warnings about 3D-image barrier layer counts and no validation errors before the crash. This later driver crash is outside this PR; main-menu boot remains unverified.

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 for this code change; the Windows game test stack above includes #637, #4018 and #4021
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4822748642 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4049). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-11T22:09:18Z. --- ### What Demon's Souls PPSA01342 v1.04 issues a pure `DB_RENDER_CONTROL.RESUMMARIZE_ENABLE` draw with `DB_DEPTH_CONTROL=0x007007f3`, D32 depth, no stencil plane, zero color writes and no pixel program. After the earlier Windows direct-memory stop is bypassed by #637, main rejects it with: ``` DB_RENDER_CONTROL depth copy, resummarize or decompress is unsupported (register 0x0 = 0x00000010) ``` Extend #2178's resident-depth model to this read-only pass. HTILE is not modeled, so recomputing its summary changes no modeled surface state. Accept only pure resummarization with enabled D16/D32 depth that always passes, no depth writes, bounds test or conditional color writes, no stencil plane, zero color writes, and no running pixel stage. Return `DrawVerdict::Nothing` before shader decoding or pipeline creation. Missing required registers and draws outside these constraints still reject. TechnicalDebt records the boundary. This is generic register-driven behavior. There is no title check, retry or new environment switch. The PR contains only the resummarize change; #1395's clear/copy recognition and the closed stencil-clear PRs do not implement it. ### Tested Windows 11, i7-13700K, Radeon RX 6900 XT, MinGW-w64, Release, hardware Vulkan, `ANYPS5_ENABLE_SPIRV_TOOLS=OFF` (default). Based on main `974116d38b1b6ba3ca7e45846c704f2101ec2de3`. - `agc_driver_graphics`: the captured register state fails before this change and passes with it. Depth writes, bounds tests, rejecting depth comparisons, a stencil plane, color writes, a running pixel stage, combined maintenance modes, unsupported depth format and missing required registers still reject. - `agc_driver_readonly_resummarize`: submits `SET_CONTEXT_REG` and `DRAW_INDEX_AUTO` through the real worker, then waits idle. The unchanged driver throws the exact maintenance rejection above; the changed driver completes. It requires no GPU and exercises the early verdict rather than only the state helper. - Full `libs` build, the two focused tests, and conventions checks pass on the new main. `agc_driver` passes with Khronos Vulkan validation enabled, without validation errors. Its normal run intermittently exits with Windows heap corruption (`0xc0000374`). A private baseline probe using the unchanged driver and original submit suite, adding only a zero-count draw (main's existing early no-op), reproduced the same exit on the third run. Thus that failure can occur without this resummarize change; it remains unresolved. - Real legal local PPSA01342 game run on the previous main snapshot `989146c3`, with #4021 (Windows build guard), #4018 (loop shader) and #637 (direct-memory write tracking), reached the maintenance rejection at about 55–90 seconds without this change. With this change it progressed into further graphics work, then hit an access violation inside `amdvlk64.dll` (read of `0xffffffffffffffff`) near the end of a 300-second observation. No menu or presented frame is claimed. Original game files were preserved. - Rebuilt all libraries and relinked the game and its two bundled modules on main `974116d38` with the same test stack. With this change and Khronos validation enabled, the game again advances past resummarization, then exits after 343 seconds with `amdvlk64.dll+0x9e251f`, read of `0xffffffffffffffff`. Validation reports ten forward-compatibility warnings about 3D-image barrier layer counts and no validation errors before the crash. This later driver crash is outside this PR; main-menu boot remains unverified. ### 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 for this code change; the Windows game test stack above includes #637, #4018 and #4021 - [x] AI-assisted: yes
btsouth commented 2026-10-12 00:21:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by btsouth on 2026-10-12T00:21:20Z.


Note

Posted by an AI agent on behalf of Tyler.

Tested on Linux with NVIDIA, Demon's Souls PPSA01342 v1.005 (US). This PR merged locally onto main bab7b328, Release, ANYPS5_ENABLE_SPIRV_TOOLS=ON, APS5_SPIRV_OPT=none. Arch Linux, kernel 7.2.8, GCC 16.2.1, RTX 4070 SUPER on driver 615.78.08.

On plain bab7b328 the title opens its window, presents 2 frames and stops with DB_RENDER_CONTROL depth copy, resummarize or decompress is unsupported (register 0x0 = 0x00000010). With this PR that error is gone. Start-up continues through about 2,450 shader compilations to the save data search, then stops presenting after 2 frames for separate reasons, which I described in #3710.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115541121 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4049#issuecomment-6115541121). Originally posted by [btsouth](https://github.com/btsouth) on 2026-10-12T00:21:20Z. --- > [!NOTE] > Posted by an AI agent on behalf of Tyler. Tested on Linux with NVIDIA, Demon's Souls PPSA01342 v1.005 (US). This PR merged locally onto main bab7b328, Release, `ANYPS5_ENABLE_SPIRV_TOOLS=ON`, `APS5_SPIRV_OPT=none`. Arch Linux, kernel 7.2.8, GCC 16.2.1, RTX 4070 SUPER on driver 615.78.08. On plain bab7b328 the title opens its window, presents 2 frames and stops with `DB_RENDER_CONTROL depth copy, resummarize or decompress is unsupported (register 0x0 = 0x00000010)`. With this PR that error is gone. Start-up continues through about 2,450 shader compilations to the save data search, then stops presenting after 2 frames for separate reasons, which I described in #3710.
github-actions[bot] commented 2026-10-12 03:35:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T03:35:21Z.


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
#1368 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L136
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6117272451 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4049#issuecomment-6117272451). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T03:35:21Z. --- <!-- 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 | |---|---|---|---| | #1368 | `core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp` [L136](https://github.com/boykopovar/AnyPS5/blob/18af2172112c311c4b59e8fec992a6a53a90d249/core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp#L136) | | |
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!4049
No description provided.