Skip to content

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

Closed
ebarr24 wants to merge 2 commits into
boykopovar:mainfrom
ebarr24:codex/d16-storage-coherence-b858
Closed

ebarr24 wants to merge 2 commits into
boykopovar:mainfrom
ebarr24:codex/d16-storage-coherence-b858

Conversation

@ebarr24

@ebarr24 ebarr24 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

Depends on #1684 (included public commit c46ecda, cleanly integrated on upstream b858fdc).

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 b858fdc 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

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants