fix(libSceAgcDriver): keep D16 storage coherent with resident depth #1842

Closed
ebarr24 wants to merge 2 commits from upstream-pr/1842 into main
ebarr24 commented 2026-10-08 21:24:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ebarr24 on 2026-10-08T21:24:01Z.


What

Depends on #1684 (included public commit c46ecda781, cleanly integrated on upstream b858fdc48e).

Matching single-level single-layer R16_UNORM 2D and 2D-array storage over resident D16_UNORM depth currently throws. Transfer its 16-bit Vulkan depth-aspect buffer plane into normalized storage and a separately keyed R16_UINT alias, and return actual compute writes to authoritative resident depth. Attachment writes refresh storage, independent view types and UNORM/UINT formats share revisions, and queued resources retain ownership. Generic storage/sample resource sets and deferred sampled captures created before residency rebuild conservatively instead of trusting stale guest-memory proofs. Existing R8 stencil behavior and unsupported-path diagnostics are preserved.

This narrow alternative overlaps #425's broader depth/array/HTILE implementation and #454's depth coherence/retirement work. Those implementations and reports are real; this PR offers explicit GPU storage/sample/attachment/lifetime/reuse regressions without adopting their broad stacks. #1430's sampled-depth proof work is complementary and needs integration review if chosen. The dependency and competing paths will need integration and revalidation if their contracts change or they merge first.

Vulkan aspect copy rules define the D16 depth plane. Logical resident transport does not verify PS5 tiling/compression, HTILE or raw CPU coherence; DCC0 is not an HTILE proof. Earlier generic-write initialization, other-layout retirement and extra depth formats/mips/layers remain unsupported. No shader ISA semantics or console hardware verification is claimed. This addresses README Status's libSceAgcDriver rendering capability and the next measured Stray blocker on dependency c46; it does not claim Issue #1409 closed, a rendered scene, title playability or controls.

The parent-owned private Stray retest of this exact head stops before the title window at a computed s_swappc_b64 call target that the current shader translator cannot statically resolve. No new menu, rendered scene, controls or playability are verified on this head. Earlier c4ac menu/readback evidence remains historical.

Tested

Windows Full validation uses GCC 15.2/MinGW and these core build/test commands, with the workspace supplying its pinned dependency package and compiler cache:

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
cmake --build build --parallel 2
cmake --build build --target libs --parallel 2
ctest --test-dir build --output-on-failure --timeout 120 --no-tests=error

Exact-head Ubuntu uses the upstream Build workflow, with required Vulkan execution and CTest --repeat until-fail:3 --parallel 4 --output-log ctest.log. No workflow or timeout is changed by this PR.

Public hand-authored DB state/T# descriptors and GLSL only. Pure upstream base b858fdc48e and final candidate use the identical fixture. The base first passes real D16 attachment comparisons, then refuses resident depth storage. Candidate validation covers typed/formatless normalized and integer 2D and one-layer array RMW, exact integer bits, UNORM sampling, positive/negative depth comparisons, attachment refresh, independent view and cross-format round trips with distinct format view identity, queued registry/cache clearing and reusable generic-to-resident storage/sample descriptor routing. D16 attachment quantization has a one-step oracle; UNORM conversion rules permit one integer step for normalized float storage writes. The test propagates actual quantized values; UINT writes and subsequent cross-format alias copies compare exactly, while sampled depth must match the stored canonical bits within2e-7. New PM4 submission/RDNA translation is not exercised by this fixture; the broader existing suite remains required. No proprietary inputs or extracted shader bytes are added.

Candidate 66bf9fa39a0226448f9fd754c7e8ea095b0386d9 is committed on pure upstream b858fdc48e29c3ab7476782199d8a41999d46d59. The reusable-resource fixture follows the merged shader runtime contract: typed numeric-class/image-shape storage/sample/sampler heap slots derived with main DescriptorBindingForImage and queried/enabled VK_EXT_robustness2 nullDescriptor. The existing stencil regression remains unchanged. Clean committed-head all-target Full Windows validation, including libs, passes 482/482 tests with zero failures or skips on Windows 11, GCC 15.2, NVIDIA GeForce RTX 3080. The D16 and unchanged stencil regressions take 0.75 s and 0.47 s. The identical isolated-base fixture fails at the intended UNORM resident-depth refusal after attachment controls. Exact-head Ubuntu 24.04 lavapipe run 37839541370 passes 464 tests, with 24 individually reviewed capability skips and no failures. Both D16 and unchanged stencil storage regressions execute and pass three times, each under 30 s including the cold run. Reviewed skips require wave-sized subgroups, conservative rasterization, or look-back scan atomic/subgroup features; their corresponding RTX 3080 Windows tests pass. Software Vulkan complements the hardware execution evidence.

Checklist

  • Based on current main; no other open PR implements the same functions — pinned upstream base b858fdc48; explicit scenario alternative overlaps #425/#454, with included dependency #1684 and final complete overlap review.
  • 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: #1684
  • AI-assisted: yes; the author is responsible for every line
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4792967071 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1842). Originally posted by [ebarr24](https://github.com/ebarr24) on 2026-10-08T21:24:01Z. --- ### What Depends on #1684 (included public commit c46ecda78121a05a02ae7748d27b5029eace4f80, cleanly integrated on upstream b858fdc48e29c3ab7476782199d8a41999d46d59). Matching single-level single-layer R16_UNORM 2D and 2D-array storage over resident D16_UNORM depth currently throws. Transfer its 16-bit Vulkan depth-aspect buffer plane into normalized storage and a separately keyed R16_UINT alias, and return actual compute writes to authoritative resident depth. Attachment writes refresh storage, independent view types and UNORM/UINT formats share revisions, and queued resources retain ownership. Generic storage/sample resource sets and deferred sampled captures created before residency rebuild conservatively instead of trusting stale guest-memory proofs. Existing R8 stencil behavior and unsupported-path diagnostics are preserved. This narrow alternative overlaps #425's broader depth/array/HTILE implementation and #454's depth coherence/retirement work. Those implementations and reports are real; this PR offers explicit GPU storage/sample/attachment/lifetime/reuse regressions without adopting their broad stacks. #1430's sampled-depth proof work is complementary and needs integration review if chosen. The dependency and competing paths will need integration and revalidation if their contracts change or they merge first. [Vulkan aspect copy rules](https://docs.vulkan.org/spec/latest/chapters/copies.html#copies-buffers-images) define the D16 depth plane. Logical resident transport does not verify PS5 tiling/compression, HTILE or raw CPU coherence; DCC0 is not an HTILE proof. Earlier generic-write initialization, other-layout retirement and extra depth formats/mips/layers remain unsupported. No shader ISA semantics or console hardware verification is claimed. This addresses README Status's libSceAgcDriver rendering capability and the next measured Stray blocker on dependency c46; it does not claim Issue #1409 closed, a rendered scene, title playability or controls. The parent-owned private Stray retest of this exact head stops before the title window at a computed `s_swappc_b64` call target that the current shader translator cannot statically resolve. No new menu, rendered scene, controls or playability are verified on this head. Earlier c4ac menu/readback evidence remains historical. ### Tested Windows Full validation uses GCC 15.2/MinGW and these core build/test commands, with the workspace supplying its pinned dependency package and compiler cache: ```sh cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ cmake --build build --parallel 2 cmake --build build --target libs --parallel 2 ctest --test-dir build --output-on-failure --timeout 120 --no-tests=error ``` Exact-head Ubuntu uses the upstream Build workflow, with required Vulkan execution and CTest `--repeat until-fail:3 --parallel 4 --output-log ctest.log`. No workflow or timeout is changed by this PR. Public hand-authored DB state/T# descriptors and GLSL only. Pure upstream base b858fdc48e29c3ab7476782199d8a41999d46d59 and final candidate use the identical fixture. The base first passes real D16 attachment comparisons, then refuses resident depth storage. Candidate validation covers typed/formatless normalized and integer 2D and one-layer array RMW, exact integer bits, UNORM sampling, positive/negative depth comparisons, attachment refresh, independent view and cross-format round trips with distinct format view identity, queued registry/cache clearing and reusable generic-to-resident storage/sample descriptor routing. D16 attachment quantization has a one-step oracle; [UNORM conversion rules](https://docs.vulkan.org/spec/latest/chapters/fundamentals.html) permit one integer step for normalized float storage writes. The test propagates actual quantized values; UINT writes and subsequent cross-format alias copies compare exactly, while sampled depth must match the stored canonical bits within2e-7. New PM4 submission/RDNA translation is not exercised by this fixture; the broader existing suite remains required. No proprietary inputs or extracted shader bytes are added. Candidate `66bf9fa39a0226448f9fd754c7e8ea095b0386d9` is committed on pure upstream `b858fdc48e29c3ab7476782199d8a41999d46d59`. The reusable-resource fixture follows the merged shader runtime contract: typed numeric-class/image-shape storage/sample/sampler heap slots derived with main DescriptorBindingForImage and queried/enabled `VK_EXT_robustness2` `nullDescriptor`. The existing stencil regression remains unchanged. Clean committed-head all-target Full Windows validation, including libs, passes 482/482 tests with zero failures or skips on Windows 11, GCC 15.2, NVIDIA GeForce RTX 3080. The D16 and unchanged stencil regressions take 0.75 s and 0.47 s. The identical isolated-base fixture fails at the intended UNORM resident-depth refusal after attachment controls. Exact-head Ubuntu 24.04 lavapipe run [37839541370](https://github.com/ebarr24/AnyPS5/actions/runs/37839541370) passes 464 tests, with 24 individually reviewed capability skips and no failures. Both D16 and unchanged stencil storage regressions execute and pass three times, each under 30 s including the cold run. Reviewed skips require wave-sized subgroups, conservative rasterization, or look-back scan atomic/subgroup features; their corresponding RTX 3080 Windows tests pass. Software Vulkan complements the hardware execution evidence. ### Checklist - [ ] Based on current `main`; no other open PR implements the same functions — pinned upstream base b858fdc48; explicit scenario alternative overlaps #425/#454, with included dependency #1684 and final complete overlap review. - [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: #1684 - [x] AI-assisted: yes; the author is responsible for every line
github-actions[bot] commented 2026-10-09 05:33:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T05:33:23Z.


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
#2076 core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp L17-18
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L65
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp L61
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp L13-14, L38, L103-104, L107, L115-116, L155, L157, L179
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp L567-571, L2642
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L225
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L494
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6074966316 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1842#issuecomment-6074966316). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T05:33:23Z. --- <!-- 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 | |---|---|---|---| | #2076 | `core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp` [L17-18](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hpp#L17-L18)<br>`core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp` [L65](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp#L65)<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp` [L61](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp#L61)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp` [L13-14](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L13-L14), [L38](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L38), [L103-104](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L103-L104), [L107](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L107), [L115-116](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L115-L116), [L155](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L155), [L157](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L157), [L179](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp#L179)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` [L567-571](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L567-L571), [L2642](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L2642)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L225](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L225)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` [L494](https://github.com/boykopovar/AnyPS5/blob/d9484c719b2a5ac6201e27f8657e0fb0f01e648c/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp#L494) | | |
oneandonlydean commented 2026-10-09 09:30:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:30:01Z.


Closing: this is a second depth-storage model next to #425 and #454, stacked on #1684, and no title reaches it on main (your Stray run stops earlier, at the s_swappc_b64 registration error). If a title stops at the D16 storage refusal once that's past, please reopen with the title ID and the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078234833 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1842#issuecomment-6078234833). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T09:30:01Z. --- Closing: this is a second depth-storage model next to #425 and #454, stacked on #1684, and no title reaches it on main (your Stray run stops earlier, at the `s_swappc_b64` registration error). If a title stops at the D16 storage refusal once that's past, please reopen with the title ID and the log line.

Pull request closed

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!1842
No description provided.